@fluentui/react-utilities 9.7.3 → 9.8.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.
Files changed (36) hide show
  1. package/CHANGELOG.json +39 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/index.d.ts +17 -2
  4. package/lib/compose/constants.js +5 -0
  5. package/lib/compose/constants.js.map +1 -0
  6. package/lib/compose/getSlots.js +10 -7
  7. package/lib/compose/getSlots.js.map +1 -1
  8. package/lib/compose/getSlotsNext.js +34 -0
  9. package/lib/compose/getSlotsNext.js.map +1 -0
  10. package/lib/compose/index.js +2 -0
  11. package/lib/compose/index.js.map +1 -1
  12. package/lib/compose/resolveShorthand.js +10 -5
  13. package/lib/compose/resolveShorthand.js.map +1 -1
  14. package/lib/hooks/useOnClickOutside.js +25 -22
  15. package/lib/hooks/useOnClickOutside.js.map +1 -1
  16. package/lib/hooks/useOnScrollOutside.js +4 -3
  17. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  18. package/lib/index.js +1 -1
  19. package/lib/index.js.map +1 -1
  20. package/lib-commonjs/compose/constants.js +14 -0
  21. package/lib-commonjs/compose/constants.js.map +1 -0
  22. package/lib-commonjs/compose/getSlots.js +10 -8
  23. package/lib-commonjs/compose/getSlots.js.map +1 -1
  24. package/lib-commonjs/compose/getSlotsNext.js +44 -0
  25. package/lib-commonjs/compose/getSlotsNext.js.map +1 -0
  26. package/lib-commonjs/compose/index.js +2 -0
  27. package/lib-commonjs/compose/index.js.map +1 -1
  28. package/lib-commonjs/compose/resolveShorthand.js +10 -5
  29. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  30. package/lib-commonjs/hooks/useOnClickOutside.js +25 -22
  31. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  32. package/lib-commonjs/hooks/useOnScrollOutside.js +4 -3
  33. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  34. package/lib-commonjs/index.js +2 -0
  35. package/lib-commonjs/index.js.map +1 -1
  36. package/package.json +1 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,45 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 04 Apr 2023 18:42:18 GMT",
5
+ "date": "Mon, 17 Apr 2023 17:50:12 GMT",
6
+ "tag": "@fluentui/react-utilities_v9.8.0",
7
+ "version": "9.8.0",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "behowell@microsoft.com",
12
+ "package": "@fluentui/react-utilities",
13
+ "commit": "c156e7682a89d7766bed3c0b9f231dc2e0a2058b",
14
+ "comment": "fix: Fix slot render functions"
15
+ }
16
+ ],
17
+ "minor": [
18
+ {
19
+ "author": "bernardo.sunderhus@gmail.com",
20
+ "package": "@fluentui/react-utilities",
21
+ "commit": "97af91aa7684bbfe149ace1b21b75fb7c04128a2",
22
+ "comment": "feat: ensure compatibility with custom JSX pragma"
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ {
28
+ "date": "Wed, 12 Apr 2023 09:31:45 GMT",
29
+ "tag": "@fluentui/react-utilities_v9.7.4",
30
+ "version": "9.7.4",
31
+ "comments": {
32
+ "patch": [
33
+ {
34
+ "author": "olfedias@microsoft.com",
35
+ "package": "@fluentui/react-utilities",
36
+ "commit": "1539311d63dfa731f1bbf1e08ab002a43c52f9a0",
37
+ "comment": "fix(hooks): cleanup event listeners only when \"disabled\" is false"
38
+ }
39
+ ]
40
+ }
41
+ },
42
+ {
43
+ "date": "Tue, 04 Apr 2023 18:44:50 GMT",
6
44
  "tag": "@fluentui/react-utilities_v9.7.3",
7
45
  "version": "9.7.3",
8
46
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,34 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Tue, 04 Apr 2023 18:42:18 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 17 Apr 2023 17:50:12 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.8.0)
8
+
9
+ Mon, 17 Apr 2023 17:50:12 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.7.4..@fluentui/react-utilities_v9.8.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat: ensure compatibility with custom JSX pragma ([PR #27472](https://github.com/microsoft/fluentui/pull/27472) by bernardo.sunderhus@gmail.com)
15
+
16
+ ### Patches
17
+
18
+ - fix: Fix slot render functions ([PR #27561](https://github.com/microsoft/fluentui/pull/27561) by behowell@microsoft.com)
19
+
20
+ ## [9.7.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.7.4)
21
+
22
+ Wed, 12 Apr 2023 09:31:45 GMT
23
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.7.3..@fluentui/react-utilities_v9.7.4)
24
+
25
+ ### Patches
26
+
27
+ - fix(hooks): cleanup event listeners only when "disabled" is false ([PR #27516](https://github.com/microsoft/fluentui/pull/27516) by olfedias@microsoft.com)
28
+
7
29
  ## [9.7.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.7.3)
8
30
 
9
- Tue, 04 Apr 2023 18:42:18 GMT
31
+ Tue, 04 Apr 2023 18:44:50 GMT
10
32
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.7.2..@fluentui/react-utilities_v9.7.3)
11
33
 
12
34
  ### Patches
package/dist/index.d.ts CHANGED
@@ -155,6 +155,14 @@ export declare function getSlots<R extends SlotPropsRecord>(state: ComponentStat
155
155
  slotProps: ObjectSlotProps<R>;
156
156
  };
157
157
 
158
+ /**
159
+ * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma
160
+ */
161
+ export declare function getSlotsNext<R extends SlotPropsRecord>(state: ComponentState<R>): {
162
+ slots: Slots<R>;
163
+ slotProps: ObjectSlotProps<R>;
164
+ };
165
+
158
166
  /**
159
167
  * @internal
160
168
  * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
@@ -435,6 +443,12 @@ export declare type Slot<Type extends keyof JSX.IntrinsicElements | React_2.Comp
435
443
  } & WithSlotRenderFunction<IntrinsicElementProps<As>>;
436
444
  }[AlternateAs] | null : 'Error: First parameter to Slot must not be not a union of types. See documentation of Slot type.';
437
445
 
446
+ /**
447
+ * @internal
448
+ * Internal reference for the render function
449
+ */
450
+ export declare const SLOT_RENDER_FUNCTION_SYMBOL: unique symbol;
451
+
438
452
  /**
439
453
  * Helper type to correctly define the slot class names object.
440
454
  */
@@ -494,7 +508,7 @@ declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never)
494
508
  * This should ONLY be used in type templates as in `extends UnknownSlotProps`;
495
509
  * it shouldn't be used as the type of a slot.
496
510
  */
497
- declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
511
+ export declare type UnknownSlotProps = Pick<React_2.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
498
512
  as?: keyof JSX.IntrinsicElements;
499
513
  };
500
514
 
@@ -618,7 +632,8 @@ export declare type UseOnClickOrScrollOutsideOptions = {
618
632
  refs: React_2.MutableRefObject<HTMLElement | undefined | null>[];
619
633
  /**
620
634
  * By default uses element.contains, but custom contain function can be provided
621
- * @param parentRef - provided parent ref
635
+ *
636
+ * @param parent - provided parent element
622
637
  * @param child - event target element
623
638
  */
624
639
  contains?(parent: HTMLElement | null, child: HTMLElement): boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @internal
3
+ * Internal reference for the render function
4
+ */export const SLOT_RENDER_FUNCTION_SYMBOL = /*#__PURE__*/Symbol('fui.slotRenderFunction');
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SLOT_RENDER_FUNCTION_SYMBOL","Symbol"],"sources":["../../src/compose/constants.ts"],"sourcesContent":["/**\n * @internal\n * Internal reference for the render function\n */\nexport const SLOT_RENDER_FUNCTION_SYMBOL = Symbol('fui.slotRenderFunction');\n"],"mappings":"AAAA;;;GAIA,OAAO,MAAMA,2BAAA,gBAA8BC,MAAA,CAAO"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { omit } from '../utils/omit';
3
+ import { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';
3
4
  /**
4
5
  * Given the state and an array of slot names, will break out `slots` and `slotProps`
5
6
  * collections.
@@ -32,24 +33,26 @@ export function getSlots(state) {
32
33
  };
33
34
  }
34
35
  function getSlot(state, slotName) {
35
- var _state_components, _state_components1, _state_slotName;
36
- if (state[slotName] === undefined) {
36
+ var _state_components, _state_components1;
37
+ const props = state[slotName];
38
+ if (props === undefined) {
37
39
  return [null, undefined];
38
40
  }
39
41
  const {
40
42
  children,
41
43
  as: asProp,
44
+ [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction,
42
45
  ...rest
43
- } = state[slotName];
46
+ } = props;
44
47
  const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
45
- if (typeof children === 'function') {
46
- const render = children;
48
+ if (renderFunction || typeof children === 'function') {
49
+ const render = renderFunction || children;
47
50
  return [React.Fragment, {
48
51
  children: render(slot, rest)
49
52
  }];
50
53
  }
51
- const shouldOmitAsProp = typeof slot === 'string' && ((_state_slotName = state[slotName]) === null || _state_slotName === void 0 ? void 0 : _state_slotName.as);
52
- const slotProps = shouldOmitAsProp ? omit(state[slotName], ['as']) : state[slotName];
54
+ const shouldOmitAsProp = typeof slot === 'string' && asProp;
55
+ const slotProps = shouldOmitAsProp ? omit(props, ['as']) : props;
53
56
  return [slot, slotProps];
54
57
  }
55
58
  //# sourceMappingURL=getSlots.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","omit","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","_state_slotName","undefined","children","as","asProp","rest","render","Fragment","shouldOmitAsProp"],"sources":["../../src/compose/getSlots.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { omit } from '../utils/omit';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n} from './types';\n\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\ntype ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P // Slot<typeof Button>\n : ExtractSlotProps<S[K]>; // Slot<ButtonProps>\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 * @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: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\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 if (state[slotName] === undefined) {\n return [null, undefined as R[K]];\n }\n const { children, as: asProp, ...rest } = state[slotName]!;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (typeof children === 'function') {\n const render = children as SlotRenderFunction<R[K]>;\n return [\n React.Fragment,\n {\n children: render(slot, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && state[slotName]?.as;\n const slotProps = (shouldOmitAsProp ? omit(state[slotName]!, ['as']) : state[slotName]) as R[K];\n\n return [slot, slotProps];\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAEvB,SAASC,IAAI,QAAQ;AA6BrB;;;;;;;;;;;;;;;;;AAiBA,OAAO,SAASC,SACdC,KAAwB,EAIxB;EACA,MAAMC,KAAA,GAAQ,CAAC;EACf,MAAMC,SAAA,GAAY,CAAC;EAEnB,MAAMC,SAAA,GAAyBC,MAAA,CAAOC,IAAI,CAACL,KAAA,CAAMM,UAAU;EAC3D,KAAK,MAAMC,QAAA,IAAYJ,SAAA,EAAW;IAChC,MAAM,CAACK,IAAA,EAAMC,KAAA,CAAM,GAAGC,OAAA,CAAQV,KAAA,EAAOO,QAAA;IACrCN,KAAK,CAACM,QAAA,CAAS,GAAGC,IAAA;IAClBN,SAAS,CAACK,QAAA,CAAS,GAAGE,KAAA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;AAC1B"}
1
+ {"version":3,"names":["React","omit","SLOT_RENDER_FUNCTION_SYMBOL","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","undefined","children","as","asProp","renderFunction","rest","render","Fragment","shouldOmitAsProp"],"sources":["../../src/compose/getSlots.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { omit } from '../utils/omit';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n UnknownSlotProps,\n} from './types';\n\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P // Slot<typeof Button>\n : ExtractSlotProps<S[K]>; // Slot<ButtonProps>\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 * @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: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\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 const {\n children,\n as: asProp,\n [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction,\n ...rest\n } = props as typeof props & { [SLOT_RENDER_FUNCTION_SYMBOL]?: SlotRenderFunction<R[K]> };\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\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,\n {\n children: render(slot, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = (shouldOmitAsProp ? omit(props, ['as']) : (props as UnknownSlotProps)) as R[K];\n return [slot, slotProps];\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAEvB,SAASC,IAAI,QAAQ;AACrB,SAASC,2BAA2B,QAAQ;AA8B5C;;;;;;;;;;;;;;;;;AAiBA,OAAO,SAASC,SACdC,KAAwB,EAIxB;EACA,MAAMC,KAAA,GAAQ,CAAC;EACf,MAAMC,SAAA,GAAY,CAAC;EAEnB,MAAMC,SAAA,GAAyBC,MAAA,CA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AEA,MAAMG,gBAAA,GAAmB,OAAOb,IAAA,KAAS,YAAYQ,MAAA;EACrD,MAAMd,SAAA,GAAamB,gBAAA,GAAmBxB,IAAA,CAAKY,KAAA,EAAO,CAAC,KAAK,IAAKA,KAA0B;EACvF,OAAO,CAACD,IAAA,EAAMN,SAAA,CAAU;AAC1B"}
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma
4
+ */
5
+ export function getSlotsNext(state) {
6
+ const slots = {};
7
+ const slotProps = {};
8
+ const slotNames = Object.keys(state.components);
9
+ for (const slotName of slotNames) {
10
+ const [slot, props] = getSlotNext(state, slotName);
11
+ slots[slotName] = slot;
12
+ slotProps[slotName] = props;
13
+ }
14
+ return {
15
+ slots,
16
+ slotProps: slotProps
17
+ };
18
+ }
19
+ function getSlotNext(state, slotName) {
20
+ var _state_components, _state_components1;
21
+ const props = state[slotName];
22
+ if (props === undefined) {
23
+ return [null, undefined];
24
+ }
25
+ const {
26
+ as: asProp,
27
+ ...propsWithoutAs
28
+ } = props;
29
+ const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
30
+ const shouldOmitAsProp = typeof slot === 'string' && asProp;
31
+ const slotProps = shouldOmitAsProp ? propsWithoutAs : props;
32
+ return [slot, slotProps];
33
+ }
34
+ //# sourceMappingURL=getSlotsNext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"sources":["../../src/compose/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 */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\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 const { as: asProp, ...propsWithoutAs } = props;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot, slotProps as R[K]];\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIvB;;;AAGA,OAAO,SAASC,aACdC,KAAwB,EAIxB;EACA,MAAMC,KAAA,GAAQ,CAAC;EACf,MAAMC,SAAA,GAAY,CAAC;EAEnB,MAAMC,SAAA,GAAyBC,MAAA,CAAOC,IAAI,CAACL,KAAA,CAAMM,UAAU;EAC3D,KAAK,MAAMC,QAAA,IAAYJ,SAAA,EAAW;IAChC,MAAM,CAACK,IAAA,EAAMC,KAAA,CAAM,GAAGC,WAAA,CAAYV,KAAA,EAAOO,QAAA;IACzCN,KAAK,CAACM,QAAA,CAAS,GAAGC,IAAA;IAClBN,SAAS,CAACK,QAAA,CAAS,GAAGE,KAAA;EACxB;EACA,OAAO;IAAER,KAAA;IAAOC,SAAA,EAAWA;EAA2C;AACxE;AAEA,SAASQ,YACPV,KAAwB,EACxBO,QAAW,EACsC;MAS/CI,iBAAA,EACcC,kBAAA;EAThB,MAAMH,KAAA,GAAQT,KAAK,CAACO,QAAA,CAAS;EAE7B,IAAIE,KAAA,KAAUI,SAAA,EAAW;IACvB,OAAO,CAAC,IAAI,EAAEA,SAAA,CAAkB;EAClC;EACA,MAAM;IAAEC,EAAA,EAAIC,MAAA;IAAQ,GAAGC;EAAA,CAAgB,GAAGP,KAAA;EAE1C,MAAMD,IAAA,GACJ,EAAAG,iBAAA,GAAAX,KAAA,CAAMM,UAAU,cAAhBK,iBAAA,uBAAAA,iBAAkB,CAACJ,QAAA,CAAS,MAAKM,SAAA,IAAa,OAAOb,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS,KAAK,WAChFQ,MAAA,KAAU,CAAAH,kBAAA,GAAAZ,KAAA,CAAMM,UAAU,cAAhBM,kBAAA,uBAAAA,kBAAkB,CAACL,QAAA,CAAS,CAAD,IAAK,QAC1CP,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS;EAGhC,MAAMU,gBAAA,GAAmB,OAAOT,IAAA,KAAS,YAAYO,MAAA;EACrD,MAAMb,SAAA,GAA8Be,gBAAA,GAAmBD,cAAA,GAAiBP,KAAK;EAE7E,OAAO,CAACD,IAAA,EAAMN,SAAA,CAAkB;AAClC"}
@@ -2,4 +2,6 @@ export * from './getSlots';
2
2
  export * from './resolveShorthand';
3
3
  export * from './types';
4
4
  export * from './isResolvedShorthand';
5
+ export * from './constants';
6
+ export * from './getSlotsNext';
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/compose/index.ts"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"names":[],"sources":["../../src/compose/index.ts"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -1,4 +1,5 @@
1
1
  import { isValidElement } from 'react';
2
+ import { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';
2
3
  /**
3
4
  * Resolves shorthands into slot props, to ensure normalization of the signature
4
5
  * being passed down to getSlots method
@@ -14,16 +15,20 @@ export const resolveShorthand = (value, options) => {
14
15
  return undefined;
15
16
  }
16
17
  let resolvedShorthand = {};
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
19
  if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {
18
20
  resolvedShorthand.children = value;
19
21
  } else if (typeof value === 'object') {
20
- resolvedShorthand = {
21
- ...value
22
- };
22
+ resolvedShorthand = value;
23
23
  }
24
- return defaultProps ? {
24
+ resolvedShorthand = {
25
25
  ...defaultProps,
26
26
  ...resolvedShorthand
27
- } : resolvedShorthand;
27
+ };
28
+ if (typeof resolvedShorthand.children === 'function') {
29
+ resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children;
30
+ resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;
31
+ }
32
+ return resolvedShorthand;
28
33
  };
29
34
  //# sourceMappingURL=resolveShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isValidElement","resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","children"],"sources":["../../src/compose/resolveShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { SlotShorthandValue, UnknownSlotProps } from './types';\n\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true\n ? { required: true; defaultProps?: Props }\n : { required?: Required; defaultProps?: Props };\n\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n <P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;\n <P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | P\n | undefined;\n};\n\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand: ResolveShorthandFunction = (value, options) => {\n const { required = false, defaultProps } = options || {};\n if (value === null || (value === undefined && !required)) {\n return undefined;\n }\n\n let resolvedShorthand = {} as UnknownSlotProps;\n\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = { ...value };\n }\n\n return defaultProps ? { ...defaultProps, ...resolvedShorthand } : resolvedShorthand;\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAc/B;;;;;;AAMA,OAAO,MAAMC,gBAAA,GAA6CA,CAACC,KAAA,EAAOC,OAAA,KAAY;EAC5E,MAAM;IAAEC,QAAA,GAAW,KAAK;IAAEC;EAAY,CAAE,GAAGF,OAAA,IAAW,CAAC;EACvD,IAAID,KAAA,KAAU,IAAI,IAAKA,KAAA,KAAUI,SAAA,IAAa,CAACF,QAAA,EAAW;IACxD,OAAOE,SAAA;EACT;EAEA,IAAIC,iBAAA,GAAoB,CAAC;EAEzB,IAAI,OAAOL,KAAA,KAAU,YAAY,OAAOA,KAAA,KAAU,YAAYM,KAAA,CAAMC,OAAO,CAACP,KAAA,kBAAUF,cAAA,CAAeE,KAAA,GAAQ;IAC3GK,iBAAA,CAAkBG,QAAQ,GAAGR,KAAA;EAC/B,OAAO,IAAI,OAAOA,KAAA,KAAU,UAAU;IACpCK,iBAAA,GAAoB;MAAE,GAAGL;IAAM;EACjC;EAEA,OAAOG,YAAA,GAAe;IAAE,GAAGA,YAAY;IAAE,GAAGE;EAAkB,IAAIA,iBAAiB;AACrF"}
1
+ {"version":3,"names":["isValidElement","SLOT_RENDER_FUNCTION_SYMBOL","resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","children"],"sources":["../../src/compose/resolveShorthand.ts"],"sourcesContent":["import { isValidElement } from 'react';\nimport type { SlotRenderFunction, SlotShorthandValue, UnknownSlotProps } from './types';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true\n ? { required: true; defaultProps?: Props }\n : { required?: Required; defaultProps?: Props };\n\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n <P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;\n <P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | P\n | undefined;\n};\n\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand: ResolveShorthandFunction = (value, options) => {\n const { required = false, defaultProps } = options || {};\n if (value === null || (value === undefined && !required)) {\n return undefined;\n }\n\n let resolvedShorthand: UnknownSlotProps & {\n [SLOT_RENDER_FUNCTION_SYMBOL]?: SlotRenderFunction<UnknownSlotProps>;\n } = {};\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement<any>(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = value;\n }\n\n resolvedShorthand = {\n ...defaultProps,\n ...resolvedShorthand,\n };\n\n if (typeof resolvedShorthand.children === 'function') {\n resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children as SlotRenderFunction<UnknownSlotProps>;\n resolvedShorthand.children = defaultProps?.children;\n }\n\n return resolvedShorthand;\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAE/B,SAASC,2BAA2B,QAAQ;AAa5C;;;;;;AAMA,OAAO,MAAMC,gBAAA,GAA6CA,CAACC,KAAA,EAAOC,OAAA,KAAY;EAC5E,MAAM;IAAEC,QAAA,GAAW,KAAK;IAAEC;EAAY,CAAE,GAAGF,OAAA,IAAW,CAAC;EACvD,IAAID,KAAA,KAAU,IAAI,IAAKA,KAAA,KAAUI,SAAA,IAAa,CAACF,QAAA,EAAW;IACxD,OAAOE,SAAA;EACT;EAEA,IAAIC,iBAAA,GAEA,CAAC;EAEL;EACA,IAAI,OAAOL,KAAA,KAAU,YAAY,OAAOA,KAAA,KAAU,YAAYM,KAAA,CAAMC,OAAO,CAACP,KAAA,kBAAUH,cAAA,CAAoBG,KAAA,GAAQ;IAChHK,iBAAA,CAAkBG,QAAQ,GAAGR,KAAA;EAC/B,OAAO,IAAI,OAAOA,KAAA,KAAU,UAAU;IACpCK,iBAAA,GAAoBL,KAAA;EACtB;EAEAK,iBAAA,GAAoB;IAClB,GAAGF,YAAY;IACf,GAAGE;EACL;EAEA,IAAI,OAAOA,iBAAA,CAAkBG,QAAQ,KAAK,YAAY;IACpDH,iBAAiB,CAACP,2BAAA,CAA4B,GAAGO,iBAAA,CAAkBG,QAAQ;IAC3EH,iBAAA,CAAkBG,QAAQ,GAAGL,YAAA,aAAAA,YAAA,uBAAAA,YAAA,CAAcK,QAAQ;EACrD;EAEA,OAAOH,iBAAA;AACT"}
@@ -24,6 +24,9 @@ export const useOnClickOutside = options => {
24
24
  }
25
25
  });
26
26
  React.useEffect(() => {
27
+ if (disabled) {
28
+ return;
29
+ }
27
30
  // Store the current event to avoid triggering handlers immediately
28
31
  // Note this depends on a deprecated but extremely well supported quirk of the web platform
29
32
  // https://github.com/facebook/react/issues/20074
@@ -36,12 +39,10 @@ export const useOnClickOutside = options => {
36
39
  }
37
40
  listener(event);
38
41
  };
39
- if (!disabled) {
40
- // use capture phase because React can update DOM before the event bubbles to the document
41
- element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);
42
- element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);
43
- element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);
44
- }
42
+ // use capture phase because React can update DOM before the event bubbles to the document
43
+ element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);
44
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);
45
+ element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);
45
46
  // Garbage collect this event after it's no longer useful to avoid memory leaks
46
47
  timeoutId.current = window.setTimeout(() => {
47
48
  currentEvent = undefined;
@@ -102,27 +103,29 @@ const useIFrameFocus = options => {
102
103
  });
103
104
  // Adds listener to the custom iframe focus event
104
105
  React.useEffect(() => {
105
- if (!disabled) {
106
- targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
107
- return () => {
108
- targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
109
- };
106
+ if (disabled) {
107
+ return;
110
108
  }
109
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
110
+ return () => {
111
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
112
+ };
111
113
  }, [targetDocument, disabled, listener]);
112
114
  // Starts polling for the active element
113
115
  React.useEffect(() => {
114
- if (!disabled) {
115
- var _targetDocument_defaultView;
116
- timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(() => {
117
- const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
118
- if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
119
- const event = new CustomEvent(FUI_FRAME_EVENT, {
120
- bubbles: true
121
- });
122
- activeElement.dispatchEvent(event);
123
- }
124
- }, pollDuration);
116
+ var _targetDocument_defaultView;
117
+ if (disabled) {
118
+ return;
125
119
  }
120
+ timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(() => {
121
+ const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
122
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
123
+ const event = new CustomEvent(FUI_FRAME_EVENT, {
124
+ bubbles: true
125
+ });
126
+ activeElement.dispatchEvent(event);
127
+ }
128
+ }, pollDuration);
126
129
  return () => {
127
130
  var _targetDocument_defaultView;
128
131
  targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEventCallback","useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","useRef","undefined","useIFrameFocus","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument","_target_ownerDocument_defaultView","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"sources":["../../src/hooks/useOnClickOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n\n/**\n * @internal\n */\nexport type UseOnClickOrScrollOutsideOptions = {\n /**\n * The element to listen for the click event\n */\n element: Document | undefined;\n /**\n * Refs to elements that check if the click is outside\n */\n refs: React.MutableRefObject<HTMLElement | undefined | null>[];\n\n /**\n * By default uses element.contains, but custom contain function can be provided\n * @param parentRef - provided parent ref\n * @param child - event target element\n */\n contains?(parent: HTMLElement | null, child: HTMLElement): boolean;\n\n /**\n * Disables event listeners\n */\n disabled?: boolean;\n\n /**\n * Called if the click is outside the element refs\n */\n callback: (ev: MouseEvent | TouchEvent) => void;\n};\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const timeoutId = React.useRef<number | undefined>(undefined);\n useIFrameFocus(options);\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n\n const conditionalHandler = (event: MouseEvent | TouchEvent) => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n\n listener(event);\n };\n\n if (!disabled) {\n // use capture phase because React can update DOM before the event bubbles to the document\n element?.addEventListener('click', conditionalHandler, true);\n element?.addEventListener('touchstart', conditionalHandler, true);\n element?.addEventListener('contextmenu', conditionalHandler, true);\n }\n\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n\n return () => {\n element?.removeEventListener('click', conditionalHandler, true);\n element?.removeEventListener('touchstart', conditionalHandler, true);\n element?.removeEventListener('contextmenu', conditionalHandler, true);\n\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\n\nconst getWindowEvent = (target: Node | Window): Event | undefined => {\n if (target) {\n if (typeof (target as Window).window === 'object' && (target as Window).window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return (target as Node).ownerDocument?.defaultView?.event ?? undefined;\n }\n\n return undefined;\n};\n\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n\ninterface UseIFrameFocusOptions extends UseOnClickOrScrollOutsideOptions {\n /**\n * Millisecond duration to poll\n */\n pollDuration?: number;\n}\n\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */\nconst useIFrameFocus = (options: UseIFrameFocusOptions) => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => !!parent?.contains(child),\n pollDuration = 1000,\n refs,\n } = options;\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n const contains = containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, e.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(e as MouseEvent);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (!disabled) {\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }\n }, [targetDocument, disabled, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (!disabled) {\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement?.tagName === 'IFRAME' || activeElement?.tagName === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, { bubbles: true });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n }\n return () => {\n targetDocument?.defaultView?.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, disabled, pollDuration]);\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AAiCjC;;;;AAIA,OAAO,MAAMC,iBAAA,GAAqBC,OAAA,IAA8C;EAC9E,MAAM;IAAEC,IAAA;IAAMC,QAAA;IAAUC,OAAA;IAASC,QAAA;IAAUC,QAAA,EAAUC;EAAY,CAAE,GAAGN,OAAA;EACtE,MAAMO,SAAA,GAAYV,KAAA,CAAMW,MAAM,CAAqBC,SAAA;EACnDC,cAAA,CAAeV,OAAA;EAEf,MAAMW,QAAA,GAAWb,gBAAA,CAAkBc,EAAA,IAAgC;IACjE,MAAMP,QAAA,GACJC,YAAA,KAAiB,CAACO,MAAA,EAAQC,KAAA;MAAU,QAAC,EAACD,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAQR,QAAQ,CAACS,KAAA;KAAK;IAE9D,MAAMC,SAAA,GAAYd,IAAA,CAAKe,KAAK,CAACC,GAAA,IAAO,CAACZ,QAAA,CAASY,GAAA,CAAIC,OAAO,IAAI,IAAI,EAAEN,EAAA,CAAGO,MAAM;IAC5E,IAAIJ,SAAA,IAAa,CAACX,QAAA,EAAU;MAC1BF,QAAA,CAASU,EAAA;IACX;EACF;EAEAf,KAAA,CAAMuB,SAAS,CAAC,MAAM;IACpB;IACA;IACA;IACA,IAAIC,YAAA,GAAeC,cAAA,CAAeC,MAAA;IAElC,MAAMC,kBAAA,GAAsBC,KAAA,IAAmC;MAC7D;MACA,IAAIA,KAAA,KAAUJ,YAAA,EAAc;QAC1BA,YAAA,GAAeZ,SAAA;QACf;MACF;MAEAE,QAAA,CAASc,KAAA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,QAAA,EAAU,IAAI;MACrE;IACF;EACF,GAAG,CAACyB,cAAA,EAAgBhC,QAAA,EAAUO,QAAA,CAAS;EAEvC;EACAd,KAAA,CAAMuB,SAAS,CAAC,MAAM;IACpB,IAAI,CAAChB,QAAA,EAAU;UACQoC,2BAAA;MAArBF,UAAA,CAAWpB,OAAO,GAAGkB,cAAA,aAAAA,cAAA,wBAAAI,2BAAA,GAAAJ,cAAA,CAAgBF,WAAW,cAA3BM,2BAAA,uBAAAA,2BAAA,CAA6BC,WAAA,CAAY,MAAM;QAClE,MAAMC,aAAA,GAAgBN,cAAA,aAAAA,cAAA,uBAAAA,cAAA,CAAgBM,aAAa;QACnD,IAAI,CAAAA,aAAA,aAAAA,aAAA,uBAAAA,aAAA,CAAeC,OAAO,MAAK,YAAY,CAAAD,aAAA,aAAAA,aAAA,uBAAAA,aAAA,CAAeC,OAAO,MAAK,WAAW;UAC/E,MAAMlB,KAAA,GAAQ,IAAImB,WAAA,CAAYT,eAAA,EAAiB;YAAEU,OAAA,EAAS;UAAK;UAC/DH,aAAA,CAAcI,aAAa,CAACrB,KAAA;QAC9B;MACF,GAAGY,YAAA;IACL;IACA,OAAO,MAAM;UACXG,2BAAA;MAAAJ,cAAA,aAAAA,cAAA,wBAAAI,2BAAA,GAAAJ,cAAA,CAAgBF,WAAW,cAA3BM,2BAAA,uBAAAA,2BAAA,CAA6BX,YAAA,CAAaS,UAAA,CAAWpB,OAAO;IAC9D;EACF,GAAG,CAACkB,cAAA,EAAgBhC,QAAA,EAAUiC,YAAA,CAAa;AAC7C"}
1
+ {"version":3,"names":["React","useEventCallback","useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","useRef","undefined","useIFrameFocus","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument","_target_ownerDocument_defaultView","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"sources":["../../src/hooks/useOnClickOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n\n/**\n * @internal\n */\nexport type UseOnClickOrScrollOutsideOptions = {\n /**\n * The element to listen for the click event\n */\n element: Document | undefined;\n /**\n * Refs to elements that check if the click is outside\n */\n refs: React.MutableRefObject<HTMLElement | undefined | null>[];\n\n /**\n * By default uses element.contains, but custom contain function can be provided\n *\n * @param parent - provided parent element\n * @param child - event target element\n */\n contains?(parent: HTMLElement | null, child: HTMLElement): boolean;\n\n /**\n * Disables event listeners\n */\n disabled?: boolean;\n\n /**\n * Called if the click is outside the element refs\n */\n callback: (ev: MouseEvent | TouchEvent) => void;\n};\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const timeoutId = React.useRef<number | undefined>(undefined);\n useIFrameFocus(options);\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n\n const conditionalHandler = (event: MouseEvent | TouchEvent) => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n\n listener(event);\n };\n\n // use capture phase because React can update DOM before the event bubbles to the document\n element?.addEventListener('click', conditionalHandler, true);\n element?.addEventListener('touchstart', conditionalHandler, true);\n element?.addEventListener('contextmenu', conditionalHandler, true);\n\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n\n return () => {\n element?.removeEventListener('click', conditionalHandler, true);\n element?.removeEventListener('touchstart', conditionalHandler, true);\n element?.removeEventListener('contextmenu', conditionalHandler, true);\n\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\n\nconst getWindowEvent = (target: Node | Window): Event | undefined => {\n if (target) {\n if (typeof (target as Window).window === 'object' && (target as Window).window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return (target as Node).ownerDocument?.defaultView?.event ?? undefined;\n }\n\n return undefined;\n};\n\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n\ninterface UseIFrameFocusOptions extends UseOnClickOrScrollOutsideOptions {\n /**\n * Millisecond duration to poll\n */\n pollDuration?: number;\n}\n\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */\nconst useIFrameFocus = (options: UseIFrameFocusOptions) => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => !!parent?.contains(child),\n pollDuration = 1000,\n refs,\n } = options;\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n const contains = containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, e.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(e as MouseEvent);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, disabled, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n\n if (activeElement?.tagName === 'IFRAME' || activeElement?.tagName === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, { bubbles: true });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n\n return () => {\n targetDocument?.defaultView?.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, disabled, pollDuration]);\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AAkCjC;;;;AAIA,OAAO,MAAMC,iBAAA,GAAqBC,OAAA,IAA8C;EAC9E,MAAM;IAAEC,IAAA;IAAMC,QAAA;IAAUC,OAAA;IAASC,QAAA;IAAUC,QAAA,EAAUC;EAAY,CAAE,GAAGN,OAAA;EACtE,MAAMO,SAAA,GAAYV,KAAA,CAAMW,MAAM,CAAqBC,SAAA;EACnDC,cAAA,CAAeV,OAAA;EAEf,MAAMW,QAAA,GAAWb,gBAAA,CAAkBc,EAAA,IAAgC;IACjE,MAAMP,QAAA,GACJC,YAAA,KAAiB,CAACO,MAAA,EAAQC,KAAA;MAAU,QAAC,EAACD,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAQR,QAAQ,CAACS,KAAA;KAAK;IAE9D,MAAMC,SAAA,GAAYd,IAAA,CAAKe,KAAK,CAACC,GAAA,IAAO,CAACZ,QAAA,CAASY,GAAA,CAAIC,OAAO,IAAI,IAAI,EAAEN,EAAA,CAAGO,MAAM;IAC5E,IAAIJ,SAAA,IAAa,CAACX,QAAA,EAAU;MAC1BF,QAAA,CAASU,EAAA;IACX;EACF;EAEAf,KAAA,CAAMuB,SAAS,CAAC,MAAM;IACpB,IAAIhB,QAAA,EAAU;MACZ;IACF;IAEA;IACA;IACA;IACA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element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
27
- element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
25
+ if (disabled) {
26
+ return;
28
27
  }
28
+ element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
29
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
29
30
  return () => {
30
31
  element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);
31
32
  element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEventCallback","useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","addEventListener","removeEventListener"],"sources":["../../src/hooks/useOnScrollOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AAGjC;;;;AAIA,OAAO,MAAMC,kBAAA,GAAsBC,OAAA,IAA8C;EAC/E,MAAM;IAAEC,IAAA;IAAMC,QAAA;IAAUC,OAAA;IAASC,QAAA;IAAUC,QAAA,EAAUC;EAAY,CAAE,GAAGN,OAAA;EAEtE,MAAMO,QAAA,GAAWT,gBAAA,CAAkBU,EAAA,IAAgC;IACjE,MAAMH,QAAA,GACJC,YAAA,KAAiB,CAACG,MAAA,EAAQC,KAAA;MAAU,QAAC,EAACD,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAQJ,QAAQ,CAACK,KAAA;KAAK;IAE9D,MAAMC,SAAA,GAAYV,IAAA,CAAKW,KAAK,CAACC,GAAA,IAAO,CAACR,QAAA,CAASQ,GAAA,CAAIC,OAAO,IAAI,IAAI,EAAEN,EAAA,CAAGO,MAAM;IAC5E,IAAIJ,SAAA,IAAa,CAACP,QAAA,EAAU;MAC1BF,QAAA,CAASM,EAAA;IACX;EACF;EAEAX,KAAA,CAAMmB,SAAS,CAAC,MAAM;IACpB,IAAI,CAACZ,QAAA,EAAU;MACbD,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASc,gBAAgB,CAAC,SAASV,QAAA;MACnCJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASc,gBAAgB,CAAC,aAAaV,QAAA;IACzC;IAEA,OAAO,MAAM;MACXJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASe,mBAAmB,CAAC,SAASX,QAAA;MACtCJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASe,mBAAmB,CAAC,aAAaX,QAAA;IAC5C;EACF,GAAG,CAACA,QAAA,EAAUJ,OAAA,EAASC,QAAA,CAAS;AAClC"}
1
+ {"version":3,"names":["React","useEventCallback","useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","addEventListener","removeEventListener"],"sources":["../../src/hooks/useOnScrollOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AAGjC;;;;AAIA,OAAO,MAAMC,kBAAA,GAAsBC,OAAA,IAA8C;EAC/E,MAAM;IAAEC,IAAA;IAAMC,QAAA;IAAUC,OAAA;IAASC,QAAA;IAAUC,QAAA,EAAUC;EAAY,CAAE,GAAGN,OAAA;EAEtE,MAAMO,QAAA,GAAWT,gBAAA,CAAkBU,EAAA,IAAgC;IACjE,MAAMH,QAAA,GACJC,YAAA,KAAiB,CAACG,MAAA,EAAQC,KAAA;MAAU,QAAC,EAACD,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAQJ,QAAQ,CAACK,KAAA;KAAK;IAE9D,MAAMC,SAAA,GAAYV,IAAA,CAAKW,KAAK,CAACC,GAAA,IAAO,CAACR,QAAA,CAASQ,GAAA,CAAIC,OAAO,IAAI,IAAI,EAAEN,EAAA,CAAGO,MAAM;IAC5E,IAAIJ,SAAA,IAAa,CAACP,QAAA,EAAU;MAC1BF,QAAA,CAASM,EAAA;IACX;EACF;EAEAX,KAAA,CAAMmB,SAAS,CAAC,MAAM;IACpB,IAAIZ,QAAA,EAAU;MACZ;IACF;IAEAD,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASc,gBAAgB,CAAC,SAASV,QAAA;IACnCJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASc,gBAAgB,CAAC,aAAaV,QAAA;IAEvC,OAAO,MAAM;MACXJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASe,mBAAmB,CAAC,SAASX,QAAA;MACtCJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASe,mBAAmB,CAAC,aAAaX,QAAA;IAC5C;EACF,GAAG,CAACA,QAAA,EAAUJ,OAAA,EAASC,QAAA,CAAS;AAClC"}
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';
1
+ export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';
2
2
  export { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';
3
3
  export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
4
4
  export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from './utils/index';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["getSlots","resolveShorthand","isResolvedShorthand","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"sources":["../src/index.ts"],"sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\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 getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n} from './utils/index';\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"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,mBAAmB,QAAQ;AAgBhE,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL;AAGP,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ;AAEjD,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,QACC;AAEP,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ;AAQ9E,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ"}
1
+ {"version":3,"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"sources":["../src/index.ts"],"sourcesContent":["export {\n getSlots,\n getSlotsNext,\n resolveShorthand,\n isResolvedShorthand,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\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 getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n} from './utils/index';\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"],"mappings":"AAAA,SACEA,QAAQ,EACRC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,EACnBC,2BAA2B,QACtB;AAiBP,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL;AAGP,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ;AAEjD,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,QACC;AAEP,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ;AAQ9E,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @internal
3
+ * Internal reference for the render function
4
+ */ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "SLOT_RENDER_FUNCTION_SYMBOL", {
9
+ enumerable: true,
10
+ get: ()=>SLOT_RENDER_FUNCTION_SYMBOL
11
+ });
12
+ const SLOT_RENDER_FUNCTION_SYMBOL = /*#__PURE__*/ Symbol('fui.slotRenderFunction'); //# sourceMappingURL=constants.js.map
13
+
14
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../lib/compose/constants.js"],"sourcesContent":["/**\n * @internal\n * Internal reference for the render function\n */export const SLOT_RENDER_FUNCTION_SYMBOL = /*#__PURE__*/Symbol('fui.slotRenderFunction');\n//# sourceMappingURL=constants.js.map"],"names":["SLOT_RENDER_FUNCTION_SYMBOL","Symbol"],"mappings":"AAAA;;;CAGC;;;;+BAAeA;;aAAAA;;AAAN,MAAMA,8BAA8B,WAAW,GAAEC,OAAO,2BAClE,qCAAqC"}
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "getSlots", {
9
9
  const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
10
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
11
  const _omit = require("../utils/omit");
12
+ const _constants = require("./constants");
12
13
  function getSlots(state) {
13
14
  const slots = {};
14
15
  const slotProps = {};
@@ -24,17 +25,18 @@ function getSlots(state) {
24
25
  };
25
26
  }
26
27
  function getSlot(state, slotName) {
27
- var _state_components, _state_components1, _state_slotName;
28
- if (state[slotName] === undefined) {
28
+ var _state_components, _state_components1;
29
+ const props = state[slotName];
30
+ if (props === undefined) {
29
31
  return [
30
32
  null,
31
33
  undefined
32
34
  ];
33
35
  }
34
- const { children , as: asProp , ...rest } = state[slotName];
36
+ const { children , as: asProp , [_constants.SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction , ...rest } = props;
35
37
  const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
36
- if (typeof children === 'function') {
37
- const render = children;
38
+ if (renderFunction || typeof children === 'function') {
39
+ const render = renderFunction || children;
38
40
  return [
39
41
  _react.Fragment,
40
42
  {
@@ -42,10 +44,10 @@ function getSlot(state, slotName) {
42
44
  }
43
45
  ];
44
46
  }
45
- const shouldOmitAsProp = typeof slot === 'string' && ((_state_slotName = state[slotName]) === null || _state_slotName === void 0 ? void 0 : _state_slotName.as);
46
- const slotProps = shouldOmitAsProp ? (0, _omit.omit)(state[slotName], [
47
+ const shouldOmitAsProp = typeof slot === 'string' && asProp;
48
+ const slotProps = shouldOmitAsProp ? (0, _omit.omit)(props, [
47
49
  'as'
48
- ]) : state[slotName];
50
+ ]) : props;
49
51
  return [
50
52
  slot,
51
53
  slotProps
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/getSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../utils/omit';\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 * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n var _state_components, _state_components1, _state_slotName;\n if (state[slotName] === undefined) {\n return [null, undefined];\n }\n const {\n children,\n as: asProp,\n ...rest\n } = state[slotName];\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n if (typeof children === 'function') {\n const render = children;\n return [React.Fragment, {\n children: render(slot, rest)\n }];\n }\n const shouldOmitAsProp = typeof slot === 'string' && ((_state_slotName = state[slotName]) === null || _state_slotName === void 0 ? void 0 : _state_slotName.as);\n const slotProps = shouldOmitAsProp ? omit(state[slotName], ['as']) : state[slotName];\n return [slot, slotProps];\n}\n//# sourceMappingURL=getSlots.js.map"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","_state_slotName","undefined","children","as","asProp","rest","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAmBgBA;;aAAAA;;;6DAnBO;sBACF;AAkBd,SAASA,SAASC,KAAK,EAAE;IAC9B,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QACLR;QACAC,WAAWA;IACb;AACF;AACA,SAASQ,QAAQV,KAAK,EAAEO,QAAQ,EAAE;IAChC,IAAII,mBAAmBC,oBAAoBC;IAC3C,IAAIb,KAAK,CAACO,SAAS,KAAKO,WAAW;QACjC,OAAO;YAAC,IAAI;YAAEA;SAAU;IAC1B,CAAC;IACD,MAAM,EACJC,SAAQ,EACRC,IAAIC,OAAM,EACV,GAAGC,MACJ,GAAGlB,KAAK,CAACO,SAAS;IACnB,MAAMC,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOO,aAAa,OAAOd,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWU,UAAW,CAAA,AAACL,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,IAAI,OAAOQ,aAAa,YAAY;QAClC,MAAMI,SAASJ;QACf,OAAO;YAACK,OAAMC,QAAQ;YAAE;gBACtBN,UAAUI,OAAOX,MAAMU;YACzB;SAAE;IACJ,CAAC;IACD,MAAMI,mBAAmB,OAAOd,SAAS,YAAa,CAAA,AAACK,CAAAA,kBAAkBb,KAAK,CAACO,SAAS,AAAD,MAAO,IAAI,IAAIM,oBAAoB,KAAK,IAAI,KAAK,IAAIA,gBAAgBG,EAAE,AAAD;IAC7J,MAAMd,YAAYoB,mBAAmBC,IAAAA,UAAI,EAACvB,KAAK,CAACO,SAAS,EAAE;QAAC;KAAK,IAAIP,KAAK,CAACO,SAAS;IACpF,OAAO;QAACC;QAAMN;KAAU;AAC1B,EACA,oCAAoC"}
1
+ {"version":3,"sources":["../../lib/compose/getSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../utils/omit';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\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 * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [null, undefined];\n }\n const {\n children,\n as: asProp,\n [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction,\n ...rest\n } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n if (renderFunction || typeof children === 'function') {\n const render = renderFunction || children;\n return [React.Fragment, {\n children: render(slot, rest)\n }];\n }\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? omit(props, ['as']) : props;\n return [slot, slotProps];\n}\n//# sourceMappingURL=getSlots.js.map"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","undefined","children","as","asProp","SLOT_RENDER_FUNCTION_SYMBOL","renderFunction","rest","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAoBgBA;;aAAAA;;;6DApBO;sBACF;2BACuB;AAkBrC,SAASA,SAASC,KAAK,EAAE;IAC9B,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QACLR;QACAC,WAAWA;IACb;AACF;AACA,SAASQ,QAAQV,KAAK,EAAEO,QAAQ,EAAE;IAChC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACvB,OAAO;YAAC,IAAI;YAAEA;SAAU;IAC1B,CAAC;IACD,MAAM,EACJC,SAAQ,EACRC,IAAIC,OAAM,EACV,CAACC,sCAA2B,CAAC,EAAEC,eAAc,EAC7C,GAAGC,MACJ,GAAGV;IACJ,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWS,UAAW,CAAA,AAACJ,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,IAAIW,kBAAkB,OAAOJ,aAAa,YAAY;QACpD,MAAMM,SAASF,kBAAkBJ;QACjC,OAAO;YAACO,OAAMC,QAAQ;YAAE;gBACtBR,UAAUM,OAAOZ,MAAMW;YACzB;SAAE;IACJ,CAAC;IACD,MAAMI,mBAAmB,OAAOf,SAAS,YAAYQ;IACrD,MAAMd,YAAYqB,mBAAmBC,IAAAA,UAAI,EAACf,OAAO;QAAC;KAAK,IAAIA,KAAK;IAChE,OAAO;QAACD;QAAMN;KAAU;AAC1B,EACA,oCAAoC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getSlotsNext", {
6
+ enumerable: true,
7
+ get: ()=>getSlotsNext
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ function getSlotsNext(state) {
12
+ const slots = {};
13
+ const slotProps = {};
14
+ const slotNames = Object.keys(state.components);
15
+ for (const slotName of slotNames){
16
+ const [slot, props] = getSlotNext(state, slotName);
17
+ slots[slotName] = slot;
18
+ slotProps[slotName] = props;
19
+ }
20
+ return {
21
+ slots,
22
+ slotProps: slotProps
23
+ };
24
+ }
25
+ function getSlotNext(state, slotName) {
26
+ var _state_components, _state_components1;
27
+ const props = state[slotName];
28
+ if (props === undefined) {
29
+ return [
30
+ null,
31
+ undefined
32
+ ];
33
+ }
34
+ const { as: asProp , ...propsWithoutAs } = props;
35
+ const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
36
+ const shouldOmitAsProp = typeof slot === 'string' && asProp;
37
+ const slotProps = shouldOmitAsProp ? propsWithoutAs : props;
38
+ return [
39
+ slot,
40
+ slotProps
41
+ ];
42
+ } //# sourceMappingURL=getSlotsNext.js.map
43
+
44
+ //# sourceMappingURL=getSlotsNext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../lib/compose/getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n */\nexport function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [null, undefined];\n }\n const {\n as: asProp,\n ...propsWithoutAs\n } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [slot, slotProps];\n}\n//# sourceMappingURL=getSlotsNext.js.map"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAIgBA;;aAAAA;;;6DAJO;AAIhB,SAASA,aAAaC,KAAK,EAAE;IAClC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QACLR;QACAC,WAAWA;IACb;AACF;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ,EAAE;IACpC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACvB,OAAO;YAAC,IAAI;YAAEA;SAAU;IAC1B,CAAC;IACD,MAAM,EACJC,IAAIC,OAAM,EACV,GAAGC,gBACJ,GAAGP;IACJ,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP,KAAK;IAC3D,OAAO;QAACD;QAAMN;KAAU;AAC1B,EACA,wCAAwC"}
@@ -7,6 +7,8 @@ _exportStar(require("./getSlots"), exports);
7
7
  _exportStar(require("./resolveShorthand"), exports);
8
8
  _exportStar(require("./types"), exports);
9
9
  _exportStar(require("./isResolvedShorthand"), exports);
10
+ _exportStar(require("./constants"), exports);
11
+ _exportStar(require("./getSlotsNext"), exports);
10
12
  //# sourceMappingURL=index.js.map
11
13
 
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/index.js"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;CACd,iCAAiC"}
1
+ {"version":3,"sources":["../../lib/compose/index.js"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
@@ -7,23 +7,28 @@ Object.defineProperty(exports, "resolveShorthand", {
7
7
  get: ()=>resolveShorthand
8
8
  });
9
9
  const _react = require("react");
10
+ const _constants = require("./constants");
10
11
  const resolveShorthand = (value, options)=>{
11
12
  const { required =false , defaultProps } = options || {};
12
13
  if (value === null || value === undefined && !required) {
13
14
  return undefined;
14
15
  }
15
16
  let resolvedShorthand = {};
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
18
  if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/ (0, _react.isValidElement)(value)) {
17
19
  resolvedShorthand.children = value;
18
20
  } else if (typeof value === 'object') {
19
- resolvedShorthand = {
20
- ...value
21
- };
21
+ resolvedShorthand = value;
22
22
  }
23
- return defaultProps ? {
23
+ resolvedShorthand = {
24
24
  ...defaultProps,
25
25
  ...resolvedShorthand
26
- } : resolvedShorthand;
26
+ };
27
+ if (typeof resolvedShorthand.children === 'function') {
28
+ resolvedShorthand[_constants.SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children;
29
+ resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;
30
+ }
31
+ return resolvedShorthand;
27
32
  }; //# sourceMappingURL=resolveShorthand.js.map
28
33
 
29
34
  //# sourceMappingURL=resolveShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/resolveShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand = (value, options) => {\n const {\n required = false,\n defaultProps\n } = options || {};\n if (value === null || value === undefined && !required) {\n return undefined;\n }\n let resolvedShorthand = {};\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = {\n ...value\n };\n }\n return defaultProps ? {\n ...defaultProps,\n ...resolvedShorthand\n } : resolvedShorthand;\n};\n//# sourceMappingURL=resolveShorthand.js.map"],"names":["resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","isValidElement","children"],"mappings":";;;;+BAOaA;;aAAAA;;uBAPkB;AAOxB,MAAMA,mBAAmB,CAACC,OAAOC,UAAY;IAClD,MAAM,EACJC,UAAW,KAAK,CAAA,EAChBC,aAAY,EACb,GAAGF,WAAW,CAAC;IAChB,IAAID,UAAU,IAAI,IAAIA,UAAUI,aAAa,CAACF,UAAU;QACtD,OAAOE;IACT,CAAC;IACD,IAAIC,oBAAoB,CAAC;IACzB,IAAI,OAAOL,UAAU,YAAY,OAAOA,UAAU,YAAYM,MAAMC,OAAO,CAACP,UAAU,WAAW,GAAEQ,IAAAA,qBAAc,EAACR,QAAQ;QACxHK,kBAAkBI,QAAQ,GAAGT;IAC/B,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpCK,oBAAoB;YAClB,GAAGL,KAAK;QACV;IACF,CAAC;IACD,OAAOG,eAAe;QACpB,GAAGA,YAAY;QACf,GAAGE,iBAAiB;IACtB,IAAIA,iBAAiB;AACvB,GACA,4CAA4C"}
1
+ {"version":3,"sources":["../../lib/compose/resolveShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand = (value, options) => {\n const {\n required = false,\n defaultProps\n } = options || {};\n if (value === null || value === undefined && !required) {\n return undefined;\n }\n let resolvedShorthand = {};\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = value;\n }\n resolvedShorthand = {\n ...defaultProps,\n ...resolvedShorthand\n };\n if (typeof resolvedShorthand.children === 'function') {\n resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children;\n resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;\n }\n return resolvedShorthand;\n};\n//# sourceMappingURL=resolveShorthand.js.map"],"names":["resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","isValidElement","children","SLOT_RENDER_FUNCTION_SYMBOL"],"mappings":";;;;+BAQaA;;aAAAA;;uBARkB;2BACa;AAOrC,MAAMA,mBAAmB,CAACC,OAAOC,UAAY;IAClD,MAAM,EACJC,UAAW,KAAK,CAAA,EAChBC,aAAY,EACb,GAAGF,WAAW,CAAC;IAChB,IAAID,UAAU,IAAI,IAAIA,UAAUI,aAAa,CAACF,UAAU;QACtD,OAAOE;IACT,CAAC;IACD,IAAIC,oBAAoB,CAAC;IACzB,8DAA8D;IAC9D,IAAI,OAAOL,UAAU,YAAY,OAAOA,UAAU,YAAYM,MAAMC,OAAO,CAACP,UAAU,WAAW,GAAEQ,IAAAA,qBAAc,EAACR,QAAQ;QACxHK,kBAAkBI,QAAQ,GAAGT;IAC/B,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpCK,oBAAoBL;IACtB,CAAC;IACDK,oBAAoB;QAClB,GAAGF,YAAY;QACf,GAAGE,iBAAiB;IACtB;IACA,IAAI,OAAOA,kBAAkBI,QAAQ,KAAK,YAAY;QACpDJ,iBAAiB,CAACK,sCAA2B,CAAC,GAAGL,kBAAkBI,QAAQ;QAC3EJ,kBAAkBI,QAAQ,GAAGN,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaM,QAAQ;IAChH,CAAC;IACD,OAAOJ;AACT,GACA,4CAA4C"}
@@ -23,6 +23,9 @@ const useOnClickOutside = (options)=>{
23
23
  }
24
24
  });
25
25
  _react.useEffect(()=>{
26
+ if (disabled) {
27
+ return;
28
+ }
26
29
  // Store the current event to avoid triggering handlers immediately
27
30
  // Note this depends on a deprecated but extremely well supported quirk of the web platform
28
31
  // https://github.com/facebook/react/issues/20074
@@ -35,12 +38,10 @@ const useOnClickOutside = (options)=>{
35
38
  }
36
39
  listener(event);
37
40
  };
38
- if (!disabled) {
39
- // use capture phase because React can update DOM before the event bubbles to the document
40
- element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);
41
- element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);
42
- element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);
43
- }
41
+ // use capture phase because React can update DOM before the event bubbles to the document
42
+ element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);
43
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);
44
+ element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);
44
45
  // Garbage collect this event after it's no longer useful to avoid memory leaks
45
46
  timeoutId.current = window.setTimeout(()=>{
46
47
  currentEvent = undefined;
@@ -97,12 +98,13 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
97
98
  });
98
99
  // Adds listener to the custom iframe focus event
99
100
  _react.useEffect(()=>{
100
- if (!disabled) {
101
- targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
102
- return ()=>{
103
- targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
104
- };
101
+ if (disabled) {
102
+ return;
105
103
  }
104
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
105
+ return ()=>{
106
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
107
+ };
106
108
  }, [
107
109
  targetDocument,
108
110
  disabled,
@@ -110,18 +112,19 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
110
112
  ]);
111
113
  // Starts polling for the active element
112
114
  _react.useEffect(()=>{
113
- if (!disabled) {
114
- var _targetDocument_defaultView;
115
- timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{
116
- const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
117
- if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
118
- const event = new CustomEvent(FUI_FRAME_EVENT, {
119
- bubbles: true
120
- });
121
- activeElement.dispatchEvent(event);
122
- }
123
- }, pollDuration);
115
+ var _targetDocument_defaultView;
116
+ if (disabled) {
117
+ return;
124
118
  }
119
+ timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{
120
+ const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
121
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
122
+ const event = new CustomEvent(FUI_FRAME_EVENT, {
123
+ bubbles: true
124
+ });
125
+ activeElement.dispatchEvent(event);
126
+ }
127
+ }, pollDuration);
125
128
  return ()=>{
126
129
  var _targetDocument_defaultView;
127
130
  targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = options => {\n const {\n refs,\n callback,\n element,\n disabled,\n contains: containsProp\n } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus(options);\n const listener = useEventCallback(ev => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(() => {\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n const conditionalHandler = event => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n listener(event);\n };\n if (!disabled) {\n // use capture phase because React can update DOM before the event bubbles to the document\n element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);\n }\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n return () => {\n element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\nconst getWindowEvent = target => {\n if (target) {\n var _target_ownerDocument, _target_ownerDocument_defaultView;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */\nconst useIFrameFocus = options => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n },\n pollDuration = 1000,\n refs\n } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback(e => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (!disabled) {\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return () => {\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }\n }, [targetDocument, disabled, listener]);\n // Starts polling for the active element\n React.useEffect(() => {\n if (!disabled) {\n var _targetDocument_defaultView;\n timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(() => {\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n }\n return () => {\n var _targetDocument_defaultView;\n targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, disabled, pollDuration]);\n};\n//# sourceMappingURL=useOnClickOutside.js.map"],"names":["useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","React","useRef","undefined","useIFrameFocus","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument","_target_ownerDocument_defaultView","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;kCACU;AAK1B,MAAMA,oBAAoBC,CAAAA,UAAW;IAC1C,MAAM,EACJC,KAAI,EACJC,SAAQ,EACRC,QAAO,EACPC,SAAQ,EACRC,UAAUC,aAAY,EACvB,GAAGN;IACJ,MAAMO,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAeX;IACf,MAAMY,WAAWC,IAAAA,kCAAgB,EAACC,CAAAA,KAAM;QACtC,MAAMT,WAAWC,gBAAiB,CAAA,CAACS,QAAQC,QAAU;YACnD,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOV,QAAQ,CAACW,MAAM,AAAD;QACjF,CAAA;QACA,MAAMC,YAAYhB,KAAKiB,KAAK,CAACC,CAAAA,MAAO,CAACd,SAASc,IAAIC,OAAO,IAAI,IAAI,EAAEN,GAAGO,MAAM;QAC5E,IAAIJ,aAAa,CAACb,UAAU;YAC1BF,SAASY;QACX,CAAC;IACH;IACAN,OAAMc,SAAS,CAAC,IAAM;QACpB,mEAAmE;QACnE,2FAA2F;QAC3F,iDAAiD;QACjD,IAAIC,eAAeC,eAAeC;QAClC,MAAMC,qBAAqBC,CAAAA,QAAS;YAClC,+EAA+E;YAC/E,IAAIA,UAAUJ,cAAc;gBAC1BA,eAAeb;gBACf;YACF,CAAC;YACDE,SAASe;QACX;QACA,IAAI,CAACvB,UAAU;YACb,0FAA0F;YAC1FD,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQyB,gBAAgB,CAAC,SAASF,oBAAoB,IAAI,CAAC;YAC7GvB,Y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QACF,CAAC;IACH,GAAG;QAAC0B;QAAgBlC;QAAUQ;KAAS;IACvC,wCAAwC;IACxCJ,OAAMc,SAAS,CAAC,IAAM;QACpB,IAAI,CAAClB,UAAU;YACb,IAAIsC;YACJF,WAAWpB,OAAO,GAAGkB,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAI,AAACI,CAAAA,8BAA8BJ,eAAeF,WAAW,AAAD,MAAO,IAAI,IAAIM,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BC,WAAW,CAAC,IAAM;gBAC1P,MAAMC,gBAAgBN,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeM,aAAa;gBAClH,IAAI,AAACA,CAAAA,kBAAkB,IAAI,IAAIA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcC,OAAO,AAAD,MAAO,YAAY,AAACD,CAAAA,kBAAkB,IAAI,IAAIA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcC,OAAO,AAAD,MAAO,WAAW;oBAC7M,MAAMlB,QAAQ,IAAImB,YAAYT,iBAAiB;wBAC7CU,SAAS,IAAI;oBACf;oBACAH,cAAcI,aAAa,CAACrB;gBAC9B,CAAC;YACH,GAAGY,aAAa;QAClB,CAAC;QACD,OAAO,IAAM;YACX,IAAIG;YACJJ,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAI,AAACI,CAAAA,8BAA8BJ,eAAeF,WAAW,AAAD,MAAO,IAAI,IAAIM,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BX,YAAY,CAACS,WAAWpB,OAAO,CAAC;QACvP;IACF,GAAG;QAACkB;QAAgBlC;QAAUmC;KAAa;AAC7C,GACA,6CAA6C"}
1
+ {"version":3,"sources":["../../lib/hooks/useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = options => {\n const {\n refs,\n callback,\n element,\n disabled,\n contains: containsProp\n } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus(options);\n const listener = useEventCallback(ev => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n const conditionalHandler = event => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n listener(event);\n };\n // use capture phase because React can update DOM before the event bubbles to the document\n element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n return () => {\n element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\nconst getWindowEvent = target => {\n if (target) {\n var _target_ownerDocument, _target_ownerDocument_defaultView;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */\nconst useIFrameFocus = options => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n },\n pollDuration = 1000,\n refs\n } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback(e => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return () => {\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, disabled, listener]);\n // Starts polling for the active element\n React.useEffect(() => {\n var _targetDocument_defaultView;\n if (disabled) {\n return;\n }\n timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(() => {\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n return () => {\n var _targetDocument_defaultView;\n targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, disabled, pollDuration]);\n};\n//# sourceMappingURL=useOnClickOutside.js.map"],"names":["useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","React","useRef","undefined","useIFrameFocus","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument","_target_ownerDocument_defaultView","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;kCACU;AAK1B,MAAMA,oBAAoBC,CAAAA,UAAW;IAC1C,MAAM,EACJC,KAAI,EACJC,SAAQ,EACRC,QAAO,EACPC,SAAQ,EACRC,UAAUC,aAAY,EACvB,GAAGN;IACJ,MAAMO,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAeX;IACf,MAAMY,WAAWC,IAAAA,kCAAgB,EAACC,CAAAA,KAAM;QACtC,MAAMT,WAAWC,gBAAiB,CAAA,CAACS,QAAQC,QAAU;YACnD,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOV,QAAQ,CAACW,MAAM,AAAD;QACjF,CAAA;QACA,MAAMC,YAAYhB,KAAKiB,KAAK,CAACC,CAAAA,MAAO,CAACd,SAASc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AAI;gBACf;gBACAH,cAAcI,aAAa,CAACrB;YAC9B,CAAC;QACH,GAAGY,aAAa;QAChB,OAAO,IAAM;YACX,IAAIG;YACJJ,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAI,AAACI,CAAAA,8BAA8BJ,eAAeF,WAAW,AAAD,MAAO,IAAI,IAAIM,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BX,YAAY,CAACS,WAAWpB,OAAO,CAAC;QACvP;IACF,GAAG;QAACkB;QAAgBlC;QAAUmC;KAAa;AAC7C,GACA,6CAA6C"}
@@ -21,10 +21,11 @@ const useOnScrollOutside = (options)=>{
21
21
  }
22
22
  });
23
23
  _react.useEffect(()=>{
24
- if (!disabled) {
25
- element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
26
- element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
24
+ if (disabled) {
25
+ return;
27
26
  }
27
+ element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
28
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
28
29
  return ()=>{
29
30
  element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);
30
31
  element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useOnScrollOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = options => {\n const {\n refs,\n callback,\n element,\n disabled,\n contains: containsProp\n } = options;\n const listener = useEventCallback(ev => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(() => {\n if (!disabled) {\n element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);\n }\n return () => {\n element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n//# sourceMappingURL=useOnScrollOutside.js.map"],"names":["useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","React","useEffect","addEventListener","removeEventListener"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;kCACU;AAK1B,MAAMA,qBAAqBC,CAAAA,UAAW;IAC3C,MAAM,EACJC,KAAI,EACJC,SAAQ,EACRC,QAAO,EACPC,SAAQ,EACRC,UAAUC,aAAY,EACvB,GAAGN;IACJ,MAAMO,WAAWC,IAAAA,kCAAgB,EAACC,CAAAA,KAAM;QACtC,MAAMJ,WAAWC,gBAAiB,CAAA,CAACI,QAAQC,QAAU;YACnD,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOL,QAAQ,CAACM,MAAM,AAAD;QACjF,CAAA;QACA,MAAMC,YAAYX,KAAKY,KAAK,CAACC,CAAAA,MAAO,CAACT,SAASS,IAAIC,OAAO,IAAI,IAAI,EAAEN,GAAGO,MAAM;QAC5E,IAAIJ,aAAa,CAACR,UAAU;YAC1BF,SAASO;QACX,CAAC;IACH;IACAQ,OAAMC,SAAS,CAAC,IAAM;QACpB,IAAI,CAACd,UAAU;YACbD,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,SAASZ,SAAS;YAC7FJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,aAAaZ,SAAS;QACnG,CAAC;QACD,OAAO,IAAM;YACXJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,SAASb,SAAS;YAChGJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,aAAab,SAAS;QACtG;IACF,GAAG;QAACA;QAAUJ;QAASC;KAAS;AAClC,GACA,8CAA8C"}
1
+ {"version":3,"sources":["../../lib/hooks/useOnScrollOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = options => {\n const {\n refs,\n callback,\n element,\n disabled,\n contains: containsProp\n } = options;\n const listener = useEventCallback(ev => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);\n return () => {\n element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n//# sourceMappingURL=useOnScrollOutside.js.map"],"names":["useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","React","useEffect","addEventListener","removeEventListener"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;kCACU;AAK1B,MAAMA,qBAAqBC,CAAAA,UAAW;IAC3C,MAAM,EACJC,KAAI,EACJC,SAAQ,EACRC,QAAO,EACPC,SAAQ,EACRC,UAAUC,aAAY,EACvB,GAAGN;IACJ,MAAMO,WAAWC,IAAAA,kCAAgB,EAACC,CAAAA,KAAM;QACtC,MAAMJ,WAAWC,gBAAiB,CAAA,CAACI,QAAQC,QAAU;YACnD,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOL,QAAQ,CAACM,MAAM,AAAD;QACjF,CAAA;QACA,MAAMC,YAAYX,KAAKY,KAAK,CAACC,CAAAA,MAAO,CAACT,SAASS,IAAIC,OAAO,IAAI,IAAI,EAAEN,GAAGO,MAAM;QAC5E,IAAIJ,aAAa,CAACR,UAAU;YAC1BF,SAASO;QACX,CAAC;IACH;IACAQ,OAAMC,SAAS,CAAC,IAAM;QACpB,IAAId,UAAU;YACZ;QACF,CAAC;QACDD,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,SAASZ,SAAS;QAC7FJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,aAAaZ,SAAS;QACjG,OAAO,IAAM;YACXJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,SAASb,SAAS;YAChGJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,aAAab,SAAS;QACtG;IACF,GAAG;QAACA;QAAUJ;QAASC;KAAS;AAClC,GACA,8CAA8C"}
@@ -10,8 +10,10 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  getSlots: ()=>_index.getSlots,
13
+ getSlotsNext: ()=>_index.getSlotsNext,
13
14
  resolveShorthand: ()=>_index.resolveShorthand,
14
15
  isResolvedShorthand: ()=>_index.isResolvedShorthand,
16
+ SLOT_RENDER_FUNCTION_SYMBOL: ()=>_index.SLOT_RENDER_FUNCTION_SYMBOL,
15
17
  IdPrefixProvider: ()=>_index1.IdPrefixProvider,
16
18
  resetIdsForTests: ()=>_index1.resetIdsForTests,
17
19
  useControllableState: ()=>_index1.useControllableState,
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n//# sourceMappingURL=index.js.map"],"names":["getSlots","resolveShorthand","isResolvedShorthand","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,eAAQ;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAC/CC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,oBAAoB,MAApBA,4BAAoB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,KAAK,MAALA,aAAK;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAAEC,WAAW,MAAXA,mBAAW;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,UAAU,MAAVA,kBAAU;IAC7OC,SAAS,MAATA,iBAAS;IAAEC,QAAQ,MAARA,gBAAQ;IAAEC,WAAW,MAAXA,mBAAW;IAChCC,KAAK,MAALA,aAAK;IAAEC,qBAAqB,MAArBA,6BAAqB;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,IAAI,MAAJA,YAAI;IACrIC,2BAA2B,MAA3BA,mCAA2B;IAAEC,eAAe,MAAfA,uBAAe;IAAEC,eAAe,MAAfA,uBAAe;IAC7DC,YAAY,MAAZA,oBAAY;IAAEC,YAAY,MAAZA,oBAAY;IAAEC,oBAAoB,MAApBA,4BAAoB;;uBALO;wBAC8L;wBAC7M;wBACqG;wBACxE;wBACb;CACjE,iCAAiC"}
1
+ {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n//# sourceMappingURL=index.js.map"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,eAAQ;IAAEC,YAAY,MAAZA,mBAAY;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAAEC,2BAA2B,MAA3BA,kCAA2B;IAC1FC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,oBAAoB,MAApBA,4BAAoB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,KAAK,MAALA,aAAK;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAAEC,WAAW,MAAXA,mBAAW;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,UAAU,MAAVA,kBAAU;IAC7OC,SAAS,MAATA,iBAAS;IAAEC,QAAQ,MAARA,gBAAQ;IAAEC,WAAW,MAAXA,mBAAW;IAChCC,KAAK,MAALA,aAAK;IAAEC,qBAAqB,MAArBA,6BAAqB;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,IAAI,MAAJA,YAAI;IACrIC,2BAA2B,MAA3BA,mCAA2B;IAAEC,eAAe,MAAfA,uBAAe;IAAEC,eAAe,MAAfA,uBAAe;IAC7DC,YAAY,MAAZA,oBAAY;IAAEC,YAAY,MAAZA,oBAAY;IAAEC,oBAAoB,MAApBA,4BAAoB;;uBALkD;wBACmJ;wBAC7M;wBACqG;wBACxE;wBACb;CACjE,iCAAiC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-utilities",
3
- "version": "9.7.3",
3
+ "version": "9.8.0",
4
4
  "description": "A set of general React-specific utilities.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",