@fluentui/react-utilities 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230322-0439.1

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 (106) hide show
  1. package/.swcrc +2 -11
  2. package/CHANGELOG.json +38 -5
  3. package/CHANGELOG.md +17 -5
  4. package/lib/compose/getSlots.js +7 -6
  5. package/lib/compose/getSlots.js.map +1 -1
  6. package/lib/compose/index.js +4 -4
  7. package/lib/compose/isResolvedShorthand.js +2 -2
  8. package/lib/compose/resolveShorthand.js +3 -3
  9. package/lib/compose/types.js +1 -1
  10. package/lib/events/index.js +1 -1
  11. package/lib/events/mouseTouchHelpers.js +5 -5
  12. package/lib/hooks/index.js +12 -12
  13. package/lib/hooks/useControllableState.js +7 -7
  14. package/lib/hooks/useEventCallback.js +3 -3
  15. package/lib/hooks/useFirstMount.js +1 -1
  16. package/lib/hooks/useForceUpdate.js +1 -1
  17. package/lib/hooks/useId.js +6 -6
  18. package/lib/hooks/useIsomorphicLayoutEffect.js +2 -2
  19. package/lib/hooks/useMergedRefs.js +2 -2
  20. package/lib/hooks/useOnClickOutside.js +30 -20
  21. package/lib/hooks/useOnClickOutside.js.map +1 -1
  22. package/lib/hooks/useOnScrollOutside.js +9 -7
  23. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  24. package/lib/hooks/usePrevious.js +1 -1
  25. package/lib/hooks/useScrollbarWidth.js +5 -5
  26. package/lib/hooks/useTimeout.js +1 -1
  27. package/lib/index.js +6 -6
  28. package/lib/ssr/SSRContext.js +6 -5
  29. package/lib/ssr/SSRContext.js.map +1 -1
  30. package/lib/ssr/canUseDOM.js +1 -1
  31. package/lib/ssr/index.js +2 -2
  32. package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
  33. package/lib/trigger/getTriggerChild.js +2 -2
  34. package/lib/trigger/index.js +4 -4
  35. package/lib/trigger/isFluentTrigger.js +1 -1
  36. package/lib/trigger/types.js +1 -1
  37. package/lib/utils/getNativeElementProps.js +3 -3
  38. package/lib/utils/getRTLSafeKey.js +5 -5
  39. package/lib/utils/getReactCallbackName.js +3 -3
  40. package/lib/utils/index.js +8 -8
  41. package/lib/utils/isHTMLElement.js +3 -1
  42. package/lib/utils/isHTMLElement.js.map +1 -1
  43. package/lib/utils/isInteractiveHTMLElement.js +5 -5
  44. package/lib/utils/mergeCallbacks.js +2 -2
  45. package/lib/utils/mergeCallbacks.js.map +1 -1
  46. package/lib/utils/properties.js +27 -27
  47. package/lib/utils/properties.js.map +1 -1
  48. package/lib-commonjs/compose/getSlots.js +5 -4
  49. package/lib-commonjs/compose/getSlots.js.map +1 -1
  50. package/lib-commonjs/compose/index.js.map +1 -1
  51. package/lib-commonjs/compose/isResolvedShorthand.js +1 -1
  52. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  53. package/lib-commonjs/compose/resolveShorthand.js +2 -2
  54. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  55. package/lib-commonjs/compose/types.js.map +1 -1
  56. package/lib-commonjs/events/index.js.map +1 -1
  57. package/lib-commonjs/events/mouseTouchHelpers.js +7 -7
  58. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  59. package/lib-commonjs/hooks/index.js.map +1 -1
  60. package/lib-commonjs/hooks/useControllableState.js +10 -10
  61. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  62. package/lib-commonjs/hooks/useEventCallback.js +1 -1
  63. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  64. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  65. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  66. package/lib-commonjs/hooks/useId.js +4 -4
  67. package/lib-commonjs/hooks/useId.js.map +1 -1
  68. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  69. package/lib-commonjs/hooks/useMergedRefs.js +1 -1
  70. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  71. package/lib-commonjs/hooks/useOnClickOutside.js +28 -18
  72. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  73. package/lib-commonjs/hooks/useOnScrollOutside.js +7 -5
  74. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  75. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  76. package/lib-commonjs/hooks/useScrollbarWidth.js +4 -4
  77. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  78. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  79. package/lib-commonjs/index.js.map +1 -1
  80. package/lib-commonjs/ssr/SSRContext.js +9 -8
  81. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  82. package/lib-commonjs/ssr/canUseDOM.js +1 -1
  83. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  84. package/lib-commonjs/ssr/index.js.map +1 -1
  85. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +2 -2
  86. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  87. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  88. package/lib-commonjs/trigger/index.js.map +1 -1
  89. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  90. package/lib-commonjs/trigger/types.js.map +1 -1
  91. package/lib-commonjs/utils/getNativeElementProps.js +2 -2
  92. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  93. package/lib-commonjs/utils/getRTLSafeKey.js +5 -5
  94. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  95. package/lib-commonjs/utils/getReactCallbackName.js +2 -2
  96. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  97. package/lib-commonjs/utils/index.js.map +1 -1
  98. package/lib-commonjs/utils/isHTMLElement.js +3 -1
  99. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  100. package/lib-commonjs/utils/isInteractiveHTMLElement.js +4 -4
  101. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  102. package/lib-commonjs/utils/mergeCallbacks.js +2 -2
  103. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  104. package/lib-commonjs/utils/properties.js +214 -214
  105. package/lib-commonjs/utils/properties.js.map +1 -1
  106. package/package.json +3 -2
package/.swcrc CHANGED
@@ -1,15 +1,5 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/swcrc",
3
- "env": {
4
- "targets": {
5
- "chrome": "84",
6
- "edge": "84",
7
- "firefox": "75",
8
- "opera": "73",
9
- "safari": "14.1"
10
- },
11
- "bugfixes": true
12
- },
13
3
  "exclude": [
14
4
  "/testing",
15
5
  "/**/*.cy.ts",
@@ -32,7 +22,8 @@
32
22
  "runtime": "classic",
33
23
  "useSpread": true
34
24
  }
35
- }
25
+ },
26
+ "target": "es2019"
36
27
  },
37
28
  "minify": false,
38
29
  "sourceMaps": true
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 17 Mar 2023 15:00:09 GMT",
6
- "tag": "@fluentui/react-utilities_v0.0.0-nightly-20230317-1454.1",
7
- "version": "0.0.0-nightly-20230317-1454.1",
5
+ "date": "Wed, 22 Mar 2023 04:46:38 GMT",
6
+ "tag": "@fluentui/react-utilities_v0.0.0-nightly-20230322-0439.1",
7
+ "version": "0.0.0-nightly-20230322-0439.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,8 +16,41 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-utilities",
19
- "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1",
20
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
19
+ "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230322-0439.1",
20
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Tue, 21 Mar 2023 21:23:15 GMT",
27
+ "tag": "@fluentui/react-utilities_v9.7.2",
28
+ "version": "9.7.2",
29
+ "comments": {
30
+ "patch": [
31
+ {
32
+ "author": "bernardo.sunderhus@gmail.com",
33
+ "package": "@fluentui/react-utilities",
34
+ "commit": "a3463ec7ba84fce450b4a03c989806ba4e11c5e1",
35
+ "comment": "chore: exports isHTMLElement as public"
36
+ },
37
+ {
38
+ "author": "tristan.watanabe@gmail.com",
39
+ "package": "@fluentui/react-utilities",
40
+ "commit": "ead1c6d4c2ac3f3596b62b8cbc07b0a03041f11f",
41
+ "comment": "fix: add node field to package.json exports map."
42
+ },
43
+ {
44
+ "author": "tristan.watanabe@gmail.com",
45
+ "package": "@fluentui/react-utilities",
46
+ "commit": "2fac1a139149bd13b76b1306207bc988dca9c72c",
47
+ "comment": "chore: migrate to swc transpilation approach."
48
+ },
49
+ {
50
+ "author": "beachball",
51
+ "package": "@fluentui/react-utilities",
52
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.2",
53
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
21
54
  }
22
55
  ]
23
56
  }
package/CHANGELOG.md CHANGED
@@ -1,18 +1,30 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Fri, 17 Mar 2023 15:00:09 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 22 Mar 2023 04:46:38 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20230317-1454.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly-20230317-1454.1)
7
+ ## [0.0.0-nightly-20230322-0439.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly-20230322-0439.1)
8
8
 
9
- Fri, 17 Mar 2023 15:00:09 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.7.1..@fluentui/react-utilities_v0.0.0-nightly-20230317-1454.1)
9
+ Wed, 22 Mar 2023 04:46:38 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.7.2..@fluentui/react-utilities_v0.0.0-nightly-20230322-0439.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
16
+
17
+ ## [9.7.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.7.2)
18
+
19
+ Tue, 21 Mar 2023 21:23:15 GMT
20
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.7.1..@fluentui/react-utilities_v9.7.2)
21
+
22
+ ### Patches
23
+
24
+ - chore: exports isHTMLElement as public ([PR #27178](https://github.com/microsoft/fluentui/pull/27178) by bernardo.sunderhus@gmail.com)
25
+ - fix: add node field to package.json exports map. ([PR #27154](https://github.com/microsoft/fluentui/pull/27154) by tristan.watanabe@gmail.com)
26
+ - chore: migrate to swc transpilation approach. ([PR #27250](https://github.com/microsoft/fluentui/pull/27250) by tristan.watanabe@gmail.com)
27
+ - Bump @fluentui/keyboard-keys to v9.0.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
16
28
 
17
29
  ## [9.7.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.7.1)
18
30
 
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { omit } from "../utils/omit";
1
+ import * as React from 'react';
2
+ import { omit } from '../utils/omit';
3
3
  /**
4
4
  * Given the state and an array of slot names, will break out `slots` and `slotProps`
5
5
  * collections.
@@ -32,6 +32,7 @@ export function getSlots(state) {
32
32
  };
33
33
  }
34
34
  function getSlot(state, slotName) {
35
+ var _state_components, _state_components1, _state_slotName;
35
36
  if (state[slotName] === undefined) {
36
37
  return [null, undefined];
37
38
  }
@@ -40,15 +41,15 @@ function getSlot(state, slotName) {
40
41
  as: asProp,
41
42
  ...rest
42
43
  } = state[slotName];
43
- const slot = state.components?.[slotName] === undefined || typeof state.components[slotName] === "string" ? asProp || state.components?.[slotName] || "div" : state.components[slotName];
44
- if (typeof children === "function") {
44
+ 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') {
45
46
  const render = children;
46
47
  return [React.Fragment, {
47
48
  children: render(slot, rest)
48
49
  }];
49
50
  }
50
- const shouldOmitAsProp = typeof slot === "string" && state[slotName]?.as;
51
- const slotProps = shouldOmitAsProp ? omit(state[slotName], ["as"]) : state[slotName];
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];
52
53
  return [slot, slotProps];
53
54
  }
54
55
  //# sourceMappingURL=getSlots.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","omit","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","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], 'children' | '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;EACxB;EACA,OAAO;IAAER,KAAA;IAAOC,SAAA,EAAWA;EAA2C;AACxE;AAEA,SAASQ,QACPV,KAAwB,EACxBO,QAAW,EACsC;EACjD,IAAIP,KAAK,CAACO,QAAA,CAAS,KAAKI,SAAA,EAAW;IACjC,OAAO,CAAC,IAAI,EAAEA,SAAA,CAAkB;EAClC;EACA,MAAM;IAAEC,QAAA;IAAUC,EAAA,EAAIC,MAAA;IAAQ,GAAGC;EAAA,CAAM,GAAGf,KAAK,CAACO,QAAA,CAAS;EAEzD,MAAMC,IAAA,GACJR,KAAA,CAAMM,UAAU,GAAGC,QAAA,CAAS,KAAKI,SAAA,IAAa,OAAOX,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS,KAAK,WAChFO,MAAA,IAAUd,KAAA,CAAMM,UAAU,GAAGC,QAAA,CAAS,IAAI,QAC1CP,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS;EAGhC,IAAI,OAAOK,QAAA,KAAa,YAAY;IAClC,MAAMI,MAAA,GAASJ,QAAA;IACf,OAAO,CACLf,KAAA,CAAMoB,QAAQ,EACd;MACEL,QAAA,EAAUI,MAAA,CAAOR,IAAA,EAAMO,IAAA;IACzB,EACD;EACH;EAEA,MAAMG,gBAAA,GAAmB,OAAOV,IAAA,KAAS,YAAYR,KAAK,CAACO,QAAA,CAAS,EAAEM,EAAA;EACtE,MAAMX,SAAA,GAAagB,gBAAA,GAAmBpB,IAAA,CAAKE,KAAK,CAACO,QAAA,CAAS,EAAG,CAAC,KAAK,IAAIP,KAAK,CAACO,QAAA,CAAS;EAEtF,OAAO,CAACC,IAAA,EAAMN,SAAA,CAAU;AAC1B"}
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], 'children' | '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;EACxB;EACA,OAAO;IAAER,KAAA;IAAOC,SAAA,EAAWA;EAA2C;AACxE;AAEA,SAASQ,QACPV,KAAwB,EACxBO,QAAW,EACsC;MAO/CI,iBAAA,EACcC,kBAAA,EAcqCC,eAAA;EArBrD,IAAIb,KAAK,CAACO,QAAA,CAAS,KAAKO,SAAA,EAAW;IACjC,OAAO,CAAC,IAAI,EAAEA,SAAA,CAAkB;EAClC;EACA,MAAM;IAAEC,QAAA;IAAUC,EAAA,EAAIC,MAAA;IAAQ,GAAGC;EAAA,CAAM,GAAGlB,KAAK,CAACO,QAAA,CAAS;EAEzD,MAAMC,IAAA,GACJ,EAAAG,iBAAA,GAAAX,KAAA,CAAMM,UAAU,cAAhBK,iBAAA,uBAAAA,iBAAkB,CAACJ,QAAA,CAAS,MAAKO,SAAA,IAAa,OAAOd,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS,KAAK,WAChFU,MAAA,KAAU,CAAAL,kBAAA,GAAAZ,KAAA,CAAMM,UAAU,cAAhBM,kBAAA,uBAAAA,kBAAkB,CAACL,QAAA,CAAS,CAAD,IAAK,QAC1CP,KAAA,CAAMM,UAAU,CAACC,QAAA,CAAS;EAGhC,IAAI,OAAOQ,QAAA,KAAa,YAAY;IAClC,MAAMI,MAAA,GAASJ,QAAA;IACf,OAAO,CACLlB,KAAA,CAAMuB,QAAQ,EACd;MACEL,QAAA,EAAUI,MAAA,CAAOX,IAAA,EAAMU,IAAA;IACzB,EACD;EACH;EAEA,MAAMG,gBAAA,GAAmB,OAAOb,IAAA,KAAS,aAAY,CAAAK,eAAA,GAAAb,KAAK,CAACO,QAAA,CAAS,cAAfM,eAAA,uBAAAA,eAAA,CAAiBG,EAAE,CAAD;EACvE,MAAMd,SAAA,GAAamB,gBAAA,GAAmBvB,IAAA,CAAKE,KAAK,CAACO,QAAA,CAAS,EAAG,CAAC,KAAK,IAAIP,KAAK,CAACO,QAAA,CAAS;EAEtF,OAAO,CAACC,IAAA,EAAMN,SAAA,CAAU;AAC1B"}
@@ -1,5 +1,5 @@
1
- export * from "./getSlots";
2
- export * from "./resolveShorthand";
3
- export * from "./types";
4
- export * from "./isResolvedShorthand";
1
+ export * from './getSlots';
2
+ export * from './resolveShorthand';
3
+ export * from './types';
4
+ export * from './isResolvedShorthand';
5
5
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { isValidElement } from "react";
1
+ import { isValidElement } from 'react';
2
2
  /**
3
3
  * Guard method that validates if a shorthand is a slot
4
4
  * can be used to extends properties provided by a slot
@@ -30,6 +30,6 @@ import { isValidElement } from "react";
30
30
  * ```
31
31
  */
32
32
  export function isResolvedShorthand(shorthand) {
33
- return shorthand !== null && typeof shorthand === "object" && !Array.isArray(shorthand) && ! /*#__PURE__*/isValidElement(shorthand);
33
+ return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && ! /*#__PURE__*/isValidElement(shorthand);
34
34
  }
35
35
  //# sourceMappingURL=isResolvedShorthand.js.map
@@ -1,4 +1,4 @@
1
- import { isValidElement } from "react";
1
+ import { isValidElement } from 'react';
2
2
  /**
3
3
  * Resolves shorthands into slot props, to ensure normalization of the signature
4
4
  * being passed down to getSlots method
@@ -14,9 +14,9 @@ export const resolveShorthand = (value, options) => {
14
14
  return undefined;
15
15
  }
16
16
  let resolvedShorthand = {};
17
- if (typeof value === "string" || typeof value === "number" || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {
17
+ if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {
18
18
  resolvedShorthand.children = value;
19
- } else if (typeof value === "object") {
19
+ } else if (typeof value === 'object') {
20
20
  resolvedShorthand = {
21
21
  ...value
22
22
  };
@@ -1,2 +1,2 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  //# sourceMappingURL=types.js.map
@@ -1,2 +1,2 @@
1
- export * from "./mouseTouchHelpers";
1
+ export * from './mouseTouchHelpers';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,15 +1,15 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  /**
3
3
  * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.
4
4
  */
5
5
  export function isTouchEvent(event) {
6
- return event.type.startsWith("touch");
6
+ return event.type.startsWith('touch');
7
7
  }
8
8
  /**
9
9
  * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.
10
10
  */
11
11
  export function isMouseEvent(event) {
12
- return event.type.startsWith("mouse") || ["click", "contextmenu", "dblclick"].indexOf(event.type) > -1;
12
+ return event.type.startsWith('mouse') || ['click', 'contextmenu', 'dblclick'].indexOf(event.type) > -1;
13
13
  }
14
14
  /**
15
15
  * Returns an object with clientX, clientY for TouchOrMouseEvent.
@@ -27,8 +27,8 @@ export function getEventClientCoords(event) {
27
27
  clientY: event.touches[0].clientY
28
28
  };
29
29
  } else {
30
- if (process.env.NODE_ENV !== "production") {
31
- throw new Error("@fluentui/react-utilities]: Unable to get clientX. Unknown event type.");
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');
32
32
  }
33
33
  return {
34
34
  clientX: 0,
@@ -1,13 +1,13 @@
1
- export * from "./useControllableState";
2
- export * from "./useEventCallback";
3
- export * from "./useFirstMount";
4
- export * from "./useForceUpdate";
5
- export * from "./useId";
6
- export * from "./useIsomorphicLayoutEffect";
7
- export * from "./useMergedRefs";
8
- export * from "./useOnClickOutside";
9
- export * from "./useOnScrollOutside";
10
- export * from "./usePrevious";
11
- export * from "./useScrollbarWidth";
12
- export * from "./useTimeout";
1
+ export * from './useControllableState';
2
+ export * from './useEventCallback';
3
+ export * from './useFirstMount';
4
+ export * from './useForceUpdate';
5
+ export * from './useId';
6
+ export * from './useIsomorphicLayoutEffect';
7
+ export * from './useMergedRefs';
8
+ export * from './useOnClickOutside';
9
+ export * from './useOnScrollOutside';
10
+ export * from './usePrevious';
11
+ export * from './useScrollbarWidth';
12
+ export * from './useTimeout';
13
13
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  function isFactoryDispatch(newState) {
3
- return typeof newState === "function";
3
+ return typeof newState === 'function';
4
4
  }
5
5
  /**
6
6
  * @internal
@@ -20,7 +20,7 @@ function isFactoryDispatch(newState) {
20
20
  */
21
21
  export const useControllableState = options => {
22
22
  const isControlled = useIsControlled(options.state);
23
- const initialState = typeof options.defaultState === "undefined" ? options.initialState : options.defaultState;
23
+ const initialState = typeof options.defaultState === 'undefined' ? options.initialState : options.defaultState;
24
24
  const [internalState, setInternalState] = React.useState(initialState);
25
25
  const state = isControlled ? options.state : internalState;
26
26
  const stateRef = React.useRef(state);
@@ -48,18 +48,18 @@ export const useControllableState = options => {
48
48
  */
49
49
  const useIsControlled = controlledValue => {
50
50
  const [isControlled] = React.useState(() => controlledValue !== undefined);
51
- if (process.env.NODE_ENV !== "production") {
51
+ if (process.env.NODE_ENV !== 'production') {
52
52
  // We don't want these warnings in production even though it is against native behaviour
53
53
  // eslint-disable-next-line react-hooks/rules-of-hooks
54
54
  React.useEffect(() => {
55
55
  if (isControlled !== (controlledValue !== undefined)) {
56
56
  const error = new Error();
57
- const controlWarning = isControlled ? "a controlled value to be uncontrolled" : "an uncontrolled value to be controlled";
58
- const undefinedWarning = isControlled ? "defined to an undefined" : "undefined to a defined";
57
+ const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';
58
+ const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';
59
59
  // eslint-disable-next-line no-console
60
60
  console.error([
61
61
  // Default react error
62
- "A component is changing " + controlWarning + ". This is likely caused by the value", "changing from " + undefinedWarning + " value, which should not happen.", "Decide between using a controlled or uncontrolled input element for the lifetime of the component.", "More info: https://reactjs.org/link/controlled-components", error.stack].join(" "));
62
+ 'A component is changing ' + controlWarning + '. This is likely caused by the value', 'changing from ' + undefinedWarning + ' value, which should not happen.', 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.', 'More info: https://reactjs.org/link/controlled-components', error.stack].join(' '));
63
63
  }
64
64
  }, [isControlled, controlledValue]);
65
65
  }
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
1
+ import * as React from 'react';
2
+ import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
3
3
  /**
4
4
  * @internal
5
5
  * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback
@@ -15,7 +15,7 @@ import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
15
15
  */
16
16
  export const useEventCallback = fn => {
17
17
  const callbackRef = React.useRef(() => {
18
- throw new Error("Cannot call an event handler while rendering");
18
+ throw new Error('Cannot call an event handler while rendering');
19
19
  });
20
20
  useIsomorphicLayoutEffect(() => {
21
21
  callbackRef.current = fn;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  /**
3
3
  * @internal
4
4
  * Checks if components was mounted the first time.
@@ -1,4 +1,4 @@
1
- import { useReducer } from "react";
1
+ import { useReducer } from 'react';
2
2
  /**
3
3
  * @internal
4
4
  * Forces a re-render, similar to `forceUpdate` in class components.
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { defaultSSRContextValue, useSSRContext } from "../ssr/index";
1
+ import * as React from 'react';
2
+ import { defaultSSRContextValue, useSSRContext } from '../ssr/index';
3
3
  const IdPrefixContext = /*#__PURE__*/React.createContext(undefined);
4
4
  /**
5
5
  * Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions
@@ -7,7 +7,7 @@ const IdPrefixContext = /*#__PURE__*/React.createContext(undefined);
7
7
  */
8
8
  export const IdPrefixProvider = IdPrefixContext.Provider;
9
9
  function useIdPrefix() {
10
- return React.useContext(IdPrefixContext) || "";
10
+ return React.useContext(IdPrefixContext) || '';
11
11
  }
12
12
  /**
13
13
  * Resets generated IDs, should be used only in tests.
@@ -23,16 +23,16 @@ export function resetIdsForTests() {
23
23
  * without conditioning the hook call
24
24
  * @returns The ID
25
25
  */
26
- export function useId(prefix = "fui-", providedId) {
26
+ export function useId(prefix = 'fui-', providedId) {
27
27
  const contextValue = useSSRContext();
28
28
  const idPrefix = useIdPrefix();
29
29
  // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to
30
30
  // prevent bundlers from complaining with older versions of React.
31
- const _useId = React["use" + "Id"];
31
+ const _useId = React['use' + 'Id'];
32
32
  if (_useId) {
33
33
  const generatedId = _useId();
34
34
  // eslint-disable-next-line react-hooks/rules-of-hooks
35
- const escapedId = React.useMemo(() => generatedId.replace(/:/g, ""), [generatedId]);
35
+ const escapedId = React.useMemo(() => generatedId.replace(/:/g, ''), [generatedId]);
36
36
  return providedId || `${idPrefix}${prefix}${escapedId}`;
37
37
  }
38
38
  // Hooks appear to be running conditionally, but they will always run in the same order since it's based on
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { canUseDOM } from "../ssr/index";
1
+ import * as React from 'react';
2
+ import { canUseDOM } from '../ssr/index';
3
3
  /**
4
4
  * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally
5
5
  * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  /**
3
3
  * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that
4
4
  * updates all provided refs
@@ -10,7 +10,7 @@ export function useMergedRefs(...refs) {
10
10
  // Update the "current" prop hanging on the function.
11
11
  mergedCallback.current = value;
12
12
  for (const ref of refs) {
13
- if (typeof ref === "function") {
13
+ if (typeof ref === 'function') {
14
14
  ref(value);
15
15
  } else if (ref) {
16
16
  // work around the immutability of the React.Ref type
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { useEventCallback } from "./useEventCallback";
1
+ import * as React from 'react';
2
+ import { useEventCallback } from './useEventCallback';
3
3
  /**
4
4
  * @internal
5
5
  * Utility to perform checks where a click/touch event was made outside a component
@@ -15,7 +15,9 @@ export const useOnClickOutside = options => {
15
15
  const timeoutId = React.useRef(undefined);
16
16
  useIFrameFocus(options);
17
17
  const listener = useEventCallback(ev => {
18
- const contains = containsProp || ((parent, child) => !!parent?.contains(child));
18
+ const contains = containsProp || ((parent, child) => {
19
+ return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
20
+ });
19
21
  const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));
20
22
  if (isOutside && !disabled) {
21
23
  callback(ev);
@@ -36,18 +38,18 @@ export const useOnClickOutside = options => {
36
38
  };
37
39
  if (!disabled) {
38
40
  // use capture phase because React can update DOM before the event bubbles to the document
39
- element?.addEventListener("click", conditionalHandler, true);
40
- element?.addEventListener("touchstart", conditionalHandler, true);
41
- element?.addEventListener("contextmenu", conditionalHandler, true);
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);
42
44
  }
43
45
  // Garbage collect this event after it's no longer useful to avoid memory leaks
44
46
  timeoutId.current = window.setTimeout(() => {
45
47
  currentEvent = undefined;
46
48
  }, 1);
47
49
  return () => {
48
- element?.removeEventListener("click", conditionalHandler, true);
49
- element?.removeEventListener("touchstart", conditionalHandler, true);
50
- element?.removeEventListener("contextmenu", conditionalHandler, true);
50
+ element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);
51
+ element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);
52
+ element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);
51
53
  clearTimeout(timeoutId.current);
52
54
  currentEvent = undefined;
53
55
  };
@@ -55,16 +57,18 @@ export const useOnClickOutside = options => {
55
57
  };
56
58
  const getWindowEvent = target => {
57
59
  if (target) {
58
- if (typeof target.window === "object" && target.window === target) {
60
+ var _target_ownerDocument, _target_ownerDocument_defaultView;
61
+ if (typeof target.window === 'object' && target.window === target) {
59
62
  // eslint-disable-next-line deprecation/deprecation
60
63
  return target.event;
61
64
  }
65
+ var _target_ownerDocument_defaultView_event;
62
66
  // eslint-disable-next-line deprecation/deprecation
63
- return target.ownerDocument?.defaultView?.event ?? undefined;
67
+ 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;
64
68
  }
65
69
  return undefined;
66
70
  };
67
- const FUI_FRAME_EVENT = "fuiframefocus";
71
+ const FUI_FRAME_EVENT = 'fuiframefocus';
68
72
  /**
69
73
  * Since click events do not propagate past iframes, we use focus to detect if a
70
74
  * click has happened inside an iframe, since the only ways of focusing inside an
@@ -80,13 +84,17 @@ const useIFrameFocus = options => {
80
84
  disabled,
81
85
  element: targetDocument,
82
86
  callback,
83
- contains: containsProp = (parent, child) => !!parent?.contains(child),
87
+ contains: containsProp = (parent, child) => {
88
+ return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
89
+ },
84
90
  pollDuration = 1000,
85
91
  refs
86
92
  } = options;
87
93
  const timeoutRef = React.useRef();
88
94
  const listener = useEventCallback(e => {
89
- const contains = containsProp || ((parent, child) => !!parent?.contains(child));
95
+ const contains = containsProp || ((parent, child) => {
96
+ return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
97
+ });
90
98
  const isOutside = refs.every(ref => !contains(ref.current || null, e.target));
91
99
  if (isOutside && !disabled) {
92
100
  callback(e);
@@ -95,18 +103,19 @@ const useIFrameFocus = options => {
95
103
  // Adds listener to the custom iframe focus event
96
104
  React.useEffect(() => {
97
105
  if (!disabled) {
98
- targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);
106
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
99
107
  return () => {
100
- targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);
108
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
101
109
  };
102
110
  }
103
111
  }, [targetDocument, disabled, listener]);
104
112
  // Starts polling for the active element
105
113
  React.useEffect(() => {
106
114
  if (!disabled) {
107
- timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {
108
- const activeElement = targetDocument?.activeElement;
109
- if (activeElement?.tagName === "IFRAME" || activeElement?.tagName === "WEBVIEW") {
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') {
110
119
  const event = new CustomEvent(FUI_FRAME_EVENT, {
111
120
  bubbles: true
112
121
  });
@@ -115,7 +124,8 @@ const useIFrameFocus = options => {
115
124
  }, pollDuration);
116
125
  }
117
126
  return () => {
118
- targetDocument?.defaultView?.clearTimeout(timeoutRef.current);
127
+ var _targetDocument_defaultView;
128
+ targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);
119
129
  };
120
130
  }, [targetDocument, disabled, pollDuration]);
121
131
  };
@@ -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","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","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,M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QAAA,CAASS,KAAA,CAAK;IAE7E,MAAMC,SAAA,GAAYd,IAAA,CAAKe,KAAK,CAACC,GAAA,IAAO,CAACZ,QAAA,CAASY,GAAA,CAAIC,OAAO,IAAI,IAAI,EAAEkB,CAAA,CAAEjB,MAAM;IAC3E,IAAIJ,SAAA,IAAa,CAACX,QAAA,EAAU;MAC1BF,QAAA,CAASkC,CAAA;IACX;EACF;EAEA;EACAvC,KAAA,CAAMuB,SAAS,CAAC,MAAM;IACpB,IAAI,CAAChB,QAAA,EAAU;MACb6B,cAAA,EAAgBP,gBAAA,CAAiBM,eAAA,EAAiBrB,QAAA,EAAU,IAAI;MAChE,OAAO,MAAM;QACXsB,cAAA,EAAgBL,mBAAA,CAAoBI,eAAA,EAAiBrB,QAAA,EAAU,IAAI;MACrE;IACF;EACF,GAAG,CAACsB,cAAA,EAAgB7B,QAAA,EAAUO,QAAA,CAAS;EAEvC;EACAd,KAAA,CAAMuB,SAAS,CAAC,MAAM;IACpB,IAAI,CAAChB,QAAA,EAAU;MACb+B,UAAA,CAAWjB,OAAO,GAAGe,cAAA,EAAgBF,WAAA,EAAaM,WAAA,CAAY,MAAM;QAClE,MAAMC,aAAA,GAAgBL,cAAA,EAAgBK,aAAA;QACtC,IAAIA,aAAA,EAAeC,OAAA,KAAY,YAAYD,aAAA,EAAeC,OAAA,KAAY,WAAW;UAC/E,MAAMd,KAAA,GAAQ,IAAIe,WAAA,CAAYR,eAAA,EAAiB;YAAES,OAAA,EAAS;UAAK;UAC/DH,aAAA,CAAcI,aAAa,CAACjB,KAAA;QAC9B;MACF,GAAGS,YAAA;IACL;IACA,OAAO,MAAM;MACXD,cAAA,EAAgBF,WAAA,EAAaF,YAAA,CAAaM,UAAA,CAAWjB,OAAO;IAC9D;EACF,GAAG,CAACe,cAAA,EAAgB7B,QAAA,EAAU8B,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 * @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,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