@fluentui/react-utilities 9.2.2 → 9.3.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 (34) hide show
  1. package/CHANGELOG.json +37 -1
  2. package/CHANGELOG.md +12 -2
  3. package/dist/index.d.ts +17 -8
  4. package/lib/index.js +1 -1
  5. package/lib/index.js.map +1 -1
  6. package/lib/utils/index.js +2 -1
  7. package/lib/utils/index.js.map +1 -1
  8. package/lib/utils/isHTMLElement.js +15 -0
  9. package/lib/utils/isHTMLElement.js.map +1 -0
  10. package/lib/utils/isInteractiveHTMLElement.js +26 -0
  11. package/lib/utils/isInteractiveHTMLElement.js.map +1 -0
  12. package/lib-amd/index.js +3 -2
  13. package/lib-amd/index.js.map +1 -1
  14. package/lib-amd/utils/index.js +3 -2
  15. package/lib-amd/utils/index.js.map +1 -1
  16. package/lib-amd/utils/isHTMLElement.js +22 -0
  17. package/lib-amd/utils/isHTMLElement.js.map +1 -0
  18. package/lib-amd/utils/isInteractiveHTMLElement.js +25 -0
  19. package/lib-amd/utils/isInteractiveHTMLElement.js.map +1 -0
  20. package/lib-commonjs/index.js +9 -3
  21. package/lib-commonjs/index.js.map +1 -1
  22. package/lib-commonjs/utils/index.js +3 -1
  23. package/lib-commonjs/utils/index.js.map +1 -1
  24. package/lib-commonjs/utils/isHTMLElement.js +24 -0
  25. package/lib-commonjs/utils/isHTMLElement.js.map +1 -0
  26. package/lib-commonjs/utils/isInteractiveHTMLElement.js +36 -0
  27. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -0
  28. package/package.json +1 -1
  29. package/lib/utils/shouldPreventDefaultOnKeyDown.js +0 -25
  30. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +0 -1
  31. package/lib-amd/utils/shouldPreventDefaultOnKeyDown.js +0 -26
  32. package/lib-amd/utils/shouldPreventDefaultOnKeyDown.js.map +0 -1
  33. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +0 -35
  34. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,43 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 17 Nov 2022 23:02:28 GMT",
5
+ "date": "Tue, 20 Dec 2022 14:55:58 GMT",
6
+ "tag": "@fluentui/react-utilities_v9.3.0",
7
+ "version": "9.3.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "bernardo.sunderhus@gmail.com",
12
+ "package": "@fluentui/react-utilities",
13
+ "commit": "f3e6e65b7f6435dc6b09bfd626e99921a10983d8",
14
+ "comment": "feat: isHTMLElement helper function"
15
+ },
16
+ {
17
+ "author": "lingfangao@hotmail.com",
18
+ "package": "@fluentui/react-utilities",
19
+ "commit": "dc96e9c54ac445396cd5e74812fd2ac1acdd15eb",
20
+ "comment": "feat: replace shouldPreventKeydown with isInteractiveHTMLElement"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Mon, 05 Dec 2022 18:29:39 GMT",
27
+ "tag": "@fluentui/react-utilities_v9.2.2",
28
+ "version": "9.2.2",
29
+ "comments": {
30
+ "none": [
31
+ {
32
+ "author": "tristan.watanabe@gmail.com",
33
+ "package": "@fluentui/react-utilities",
34
+ "commit": "109f6e6966ce703169c98134f1aedbaec17d6f93",
35
+ "comment": "chore: Migrate to new package structure."
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "date": "Thu, 17 Nov 2022 23:05:30 GMT",
6
42
  "tag": "@fluentui/react-utilities_v9.2.2",
7
43
  "version": "9.2.2",
8
44
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,22 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Thu, 17 Nov 2022 23:02:28 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 20 Dec 2022 14:55:58 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.3.0)
8
+
9
+ Tue, 20 Dec 2022 14:55:58 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.2.2..@fluentui/react-utilities_v9.3.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat: isHTMLElement helper function ([PR #25891](https://github.com/microsoft/fluentui/pull/25891) by bernardo.sunderhus@gmail.com)
15
+ - feat: replace shouldPreventKeydown with isInteractiveHTMLElement ([PR #25942](https://github.com/microsoft/fluentui/pull/25942) by lingfangao@hotmail.com)
16
+
7
17
  ## [9.2.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.2.2)
8
18
 
9
- Thu, 17 Nov 2022 23:02:28 GMT
19
+ Thu, 17 Nov 2022 23:05:30 GMT
10
20
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.2.1..@fluentui/react-utilities_v9.2.2)
11
21
 
12
22
  ### Patches
package/dist/index.d.ts CHANGED
@@ -188,6 +188,23 @@ declare type IntrisicElementProps<Type extends keyof JSX.IntrinsicElements> = Re
188
188
  */
189
189
  export declare function isFluentTrigger(element: React_2.ReactElement): element is React_2.ReactElement<TriggerProps>;
190
190
 
191
+ /**
192
+ * @internal
193
+ * Verifies if a given node is an HTMLElement,
194
+ * this method works seamlessly with frames and elements from different documents
195
+ *
196
+ * This is required as simply using `instanceof`
197
+ * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
198
+ *
199
+ */
200
+ export declare function isHTMLElement(element?: Node | null | undefined): element is HTMLElement;
201
+
202
+ /**
203
+ * @internal
204
+ * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
205
+ */
206
+ export declare function isInteractiveHTMLElement(element: Node | null | undefined): boolean;
207
+
191
208
  /**
192
209
  * Guard method that validates if a shorthand is a slot
193
210
  * can be used to extends properties provided by a slot
@@ -318,14 +335,6 @@ export declare type ResolveShorthandOptions<Props, Required extends boolean = fa
318
335
  defaultProps?: Props;
319
336
  };
320
337
 
321
- /**
322
- * @internal
323
- * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
324
- *
325
- * Useful for situations where a keydown needs to be transformed to a click event
326
- */
327
- export declare function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React_2.KeyboardEvent): boolean;
328
-
329
338
  /**
330
339
  * The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
331
340
  * or a component like `typeof Button`.
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';
2
2
  export { resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useTimeout } from './hooks/index';
3
3
  export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
4
- export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, shouldPreventDefaultOnKeyDown } from './utils/index';
4
+ export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement } from './utils/index';
5
5
  export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';
6
6
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,EAAmB,gBAAnB,EAAqC,mBAArC,QAAgE,iBAAhE;AAgBA,SACE,gBADF,EAEE,oBAFF,EAGE,gBAHF,EAIE,aAJF,EAKE,cALF,EAME,KANF,EAOE,yBAPF,EAQE,aARF,EASE,iBATF,EAUE,kBAVF,EAWE,WAXF,EAYE,UAZF,QAaO,eAbP;AAgBA,SAAS,SAAT,EAAoB,QAApB,EAA8B,WAA9B,QAAiD,aAAjD;AAEA,SACE,KADF,EAEE,qBAFF,EAGE,yBAHF,EAIE,aAJF,EAKE,cALF,EAME,6BANF,QAOO,eAPP;AASA,SAAS,2BAAT,EAAsC,eAAtC,EAAuD,eAAvD,QAA8E,iBAA9E","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 resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\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 shouldPreventDefaultOnKeyDown,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,EAAmB,gBAAnB,EAAqC,mBAArC,QAAgE,iBAAhE;AAgBA,SACE,gBADF,EAEE,oBAFF,EAGE,gBAHF,EAIE,aAJF,EAKE,cALF,EAME,KANF,EAOE,yBAPF,EAQE,aARF,EASE,iBATF,EAUE,kBAVF,EAWE,WAXF,EAYE,UAZF,QAaO,eAbP;AAgBA,SAAS,SAAT,EAAoB,QAApB,EAA8B,WAA9B,QAAiD,aAAjD;AAEA,SACE,KADF,EAEE,qBAFF,EAGE,yBAHF,EAIE,aAJF,EAKE,cALF,EAME,aANF,EAOE,wBAPF,QAQO,eARP;AAUA,SAAS,2BAAT,EAAsC,eAAtC,EAAuD,eAAvD,QAA8E,iBAA9E","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 resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\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} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"],"sourceRoot":"../src/"}
@@ -4,5 +4,6 @@ export * from './getRTLSafeKey';
4
4
  export * from './mergeCallbacks';
5
5
  export * from './omit';
6
6
  export * from './properties';
7
- export * from './shouldPreventDefaultOnKeyDown';
7
+ export * from './isHTMLElement';
8
+ export * from './isInteractiveHTMLElement';
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './shouldPreventDefaultOnKeyDown';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @internal
3
+ * Verifies if a given node is an HTMLElement,
4
+ * this method works seamlessly with frames and elements from different documents
5
+ *
6
+ * This is required as simply using `instanceof`
7
+ * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
8
+ *
9
+ */
10
+ export function isHTMLElement(element) {
11
+ var _a;
12
+
13
+ return Boolean(element !== null && ((_a = element === null || element === void 0 ? void 0 : element.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) && element instanceof element.ownerDocument.defaultView.HTMLElement);
14
+ }
15
+ //# sourceMappingURL=isHTMLElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AACH,OAAM,SAAU,aAAV,CAAwB,OAAxB,EAAyD;;;EAC7D,OAAO,OAAO,CACZ,OAAO,KAAK,IAAZ,KACE,CAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAD1B,KAEE,OAAO,YAAY,OAAO,CAAC,aAAR,CAAsB,WAAtB,CAAkC,WAH3C,CAAd;AAKD","sourcesContent":["/**\n * @internal\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is required as simply using `instanceof`\n * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n */\nexport function isHTMLElement(element?: Node | null | undefined): element is HTMLElement {\n return Boolean(\n element !== null &&\n element?.ownerDocument?.defaultView &&\n element instanceof element.ownerDocument.defaultView.HTMLElement,\n );\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,26 @@
1
+ import { isHTMLElement } from './isHTMLElement';
2
+ /**
3
+ * @internal
4
+ * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
5
+ */
6
+
7
+ export function isInteractiveHTMLElement(element) {
8
+ if (!isHTMLElement(element)) {
9
+ return false;
10
+ }
11
+
12
+ const {
13
+ tagName
14
+ } = element;
15
+
16
+ switch (tagName) {
17
+ case 'BUTTON':
18
+ case 'A':
19
+ case 'INPUT':
20
+ case 'TEXTAREA':
21
+ return true;
22
+ }
23
+
24
+ return element.isContentEditable;
25
+ }
26
+ //# sourceMappingURL=isInteractiveHTMLElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,iBAA9B;AAEA;;;AAGG;;AACH,OAAM,SAAU,wBAAV,CAAmC,OAAnC,EAAmE;EACvE,IAAI,CAAC,aAAa,CAAC,OAAD,CAAlB,EAA6B;IAC3B,OAAO,KAAP;EACD;;EAED,MAAM;IAAE;EAAF,IAAc,OAApB;;EACA,QAAQ,OAAR;IACE,KAAK,QAAL;IACA,KAAK,GAAL;IACA,KAAK,OAAL;IACA,KAAK,UAAL;MACE,OAAO,IAAP;EALJ;;EAQA,OAAO,OAAO,CAAC,iBAAf;AACD","sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: Node | null | undefined) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"],"sourceRoot":"../src/"}
package/lib-amd/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  define(["require", "exports", "./compose/index", "./hooks/index", "./ssr/index", "./utils/index", "./trigger/index"], function (require, exports, index_1, index_2, index_3, index_4, index_5) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isFluentTrigger = exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.shouldPreventDefaultOnKeyDown = exports.mergeCallbacks = exports.getRTLSafeKey = exports.getPartitionedNativeProps = exports.getNativeElementProps = exports.clamp = exports.SSRProvider = exports.useIsSSR = exports.canUseDOM = exports.useTimeout = exports.usePrevious = exports.useOnScrollOutside = exports.useOnClickOutside = exports.useMergedRefs = exports.useIsomorphicLayoutEffect = exports.useId = exports.useForceUpdate = exports.useFirstMount = exports.useEventCallback = exports.useControllableState = exports.resetIdsForTests = exports.isResolvedShorthand = exports.resolveShorthand = exports.getSlots = void 0;
4
+ exports.isFluentTrigger = exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.isInteractiveHTMLElement = exports.isHTMLElement = exports.mergeCallbacks = exports.getRTLSafeKey = exports.getPartitionedNativeProps = exports.getNativeElementProps = exports.clamp = exports.SSRProvider = exports.useIsSSR = exports.canUseDOM = exports.useTimeout = exports.usePrevious = exports.useOnScrollOutside = exports.useOnClickOutside = exports.useMergedRefs = exports.useIsomorphicLayoutEffect = exports.useId = exports.useForceUpdate = exports.useFirstMount = exports.useEventCallback = exports.useControllableState = exports.resetIdsForTests = exports.isResolvedShorthand = exports.resolveShorthand = exports.getSlots = void 0;
5
5
  Object.defineProperty(exports, "getSlots", { enumerable: true, get: function () { return index_1.getSlots; } });
6
6
  Object.defineProperty(exports, "resolveShorthand", { enumerable: true, get: function () { return index_1.resolveShorthand; } });
7
7
  Object.defineProperty(exports, "isResolvedShorthand", { enumerable: true, get: function () { return index_1.isResolvedShorthand; } });
@@ -25,7 +25,8 @@ define(["require", "exports", "./compose/index", "./hooks/index", "./ssr/index",
25
25
  Object.defineProperty(exports, "getPartitionedNativeProps", { enumerable: true, get: function () { return index_4.getPartitionedNativeProps; } });
26
26
  Object.defineProperty(exports, "getRTLSafeKey", { enumerable: true, get: function () { return index_4.getRTLSafeKey; } });
27
27
  Object.defineProperty(exports, "mergeCallbacks", { enumerable: true, get: function () { return index_4.mergeCallbacks; } });
28
- Object.defineProperty(exports, "shouldPreventDefaultOnKeyDown", { enumerable: true, get: function () { return index_4.shouldPreventDefaultOnKeyDown; } });
28
+ Object.defineProperty(exports, "isHTMLElement", { enumerable: true, get: function () { return index_4.isHTMLElement; } });
29
+ Object.defineProperty(exports, "isInteractiveHTMLElement", { enumerable: true, get: function () { return index_4.isInteractiveHTMLElement; } });
29
30
  Object.defineProperty(exports, "applyTriggerPropsToChildren", { enumerable: true, get: function () { return index_5.applyTriggerPropsToChildren; } });
30
31
  Object.defineProperty(exports, "getTriggerChild", { enumerable: true, get: function () { return index_5.getTriggerChild; } });
31
32
  Object.defineProperty(exports, "isFluentTrigger", { enumerable: true, get: function () { return index_5.isFluentTrigger; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":";;;;IAAS,iGAAA,QAAQ,OAAA;IAAE,yGAAA,gBAAgB,OAAA;IAAE,4GAAA,mBAAmB,OAAA;IAiBtD,yGAAA,gBAAgB,OAAA;IAChB,6GAAA,oBAAoB,OAAA;IACpB,yGAAA,gBAAgB,OAAA;IAChB,sGAAA,aAAa,OAAA;IACb,uGAAA,cAAc,OAAA;IACd,8FAAA,KAAK,OAAA;IACL,kHAAA,yBAAyB,OAAA;IACzB,sGAAA,aAAa,OAAA;IACb,0GAAA,iBAAiB,OAAA;IACjB,2GAAA,kBAAkB,OAAA;IAClB,oGAAA,WAAW,OAAA;IACX,mGAAA,UAAU,OAAA;IAIH,kGAAA,SAAS,OAAA;IAAE,iGAAA,QAAQ,OAAA;IAAE,oGAAA,WAAW,OAAA;IAGvC,8FAAA,KAAK,OAAA;IACL,8GAAA,qBAAqB,OAAA;IACrB,kHAAA,yBAAyB,OAAA;IACzB,sGAAA,aAAa,OAAA;IACb,uGAAA,cAAc,OAAA;IACd,sHAAA,6BAA6B,OAAA;IAGtB,oHAAA,2BAA2B,OAAA;IAAE,wGAAA,eAAe,OAAA;IAAE,wGAAA,eAAe,OAAA","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 resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\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 shouldPreventDefaultOnKeyDown,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":";;;;IAAS,iGAAA,QAAQ,OAAA;IAAE,yGAAA,gBAAgB,OAAA;IAAE,4GAAA,mBAAmB,OAAA;IAiBtD,yGAAA,gBAAgB,OAAA;IAChB,6GAAA,oBAAoB,OAAA;IACpB,yGAAA,gBAAgB,OAAA;IAChB,sGAAA,aAAa,OAAA;IACb,uGAAA,cAAc,OAAA;IACd,8FAAA,KAAK,OAAA;IACL,kHAAA,yBAAyB,OAAA;IACzB,sGAAA,aAAa,OAAA;IACb,0GAAA,iBAAiB,OAAA;IACjB,2GAAA,kBAAkB,OAAA;IAClB,oGAAA,WAAW,OAAA;IACX,mGAAA,UAAU,OAAA;IAIH,kGAAA,SAAS,OAAA;IAAE,iGAAA,QAAQ,OAAA;IAAE,oGAAA,WAAW,OAAA;IAGvC,8FAAA,KAAK,OAAA;IACL,8GAAA,qBAAqB,OAAA;IACrB,kHAAA,yBAAyB,OAAA;IACzB,sGAAA,aAAa,OAAA;IACb,uGAAA,cAAc,OAAA;IACd,sGAAA,aAAa,OAAA;IACb,iHAAA,wBAAwB,OAAA;IAGjB,oHAAA,2BAA2B,OAAA;IAAE,wGAAA,eAAe,OAAA;IAAE,wGAAA,eAAe,OAAA","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 resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\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} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "./clamp", "./getNativeElementProps", "./getRTLSafeKey", "./mergeCallbacks", "./omit", "./properties", "./shouldPreventDefaultOnKeyDown"], function (require, exports, tslib_1, clamp_1, getNativeElementProps_1, getRTLSafeKey_1, mergeCallbacks_1, omit_1, properties_1, shouldPreventDefaultOnKeyDown_1) {
1
+ define(["require", "exports", "tslib", "./clamp", "./getNativeElementProps", "./getRTLSafeKey", "./mergeCallbacks", "./omit", "./properties", "./isHTMLElement", "./isInteractiveHTMLElement"], function (require, exports, tslib_1, clamp_1, getNativeElementProps_1, getRTLSafeKey_1, mergeCallbacks_1, omit_1, properties_1, isHTMLElement_1, isInteractiveHTMLElement_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  tslib_1.__exportStar(clamp_1, exports);
@@ -7,6 +7,7 @@ define(["require", "exports", "tslib", "./clamp", "./getNativeElementProps", "./
7
7
  tslib_1.__exportStar(mergeCallbacks_1, exports);
8
8
  tslib_1.__exportStar(omit_1, exports);
9
9
  tslib_1.__exportStar(properties_1, exports);
10
- tslib_1.__exportStar(shouldPreventDefaultOnKeyDown_1, exports);
10
+ tslib_1.__exportStar(isHTMLElement_1, exports);
11
+ tslib_1.__exportStar(isInteractiveHTMLElement_1, exports);
11
12
  });
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":";;;IAAA,uCAAwB;IACxB,uDAAwC;IACxC,+CAAgC;IAChC,gDAAiC;IACjC,sCAAuB;IACvB,4CAA6B;IAC7B,+DAAgD","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './shouldPreventDefaultOnKeyDown';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":";;;IAAA,uCAAwB;IACxB,uDAAwC;IACxC,+CAAgC;IAChC,gDAAiC;IACjC,sCAAuB;IACvB,4CAA6B;IAC7B,+CAAgC;IAChC,0DAA2C","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n"]}
@@ -0,0 +1,22 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isHTMLElement = void 0;
5
+ /**
6
+ * @internal
7
+ * Verifies if a given node is an HTMLElement,
8
+ * this method works seamlessly with frames and elements from different documents
9
+ *
10
+ * This is required as simply using `instanceof`
11
+ * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
12
+ *
13
+ */
14
+ function isHTMLElement(element) {
15
+ var _a;
16
+ return Boolean(element !== null &&
17
+ ((_a = element === null || element === void 0 ? void 0 : element.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) &&
18
+ element instanceof element.ownerDocument.defaultView.HTMLElement);
19
+ }
20
+ exports.isHTMLElement = isHTMLElement;
21
+ });
22
+ //# sourceMappingURL=isHTMLElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isHTMLElement.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":";;;;IAAA;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAiC;;QAC7D,OAAO,OAAO,CACZ,OAAO,KAAK,IAAI;aACd,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,0CAAE,WAAW,CAAA;YACnC,OAAO,YAAY,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,WAAW,CACnE,CAAC;IACJ,CAAC;IAND,sCAMC","sourcesContent":["/**\n * @internal\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is required as simply using `instanceof`\n * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n */\nexport function isHTMLElement(element?: Node | null | undefined): element is HTMLElement {\n return Boolean(\n element !== null &&\n element?.ownerDocument?.defaultView &&\n element instanceof element.ownerDocument.defaultView.HTMLElement,\n );\n}\n"]}
@@ -0,0 +1,25 @@
1
+ define(["require", "exports", "./isHTMLElement"], function (require, exports, isHTMLElement_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isInteractiveHTMLElement = void 0;
5
+ /**
6
+ * @internal
7
+ * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
8
+ */
9
+ function isInteractiveHTMLElement(element) {
10
+ if (!isHTMLElement_1.isHTMLElement(element)) {
11
+ return false;
12
+ }
13
+ var tagName = element.tagName;
14
+ switch (tagName) {
15
+ case 'BUTTON':
16
+ case 'A':
17
+ case 'INPUT':
18
+ case 'TEXTAREA':
19
+ return true;
20
+ }
21
+ return element.isContentEditable;
22
+ }
23
+ exports.isInteractiveHTMLElement = isInteractiveHTMLElement;
24
+ });
25
+ //# sourceMappingURL=isInteractiveHTMLElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isInteractiveHTMLElement.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"names":[],"mappings":";;;;IAEA;;;OAGG;IACH,SAAgB,wBAAwB,CAAC,OAAgC;QACvE,IAAI,CAAC,6BAAa,CAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,KAAK,CAAC;SACd;QAEO,IAAA,OAAO,GAAK,OAAO,QAAZ,CAAa;QAC5B,QAAQ,OAAO,EAAE;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,GAAG,CAAC;YACT,KAAK,OAAO,CAAC;YACb,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC;SACf;QAED,OAAO,OAAO,CAAC,iBAAiB,CAAC;IACnC,CAAC;IAfD,4DAeC","sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: Node | null | undefined) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isFluentTrigger = exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.shouldPreventDefaultOnKeyDown = exports.mergeCallbacks = exports.getRTLSafeKey = exports.getPartitionedNativeProps = exports.getNativeElementProps = exports.clamp = exports.SSRProvider = exports.useIsSSR = exports.canUseDOM = exports.useTimeout = exports.usePrevious = exports.useOnScrollOutside = exports.useOnClickOutside = exports.useMergedRefs = exports.useIsomorphicLayoutEffect = exports.useId = exports.useForceUpdate = exports.useFirstMount = exports.useEventCallback = exports.useControllableState = exports.resetIdsForTests = exports.isResolvedShorthand = exports.resolveShorthand = exports.getSlots = void 0;
6
+ exports.isFluentTrigger = exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.isInteractiveHTMLElement = exports.isHTMLElement = exports.mergeCallbacks = exports.getRTLSafeKey = exports.getPartitionedNativeProps = exports.getNativeElementProps = exports.clamp = exports.SSRProvider = exports.useIsSSR = exports.canUseDOM = exports.useTimeout = exports.usePrevious = exports.useOnScrollOutside = exports.useOnClickOutside = exports.useMergedRefs = exports.useIsomorphicLayoutEffect = exports.useId = exports.useForceUpdate = exports.useFirstMount = exports.useEventCallback = exports.useControllableState = exports.resetIdsForTests = exports.isResolvedShorthand = exports.resolveShorthand = exports.getSlots = void 0;
7
7
 
8
8
  var index_1 = /*#__PURE__*/require("./compose/index");
9
9
 
@@ -154,10 +154,16 @@ Object.defineProperty(exports, "mergeCallbacks", {
154
154
  return index_4.mergeCallbacks;
155
155
  }
156
156
  });
157
- Object.defineProperty(exports, "shouldPreventDefaultOnKeyDown", {
157
+ Object.defineProperty(exports, "isHTMLElement", {
158
158
  enumerable: true,
159
159
  get: function () {
160
- return index_4.shouldPreventDefaultOnKeyDown;
160
+ return index_4.isHTMLElement;
161
+ }
162
+ });
163
+ Object.defineProperty(exports, "isInteractiveHTMLElement", {
164
+ enumerable: true,
165
+ get: function () {
166
+ return index_4.isInteractiveHTMLElement;
161
167
  }
162
168
  });
163
169
 
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,i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,EAAA,+BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,6BAAA;EAA6B;AAA7B,CAAA;;AAGF,IAAA,OAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,2BAAA;EAA2B;AAA3B,CAAA;AAA6B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA","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 resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\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 shouldPreventDefaultOnKeyDown,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,UAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,QAAA;EAAQ;AAAR,CAAA;AAAU,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AAAkB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA;;AAgBrC,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,oBAAA;EAAoB;AAApB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AACA,MAAA,CAAA,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AA,OAAA,CAAA,aAAA;EAAa;AAAb,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,cAAA;EAAc;AAAd,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,eAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,aAAA;EAAa;AAAb,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,wBAAA;EAAwB;AAAxB,CAAA;;AAGF,IAAA,OAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,2BAAA;EAA2B;AAA3B,CAAA;AAA6B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA","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 resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\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} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"],"sourceRoot":"../src/"}
@@ -18,5 +18,7 @@ tslib_1.__exportStar(require("./omit"), exports);
18
18
 
19
19
  tslib_1.__exportStar(require("./properties"), exports);
20
20
 
21
- tslib_1.__exportStar(require("./shouldPreventDefaultOnKeyDown"), exports);
21
+ tslib_1.__exportStar(require("./isHTMLElement"), exports);
22
+
23
+ tslib_1.__exportStar(require("./isInteractiveHTMLElement"), exports);
22
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './shouldPreventDefaultOnKeyDown';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isHTMLElement = void 0;
7
+ /**
8
+ * @internal
9
+ * Verifies if a given node is an HTMLElement,
10
+ * this method works seamlessly with frames and elements from different documents
11
+ *
12
+ * This is required as simply using `instanceof`
13
+ * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
14
+ *
15
+ */
16
+
17
+ function isHTMLElement(element) {
18
+ var _a;
19
+
20
+ return Boolean(element !== null && ((_a = element === null || element === void 0 ? void 0 : element.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) && element instanceof element.ownerDocument.defaultView.HTMLElement);
21
+ }
22
+
23
+ exports.isHTMLElement = isHTMLElement;
24
+ //# sourceMappingURL=isHTMLElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;AAQG;;AACH,SAAgB,aAAhB,CAA8B,OAA9B,EAA+D;;;EAC7D,OAAO,OAAO,CACZ,OAAO,KAAK,IAAZ,KACE,CAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAD1B,KAEE,OAAO,YAAY,OAAO,CAAC,aAAR,CAAsB,WAAtB,CAAkC,WAH3C,CAAd;AAKD;;AAND,OAAA,CAAA,aAAA,GAAA,aAAA","sourcesContent":["/**\n * @internal\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is required as simply using `instanceof`\n * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n */\nexport function isHTMLElement(element?: Node | null | undefined): element is HTMLElement {\n return Boolean(\n element !== null &&\n element?.ownerDocument?.defaultView &&\n element instanceof element.ownerDocument.defaultView.HTMLElement,\n );\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isInteractiveHTMLElement = void 0;
7
+
8
+ const isHTMLElement_1 = /*#__PURE__*/require("./isHTMLElement");
9
+ /**
10
+ * @internal
11
+ * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
12
+ */
13
+
14
+
15
+ function isInteractiveHTMLElement(element) {
16
+ if (!isHTMLElement_1.isHTMLElement(element)) {
17
+ return false;
18
+ }
19
+
20
+ const {
21
+ tagName
22
+ } = element;
23
+
24
+ switch (tagName) {
25
+ case 'BUTTON':
26
+ case 'A':
27
+ case 'INPUT':
28
+ case 'TEXTAREA':
29
+ return true;
30
+ }
31
+
32
+ return element.isContentEditable;
33
+ }
34
+
35
+ exports.isInteractiveHTMLElement = isInteractiveHTMLElement;
36
+ //# sourceMappingURL=isInteractiveHTMLElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,wBAAhB,CAAyC,OAAzC,EAAyE;EACvE,IAAI,CAAC,eAAA,CAAA,aAAA,CAAc,OAAd,CAAL,EAA6B;IAC3B,OAAO,KAAP;EACD;;EAED,MAAM;IAAE;EAAF,IAAc,OAApB;;EACA,QAAQ,OAAR;IACE,KAAK,QAAL;IACA,KAAK,GAAL;IACA,KAAK,OAAL;IACA,KAAK,UAAL;MACE,OAAO,IAAP;EALJ;;EAQA,OAAO,OAAO,CAAC,iBAAf;AACD;;AAfD,OAAA,CAAA,wBAAA,GAAA,wBAAA","sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: Node | null | undefined) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-utilities",
3
- "version": "9.2.2",
3
+ "version": "9.3.0",
4
4
  "description": "A set of general React-specific utilities.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -1,25 +0,0 @@
1
- import { Space, Enter } from '@fluentui/keyboard-keys';
2
- /**
3
- * @internal
4
- * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
5
- *
6
- * Useful for situations where a keydown needs to be transformed to a click event
7
- */
8
-
9
- export function shouldPreventDefaultOnKeyDown(e) {
10
- if (e.defaultPrevented) {
11
- return false;
12
- }
13
-
14
- const key = e.key;
15
- const target = e.target;
16
- const matchesByKey = key === Space || key === Enter;
17
-
18
- if ((target === null || target === void 0 ? void 0 : target.tagName) === 'A') {
19
- return key === Space;
20
- }
21
-
22
- const ignoredByTag = (target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' || (target === null || target === void 0 ? void 0 : target.tagName) === 'TEXTAREA' || (target === null || target === void 0 ? void 0 : target.isContentEditable) === true;
23
- return matchesByKey && !ignoredByTag;
24
- }
25
- //# sourceMappingURL=shouldPreventDefaultOnKeyDown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["packages/react-components/react-utilities/src/utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AAGA;;;;;AAKG;;AACH,OAAM,SAAU,6BAAV,CAAwC,CAAxC,EAA8E;EAClF,IAAI,CAAC,CAAC,gBAAN,EAAwB;IACtB,OAAO,KAAP;EACD;;EAED,MAAM,GAAG,GAAG,CAAC,CAAC,GAAd;EACA,MAAM,MAAM,GAA4B,CAAC,CAAC,MAA1C;EAEA,MAAM,YAAY,GAAG,GAAG,KAAK,KAAR,IAAiB,GAAG,KAAK,KAA9C;;EAEA,IAAI,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,GAAxB,EAA6B;IAC3B,OAAO,GAAG,KAAK,KAAf;EACD;;EAED,MAAM,YAAY,GAChB,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,OAApB,IAA+B,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,UAAnD,IAAiE,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,iBAAR,MAA8B,IADjG;EAGA,OAAO,YAAY,IAAI,CAAC,YAAxB;AACD","sourcesContent":["import { Space, Enter } from '@fluentui/keyboard-keys';\nimport * as React from 'react';\n\n/**\n * @internal\n * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys\n *\n * Useful for situations where a keydown needs to be transformed to a click event\n */\nexport function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent) {\n if (e.defaultPrevented) {\n return false;\n }\n\n const key = e.key;\n const target: HTMLElement | undefined = e.target as HTMLElement;\n\n const matchesByKey = key === Space || key === Enter;\n\n if (target?.tagName === 'A') {\n return key === Space;\n }\n\n const ignoredByTag =\n target?.tagName === 'INPUT' || target?.tagName === 'TEXTAREA' || target?.isContentEditable === true;\n\n return matchesByKey && !ignoredByTag;\n}\n"],"sourceRoot":"../src/"}
@@ -1,26 +0,0 @@
1
- define(["require", "exports", "@fluentui/keyboard-keys"], function (require, exports, keyboard_keys_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.shouldPreventDefaultOnKeyDown = void 0;
5
- /**
6
- * @internal
7
- * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
8
- *
9
- * Useful for situations where a keydown needs to be transformed to a click event
10
- */
11
- function shouldPreventDefaultOnKeyDown(e) {
12
- if (e.defaultPrevented) {
13
- return false;
14
- }
15
- var key = e.key;
16
- var target = e.target;
17
- var matchesByKey = key === keyboard_keys_1.Space || key === keyboard_keys_1.Enter;
18
- if ((target === null || target === void 0 ? void 0 : target.tagName) === 'A') {
19
- return key === keyboard_keys_1.Space;
20
- }
21
- var ignoredByTag = (target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' || (target === null || target === void 0 ? void 0 : target.tagName) === 'TEXTAREA' || (target === null || target === void 0 ? void 0 : target.isContentEditable) === true;
22
- return matchesByKey && !ignoredByTag;
23
- }
24
- exports.shouldPreventDefaultOnKeyDown = shouldPreventDefaultOnKeyDown;
25
- });
26
- //# sourceMappingURL=shouldPreventDefaultOnKeyDown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shouldPreventDefaultOnKeyDown.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":";;;;IAGA;;;;;OAKG;IACH,SAAgB,6BAA6B,CAAC,CAAsC;QAClF,IAAI,CAAC,CAAC,gBAAgB,EAAE;YACtB,OAAO,KAAK,CAAC;SACd;QAED,IAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;QAClB,IAAM,MAAM,GAA4B,CAAC,CAAC,MAAqB,CAAC;QAEhE,IAAM,YAAY,GAAG,GAAG,KAAK,qBAAK,IAAI,GAAG,KAAK,qBAAK,CAAC;QAEpD,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,MAAK,GAAG,EAAE;YAC3B,OAAO,GAAG,KAAK,qBAAK,CAAC;SACtB;QAED,IAAM,YAAY,GAChB,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,MAAK,OAAO,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,MAAK,UAAU,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB,MAAK,IAAI,CAAC;QAEtG,OAAO,YAAY,IAAI,CAAC,YAAY,CAAC;IACvC,CAAC;IAlBD,sEAkBC","sourcesContent":["import { Space, Enter } from '@fluentui/keyboard-keys';\nimport * as React from 'react';\n\n/**\n * @internal\n * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys\n *\n * Useful for situations where a keydown needs to be transformed to a click event\n */\nexport function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent) {\n if (e.defaultPrevented) {\n return false;\n }\n\n const key = e.key;\n const target: HTMLElement | undefined = e.target as HTMLElement;\n\n const matchesByKey = key === Space || key === Enter;\n\n if (target?.tagName === 'A') {\n return key === Space;\n }\n\n const ignoredByTag =\n target?.tagName === 'INPUT' || target?.tagName === 'TEXTAREA' || target?.isContentEditable === true;\n\n return matchesByKey && !ignoredByTag;\n}\n"]}
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.shouldPreventDefaultOnKeyDown = void 0;
7
-
8
- const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
9
- /**
10
- * @internal
11
- * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
12
- *
13
- * Useful for situations where a keydown needs to be transformed to a click event
14
- */
15
-
16
-
17
- function shouldPreventDefaultOnKeyDown(e) {
18
- if (e.defaultPrevented) {
19
- return false;
20
- }
21
-
22
- const key = e.key;
23
- const target = e.target;
24
- const matchesByKey = key === keyboard_keys_1.Space || key === keyboard_keys_1.Enter;
25
-
26
- if ((target === null || target === void 0 ? void 0 : target.tagName) === 'A') {
27
- return key === keyboard_keys_1.Space;
28
- }
29
-
30
- const ignoredByTag = (target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' || (target === null || target === void 0 ? void 0 : target.tagName) === 'TEXTAREA' || (target === null || target === void 0 ? void 0 : target.isContentEditable) === true;
31
- return matchesByKey && !ignoredByTag;
32
- }
33
-
34
- exports.shouldPreventDefaultOnKeyDown = shouldPreventDefaultOnKeyDown;
35
- //# sourceMappingURL=shouldPreventDefaultOnKeyDown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["packages/react-components/react-utilities/src/utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;;;AAKG;;;AACH,SAAgB,6BAAhB,CAA8C,CAA9C,EAAoF;EAClF,IAAI,CAAC,CAAC,gBAAN,EAAwB;IACtB,OAAO,KAAP;EACD;;EAED,MAAM,GAAG,GAAG,CAAC,CAAC,GAAd;EACA,MAAM,MAAM,GAA4B,CAAC,CAAC,MAA1C;EAEA,MAAM,YAAY,GAAG,GAAG,KAAK,eAAA,CAAA,KAAR,IAAiB,GAAG,KAAK,eAAA,CAAA,KAA9C;;EAEA,IAAI,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,GAAxB,EAA6B;IAC3B,OAAO,GAAG,KAAK,eAAA,CAAA,KAAf;EACD;;EAED,MAAM,YAAY,GAChB,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,OAApB,IAA+B,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,UAAnD,IAAiE,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,iBAAR,MAA8B,IADjG;EAGA,OAAO,YAAY,IAAI,CAAC,YAAxB;AACD;;AAlBD,OAAA,CAAA,6BAAA,GAAA,6BAAA","sourcesContent":["import { Space, Enter } from '@fluentui/keyboard-keys';\nimport * as React from 'react';\n\n/**\n * @internal\n * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys\n *\n * Useful for situations where a keydown needs to be transformed to a click event\n */\nexport function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent) {\n if (e.defaultPrevented) {\n return false;\n }\n\n const key = e.key;\n const target: HTMLElement | undefined = e.target as HTMLElement;\n\n const matchesByKey = key === Space || key === Enter;\n\n if (target?.tagName === 'A') {\n return key === Space;\n }\n\n const ignoredByTag =\n target?.tagName === 'INPUT' || target?.tagName === 'TEXTAREA' || target?.isContentEditable === true;\n\n return matchesByKey && !ignoredByTag;\n}\n"],"sourceRoot":"../src/"}