@fluentui/react-utilities 9.23.1 → 9.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -2
- package/dist/index.d.ts +17 -11
- package/lib/compose/deprecated/getSlots.js +3 -2
- package/lib/compose/deprecated/getSlots.js.map +1 -1
- package/lib/compose/deprecated/getSlotsNext.js.map +1 -1
- package/lib/hooks/useFirstMount.js +7 -8
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/generated-types.js.map +1 -1
- package/lib/utils/getReactElementRef.js +16 -0
- package/lib/utils/getReactElementRef.js.map +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/virtualParent/setVirtualParent.js +5 -5
- package/lib/virtualParent/setVirtualParent.js.map +1 -1
- package/lib-commonjs/compose/deprecated/getSlots.js +3 -2
- package/lib-commonjs/compose/deprecated/getSlots.js.map +1 -1
- package/lib-commonjs/compose/deprecated/getSlotsNext.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +5 -4
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/index.js +3 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/generated-types.js.map +1 -1
- package/lib-commonjs/utils/getReactElementRef.js +22 -0
- package/lib-commonjs/utils/getReactElementRef.js.map +1 -0
- package/lib-commonjs/utils/index.js +4 -0
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/virtualParent/setVirtualParent.js +12 -6
- package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 21 Aug 2025 12:20:29 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.24.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.24.0)
|
|
8
|
+
|
|
9
|
+
Thu, 21 Aug 2025 12:20:29 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.23.2..@fluentui/react-utilities_v9.24.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: enhance hook to support React concurrent mode using setEffect for first mount tracking ([PR #34985](https://github.com/microsoft/fluentui/pull/34985) by dmytrokirpa@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-shared-contexts to v9.25.0 ([PR #35055](https://github.com/microsoft/fluentui/pull/35055) by beachball)
|
|
16
|
+
|
|
17
|
+
### Patches
|
|
18
|
+
|
|
19
|
+
- fix: replace deprecated element.ref usages to support react 19 ([PR #35030](https://github.com/microsoft/fluentui/pull/35030) by dmytrokirpa@microsoft.com)
|
|
20
|
+
|
|
21
|
+
## [9.23.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.23.2)
|
|
22
|
+
|
|
23
|
+
Thu, 07 Aug 2025 10:03:30 GMT
|
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.23.1..@fluentui/react-utilities_v9.23.2)
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- refactor: simplify setVirtualParent function by using Object.assign for virtual parent assignment ([PR #34968](https://github.com/microsoft/fluentui/pull/34968) by dmytrokirpa@microsoft.com)
|
|
29
|
+
- fix: add mpath svg intrinsic element to compat JSXIntrinsicElementKeysCompat ([PR #34979](https://github.com/microsoft/fluentui/pull/34979) by martinhochel@microsoft.com)
|
|
30
|
+
|
|
7
31
|
## [9.23.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.23.1)
|
|
8
32
|
|
|
9
|
-
Wed, 30 Jul 2025
|
|
33
|
+
Wed, 30 Jul 2025 13:10:57 GMT
|
|
10
34
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.23.0..@fluentui/react-utilities_v9.23.1)
|
|
11
35
|
|
|
12
36
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -247,7 +247,7 @@ export declare function getEventClientCoords(event: TouchOrMouseEvent): {
|
|
|
247
247
|
* @param props - The component's props object
|
|
248
248
|
* @param excludedPropNames - List of native props to exclude from the returned value
|
|
249
249
|
*/
|
|
250
|
-
export declare const getIntrinsicElementProps: <Props extends UnknownSlotProps, ExcludedPropKeys extends Extract<keyof Props, string> = never>(tagName: NonNullable<Props["as"]>, props: Props & React_2.RefAttributes<InferredElementRefType<Props>>, excludedPropNames?: ExcludedPropKeys[]
|
|
250
|
+
export declare const getIntrinsicElementProps: <Props extends UnknownSlotProps, ExcludedPropKeys extends Extract<keyof Props, string> = never>(tagName: NonNullable<Props["as"]>, props: Props & React_2.RefAttributes<InferredElementRefType<Props>>, excludedPropNames?: ExcludedPropKeys[]) => DistributiveOmit<Props, ExcludedPropKeys | Exclude<keyof Props, "as" | keyof HTMLAttributes>>;
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* Given an element tagname and user props, filters the props to only allowed props for the given
|
|
@@ -289,7 +289,7 @@ export declare const getPartitionedNativeProps: <Props extends Pick<React_2.HTML
|
|
|
289
289
|
/** The component's props object */
|
|
290
290
|
props: Props;
|
|
291
291
|
/** List of native props to exclude from the returned value */
|
|
292
|
-
excludedPropNames?: ExcludedPropKeys[]
|
|
292
|
+
excludedPropNames?: ExcludedPropKeys[];
|
|
293
293
|
}) => {
|
|
294
294
|
root: {
|
|
295
295
|
style: React_2.CSSProperties | undefined;
|
|
@@ -298,11 +298,19 @@ export declare const getPartitionedNativeProps: <Props extends Pick<React_2.HTML
|
|
|
298
298
|
primary: Omit<Props, ExcludedPropKeys>;
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Returns a ref for the React element in a backwards-compatible way.
|
|
303
|
+
*
|
|
304
|
+
* @param element - The element to get the ref for.
|
|
305
|
+
* @returns The ref for the element.
|
|
306
|
+
*/
|
|
307
|
+
export declare function getReactElementRef<T>(element: React_2.ReactElement | null | undefined): React_2.Ref<T> | undefined;
|
|
308
|
+
|
|
301
309
|
/**
|
|
302
310
|
* @internal
|
|
303
311
|
* Finds and swaps a provided key for it's right to left format.
|
|
304
312
|
*/
|
|
305
|
-
export declare const getRTLSafeKey: (key: string, dir:
|
|
313
|
+
export declare const getRTLSafeKey: (key: string, dir: "ltr" | "rtl") => string;
|
|
306
314
|
|
|
307
315
|
/**
|
|
308
316
|
* Get the className prop set on the slot by the user, without including the default classes added by the component.
|
|
@@ -547,12 +555,12 @@ export declare type JSXIntrinsicElementKeys = ReactVersionDependent<JSXIntrinsic
|
|
|
547
555
|
/**
|
|
548
556
|
* Unwrapped type for 'keyof JSX.IntrinsicElement'. (Backwards compatible with older versions of '\@types/react')
|
|
549
557
|
*/
|
|
550
|
-
declare type JSXIntrinsicElementKeysCompat = 'a' | 'abbr' | 'address' | 'animate' | 'animateMotion' | 'animateTransform' | 'area' | 'article' | 'aside' | 'audio' | 'b' | 'base' | 'bdi' | 'bdo' | 'big' | 'blockquote' | 'body' | 'br' | 'button' | 'canvas' | 'caption' | 'circle' | 'cite' | 'clipPath' | 'code' | 'col' | 'colgroup' | 'data' | 'datalist' | 'dd' | 'defs' | 'del' | 'desc' | 'details' | 'dfn' | 'dialog' | 'div' | 'dl' | 'dt' | 'ellipse' | 'em' | 'embed' | 'feBlend' | 'feColorMatrix' | 'feComponentTransfer' | 'feComposite' | 'feConvolveMatrix' | 'feDiffuseLighting' | 'feDisplacementMap' | 'feDistantLight' | 'feDropShadow' | 'feFlood' | 'feFuncA' | 'feFuncB' | 'feFuncG' | 'feFuncR' | 'feGaussianBlur' | 'feImage' | 'feMerge' | 'feMergeNode' | 'feMorphology' | 'feOffset' | 'fePointLight' | 'feSpecularLighting' | 'feSpotLight' | 'feTile' | 'feTurbulence' | 'fieldset' | 'figcaption' | 'figure' | 'filter' | 'footer' | 'foreignObject' | 'form' | 'g' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hgroup' | 'hr' | 'html' | 'i' | 'iframe' | 'image' | 'img' | 'input' | 'ins' | 'kbd' | 'keygen' | 'label' | 'legend' | 'li' | 'line' | 'linearGradient' | 'link' | 'main' | 'map' | 'mark' | 'marker' | 'mask' | 'menu' | 'menuitem' | 'meta' | 'metadata' | 'meter' | 'nav' | 'noindex' | 'noscript' | 'object' | 'ol' | 'optgroup' | 'option' | 'output' | 'p' | 'param' | 'path' | 'pattern' | 'picture' | 'polygon' | 'polyline' | 'pre' | 'progress' | 'q' | 'radialGradient' | 'rect' | 'rp' | 'rt' | 'ruby' | 's' | 'samp' | 'script' | 'section' | 'select' | 'slot' | 'small' | 'source' | 'span' | 'stop' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg' | 'switch' | 'symbol' | 'table' | 'tbody' | 'td' | 'template' | 'text' | 'textPath' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'time' | 'title' | 'tr' | 'track' | 'tspan' | 'u' | 'ul' | 'use' | 'var' | 'video' | 'view' | 'wbr' | 'webview';
|
|
558
|
+
declare type JSXIntrinsicElementKeysCompat = 'a' | 'abbr' | 'address' | 'animate' | 'animateMotion' | 'animateTransform' | 'area' | 'article' | 'aside' | 'audio' | 'b' | 'base' | 'bdi' | 'bdo' | 'big' | 'blockquote' | 'body' | 'br' | 'button' | 'canvas' | 'caption' | 'circle' | 'cite' | 'clipPath' | 'code' | 'col' | 'colgroup' | 'data' | 'datalist' | 'dd' | 'defs' | 'del' | 'desc' | 'details' | 'dfn' | 'dialog' | 'div' | 'dl' | 'dt' | 'ellipse' | 'em' | 'embed' | 'feBlend' | 'feColorMatrix' | 'feComponentTransfer' | 'feComposite' | 'feConvolveMatrix' | 'feDiffuseLighting' | 'feDisplacementMap' | 'feDistantLight' | 'feDropShadow' | 'feFlood' | 'feFuncA' | 'feFuncB' | 'feFuncG' | 'feFuncR' | 'feGaussianBlur' | 'feImage' | 'feMerge' | 'feMergeNode' | 'feMorphology' | 'feOffset' | 'fePointLight' | 'feSpecularLighting' | 'feSpotLight' | 'feTile' | 'feTurbulence' | 'fieldset' | 'figcaption' | 'figure' | 'filter' | 'footer' | 'foreignObject' | 'form' | 'g' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hgroup' | 'hr' | 'html' | 'i' | 'iframe' | 'image' | 'img' | 'input' | 'ins' | 'kbd' | 'keygen' | 'label' | 'legend' | 'li' | 'line' | 'linearGradient' | 'link' | 'main' | 'map' | 'mark' | 'marker' | 'mask' | 'menu' | 'menuitem' | 'meta' | 'metadata' | 'meter' | 'mpath' | 'nav' | 'noindex' | 'noscript' | 'object' | 'ol' | 'optgroup' | 'option' | 'output' | 'p' | 'param' | 'path' | 'pattern' | 'picture' | 'polygon' | 'polyline' | 'pre' | 'progress' | 'q' | 'radialGradient' | 'rect' | 'rp' | 'rt' | 'ruby' | 's' | 'samp' | 'script' | 'section' | 'select' | 'slot' | 'small' | 'source' | 'span' | 'stop' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg' | 'switch' | 'symbol' | 'table' | 'tbody' | 'td' | 'template' | 'text' | 'textPath' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'time' | 'title' | 'tr' | 'track' | 'tspan' | 'u' | 'ul' | 'use' | 'var' | 'video' | 'view' | 'wbr' | 'webview';
|
|
551
559
|
|
|
552
560
|
/**
|
|
553
561
|
* Unwrapped type for 'keyof JSX.IntrinsicElement'
|
|
554
562
|
*/
|
|
555
|
-
declare type JSXIntrinsicElementKeysLatest = 'set' | '
|
|
563
|
+
declare type JSXIntrinsicElementKeysLatest = 'set' | 'center' | 'search' | JSXIntrinsicElementKeysCompat;
|
|
556
564
|
|
|
557
565
|
/**
|
|
558
566
|
* @internal
|
|
@@ -979,7 +987,7 @@ export declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>,
|
|
|
979
987
|
*
|
|
980
988
|
* @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.
|
|
981
989
|
*/
|
|
982
|
-
export declare function useAnimationFrame(): readonly [(fn: () => void, delay?: number
|
|
990
|
+
export declare function useAnimationFrame(): readonly [(fn: () => void, delay?: number) => number, () => void];
|
|
983
991
|
|
|
984
992
|
/**
|
|
985
993
|
* @internal
|
|
@@ -1037,10 +1045,8 @@ export declare const useEventCallback: <Args extends unknown[], Return>(fn: (...
|
|
|
1037
1045
|
/**
|
|
1038
1046
|
* @internal
|
|
1039
1047
|
* Checks if components was mounted the first time.
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
* https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx
|
|
1043
|
-
* https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx
|
|
1048
|
+
* Supports React concurrent/strict mode by using `useEffect`
|
|
1049
|
+
* to track the first mount instead of mutating refs during render.
|
|
1044
1050
|
*
|
|
1045
1051
|
* @example
|
|
1046
1052
|
* const isFirstMount = useFirstMount();
|
|
@@ -1164,7 +1170,7 @@ export declare function useSelection(params: SelectionHookParams): readonly [Set
|
|
|
1164
1170
|
*
|
|
1165
1171
|
* @returns A pair of [setTimeout, clearTimeout] that are stable between renders.
|
|
1166
1172
|
*/
|
|
1167
|
-
export declare function useTimeout(): readonly [(fn: () => void, delay?: number
|
|
1173
|
+
export declare function useTimeout(): readonly [(fn: () => void, delay?: number) => number, () => void];
|
|
1168
1174
|
|
|
1169
1175
|
/**
|
|
1170
1176
|
* @internal
|
|
@@ -54,12 +54,13 @@ function getSlot(state, slotName) {
|
|
|
54
54
|
const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || // eslint-disable-line @typescript-eslint/no-deprecated
|
|
55
55
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
56
56
|
typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
|
|
57
|
+
const asserted = slot;
|
|
57
58
|
if (renderFunction || typeof children === 'function') {
|
|
58
59
|
const render = renderFunction || children;
|
|
59
60
|
return [
|
|
60
61
|
React.Fragment,
|
|
61
62
|
{
|
|
62
|
-
children: render(
|
|
63
|
+
children: render(asserted, rest)
|
|
63
64
|
}
|
|
64
65
|
];
|
|
65
66
|
}
|
|
@@ -69,7 +70,7 @@ function getSlot(state, slotName) {
|
|
|
69
70
|
'as'
|
|
70
71
|
]) : props;
|
|
71
72
|
return [
|
|
72
|
-
|
|
73
|
+
asserted,
|
|
73
74
|
slotProps
|
|
74
75
|
];
|
|
75
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compose/deprecated/getSlots.ts"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../../utils/omit';\nimport type { ComponentState, SlotPropsRecord, SlotRenderFunction, UnknownSlotProps } from '../types';\nimport { isSlot } from '../isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type Slots<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]: React.ElementType<any>;\n};\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]-?: any;\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typeState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typeState.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(typeState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props as NonUndefined<typeof props>;\n\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = (renderFunction || children) as SlotRenderFunction<R[K]>;\n return [\n React.Fragment as React.ElementType<R[K]>,\n {\n children: render(
|
|
1
|
+
{"version":3,"sources":["../src/compose/deprecated/getSlots.ts"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../../utils/omit';\nimport type { ComponentState, SlotPropsRecord, SlotRenderFunction, UnknownSlotProps } from '../types';\nimport { isSlot } from '../isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type Slots<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]: React.ElementType<any>;\n};\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]-?: any;\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typeState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typeState.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(typeState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props as NonUndefined<typeof props>;\n\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const asserted = slot as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = (renderFunction || children) as SlotRenderFunction<R[K]>;\n return [\n React.Fragment as React.ElementType<R[K]>,\n {\n children: render(asserted, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotProps = (shouldOmitAsProp ? omit(props, ['as']) : (props as UnknownSlotProps)) as R[K];\n return [asserted, slotProps];\n}\n"],"names":["React","omit","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","getSlots","state","typeState","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","undefined","as","asProp","children","rest","renderFunction","asserted","render","Fragment","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,mBAAmB;AAExC,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,2BAA2B,QAAQ,eAAe;AAkB3D;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,SACdC,KAAc;IAOd,MAAMC,YAAYD;IAClB,4DAA4D;IAC5D,MAAME,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,4DAA4D;IAC5D,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,UAAUM,UAAU;IAC/D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,WAAWO;QACzC,4DAA4D;QAC5DN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,4DAA4D;IAC5D,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA,SAASQ,QACPX,KAAwB,EACxBQ,QAAW;QAeTR,mBAIcA;IAjBhB,MAAMU,QAAQV,KAAK,CAACQ,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGN;IAE1C,MAAMO,iBAAiBpB,OAAOa,SAASA,KAAK,CAACZ,4BAA4B,GAAGc;IAE5E,MAAMH,OACJT,EAAAA,oBAAAA,MAAMO,UAAU,cAAhBP,wCAAAA,iBAAkB,CAACQ,SAAS,MAAKI,aAAa,uDAAuD;IACrG,4DAA4D;IAC5D,OAAOZ,MAAMO,UAAU,CAACC,SAAS,KAAK,WAElCM,YAAUd,qBAAAA,MAAMO,UAAU,cAAhBP,yCAAAA,kBAAkB,CAACQ,SAAS,KAAI,QAE1CR,MAAMO,UAAU,CAACC,SAAS;IAGhC,MAAMU,WAAWT;IAEjB,IAAIQ,kBAAkB,OAAOF,aAAa,YAAY;QACpD,MAAMI,SAAUF,kBAAkBF;QAClC,OAAO;YACLpB,MAAMyB,QAAQ;YACd;gBACEL,UAAUI,OAAOD,UAAUF;YAC7B;SACD;IACH;IAEA,MAAMK,mBAAmB,OAAOZ,SAAS,YAAYK;IACrD,4DAA4D;IAC5D,MAAMX,YAAakB,mBAAmBzB,KAAKc,OAAO;QAAC;KAAK,IAAKA;IAC7D,OAAO;QAACQ;QAAUf;KAAU;AAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compose/deprecated/getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from '../types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typedState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typedState.components);\n for (const slotName of slotNames) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const [slot, props] = getSlotNext(typedState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\n/**\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot
|
|
1
|
+
{"version":3,"sources":["../src/compose/deprecated/getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from '../types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typedState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typedState.components);\n for (const slotName of slotNames) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const [slot, props] = getSlotNext(typedState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\n/**\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot as React.ElementType<R[K]>, slotProps as R[K]];\n}\n"],"names":["React","getSlotsNext","state","typedState","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;;;;;;;;CASC,GACD,OAAO,SAASC,aACdC,KAAc;IAOd,MAAMC,aAAaD;IACnB,4DAA4D;IAC5D,MAAME,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,4DAA4D;IAC5D,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,WAAWM,UAAU;IAChE,KAAK,MAAMC,YAAYJ,UAAW;QAChC,4DAA4D;QAC5D,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,YAAYO;QAC9C,4DAA4D;QAC5DN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,4DAA4D;IAC5D,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA;;CAEC,GACD,SAASQ,YACPX,KAAwB,EACxBQ,QAAW;QAaTR,mBAIcA;IAfhB,MAAMU,QAAQV,KAAK,CAACQ,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAE,GAAGC,gBAAgB,GAAGL;IAE1C,MAAMD,OACJT,EAAAA,oBAAAA,MAAMO,UAAU,cAAhBP,wCAAAA,iBAAkB,CAACQ,SAAS,MAAKI,aAAa,uDAAuD;IACrG,4DAA4D;IAC5D,OAAOZ,MAAMO,UAAU,CAACC,SAAS,KAAK,WAElCM,YAAUd,qBAAAA,MAAMO,UAAU,cAAhBP,yCAAAA,kBAAkB,CAACQ,SAAS,KAAI,QAE1CR,MAAMO,UAAU,CAACC,SAAS;IAGhC,MAAMQ,mBAAmB,OAAOP,SAAS,YAAYK;IACrD,4DAA4D;IAC5D,MAAMX,YAA8Ba,mBAAmBD,iBAAiBL;IAExE,OAAO;QAACD;QAAiCN;KAAkB;AAC7D"}
|
|
@@ -2,18 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
* Checks if components was mounted the first time.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx
|
|
8
|
-
* https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx
|
|
5
|
+
* Supports React concurrent/strict mode by using `useEffect`
|
|
6
|
+
* to track the first mount instead of mutating refs during render.
|
|
9
7
|
*
|
|
10
8
|
* @example
|
|
11
9
|
* const isFirstMount = useFirstMount();
|
|
12
10
|
*/ export function useFirstMount() {
|
|
13
11
|
const isFirst = React.useRef(true);
|
|
14
|
-
|
|
15
|
-
isFirst.current
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
React.useEffect(()=>{
|
|
13
|
+
if (isFirst.current) {
|
|
14
|
+
isFirst.current = false;
|
|
15
|
+
}
|
|
16
|
+
}, []);
|
|
18
17
|
return isFirst.current;
|
|
19
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useFirstMount.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Checks if components was mounted the first time.\n *
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useFirstMount.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Supports React concurrent/strict mode by using `useEffect`\n * to track the first mount instead of mutating refs during render.\n *\n * @example\n * const isFirstMount = useFirstMount();\n */\nexport function useFirstMount(): boolean {\n const isFirst = React.useRef(true);\n\n React.useEffect(() => {\n if (isFirst.current) {\n isFirst.current = false;\n }\n }, []);\n\n return isFirst.current;\n}\n"],"names":["React","useFirstMount","isFirst","useRef","useEffect","current"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B;;;;;;;;CAQC,GACD,OAAO,SAASC;IACd,MAAMC,UAAUF,MAAMG,MAAM,CAAC;IAE7BH,MAAMI,SAAS,CAAC;QACd,IAAIF,QAAQG,OAAO,EAAE;YACnBH,QAAQG,OAAO,GAAG;QACpB;IACF,GAAG,EAAE;IAEL,OAAOH,QAAQG,OAAO;AACxB"}
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ resolveShorthand, isResolvedShorthand, getIntrinsicElementProps, getSlotClassNam
|
|
|
5
5
|
export { IdPrefixProvider, resetIdsForTests, useAnimationFrame, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';
|
|
6
6
|
export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
|
|
7
7
|
export { clamp, // eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
8
|
-
getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';
|
|
8
|
+
getNativeElementProps, getPartitionedNativeProps, getReactElementRef, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';
|
|
9
9
|
export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';
|
|
10
10
|
export { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';
|
|
11
11
|
export { useSelection } from './selection/index';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlotsNext,\n assertSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n getSlotClassNameProp_unstable,\n SLOT_CLASS_NAME_PROP_SYMBOL,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n RefAttributes,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandFunction,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandOptions,\n Slot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n EventData,\n EventHandler,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type {\n DistributiveOmit,\n UnionToIntersection,\n JSXElement,\n JSXIntrinsicElement,\n JSXIntrinsicElementKeys,\n} from './utils/types';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","getSlotClassNameProp_unstable","SLOT_CLASS_NAME_PROP_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection","elementContains","setVirtualParent","getParent"],"mappings":"AAAA,SACEA,IAAI,EACJC,MAAM,EACN,4DAA4D;AAC5DC,QAAQ,EACR,4DAA4D;AAC5DC,YAAY,EACZC,WAAW,EACX,4DAA4D;AAC5DC,gBAAgB,EAChBC,mBAAmB,EACnBC,wBAAwB,EACxBC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,wBAAwB,EACxBC,2BAA2B,QACtB,kBAAkB;AA0BzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL,gBAAgB;AAGvB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc;AAE/D,SACEC,KAAK,EACL,4DAA4D;AAC5DC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd,gBAAgB;AAYvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,kBAAkB;AAQhG,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,iBAAiB;AAUlF,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,wBAAwB"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlotsNext,\n assertSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n getSlotClassNameProp_unstable,\n SLOT_CLASS_NAME_PROP_SYMBOL,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n RefAttributes,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandFunction,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandOptions,\n Slot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n EventData,\n EventHandler,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n getReactElementRef,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type {\n DistributiveOmit,\n UnionToIntersection,\n JSXElement,\n JSXIntrinsicElement,\n JSXIntrinsicElementKeys,\n} from './utils/types';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","getSlotClassNameProp_unstable","SLOT_CLASS_NAME_PROP_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getReactElementRef","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection","elementContains","setVirtualParent","getParent"],"mappings":"AAAA,SACEA,IAAI,EACJC,MAAM,EACN,4DAA4D;AAC5DC,QAAQ,EACR,4DAA4D;AAC5DC,YAAY,EACZC,WAAW,EACX,4DAA4D;AAC5DC,gBAAgB,EAChBC,mBAAmB,EACnBC,wBAAwB,EACxBC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,wBAAwB,EACxBC,2BAA2B,QACtB,kBAAkB;AA0BzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL,gBAAgB;AAGvB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc;AAE/D,SACEC,KAAK,EACL,4DAA4D;AAC5DC,qBAAqB,EACrBC,yBAAyB,EACzBC,kBAAkB,EAClBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd,gBAAgB;AAYvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,kBAAkB;AAQhG,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,iBAAiB;AAUlF,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/generated-types.ts"],"sourcesContent":["/**\n * ============================================\n * 💡 DO NOT EDIT THIS FILE.\n * - This file is automatically generated and should not be edited manually.\n * - To regenerate run `yarn nx run react-utilities:build`.\n * ============================================\n */\n\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'. (Backwards compatible with older versions of '\\@types/react')\n */\nexport type JSXIntrinsicElementKeysCompat =\n | 'a'\n | 'abbr'\n | 'address'\n | 'animate'\n | 'animateMotion'\n | 'animateTransform'\n | 'area'\n | 'article'\n | 'aside'\n | 'audio'\n | 'b'\n | 'base'\n | 'bdi'\n | 'bdo'\n | 'big'\n | 'blockquote'\n | 'body'\n | 'br'\n | 'button'\n | 'canvas'\n | 'caption'\n | 'circle'\n | 'cite'\n | 'clipPath'\n | 'code'\n | 'col'\n | 'colgroup'\n | 'data'\n | 'datalist'\n | 'dd'\n | 'defs'\n | 'del'\n | 'desc'\n | 'details'\n | 'dfn'\n | 'dialog'\n | 'div'\n | 'dl'\n | 'dt'\n | 'ellipse'\n | 'em'\n | 'embed'\n | 'feBlend'\n | 'feColorMatrix'\n | 'feComponentTransfer'\n | 'feComposite'\n | 'feConvolveMatrix'\n | 'feDiffuseLighting'\n | 'feDisplacementMap'\n | 'feDistantLight'\n | 'feDropShadow'\n | 'feFlood'\n | 'feFuncA'\n | 'feFuncB'\n | 'feFuncG'\n | 'feFuncR'\n | 'feGaussianBlur'\n | 'feImage'\n | 'feMerge'\n | 'feMergeNode'\n | 'feMorphology'\n | 'feOffset'\n | 'fePointLight'\n | 'feSpecularLighting'\n | 'feSpotLight'\n | 'feTile'\n | 'feTurbulence'\n | 'fieldset'\n | 'figcaption'\n | 'figure'\n | 'filter'\n | 'footer'\n | 'foreignObject'\n | 'form'\n | 'g'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'head'\n | 'header'\n | 'hgroup'\n | 'hr'\n | 'html'\n | 'i'\n | 'iframe'\n | 'image'\n | 'img'\n | 'input'\n | 'ins'\n | 'kbd'\n | 'keygen'\n | 'label'\n | 'legend'\n | 'li'\n | 'line'\n | 'linearGradient'\n | 'link'\n | 'main'\n | 'map'\n | 'mark'\n | 'marker'\n | 'mask'\n | 'menu'\n | 'menuitem'\n | 'meta'\n | 'metadata'\n | 'meter'\n | 'nav'\n | 'noindex'\n | 'noscript'\n | 'object'\n | 'ol'\n | 'optgroup'\n | 'option'\n | 'output'\n | 'p'\n | 'param'\n | 'path'\n | 'pattern'\n | 'picture'\n | 'polygon'\n | 'polyline'\n | 'pre'\n | 'progress'\n | 'q'\n | 'radialGradient'\n | 'rect'\n | 'rp'\n | 'rt'\n | 'ruby'\n | 's'\n | 'samp'\n | 'script'\n | 'section'\n | 'select'\n | 'slot'\n | 'small'\n | 'source'\n | 'span'\n | 'stop'\n | 'strong'\n | 'style'\n | 'sub'\n | 'summary'\n | 'sup'\n | 'svg'\n | 'switch'\n | 'symbol'\n | 'table'\n | 'tbody'\n | 'td'\n | 'template'\n | 'text'\n | 'textPath'\n | 'textarea'\n | 'tfoot'\n | 'th'\n | 'thead'\n | 'time'\n | 'title'\n | 'tr'\n | 'track'\n | 'tspan'\n | 'u'\n | 'ul'\n | 'use'\n | 'var'\n | 'video'\n | 'view'\n | 'wbr'\n | 'webview';\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'\n */\nexport type JSXIntrinsicElementKeysLatest = 'set' | '
|
|
1
|
+
{"version":3,"sources":["../src/utils/generated-types.ts"],"sourcesContent":["/**\n * ============================================\n * 💡 DO NOT EDIT THIS FILE.\n * - This file is automatically generated and should not be edited manually.\n * - To regenerate run `yarn nx run react-utilities:build`.\n * ============================================\n */\n\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'. (Backwards compatible with older versions of '\\@types/react')\n */\nexport type JSXIntrinsicElementKeysCompat =\n | 'a'\n | 'abbr'\n | 'address'\n | 'animate'\n | 'animateMotion'\n | 'animateTransform'\n | 'area'\n | 'article'\n | 'aside'\n | 'audio'\n | 'b'\n | 'base'\n | 'bdi'\n | 'bdo'\n | 'big'\n | 'blockquote'\n | 'body'\n | 'br'\n | 'button'\n | 'canvas'\n | 'caption'\n | 'circle'\n | 'cite'\n | 'clipPath'\n | 'code'\n | 'col'\n | 'colgroup'\n | 'data'\n | 'datalist'\n | 'dd'\n | 'defs'\n | 'del'\n | 'desc'\n | 'details'\n | 'dfn'\n | 'dialog'\n | 'div'\n | 'dl'\n | 'dt'\n | 'ellipse'\n | 'em'\n | 'embed'\n | 'feBlend'\n | 'feColorMatrix'\n | 'feComponentTransfer'\n | 'feComposite'\n | 'feConvolveMatrix'\n | 'feDiffuseLighting'\n | 'feDisplacementMap'\n | 'feDistantLight'\n | 'feDropShadow'\n | 'feFlood'\n | 'feFuncA'\n | 'feFuncB'\n | 'feFuncG'\n | 'feFuncR'\n | 'feGaussianBlur'\n | 'feImage'\n | 'feMerge'\n | 'feMergeNode'\n | 'feMorphology'\n | 'feOffset'\n | 'fePointLight'\n | 'feSpecularLighting'\n | 'feSpotLight'\n | 'feTile'\n | 'feTurbulence'\n | 'fieldset'\n | 'figcaption'\n | 'figure'\n | 'filter'\n | 'footer'\n | 'foreignObject'\n | 'form'\n | 'g'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'head'\n | 'header'\n | 'hgroup'\n | 'hr'\n | 'html'\n | 'i'\n | 'iframe'\n | 'image'\n | 'img'\n | 'input'\n | 'ins'\n | 'kbd'\n | 'keygen'\n | 'label'\n | 'legend'\n | 'li'\n | 'line'\n | 'linearGradient'\n | 'link'\n | 'main'\n | 'map'\n | 'mark'\n | 'marker'\n | 'mask'\n | 'menu'\n | 'menuitem'\n | 'meta'\n | 'metadata'\n | 'meter'\n | 'mpath'\n | 'nav'\n | 'noindex'\n | 'noscript'\n | 'object'\n | 'ol'\n | 'optgroup'\n | 'option'\n | 'output'\n | 'p'\n | 'param'\n | 'path'\n | 'pattern'\n | 'picture'\n | 'polygon'\n | 'polyline'\n | 'pre'\n | 'progress'\n | 'q'\n | 'radialGradient'\n | 'rect'\n | 'rp'\n | 'rt'\n | 'ruby'\n | 's'\n | 'samp'\n | 'script'\n | 'section'\n | 'select'\n | 'slot'\n | 'small'\n | 'source'\n | 'span'\n | 'stop'\n | 'strong'\n | 'style'\n | 'sub'\n | 'summary'\n | 'sup'\n | 'svg'\n | 'switch'\n | 'symbol'\n | 'table'\n | 'tbody'\n | 'td'\n | 'template'\n | 'text'\n | 'textPath'\n | 'textarea'\n | 'tfoot'\n | 'th'\n | 'thead'\n | 'time'\n | 'title'\n | 'tr'\n | 'track'\n | 'tspan'\n | 'u'\n | 'ul'\n | 'use'\n | 'var'\n | 'video'\n | 'view'\n | 'wbr'\n | 'webview';\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'\n */\nexport type JSXIntrinsicElementKeysLatest = 'set' | 'center' | 'search' | JSXIntrinsicElementKeysCompat;\n"],"names":[],"mappings":"AAAA;;;;;;CAMC,GAED;;CAEC,GAiLD;;CAEC,GACD,WAAwG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const IS_REACT_19_OR_HIGHER = parseInt(React.version, 10) >= 19;
|
|
3
|
+
/**
|
|
4
|
+
* Returns a ref for the React element in a backwards-compatible way.
|
|
5
|
+
*
|
|
6
|
+
* @param element - The element to get the ref for.
|
|
7
|
+
* @returns The ref for the element.
|
|
8
|
+
*/ export function getReactElementRef(element) {
|
|
9
|
+
if (!element) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
if (IS_REACT_19_OR_HIGHER) {
|
|
13
|
+
return element.props.ref;
|
|
14
|
+
}
|
|
15
|
+
return element.ref;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/getReactElementRef.ts"],"sourcesContent":["import * as React from 'react';\n\nconst IS_REACT_19_OR_HIGHER = parseInt(React.version, 10) >= 19;\n\n/**\n * Returns a ref for the React element in a backwards-compatible way.\n *\n * @param element - The element to get the ref for.\n * @returns The ref for the element.\n */\nexport function getReactElementRef<T>(element: React.ReactElement | null | undefined): React.Ref<T> | undefined {\n if (!element) {\n return undefined;\n }\n\n if (IS_REACT_19_OR_HIGHER) {\n return element.props.ref;\n }\n\n return (element as React.ReactElement & { ref: React.Ref<T> | undefined }).ref;\n}\n"],"names":["React","IS_REACT_19_OR_HIGHER","parseInt","version","getReactElementRef","element","undefined","props","ref"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,MAAMC,wBAAwBC,SAASF,MAAMG,OAAO,EAAE,OAAO;AAE7D;;;;;CAKC,GACD,OAAO,SAASC,mBAAsBC,OAA8C;IAClF,IAAI,CAACA,SAAS;QACZ,OAAOC;IACT;IAEA,IAAIL,uBAAuB;QACzB,OAAOI,QAAQE,KAAK,CAACC,GAAG;IAC1B;IAEA,OAAO,AAACH,QAAmEG,GAAG;AAChF"}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { clamp } from './clamp';
|
|
2
2
|
export { // eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3
3
|
getNativeElementProps, getPartitionedNativeProps } from './getNativeElementProps';
|
|
4
|
+
export { getReactElementRef } from './getReactElementRef';
|
|
4
5
|
export { getRTLSafeKey } from './getRTLSafeKey';
|
|
5
6
|
export { mergeCallbacks } from './mergeCallbacks';
|
|
6
7
|
export { omit } from './omit';
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n} from './getNativeElementProps';\nexport { getRTLSafeKey } from './getRTLSafeKey';\nexport { mergeCallbacks } from './mergeCallbacks';\nexport { omit } from './omit';\nexport {\n anchorProperties,\n audioProperties,\n baseElementEvents,\n baseElementProperties,\n buttonProperties,\n colGroupProperties,\n colProperties,\n dialogProperties,\n divProperties,\n fieldsetProperties,\n formProperties,\n getNativeProps,\n htmlElementProperties,\n iframeProperties,\n imgProperties,\n inputProperties,\n labelProperties,\n liProperties,\n microdataProperties,\n olProperties,\n optionProperties,\n selectProperties,\n tableProperties,\n tdProperties,\n textAreaProperties,\n thProperties,\n timeProperties,\n trProperties,\n videoProperties,\n} from './properties';\nexport { isHTMLElement } from './isHTMLElement';\nexport { isInteractiveHTMLElement } from './isInteractiveHTMLElement';\nexport type { PriorityQueue, PriorityQueueCompareFn } from './priorityQueue';\nexport { createPriorityQueue } from './priorityQueue';\n"],"names":["clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","omit","anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","colGroupProperties","colProperties","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeProps","htmlElementProperties","iframeProperties","imgProperties","inputProperties","labelProperties","liProperties","microdataProperties","olProperties","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties","isHTMLElement","isInteractiveHTMLElement","createPriorityQueue"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAChC,SACE,4DAA4D;AAC5DC,qBAAqB,EACrBC,yBAAyB,QACpB,0BAA0B;AACjC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAC9B,SACEC,gBAAgB,EAChBC,eAAe,EACfC,iBAAiB,EACjBC,qBAAqB,EACrBC,gBAAgB,EAChBC,kBAAkB,EAClBC,aAAa,EACbC,gBAAgB,EAChBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,cAAc,EACdC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,EACbC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,mBAAmB,EACnBC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,eAAe,QACV,eAAe;AACtB,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,wBAAwB,QAAQ,6BAA6B;AAEtE,SAASC,mBAAmB,QAAQ,kBAAkB"}
|
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n} from './getNativeElementProps';\nexport { getReactElementRef } from './getReactElementRef';\nexport { getRTLSafeKey } from './getRTLSafeKey';\nexport { mergeCallbacks } from './mergeCallbacks';\nexport { omit } from './omit';\nexport {\n anchorProperties,\n audioProperties,\n baseElementEvents,\n baseElementProperties,\n buttonProperties,\n colGroupProperties,\n colProperties,\n dialogProperties,\n divProperties,\n fieldsetProperties,\n formProperties,\n getNativeProps,\n htmlElementProperties,\n iframeProperties,\n imgProperties,\n inputProperties,\n labelProperties,\n liProperties,\n microdataProperties,\n olProperties,\n optionProperties,\n selectProperties,\n tableProperties,\n tdProperties,\n textAreaProperties,\n thProperties,\n timeProperties,\n trProperties,\n videoProperties,\n} from './properties';\nexport { isHTMLElement } from './isHTMLElement';\nexport { isInteractiveHTMLElement } from './isInteractiveHTMLElement';\nexport type { PriorityQueue, PriorityQueueCompareFn } from './priorityQueue';\nexport { createPriorityQueue } from './priorityQueue';\n"],"names":["clamp","getNativeElementProps","getPartitionedNativeProps","getReactElementRef","getRTLSafeKey","mergeCallbacks","omit","anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","colGroupProperties","colProperties","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeProps","htmlElementProperties","iframeProperties","imgProperties","inputProperties","labelProperties","liProperties","microdataProperties","olProperties","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties","isHTMLElement","isInteractiveHTMLElement","createPriorityQueue"],"mappings":"AAAA,SAASA,KAAK,QAAQ,UAAU;AAChC,SACE,4DAA4D;AAC5DC,qBAAqB,EACrBC,yBAAyB,QACpB,0BAA0B;AACjC,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAC9B,SACEC,gBAAgB,EAChBC,eAAe,EACfC,iBAAiB,EACjBC,qBAAqB,EACrBC,gBAAgB,EAChBC,kBAAkB,EAClBC,aAAa,EACbC,gBAAgB,EAChBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,cAAc,EACdC,qBAAqB,EACrBC,gBAAgB,EAChBC,aAAa,EACbC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,mBAAmB,EACnBC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,eAAe,QACV,eAAe;AACtB,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,wBAAwB,QAAQ,6BAA6B;AAEtE,SAASC,mBAAmB,QAAQ,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/virtualParent/setVirtualParent.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/virtualParent/setVirtualParent.ts"],"sourcesContent":["/**\n * Sets the virtual parent of an element.\n *\n * @internal\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n Object.assign(child, {\n _virtual: {\n parent,\n },\n });\n}\n"],"names":["setVirtualParent","child","parent","Object","assign","_virtual"],"mappings":"AAAA;;;;;;CAMC,GACD,OAAO,SAASA,iBAAiBC,KAAW,EAAEC,MAAa;IACzD,IAAI,CAACD,OAAO;QACV;IACF;IAEAE,OAAOC,MAAM,CAACH,OAAO;QACnBI,UAAU;YACRH;QACF;IACF;AACF"}
|
|
@@ -47,12 +47,13 @@ function getSlot(state, slotName) {
|
|
|
47
47
|
const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || // eslint-disable-line @typescript-eslint/no-deprecated
|
|
48
48
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
49
49
|
typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
|
|
50
|
+
const asserted = slot;
|
|
50
51
|
if (renderFunction || typeof children === 'function') {
|
|
51
52
|
const render = renderFunction || children;
|
|
52
53
|
return [
|
|
53
54
|
_react.Fragment,
|
|
54
55
|
{
|
|
55
|
-
children: render(
|
|
56
|
+
children: render(asserted, rest)
|
|
56
57
|
}
|
|
57
58
|
];
|
|
58
59
|
}
|
|
@@ -62,7 +63,7 @@ function getSlot(state, slotName) {
|
|
|
62
63
|
'as'
|
|
63
64
|
]) : props;
|
|
64
65
|
return [
|
|
65
|
-
|
|
66
|
+
asserted,
|
|
66
67
|
slotProps
|
|
67
68
|
];
|
|
68
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compose/deprecated/getSlots.ts"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../../utils/omit';\nimport type { ComponentState, SlotPropsRecord, SlotRenderFunction, UnknownSlotProps } from '../types';\nimport { isSlot } from '../isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type Slots<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]: React.ElementType<any>;\n};\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]-?: any;\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typeState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typeState.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(typeState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props as NonUndefined<typeof props>;\n\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = (renderFunction || children) as SlotRenderFunction<R[K]>;\n return [\n React.Fragment as React.ElementType<R[K]>,\n {\n children: render(
|
|
1
|
+
{"version":3,"sources":["../src/compose/deprecated/getSlots.ts"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../../utils/omit';\nimport type { ComponentState, SlotPropsRecord, SlotRenderFunction, UnknownSlotProps } from '../types';\nimport { isSlot } from '../isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type Slots<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]: React.ElementType<any>;\n};\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof S]-?: any;\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typeState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typeState.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(typeState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props as NonUndefined<typeof props>;\n\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const asserted = slot as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = (renderFunction || children) as SlotRenderFunction<R[K]>;\n return [\n React.Fragment as React.ElementType<R[K]>,\n {\n children: render(asserted, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotProps = (shouldOmitAsProp ? omit(props, ['as']) : (props as UnknownSlotProps)) as R[K];\n return [asserted, slotProps];\n}\n"],"names":["getSlots","state","typeState","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","undefined","as","asProp","children","rest","renderFunction","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","asserted","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAyCgBA;;;eAAAA;;;;iEAzCO;sBACF;wBAEE;2BACqB;AAqCrC,SAASA,SACdC,KAAc;IAOd,MAAMC,YAAYD;IAClB,4DAA4D;IAC5D,MAAME,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,4DAA4D;IAC5D,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,UAAUM,UAAU;IAC/D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,WAAWO;QACzC,4DAA4D;QAC5DN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,4DAA4D;IAC5D,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA,SAASQ,QACPX,KAAwB,EACxBQ,QAAW;QAeTR,mBAIcA;IAjBhB,MAAMU,QAAQV,KAAK,CAACQ,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGN;IAE1C,MAAMO,iBAAiBC,IAAAA,cAAM,EAACR,SAASA,KAAK,CAACS,sCAA2B,CAAC,GAAGP;IAE5E,MAAMH,OACJT,EAAAA,oBAAAA,MAAMO,UAAU,cAAhBP,wCAAAA,iBAAkB,CAACQ,SAAS,MAAKI,aAAa,uDAAuD;IACrG,4DAA4D;IAC5D,OAAOZ,MAAMO,UAAU,CAACC,SAAS,KAAK,WAElCM,YAAUd,qBAAAA,MAAMO,UAAU,cAAhBP,yCAAAA,kBAAkB,CAACQ,SAAS,KAAI,QAE1CR,MAAMO,UAAU,CAACC,SAAS;IAGhC,MAAMY,WAAWX;IAEjB,IAAIQ,kBAAkB,OAAOF,aAAa,YAAY;QACpD,MAAMM,SAAUJ,kBAAkBF;QAClC,OAAO;YACLO,OAAMC,QAAQ;YACd;gBACER,UAAUM,OAAOD,UAAUJ;YAC7B;SACD;IACH;IAEA,MAAMQ,mBAAmB,OAAOf,SAAS,YAAYK;IACrD,4DAA4D;IAC5D,MAAMX,YAAaqB,mBAAmBC,IAAAA,UAAI,EAACf,OAAO;QAAC;KAAK,IAAKA;IAC7D,OAAO;QAACU;QAAUjB;KAAU;AAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compose/deprecated/getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from '../types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typedState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typedState.components);\n for (const slotName of slotNames) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const [slot, props] = getSlotNext(typedState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\n/**\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot
|
|
1
|
+
{"version":3,"sources":["../src/compose/deprecated/getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from '../types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: unknown,\n): {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots: Slots<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slotProps: ObjectSlotProps<R>;\n} {\n const typedState = state as ComponentState<R>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotNames: (keyof R)[] = Object.keys(typedState.components);\n for (const slotName of slotNames) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const [slot, props] = getSlotNext(typedState, slotName);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\n/**\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof state.components[slotName] === 'string'\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n asProp || state.components?.[slotName] || 'div'\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot as React.ElementType<R[K]>, slotProps as R[K]];\n}\n"],"names":["getSlotsNext","state","typedState","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAcgBA;;;eAAAA;;;;iEAdO;AAchB,SAASA,aACdC,KAAc;IAOd,MAAMC,aAAaD;IACnB,4DAA4D;IAC5D,MAAME,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,4DAA4D;IAC5D,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,WAAWM,UAAU;IAChE,KAAK,MAAMC,YAAYJ,UAAW;QAChC,4DAA4D;QAC5D,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,YAAYO;QAC9C,4DAA4D;QAC5DN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,4DAA4D;IAC5D,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA;;CAEC,GACD,SAASQ,YACPX,KAAwB,EACxBQ,QAAW;QAaTR,mBAIcA;IAfhB,MAAMU,QAAQV,KAAK,CAACQ,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAE,GAAGC,gBAAgB,GAAGL;IAE1C,MAAMD,OACJT,EAAAA,oBAAAA,MAAMO,UAAU,cAAhBP,wCAAAA,iBAAkB,CAACQ,SAAS,MAAKI,aAAa,uDAAuD;IACrG,4DAA4D;IAC5D,OAAOZ,MAAMO,UAAU,CAACC,SAAS,KAAK,WAElCM,YAAUd,qBAAAA,MAAMO,UAAU,cAAhBP,yCAAAA,kBAAkB,CAACQ,SAAS,KAAI,QAE1CR,MAAMO,UAAU,CAACC,SAAS;IAGhC,MAAMQ,mBAAmB,OAAOP,SAAS,YAAYK;IACrD,4DAA4D;IAC5D,MAAMX,YAA8Ba,mBAAmBD,iBAAiBL;IAExE,OAAO;QAACD;QAAiCN;KAAkB;AAC7D"}
|
|
@@ -12,9 +12,10 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
function useFirstMount() {
|
|
14
14
|
const isFirst = _react.useRef(true);
|
|
15
|
-
|
|
16
|
-
isFirst.current
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
_react.useEffect(()=>{
|
|
16
|
+
if (isFirst.current) {
|
|
17
|
+
isFirst.current = false;
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
19
20
|
return isFirst.current;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useFirstMount.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Checks if components was mounted the first time.\n *
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useFirstMount.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Supports React concurrent/strict mode by using `useEffect`\n * to track the first mount instead of mutating refs during render.\n *\n * @example\n * const isFirstMount = useFirstMount();\n */\nexport function useFirstMount(): boolean {\n const isFirst = React.useRef(true);\n\n React.useEffect(() => {\n if (isFirst.current) {\n isFirst.current = false;\n }\n }, []);\n\n return isFirst.current;\n}\n"],"names":["useFirstMount","isFirst","React","useRef","useEffect","current"],"mappings":";;;;+BAWgBA;;;eAAAA;;;;iEAXO;AAWhB,SAASA;IACd,MAAMC,UAAUC,OAAMC,MAAM,CAAC;IAE7BD,OAAME,SAAS,CAAC;QACd,IAAIH,QAAQI,OAAO,EAAE;YACnBJ,QAAQI,OAAO,GAAG;QACpB;IACF,GAAG,EAAE;IAEL,OAAOJ,QAAQI,OAAO;AACxB"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -61,6 +61,9 @@ _export(exports, {
|
|
|
61
61
|
getRTLSafeKey: function() {
|
|
62
62
|
return _index3.getRTLSafeKey;
|
|
63
63
|
},
|
|
64
|
+
getReactElementRef: function() {
|
|
65
|
+
return _index3.getReactElementRef;
|
|
66
|
+
},
|
|
64
67
|
getSlotClassNameProp_unstable: function() {
|
|
65
68
|
return _index.getSlotClassNameProp_unstable;
|
|
66
69
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlotsNext,\n assertSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n getSlotClassNameProp_unstable,\n SLOT_CLASS_NAME_PROP_SYMBOL,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n RefAttributes,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandFunction,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandOptions,\n Slot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n EventData,\n EventHandler,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type {\n DistributiveOmit,\n UnionToIntersection,\n JSXElement,\n JSXIntrinsicElement,\n JSXIntrinsicElementKeys,\n} from './utils/types';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["IdPrefixProvider","SLOT_CLASS_NAME_PROP_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","SSRProvider","applyTriggerPropsToChildren","assertSlots","canUseDOM","clamp","createPriorityQueue","elementContains","getEventClientCoords","getIntrinsicElementProps","getNativeElementProps","getParent","getPartitionedNativeProps","getRTLSafeKey","getSlotClassNameProp_unstable","getSlots","getSlotsNext","getTriggerChild","isFluentTrigger","isHTMLElement","isInteractiveHTMLElement","isMouseEvent","isResolvedShorthand","isSlot","isTouchEvent","mergeCallbacks","omit","resetIdsForTests","resolveShorthand","setVirtualParent","slot","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsSSR","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useSelection","useTimeout"],"mappings":";;;;;;;;;;;IA2CEA,gBAAgB;eAAhBA,wBAAgB;;IA9BhBC,2BAA2B;eAA3BA,kCAA2B;;IAC3BC,wBAAwB;eAAxBA,+BAAwB;;IACxBC,2BAA2B;eAA3BA,kCAA2B;;IA8CCC,WAAW;eAAXA,mBAAW;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getSlotsNext,\n assertSlots,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n getSlotClassNameProp_unstable,\n SLOT_CLASS_NAME_PROP_SYMBOL,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n RefAttributes,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandFunction,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ResolveShorthandOptions,\n Slot,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n EventData,\n EventHandler,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n getReactElementRef,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type {\n DistributiveOmit,\n UnionToIntersection,\n JSXElement,\n JSXIntrinsicElement,\n JSXIntrinsicElementKeys,\n} from './utils/types';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["IdPrefixProvider","SLOT_CLASS_NAME_PROP_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","SSRProvider","applyTriggerPropsToChildren","assertSlots","canUseDOM","clamp","createPriorityQueue","elementContains","getEventClientCoords","getIntrinsicElementProps","getNativeElementProps","getParent","getPartitionedNativeProps","getRTLSafeKey","getReactElementRef","getSlotClassNameProp_unstable","getSlots","getSlotsNext","getTriggerChild","isFluentTrigger","isHTMLElement","isInteractiveHTMLElement","isMouseEvent","isResolvedShorthand","isSlot","isTouchEvent","mergeCallbacks","omit","resetIdsForTests","resolveShorthand","setVirtualParent","slot","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsSSR","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useSelection","useTimeout"],"mappings":";;;;;;;;;;;IA2CEA,gBAAgB;eAAhBA,wBAAgB;;IA9BhBC,2BAA2B;eAA3BA,kCAA2B;;IAC3BC,wBAAwB;eAAxBA,+BAAwB;;IACxBC,2BAA2B;eAA3BA,kCAA2B;;IA8CCC,WAAW;eAAXA,mBAAW;;IA0BhCC,2BAA2B;eAA3BA,mCAA2B;;IAhFlCC,WAAW;eAAXA,kBAAW;;IAsDJC,SAAS;eAATA,iBAAS;;IAGhBC,KAAK;eAALA,aAAK;;IAULC,mBAAmB;eAAnBA,2BAAmB;;IAiCZC,eAAe;eAAfA,uBAAe;;IAZaC,oBAAoB;eAApBA,4BAAoB;;IApFvDC,wBAAwB;eAAxBA,+BAAwB;;IAsDxB,4DAA4D;IAC5DC,qBAAqB;eAArBA,6BAAqB;;IAyCqBC,SAAS;eAATA,iBAAS;;IAxCnDC,yBAAyB;eAAzBA,iCAAyB;;IAEzBC,aAAa;eAAbA,qBAAa;;IADbC,kBAAkB;eAAlBA,0BAAkB;;IAxDlBC,6BAA6B;eAA7BA,oCAA6B;;IAT7B,4DAA4D;IAC5DC,QAAQ;eAARA,eAAQ;;IACR,4DAA4D;IAC5DC,YAAY;eAAZA,mBAAY;;IAiFwBC,eAAe;eAAfA,uBAAe;;IAAEC,eAAe;eAAfA,uBAAe;;IAhBpEC,aAAa;eAAbA,qBAAa;;IACbC,wBAAwB;eAAxBA,gCAAwB;;IAuBHC,YAAY;eAAZA,oBAAY;;IArFjCC,mBAAmB;eAAnBA,0BAAmB;;IARnBC,MAAM;eAANA,aAAM;;IA6FCC,YAAY;eAAZA,oBAAY;;IAzBnBC,cAAc;eAAdA,sBAAc;;IAGdC,IAAI;eAAJA,YAAI;;IA7BJC,gBAAgB;eAAhBA,wBAAgB;;IApChB,4DAA4D;IAC5DC,gBAAgB;eAAhBA,uBAAgB;;IAkGQC,gBAAgB;eAAhBA,wBAAgB;;IA1GxCC,IAAI;eAAJA,WAAI;;IA4CJC,iBAAiB;eAAjBA,yBAAiB;;IACjBC,oBAAoB;eAApBA,4BAAoB;;IACpBC,gBAAgB;eAAhBA,wBAAgB;;IAChBC,aAAa;eAAbA,qBAAa;;IACbC,cAAc;eAAdA,sBAAc;;IACdC,KAAK;eAALA,aAAK;;IAWaC,QAAQ;eAARA,gBAAQ;;IAV1BC,yBAAyB;eAAzBA,iCAAyB;;IACzBC,aAAa;eAAbA,qBAAa;;IACbC,iBAAiB;eAAjBA,yBAAiB;;IACjBC,kBAAkB;eAAlBA,0BAAkB;;IAClBC,WAAW;eAAXA,mBAAW;;IACXC,iBAAiB;eAAjBA,yBAAiB;;IAiDVC,YAAY;eAAZA,oBAAY;;IAhDnBC,UAAU;eAAVA,kBAAU;;;uBAzCL;wBA0CA;wBAG0C;wBAc1C;wBAYuE;wBAQb;wBAUpC;wBAEgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/generated-types.ts"],"sourcesContent":["/**\n * ============================================\n * 💡 DO NOT EDIT THIS FILE.\n * - This file is automatically generated and should not be edited manually.\n * - To regenerate run `yarn nx run react-utilities:build`.\n * ============================================\n */\n\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'. (Backwards compatible with older versions of '\\@types/react')\n */\nexport type JSXIntrinsicElementKeysCompat =\n | 'a'\n | 'abbr'\n | 'address'\n | 'animate'\n | 'animateMotion'\n | 'animateTransform'\n | 'area'\n | 'article'\n | 'aside'\n | 'audio'\n | 'b'\n | 'base'\n | 'bdi'\n | 'bdo'\n | 'big'\n | 'blockquote'\n | 'body'\n | 'br'\n | 'button'\n | 'canvas'\n | 'caption'\n | 'circle'\n | 'cite'\n | 'clipPath'\n | 'code'\n | 'col'\n | 'colgroup'\n | 'data'\n | 'datalist'\n | 'dd'\n | 'defs'\n | 'del'\n | 'desc'\n | 'details'\n | 'dfn'\n | 'dialog'\n | 'div'\n | 'dl'\n | 'dt'\n | 'ellipse'\n | 'em'\n | 'embed'\n | 'feBlend'\n | 'feColorMatrix'\n | 'feComponentTransfer'\n | 'feComposite'\n | 'feConvolveMatrix'\n | 'feDiffuseLighting'\n | 'feDisplacementMap'\n | 'feDistantLight'\n | 'feDropShadow'\n | 'feFlood'\n | 'feFuncA'\n | 'feFuncB'\n | 'feFuncG'\n | 'feFuncR'\n | 'feGaussianBlur'\n | 'feImage'\n | 'feMerge'\n | 'feMergeNode'\n | 'feMorphology'\n | 'feOffset'\n | 'fePointLight'\n | 'feSpecularLighting'\n | 'feSpotLight'\n | 'feTile'\n | 'feTurbulence'\n | 'fieldset'\n | 'figcaption'\n | 'figure'\n | 'filter'\n | 'footer'\n | 'foreignObject'\n | 'form'\n | 'g'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'head'\n | 'header'\n | 'hgroup'\n | 'hr'\n | 'html'\n | 'i'\n | 'iframe'\n | 'image'\n | 'img'\n | 'input'\n | 'ins'\n | 'kbd'\n | 'keygen'\n | 'label'\n | 'legend'\n | 'li'\n | 'line'\n | 'linearGradient'\n | 'link'\n | 'main'\n | 'map'\n | 'mark'\n | 'marker'\n | 'mask'\n | 'menu'\n | 'menuitem'\n | 'meta'\n | 'metadata'\n | 'meter'\n | 'nav'\n | 'noindex'\n | 'noscript'\n | 'object'\n | 'ol'\n | 'optgroup'\n | 'option'\n | 'output'\n | 'p'\n | 'param'\n | 'path'\n | 'pattern'\n | 'picture'\n | 'polygon'\n | 'polyline'\n | 'pre'\n | 'progress'\n | 'q'\n | 'radialGradient'\n | 'rect'\n | 'rp'\n | 'rt'\n | 'ruby'\n | 's'\n | 'samp'\n | 'script'\n | 'section'\n | 'select'\n | 'slot'\n | 'small'\n | 'source'\n | 'span'\n | 'stop'\n | 'strong'\n | 'style'\n | 'sub'\n | 'summary'\n | 'sup'\n | 'svg'\n | 'switch'\n | 'symbol'\n | 'table'\n | 'tbody'\n | 'td'\n | 'template'\n | 'text'\n | 'textPath'\n | 'textarea'\n | 'tfoot'\n | 'th'\n | 'thead'\n | 'time'\n | 'title'\n | 'tr'\n | 'track'\n | 'tspan'\n | 'u'\n | 'ul'\n | 'use'\n | 'var'\n | 'video'\n | 'view'\n | 'wbr'\n | 'webview';\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'\n */\nexport type JSXIntrinsicElementKeysLatest = 'set' | '
|
|
1
|
+
{"version":3,"sources":["../src/utils/generated-types.ts"],"sourcesContent":["/**\n * ============================================\n * 💡 DO NOT EDIT THIS FILE.\n * - This file is automatically generated and should not be edited manually.\n * - To regenerate run `yarn nx run react-utilities:build`.\n * ============================================\n */\n\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'. (Backwards compatible with older versions of '\\@types/react')\n */\nexport type JSXIntrinsicElementKeysCompat =\n | 'a'\n | 'abbr'\n | 'address'\n | 'animate'\n | 'animateMotion'\n | 'animateTransform'\n | 'area'\n | 'article'\n | 'aside'\n | 'audio'\n | 'b'\n | 'base'\n | 'bdi'\n | 'bdo'\n | 'big'\n | 'blockquote'\n | 'body'\n | 'br'\n | 'button'\n | 'canvas'\n | 'caption'\n | 'circle'\n | 'cite'\n | 'clipPath'\n | 'code'\n | 'col'\n | 'colgroup'\n | 'data'\n | 'datalist'\n | 'dd'\n | 'defs'\n | 'del'\n | 'desc'\n | 'details'\n | 'dfn'\n | 'dialog'\n | 'div'\n | 'dl'\n | 'dt'\n | 'ellipse'\n | 'em'\n | 'embed'\n | 'feBlend'\n | 'feColorMatrix'\n | 'feComponentTransfer'\n | 'feComposite'\n | 'feConvolveMatrix'\n | 'feDiffuseLighting'\n | 'feDisplacementMap'\n | 'feDistantLight'\n | 'feDropShadow'\n | 'feFlood'\n | 'feFuncA'\n | 'feFuncB'\n | 'feFuncG'\n | 'feFuncR'\n | 'feGaussianBlur'\n | 'feImage'\n | 'feMerge'\n | 'feMergeNode'\n | 'feMorphology'\n | 'feOffset'\n | 'fePointLight'\n | 'feSpecularLighting'\n | 'feSpotLight'\n | 'feTile'\n | 'feTurbulence'\n | 'fieldset'\n | 'figcaption'\n | 'figure'\n | 'filter'\n | 'footer'\n | 'foreignObject'\n | 'form'\n | 'g'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'head'\n | 'header'\n | 'hgroup'\n | 'hr'\n | 'html'\n | 'i'\n | 'iframe'\n | 'image'\n | 'img'\n | 'input'\n | 'ins'\n | 'kbd'\n | 'keygen'\n | 'label'\n | 'legend'\n | 'li'\n | 'line'\n | 'linearGradient'\n | 'link'\n | 'main'\n | 'map'\n | 'mark'\n | 'marker'\n | 'mask'\n | 'menu'\n | 'menuitem'\n | 'meta'\n | 'metadata'\n | 'meter'\n | 'mpath'\n | 'nav'\n | 'noindex'\n | 'noscript'\n | 'object'\n | 'ol'\n | 'optgroup'\n | 'option'\n | 'output'\n | 'p'\n | 'param'\n | 'path'\n | 'pattern'\n | 'picture'\n | 'polygon'\n | 'polyline'\n | 'pre'\n | 'progress'\n | 'q'\n | 'radialGradient'\n | 'rect'\n | 'rp'\n | 'rt'\n | 'ruby'\n | 's'\n | 'samp'\n | 'script'\n | 'section'\n | 'select'\n | 'slot'\n | 'small'\n | 'source'\n | 'span'\n | 'stop'\n | 'strong'\n | 'style'\n | 'sub'\n | 'summary'\n | 'sup'\n | 'svg'\n | 'switch'\n | 'symbol'\n | 'table'\n | 'tbody'\n | 'td'\n | 'template'\n | 'text'\n | 'textPath'\n | 'textarea'\n | 'tfoot'\n | 'th'\n | 'thead'\n | 'time'\n | 'title'\n | 'tr'\n | 'track'\n | 'tspan'\n | 'u'\n | 'ul'\n | 'use'\n | 'var'\n | 'video'\n | 'view'\n | 'wbr'\n | 'webview';\n/**\n * Unwrapped type for 'keyof JSX.IntrinsicElement'\n */\nexport type JSXIntrinsicElementKeysLatest = 'set' | 'center' | 'search' | JSXIntrinsicElementKeysCompat;\n"],"names":[],"mappings":"AAAA;;;;;;CAMC,GAED;;CAEC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getReactElementRef", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getReactElementRef;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const IS_REACT_19_OR_HIGHER = parseInt(_react.version, 10) >= 19;
|
|
14
|
+
function getReactElementRef(element) {
|
|
15
|
+
if (!element) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (IS_REACT_19_OR_HIGHER) {
|
|
19
|
+
return element.props.ref;
|
|
20
|
+
}
|
|
21
|
+
return element.ref;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/getReactElementRef.ts"],"sourcesContent":["import * as React from 'react';\n\nconst IS_REACT_19_OR_HIGHER = parseInt(React.version, 10) >= 19;\n\n/**\n * Returns a ref for the React element in a backwards-compatible way.\n *\n * @param element - The element to get the ref for.\n * @returns The ref for the element.\n */\nexport function getReactElementRef<T>(element: React.ReactElement | null | undefined): React.Ref<T> | undefined {\n if (!element) {\n return undefined;\n }\n\n if (IS_REACT_19_OR_HIGHER) {\n return element.props.ref;\n }\n\n return (element as React.ReactElement & { ref: React.Ref<T> | undefined }).ref;\n}\n"],"names":["getReactElementRef","IS_REACT_19_OR_HIGHER","parseInt","React","version","element","undefined","props","ref"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;iEAVO;AAEvB,MAAMC,wBAAwBC,SAASC,OAAMC,OAAO,EAAE,OAAO;AAQtD,SAASJ,mBAAsBK,OAA8C;IAClF,IAAI,CAACA,SAAS;QACZ,OAAOC;IACT;IAEA,IAAIL,uBAAuB;QACzB,OAAOI,QAAQE,KAAK,CAACC,GAAG;IAC1B;IAEA,OAAO,AAACH,QAAmEG,GAAG;AAChF"}
|
|
@@ -61,6 +61,9 @@ _export(exports, {
|
|
|
61
61
|
getRTLSafeKey: function() {
|
|
62
62
|
return _getRTLSafeKey.getRTLSafeKey;
|
|
63
63
|
},
|
|
64
|
+
getReactElementRef: function() {
|
|
65
|
+
return _getReactElementRef.getReactElementRef;
|
|
66
|
+
},
|
|
64
67
|
htmlElementProperties: function() {
|
|
65
68
|
return _properties.htmlElementProperties;
|
|
66
69
|
},
|
|
@@ -127,6 +130,7 @@ _export(exports, {
|
|
|
127
130
|
});
|
|
128
131
|
const _clamp = require("./clamp");
|
|
129
132
|
const _getNativeElementProps = require("./getNativeElementProps");
|
|
133
|
+
const _getReactElementRef = require("./getReactElementRef");
|
|
130
134
|
const _getRTLSafeKey = require("./getRTLSafeKey");
|
|
131
135
|
const _mergeCallbacks = require("./mergeCallbacks");
|
|
132
136
|
const _omit = require("./omit");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n} from './getNativeElementProps';\nexport { getRTLSafeKey } from './getRTLSafeKey';\nexport { mergeCallbacks } from './mergeCallbacks';\nexport { omit } from './omit';\nexport {\n anchorProperties,\n audioProperties,\n baseElementEvents,\n baseElementProperties,\n buttonProperties,\n colGroupProperties,\n colProperties,\n dialogProperties,\n divProperties,\n fieldsetProperties,\n formProperties,\n getNativeProps,\n htmlElementProperties,\n iframeProperties,\n imgProperties,\n inputProperties,\n labelProperties,\n liProperties,\n microdataProperties,\n olProperties,\n optionProperties,\n selectProperties,\n tableProperties,\n tdProperties,\n textAreaProperties,\n thProperties,\n timeProperties,\n trProperties,\n videoProperties,\n} from './properties';\nexport { isHTMLElement } from './isHTMLElement';\nexport { isInteractiveHTMLElement } from './isInteractiveHTMLElement';\nexport type { PriorityQueue, PriorityQueueCompareFn } from './priorityQueue';\nexport { createPriorityQueue } from './priorityQueue';\n"],"names":["anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","clamp","colGroupProperties","colProperties","createPriorityQueue","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeElementProps","getNativeProps","getPartitionedNativeProps","getRTLSafeKey","htmlElementProperties","iframeProperties","imgProperties","inputProperties","isHTMLElement","isInteractiveHTMLElement","labelProperties","liProperties","mergeCallbacks","microdataProperties","olProperties","omit","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n} from './getNativeElementProps';\nexport { getReactElementRef } from './getReactElementRef';\nexport { getRTLSafeKey } from './getRTLSafeKey';\nexport { mergeCallbacks } from './mergeCallbacks';\nexport { omit } from './omit';\nexport {\n anchorProperties,\n audioProperties,\n baseElementEvents,\n baseElementProperties,\n buttonProperties,\n colGroupProperties,\n colProperties,\n dialogProperties,\n divProperties,\n fieldsetProperties,\n formProperties,\n getNativeProps,\n htmlElementProperties,\n iframeProperties,\n imgProperties,\n inputProperties,\n labelProperties,\n liProperties,\n microdataProperties,\n olProperties,\n optionProperties,\n selectProperties,\n tableProperties,\n tdProperties,\n textAreaProperties,\n thProperties,\n timeProperties,\n trProperties,\n videoProperties,\n} from './properties';\nexport { isHTMLElement } from './isHTMLElement';\nexport { isInteractiveHTMLElement } from './isInteractiveHTMLElement';\nexport type { PriorityQueue, PriorityQueueCompareFn } from './priorityQueue';\nexport { createPriorityQueue } from './priorityQueue';\n"],"names":["anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","clamp","colGroupProperties","colProperties","createPriorityQueue","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeElementProps","getNativeProps","getPartitionedNativeProps","getRTLSafeKey","getReactElementRef","htmlElementProperties","iframeProperties","imgProperties","inputProperties","isHTMLElement","isInteractiveHTMLElement","labelProperties","liProperties","mergeCallbacks","microdataProperties","olProperties","omit","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties"],"mappings":";;;;;;;;;;;IAWEA,gBAAgB;eAAhBA,4BAAgB;;IAChBC,eAAe;eAAfA,2BAAe;;IACfC,iBAAiB;eAAjBA,6BAAiB;;IACjBC,qBAAqB;eAArBA,iCAAqB;;IACrBC,gBAAgB;eAAhBA,4BAAgB;;IAfTC,KAAK;eAALA,YAAK;;IAgBZC,kBAAkB;eAAlBA,8BAAkB;;IAClBC,aAAa;eAAbA,yBAAa;;IA2BNC,mBAAmB;eAAnBA,kCAAmB;;IA1B1BC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,aAAa;eAAbA,yBAAa;;IACbC,kBAAkB;eAAlBA,8BAAkB;;IAClBC,cAAc;eAAdA,0BAAc;;IAnBd,4DAA4D;IAC5DC,qBAAqB;eAArBA,4CAAqB;;IAmBrBC,cAAc;eAAdA,0BAAc;;IAlBdC,yBAAyB;eAAzBA,gDAAyB;;IAGlBC,aAAa;eAAbA,4BAAa;;IADbC,kBAAkB;eAAlBA,sCAAkB;;IAiBzBC,qBAAqB;eAArBA,iCAAqB;;IACrBC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,aAAa;eAAbA,yBAAa;;IACbC,eAAe;eAAfA,2BAAe;;IAeRC,aAAa;eAAbA,4BAAa;;IACbC,wBAAwB;eAAxBA,kDAAwB;;IAf/BC,eAAe;eAAfA,2BAAe;;IACfC,YAAY;eAAZA,wBAAY;;IApBLC,cAAc;eAAdA,8BAAc;;IAqBrBC,mBAAmB;eAAnBA,+BAAmB;;IACnBC,YAAY;eAAZA,wBAAY;;IArBLC,IAAI;eAAJA,UAAI;;IAsBXC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,eAAe;eAAfA,2BAAe;;IACfC,YAAY;eAAZA,wBAAY;;IACZC,kBAAkB;eAAlBA,8BAAkB;;IAClBC,YAAY;eAAZA,wBAAY;;IACZC,cAAc;eAAdA,0BAAc;;IACdC,YAAY;eAAZA,wBAAY;;IACZC,eAAe;eAAfA,2BAAe;;;uBAvCK;uCAKf;oCAC4B;+BACL;gCACC;sBACV;4BA+Bd;+BACuB;0CACW;+BAEL"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Sets the virtual parent of an element.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
* @param child - Theme element to set the virtual parent
|
|
6
|
+
* @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
|
|
7
|
+
*/ "use strict";
|
|
2
8
|
Object.defineProperty(exports, "__esModule", {
|
|
3
9
|
value: true
|
|
4
10
|
});
|
|
@@ -12,9 +18,9 @@ function setVirtualParent(child, parent) {
|
|
|
12
18
|
if (!child) {
|
|
13
19
|
return;
|
|
14
20
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
Object.assign(child, {
|
|
22
|
+
_virtual: {
|
|
23
|
+
parent
|
|
24
|
+
}
|
|
25
|
+
});
|
|
20
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/virtualParent/setVirtualParent.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/virtualParent/setVirtualParent.ts"],"sourcesContent":["/**\n * Sets the virtual parent of an element.\n *\n * @internal\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n Object.assign(child, {\n _virtual: {\n parent,\n },\n });\n}\n"],"names":["setVirtualParent","child","parent","Object","assign","_virtual"],"mappings":"AAAA;;;;;;CAMC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,iBAAiBC,KAAW,EAAEC,MAAa;IACzD,IAAI,CAACD,OAAO;QACV;IACF;IAEAE,OAAOC,MAAM,CAACH,OAAO;QACnBI,UAAU;YACRH;QACF;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.24.0",
|
|
4
4
|
"description": "A set of general React-specific utilities.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@fluentui/keyboard-keys": "^9.0.8",
|
|
21
|
-
"@fluentui/react-shared-contexts": "^9.
|
|
21
|
+
"@fluentui/react-shared-contexts": "^9.25.0",
|
|
22
22
|
"@swc/helpers": "^0.5.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|