@fluentui/react-utilities 9.0.0-alpha.9 → 9.0.0-beta.4

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 (283) hide show
  1. package/CHANGELOG.json +1132 -1
  2. package/CHANGELOG.md +492 -2
  3. package/dist/react-utilities.d.ts +335 -67
  4. package/lib/compose/getSlots.d.ts +13 -4
  5. package/lib/compose/getSlots.js +44 -32
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.d.ts +1 -2
  8. package/lib/compose/index.js +2 -2
  9. package/lib/compose/index.js.map +1 -1
  10. package/lib/compose/nullRender.js +1 -1
  11. package/lib/compose/nullRender.js.map +1 -1
  12. package/lib/compose/resolveShorthand.d.ts +12 -0
  13. package/lib/compose/resolveShorthand.js +31 -0
  14. package/lib/compose/resolveShorthand.js.map +1 -0
  15. package/lib/compose/types.d.ts +95 -21
  16. package/lib/compose/types.js +5 -0
  17. package/lib/compose/types.js.map +1 -1
  18. package/lib/hooks/index.d.ts +9 -1
  19. package/lib/hooks/index.js +9 -1
  20. package/lib/hooks/index.js.map +1 -1
  21. package/lib/hooks/useBoolean.d.ts +2 -2
  22. package/lib/hooks/useBoolean.js +16 -11
  23. package/lib/hooks/useBoolean.js.map +1 -1
  24. package/lib/hooks/useConst.js +15 -12
  25. package/lib/hooks/useConst.js.map +1 -1
  26. package/lib/hooks/useControllableState.d.ts +21 -0
  27. package/lib/hooks/useControllableState.js +68 -0
  28. package/lib/hooks/useControllableState.js.map +1 -0
  29. package/lib/hooks/useControllableValue.js +47 -50
  30. package/lib/hooks/useControllableValue.js.map +1 -1
  31. package/lib/hooks/useEventCallback.d.ts +2 -2
  32. package/lib/hooks/useEventCallback.js +14 -17
  33. package/lib/hooks/useEventCallback.js.map +1 -1
  34. package/lib/hooks/useFirstMount.d.ts +11 -0
  35. package/lib/hooks/useFirstMount.js +23 -0
  36. package/lib/hooks/useFirstMount.js.map +1 -0
  37. package/lib/hooks/useForceUpdate.d.ts +4 -0
  38. package/lib/hooks/useForceUpdate.js +9 -0
  39. package/lib/hooks/useForceUpdate.js.map +1 -0
  40. package/lib/hooks/useId.d.ts +7 -3
  41. package/lib/hooks/useId.js +13 -17
  42. package/lib/hooks/useId.js.map +1 -1
  43. package/lib/hooks/useIsomorphicLayoutEffect.d.ts +9 -0
  44. package/lib/hooks/useIsomorphicLayoutEffect.js +13 -4
  45. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  46. package/lib/hooks/useMergedRefs.js +16 -20
  47. package/lib/hooks/useMergedRefs.js.map +1 -1
  48. package/lib/hooks/useMount.d.ts +6 -0
  49. package/lib/hooks/useMount.js +17 -0
  50. package/lib/hooks/useMount.js.map +1 -0
  51. package/lib/hooks/useOnClickOutside.d.ts +14 -4
  52. package/lib/hooks/useOnClickOutside.js +129 -18
  53. package/lib/hooks/useOnClickOutside.js.map +1 -1
  54. package/lib/hooks/useOnScrollOutside.d.ts +5 -0
  55. package/lib/hooks/useOnScrollOutside.js +36 -0
  56. package/lib/hooks/useOnScrollOutside.js.map +1 -0
  57. package/lib/hooks/usePrevious.d.ts +1 -0
  58. package/lib/hooks/usePrevious.js +9 -0
  59. package/lib/hooks/usePrevious.js.map +1 -0
  60. package/lib/hooks/useTimeout.d.ts +8 -0
  61. package/lib/hooks/useTimeout.js +29 -0
  62. package/lib/hooks/useTimeout.js.map +1 -0
  63. package/lib/hooks/useUnmount.d.ts +6 -0
  64. package/lib/hooks/useUnmount.js +17 -0
  65. package/lib/hooks/useUnmount.js.map +1 -0
  66. package/lib/index.d.ts +1 -0
  67. package/lib/index.js +1 -0
  68. package/lib/index.js.map +1 -1
  69. package/lib/ssr/SSRContext.d.ts +33 -0
  70. package/lib/ssr/SSRContext.js +65 -0
  71. package/lib/ssr/SSRContext.js.map +1 -0
  72. package/lib/ssr/canUseDOM.d.ts +4 -0
  73. package/lib/ssr/canUseDOM.js +8 -0
  74. package/lib/ssr/canUseDOM.js.map +1 -0
  75. package/lib/ssr/index.d.ts +2 -0
  76. package/lib/ssr/index.js +3 -0
  77. package/lib/ssr/index.js.map +1 -0
  78. package/lib/tsdoc-metadata.json +1 -1
  79. package/lib/utils/applyTriggerPropsToChildren.d.ts +5 -0
  80. package/lib/utils/applyTriggerPropsToChildren.js +16 -0
  81. package/lib/utils/applyTriggerPropsToChildren.js.map +1 -0
  82. package/lib/utils/clamp.d.ts +8 -0
  83. package/lib/utils/clamp.js +9 -0
  84. package/lib/utils/clamp.js.map +1 -0
  85. package/lib/utils/getNativeElementProps.d.ts +22 -0
  86. package/lib/utils/getNativeElementProps.js +48 -24
  87. package/lib/utils/getNativeElementProps.js.map +1 -1
  88. package/lib/utils/getRTLSafeKey.d.ts +4 -0
  89. package/lib/utils/getRTLSafeKey.js +21 -0
  90. package/lib/utils/getRTLSafeKey.js.map +1 -0
  91. package/lib/utils/index.d.ts +5 -0
  92. package/lib/utils/index.js +5 -0
  93. package/lib/utils/index.js.map +1 -1
  94. package/lib/utils/omit.d.ts +1 -1
  95. package/lib/utils/omit.js +9 -7
  96. package/lib/utils/omit.js.map +1 -1
  97. package/lib/utils/onlyChild.d.ts +5 -0
  98. package/lib/utils/onlyChild.js +13 -0
  99. package/lib/utils/onlyChild.js.map +1 -0
  100. package/lib/utils/properties.js +80 -282
  101. package/lib/utils/properties.js.map +1 -1
  102. package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
  103. package/lib/utils/shouldPreventDefaultOnKeyDown.js +20 -0
  104. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
  105. package/lib-commonjs/compose/getSlots.d.ts +13 -4
  106. package/lib-commonjs/compose/getSlots.js +57 -35
  107. package/lib-commonjs/compose/getSlots.js.map +1 -1
  108. package/lib-commonjs/compose/index.d.ts +1 -2
  109. package/lib-commonjs/compose/index.js +12 -4
  110. package/lib-commonjs/compose/index.js.map +1 -1
  111. package/lib-commonjs/compose/nullRender.js +9 -2
  112. package/lib-commonjs/compose/nullRender.js.map +1 -1
  113. package/lib-commonjs/compose/resolveShorthand.d.ts +12 -0
  114. package/lib-commonjs/compose/resolveShorthand.js +41 -0
  115. package/lib-commonjs/compose/resolveShorthand.js.map +1 -0
  116. package/lib-commonjs/compose/types.d.ts +95 -21
  117. package/lib-commonjs/compose/types.js +8 -1
  118. package/lib-commonjs/compose/types.js.map +1 -1
  119. package/lib-commonjs/hooks/index.d.ts +9 -1
  120. package/lib-commonjs/hooks/index.js +31 -4
  121. package/lib-commonjs/hooks/index.js.map +1 -1
  122. package/lib-commonjs/hooks/useBoolean.d.ts +2 -2
  123. package/lib-commonjs/hooks/useBoolean.js +27 -14
  124. package/lib-commonjs/hooks/useBoolean.js.map +1 -1
  125. package/lib-commonjs/hooks/useConst.js +24 -14
  126. package/lib-commonjs/hooks/useConst.js.map +1 -1
  127. package/lib-commonjs/hooks/useControllableState.d.ts +21 -0
  128. package/lib-commonjs/hooks/useControllableState.js +78 -0
  129. package/lib-commonjs/hooks/useControllableState.js.map +1 -0
  130. package/lib-commonjs/hooks/useControllableValue.js +58 -53
  131. package/lib-commonjs/hooks/useControllableValue.js.map +1 -1
  132. package/lib-commonjs/hooks/useEventCallback.d.ts +2 -2
  133. package/lib-commonjs/hooks/useEventCallback.js +26 -20
  134. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  135. package/lib-commonjs/hooks/useFirstMount.d.ts +11 -0
  136. package/lib-commonjs/hooks/useFirstMount.js +33 -0
  137. package/lib-commonjs/hooks/useFirstMount.js.map +1 -0
  138. package/lib-commonjs/hooks/useForceUpdate.d.ts +4 -0
  139. package/lib-commonjs/hooks/useForceUpdate.js +19 -0
  140. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -0
  141. package/lib-commonjs/hooks/useId.d.ts +7 -3
  142. package/lib-commonjs/hooks/useId.js +25 -21
  143. package/lib-commonjs/hooks/useId.js.map +1 -1
  144. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +9 -0
  145. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +22 -6
  146. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  147. package/lib-commonjs/hooks/useMergedRefs.js +25 -22
  148. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  149. package/lib-commonjs/hooks/useMount.d.ts +6 -0
  150. package/lib-commonjs/hooks/useMount.js +27 -0
  151. package/lib-commonjs/hooks/useMount.js.map +1 -0
  152. package/lib-commonjs/hooks/useOnClickOutside.d.ts +14 -4
  153. package/lib-commonjs/hooks/useOnClickOutside.js +141 -21
  154. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  155. package/lib-commonjs/hooks/useOnScrollOutside.d.ts +5 -0
  156. package/lib-commonjs/hooks/useOnScrollOutside.js +47 -0
  157. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -0
  158. package/lib-commonjs/hooks/usePrevious.d.ts +1 -0
  159. package/lib-commonjs/hooks/usePrevious.js +19 -0
  160. package/lib-commonjs/hooks/usePrevious.js.map +1 -0
  161. package/lib-commonjs/hooks/useTimeout.d.ts +8 -0
  162. package/lib-commonjs/hooks/useTimeout.js +40 -0
  163. package/lib-commonjs/hooks/useTimeout.js.map +1 -0
  164. package/lib-commonjs/hooks/useUnmount.d.ts +6 -0
  165. package/lib-commonjs/hooks/useUnmount.js +27 -0
  166. package/lib-commonjs/hooks/useUnmount.js.map +1 -0
  167. package/lib-commonjs/index.d.ts +1 -0
  168. package/lib-commonjs/index.js +11 -2
  169. package/lib-commonjs/index.js.map +1 -1
  170. package/lib-commonjs/ssr/SSRContext.d.ts +33 -0
  171. package/lib-commonjs/ssr/SSRContext.js +80 -0
  172. package/lib-commonjs/ssr/SSRContext.js.map +1 -0
  173. package/lib-commonjs/ssr/canUseDOM.d.ts +4 -0
  174. package/lib-commonjs/ssr/canUseDOM.js +17 -0
  175. package/lib-commonjs/ssr/canUseDOM.js.map +1 -0
  176. package/lib-commonjs/ssr/index.d.ts +2 -0
  177. package/lib-commonjs/ssr/index.js +12 -0
  178. package/lib-commonjs/ssr/index.js.map +1 -0
  179. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +5 -0
  180. package/lib-commonjs/utils/applyTriggerPropsToChildren.js +27 -0
  181. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -0
  182. package/lib-commonjs/utils/clamp.d.ts +8 -0
  183. package/lib-commonjs/utils/clamp.js +18 -0
  184. package/lib-commonjs/utils/clamp.js.map +1 -0
  185. package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
  186. package/lib-commonjs/utils/getNativeElementProps.js +58 -25
  187. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  188. package/lib-commonjs/utils/getRTLSafeKey.d.ts +4 -0
  189. package/lib-commonjs/utils/getRTLSafeKey.js +30 -0
  190. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -0
  191. package/lib-commonjs/utils/index.d.ts +5 -0
  192. package/lib-commonjs/utils/index.js +19 -2
  193. package/lib-commonjs/utils/index.js.map +1 -1
  194. package/lib-commonjs/utils/omit.d.ts +1 -1
  195. package/lib-commonjs/utils/omit.js +16 -8
  196. package/lib-commonjs/utils/omit.js.map +1 -1
  197. package/lib-commonjs/utils/onlyChild.d.ts +5 -0
  198. package/lib-commonjs/utils/onlyChild.js +23 -0
  199. package/lib-commonjs/utils/onlyChild.js.map +1 -0
  200. package/lib-commonjs/utils/properties.js +84 -280
  201. package/lib-commonjs/utils/properties.js.map +1 -1
  202. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +7 -0
  203. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +30 -0
  204. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -0
  205. package/package.json +11 -9
  206. package/NOTICE.txt +0 -0
  207. package/config/api-extractor.json +0 -3
  208. package/config/tests.js +0 -7
  209. package/etc/react-utilities.api.md +0 -207
  210. package/just.config.ts +0 -3
  211. package/lib/compose/makeMergeProps.d.ts +0 -15
  212. package/lib/compose/makeMergeProps.js +0 -96
  213. package/lib/compose/makeMergeProps.js.map +0 -1
  214. package/lib/compose/resolveShorthandProps.d.ts +0 -7
  215. package/lib/compose/resolveShorthandProps.js +0 -27
  216. package/lib/compose/resolveShorthandProps.js.map +0 -1
  217. package/lib-amd/compose/getSlots.d.ts +0 -20
  218. package/lib-amd/compose/getSlots.js +0 -51
  219. package/lib-amd/compose/getSlots.js.map +0 -1
  220. package/lib-amd/compose/index.d.ts +0 -5
  221. package/lib-amd/compose/index.js +0 -9
  222. package/lib-amd/compose/index.js.map +0 -1
  223. package/lib-amd/compose/makeMergeProps.d.ts +0 -15
  224. package/lib-amd/compose/makeMergeProps.js +0 -98
  225. package/lib-amd/compose/makeMergeProps.js.map +0 -1
  226. package/lib-amd/compose/nullRender.d.ts +0 -4
  227. package/lib-amd/compose/nullRender.js +0 -9
  228. package/lib-amd/compose/nullRender.js.map +0 -1
  229. package/lib-amd/compose/resolveShorthandProps.d.ts +0 -7
  230. package/lib-amd/compose/resolveShorthandProps.js +0 -29
  231. package/lib-amd/compose/resolveShorthandProps.js.map +0 -1
  232. package/lib-amd/compose/types.d.ts +0 -29
  233. package/lib-amd/compose/types.js +0 -5
  234. package/lib-amd/compose/types.js.map +0 -1
  235. package/lib-amd/hooks/index.d.ts +0 -8
  236. package/lib-amd/hooks/index.js +0 -13
  237. package/lib-amd/hooks/index.js.map +0 -1
  238. package/lib-amd/hooks/useBoolean.d.ts +0 -17
  239. package/lib-amd/hooks/useBoolean.js +0 -26
  240. package/lib-amd/hooks/useBoolean.js.map +0 -1
  241. package/lib-amd/hooks/useConst.d.ts +0 -12
  242. package/lib-amd/hooks/useConst.js +0 -31
  243. package/lib-amd/hooks/useConst.js.map +0 -1
  244. package/lib-amd/hooks/useControllableValue.d.ts +0 -20
  245. package/lib-amd/hooks/useControllableValue.js +0 -42
  246. package/lib-amd/hooks/useControllableValue.js.map +0 -1
  247. package/lib-amd/hooks/useEventCallback.d.ts +0 -13
  248. package/lib-amd/hooks/useEventCallback.js +0 -33
  249. package/lib-amd/hooks/useEventCallback.js.map +0 -1
  250. package/lib-amd/hooks/useId.d.ts +0 -11
  251. package/lib-amd/hooks/useId.js +0 -35
  252. package/lib-amd/hooks/useId.js.map +0 -1
  253. package/lib-amd/hooks/useIsomorphicLayoutEffect.d.ts +0 -2
  254. package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -9
  255. package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
  256. package/lib-amd/hooks/useMergedRefs.d.ts +0 -13
  257. package/lib-amd/hooks/useMergedRefs.js +0 -33
  258. package/lib-amd/hooks/useMergedRefs.js.map +0 -1
  259. package/lib-amd/hooks/useOnClickOutside.d.ts +0 -19
  260. package/lib-amd/hooks/useOnClickOutside.js +0 -27
  261. package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
  262. package/lib-amd/index.d.ts +0 -3
  263. package/lib-amd/index.js +0 -8
  264. package/lib-amd/index.js.map +0 -1
  265. package/lib-amd/utils/getNativeElementProps.d.ts +0 -9
  266. package/lib-amd/utils/getNativeElementProps.js +0 -40
  267. package/lib-amd/utils/getNativeElementProps.js.map +0 -1
  268. package/lib-amd/utils/index.d.ts +0 -3
  269. package/lib-amd/utils/index.js +0 -8
  270. package/lib-amd/utils/index.js.map +0 -1
  271. package/lib-amd/utils/omit.d.ts +0 -14
  272. package/lib-amd/utils/omit.js +0 -30
  273. package/lib-amd/utils/omit.js.map +0 -1
  274. package/lib-amd/utils/properties.d.ts +0 -148
  275. package/lib-amd/utils/properties.js +0 -416
  276. package/lib-amd/utils/properties.js.map +0 -1
  277. package/lib-commonjs/compose/makeMergeProps.d.ts +0 -15
  278. package/lib-commonjs/compose/makeMergeProps.js +0 -98
  279. package/lib-commonjs/compose/makeMergeProps.js.map +0 -1
  280. package/lib-commonjs/compose/resolveShorthandProps.d.ts +0 -7
  281. package/lib-commonjs/compose/resolveShorthandProps.js +0 -29
  282. package/lib-commonjs/compose/resolveShorthandProps.js.map +0 -1
  283. package/src/compose/README.md +0 -279
@@ -1,372 +1,172 @@
1
- var toObjectMap = function () {
2
- var items = [];
3
- for (var _i = 0; _i < arguments.length; _i++) {
4
- items[_i] = arguments[_i];
5
- }
6
- var result = {};
7
- for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {
8
- var item = items_1[_a];
9
- var keys = Array.isArray(item) ? item : Object.keys(item);
10
- for (var _b = 0, keys_1 = keys; _b < keys_1.length; _b++) {
11
- var key = keys_1[_b];
12
- result[key] = 1;
13
- }
1
+ const toObjectMap = (...items) => {
2
+ const result = {};
3
+
4
+ for (const item of items) {
5
+ const keys = Array.isArray(item) ? item : Object.keys(item);
6
+
7
+ for (const key of keys) {
8
+ result[key] = 1;
14
9
  }
15
- return result;
10
+ }
11
+
12
+ return result;
16
13
  };
17
14
  /**
18
15
  * An array of events that are allowed on every html element type.
19
16
  *
20
17
  * @public
21
18
  */
22
- export var baseElementEvents = toObjectMap([
23
- 'onCopy',
24
- 'onCut',
25
- 'onPaste',
26
- 'onCompositionEnd',
27
- 'onCompositionStart',
28
- 'onCompositionUpdate',
29
- 'onFocus',
30
- 'onFocusCapture',
31
- 'onBlur',
32
- 'onBlurCapture',
33
- 'onChange',
34
- 'onInput',
35
- 'onSubmit',
36
- 'onLoad',
37
- 'onError',
38
- 'onKeyDown',
39
- 'onKeyDownCapture',
40
- 'onKeyPress',
41
- 'onKeyUp',
42
- 'onAbort',
43
- 'onCanPlay',
44
- 'onCanPlayThrough',
45
- 'onDurationChange',
46
- 'onEmptied',
47
- 'onEncrypted',
48
- 'onEnded',
49
- 'onLoadedData',
50
- 'onLoadedMetadata',
51
- 'onLoadStart',
52
- 'onPause',
53
- 'onPlay',
54
- 'onPlaying',
55
- 'onProgress',
56
- 'onRateChange',
57
- 'onSeeked',
58
- 'onSeeking',
59
- 'onStalled',
60
- 'onSuspend',
61
- 'onTimeUpdate',
62
- 'onVolumeChange',
63
- 'onWaiting',
64
- 'onClick',
65
- 'onClickCapture',
66
- 'onContextMenu',
67
- 'onDoubleClick',
68
- 'onDrag',
69
- 'onDragEnd',
70
- 'onDragEnter',
71
- 'onDragExit',
72
- 'onDragLeave',
73
- 'onDragOver',
74
- 'onDragStart',
75
- 'onDrop',
76
- 'onMouseDown',
77
- 'onMouseDownCapture',
78
- 'onMouseEnter',
79
- 'onMouseLeave',
80
- 'onMouseMove',
81
- 'onMouseOut',
82
- 'onMouseOver',
83
- 'onMouseUp',
84
- 'onMouseUpCapture',
85
- 'onSelect',
86
- 'onTouchCancel',
87
- 'onTouchEnd',
88
- 'onTouchMove',
89
- 'onTouchStart',
90
- 'onScroll',
91
- 'onWheel',
92
- 'onPointerCancel',
93
- 'onPointerDown',
94
- 'onPointerEnter',
95
- 'onPointerLeave',
96
- 'onPointerMove',
97
- 'onPointerOut',
98
- 'onPointerOver',
99
- 'onPointerUp',
100
- 'onGotPointerCapture',
101
- 'onLostPointerCapture',
102
- ]);
19
+
20
+
21
+ export const baseElementEvents = /*#__PURE__*/toObjectMap(['onAuxClick', 'onCopy', 'onCut', 'onPaste', 'onCompositionEnd', 'onCompositionStart', 'onCompositionUpdate', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onInput', 'onSubmit', 'onLoad', 'onError', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyUp', 'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onClick', 'onClickCapture', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'onScroll', 'onWheel', 'onPointerCancel', 'onPointerDown', 'onPointerEnter', 'onPointerLeave', 'onPointerMove', 'onPointerOut', 'onPointerOver', 'onPointerUp', 'onGotPointerCapture', 'onLostPointerCapture']);
103
22
  /**
104
23
  * An array of element attributes which are allowed on every html element type.
105
24
  *
106
25
  * @public
107
26
  */
108
- export var baseElementProperties = toObjectMap([
109
- 'accessKey',
110
- 'children',
111
- 'className',
112
- 'contentEditable',
113
- 'dir',
114
- 'draggable',
115
- 'hidden',
116
- 'htmlFor',
117
- 'id',
118
- 'lang',
119
- 'ref',
120
- 'role',
121
- 'style',
122
- 'tabIndex',
123
- 'title',
124
- 'translate',
125
- 'spellCheck',
126
- 'name',
127
- ]);
27
+
28
+ export const baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name']);
128
29
  /**
129
30
  * An array of HTML element properties and events.
130
31
  *
131
32
  * @public
132
33
  */
133
- export var htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents);
34
+
35
+ export const htmlElementProperties = /*#__PURE__*/toObjectMap(baseElementProperties, baseElementEvents);
134
36
  /**
135
37
  * An array of LABEL tag properties and events.
136
38
  *
137
39
  * @public
138
40
  */
139
- export var labelProperties = toObjectMap(htmlElementProperties, [
140
- 'form',
141
- ]);
41
+
42
+ export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['form']);
142
43
  /**
143
44
  * An array of AUDIO tag properties and events.
144
45
 
145
46
  * @public
146
47
  */
147
- export var audioProperties = toObjectMap(htmlElementProperties, [
148
- 'height',
149
- 'loop',
150
- 'muted',
151
- 'preload',
152
- 'src',
153
- 'width',
154
- ]);
48
+
49
+ export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width']);
155
50
  /**
156
51
  * An array of VIDEO tag properties and events.
157
52
  *
158
53
  * @public
159
54
  */
160
- export var videoProperties = toObjectMap(audioProperties, [
161
- 'poster',
162
- ]);
55
+
56
+ export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ['poster']);
163
57
  /**
164
58
  * An array of OL tag properties and events.
165
59
  *
166
60
  * @public
167
61
  */
168
- export var olProperties = toObjectMap(htmlElementProperties, [
169
- 'start',
170
- ]);
62
+
63
+ export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['start']);
171
64
  /**
172
65
  * An array of LI tag properties and events.
173
66
  *
174
67
  * @public
175
68
  */
176
- export var liProperties = toObjectMap(htmlElementProperties, [
177
- 'value',
178
- ]);
69
+
70
+ export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['value']);
179
71
  /**
180
72
  * An array of A tag properties and events.
181
73
  *
182
74
  * @public
183
75
  */
184
- export var anchorProperties = toObjectMap(htmlElementProperties, [
185
- 'download',
186
- 'href',
187
- 'hrefLang',
188
- 'media',
189
- 'rel',
190
- 'target',
191
- 'type',
192
- ]);
76
+
77
+ export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type']);
193
78
  /**
194
79
  * An array of BUTTON tag properties and events.
195
80
  *
196
81
  * @public
197
82
  */
198
- export var buttonProperties = toObjectMap(htmlElementProperties, [
199
- 'autoFocus',
200
- 'disabled',
201
- 'form',
202
- 'formAction',
203
- 'formEncType',
204
- 'formMethod',
205
- 'formNoValidate',
206
- 'formTarget',
207
- 'type',
208
- 'value',
209
- ]);
83
+
84
+ export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value']);
210
85
  /**
211
86
  * An array of INPUT tag properties and events.
212
87
  *
213
88
  * @public
214
89
  */
215
- export var inputProperties = toObjectMap(buttonProperties, [
216
- 'accept',
217
- 'alt',
218
- 'autoCapitalize',
219
- 'autoComplete',
220
- 'checked',
221
- 'dirname',
222
- 'form',
223
- 'height',
224
- 'inputMode',
225
- 'list',
226
- 'max',
227
- 'maxLength',
228
- 'min',
229
- 'multiple',
230
- 'pattern',
231
- 'placeholder',
232
- 'readOnly',
233
- 'required',
234
- 'src',
235
- 'step',
236
- 'size',
237
- 'type',
238
- 'value',
239
- 'width',
240
- ]);
90
+
91
+ export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width']);
241
92
  /**
242
93
  * An array of TEXTAREA tag properties and events.
243
94
  *
244
95
  * @public
245
96
  */
246
- export var textAreaProperties = toObjectMap(buttonProperties, [
247
- 'autoCapitalize',
248
- 'cols',
249
- 'dirname',
250
- 'form',
251
- 'maxLength',
252
- 'placeholder',
253
- 'readOnly',
254
- 'required',
255
- 'rows',
256
- 'wrap',
257
- ]);
97
+
98
+ export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap']);
258
99
  /**
259
100
  * An array of SELECT tag properties and events.
260
101
  *
261
102
  * @public
262
103
  */
263
- export var selectProperties = toObjectMap(buttonProperties, [
264
- 'form',
265
- 'multiple',
266
- 'required',
267
- ]);
268
- export var optionProperties = toObjectMap(htmlElementProperties, [
269
- 'selected',
270
- 'value',
271
- ]);
104
+
105
+ export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ['form', 'multiple', 'required']);
106
+ export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value']);
272
107
  /**
273
108
  * An array of TABLE tag properties and events.
274
109
  *
275
110
  * @public
276
111
  */
277
- export var tableProperties = toObjectMap(htmlElementProperties, [
278
- 'cellPadding',
279
- 'cellSpacing',
280
- ]);
112
+
113
+ export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['cellPadding', 'cellSpacing']);
281
114
  /**
282
115
  * An array of TR tag properties and events.
283
116
  *
284
117
  * @public
285
118
  */
286
- export var trProperties = htmlElementProperties;
119
+
120
+ export const trProperties = htmlElementProperties;
287
121
  /**
288
122
  * An array of TH tag properties and events.
289
123
  *
290
124
  * @public
291
125
  */
292
- export var thProperties = toObjectMap(htmlElementProperties, [
293
- 'rowSpan',
294
- 'scope',
295
- ]);
126
+
127
+ export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['rowSpan', 'scope']);
296
128
  /**
297
129
  * An array of TD tag properties and events.
298
130
  *
299
131
  * @public
300
132
  */
301
- export var tdProperties = toObjectMap(htmlElementProperties, [
302
- 'colSpan',
303
- 'headers',
304
- 'rowSpan',
305
- 'scope',
306
- ]);
307
- export var colGroupProperties = toObjectMap(htmlElementProperties, [
308
- 'span',
309
- ]);
310
- export var colProperties = toObjectMap(htmlElementProperties, [
311
- 'span',
312
- ]);
133
+
134
+ export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope']);
135
+ export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
136
+ export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span']);
313
137
  /**
314
138
  * An array of FORM tag properties and events.
315
139
  *
316
140
  * @public
317
141
  */
318
- export var formProperties = toObjectMap(htmlElementProperties, [
319
- 'acceptCharset',
320
- 'action',
321
- 'encType',
322
- 'encType',
323
- 'method',
324
- 'noValidate',
325
- 'target',
326
- ]);
142
+
143
+ export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target']);
327
144
  /**
328
145
  * An array of IFRAME tag properties and events.
329
146
  *
330
147
  * @public
331
148
  */
332
- export var iframeProperties = toObjectMap(htmlElementProperties, [
333
- 'allow',
334
- 'allowFullScreen',
335
- 'allowPaymentRequest',
336
- 'allowTransparency',
337
- 'csp',
338
- 'height',
339
- 'importance',
340
- 'referrerPolicy',
341
- 'sandbox',
342
- 'src',
343
- 'srcDoc',
344
- 'width',
345
- ]);
149
+
150
+ export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width']);
346
151
  /**
347
152
  * An array of IMAGE tag properties and events.
348
153
  *
349
154
  * @public
350
155
  */
351
- export var imgProperties = toObjectMap(htmlElementProperties, [
352
- 'alt',
353
- 'crossOrigin',
354
- 'height',
355
- 'src',
356
- 'srcSet',
357
- 'useMap',
358
- 'width',
359
- ]);
156
+
157
+ export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width']);
360
158
  /**
361
159
  * @deprecated Use imgProperties for img elements.
362
160
  */
363
- export var imageProperties = imgProperties;
161
+
162
+ export const imageProperties = imgProperties;
364
163
  /**
365
164
  * An array of DIV tag properties and events.
366
165
  *
367
166
  * @public
368
167
  */
369
- export var divProperties = htmlElementProperties;
168
+
169
+ export const divProperties = htmlElementProperties;
370
170
  /**
371
171
  * Gets native supported props for an html element provided the allowance set. Use one of the property
372
172
  * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
@@ -382,30 +182,28 @@ export var divProperties = htmlElementProperties;
382
182
  * @returns The filtered props
383
183
  */
384
184
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
385
- export function getNativeProps(
386
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
185
+
186
+ export function getNativeProps( // eslint-disable-next-line @typescript-eslint/no-explicit-any
387
187
  props, allowedPropNames, excludedPropNames) {
388
- // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
389
- // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
390
- // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
391
- // return native props.
392
- // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
393
- var _a;
394
- var isArray = Array.isArray(allowedPropNames);
395
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
396
- var result = {};
397
- var keys = Object.keys(props);
398
- for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
399
- var key = keys_2[_i];
400
- var isNativeProp = (!isArray && allowedPropNames[key]) ||
401
- (isArray && allowedPropNames.indexOf(key) >= 0) ||
402
- key.indexOf('data-') === 0 ||
403
- key.indexOf('aria-') === 0;
404
- if (isNativeProp && (!excludedPropNames || ((_a = excludedPropNames) === null || _a === void 0 ? void 0 : _a.indexOf(key)) === -1)) {
405
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
406
- result[key] = props[key];
407
- }
188
+ // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
189
+ // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
190
+ // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
191
+ // return native props.
192
+ // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
193
+ const isArray = Array.isArray(allowedPropNames); // eslint-disable-next-line @typescript-eslint/no-explicit-any
194
+
195
+ const result = {};
196
+ const keys = Object.keys(props);
197
+
198
+ for (const key of keys) {
199
+ const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
200
+
201
+ if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
202
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
203
+ result[key] = props[key];
408
204
  }
409
- return result;
205
+ }
206
+
207
+ return result;
410
208
  }
411
209
  //# sourceMappingURL=properties.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"properties.js","sourceRoot":"../src/","sources":["utils/properties.ts"],"names":[],"mappings":"AAAA,IAAM,WAAW,GAAG;IAAC,eAA+C;SAA/C,UAA+C,EAA/C,qBAA+C,EAA/C,IAA+C;QAA/C,0BAA+C;;IAClE,IAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;QAArB,IAAM,IAAI,cAAA;QACb,IAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5D,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAnB,IAAM,GAAG,aAAA;YACZ,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACjB;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAG,WAAW,CAAC;IAC3C,QAAQ;IACR,OAAO;IACP,SAAS;IACT,kBAAkB;IAClB,oBAAoB;IACpB,qBAAqB;IACrB,SAAS;IACT,gBAAgB;IAChB,QAAQ;IACR,eAAe;IACf,UAAU;IACV,SAAS;IACT,UAAU;IACV,QAAQ;IACR,SAAS;IACT,WAAW;IACX,kBAAkB;IAClB,YAAY;IACZ,SAAS;IACT,SAAS;IACT,WAAW;IACX,kBAAkB;IAClB,kBAAkB;IAClB,WAAW;IACX,aAAa;IACb,SAAS;IACT,cAAc;IACd,kBAAkB;IAClB,aAAa;IACb,SAAS;IACT,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,cAAc;IACd,UAAU;IACV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C,EAAE;YAClF,8DAA8D;YAC9D,MAAM,CAAC,GAAG,CAAC,GAAG,KAAM,CAAC,GAAG,CAAQ,CAAC;SAClC;KACF;IAED,OAAO,MAAW,CAAC;AACrB,CAAC","sourcesContent":["const toObjectMap = (...items: (string[] | Record<string, number>)[]) => {\n const result: Record<string, number> = {};\n\n for (const item of items) {\n const keys = Array.isArray(item) ? item : Object.keys(item);\n\n for (const key of keys) {\n result[key] = 1;\n }\n }\n\n return result;\n};\n\n/**\n * An array of events that are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementEvents = toObjectMap([\n 'onCopy',\n 'onCut',\n 'onPaste',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onFocus',\n 'onFocusCapture',\n 'onBlur',\n 'onBlurCapture',\n 'onChange',\n 'onInput',\n 'onSubmit',\n 'onLoad',\n 'onError',\n 'onKeyDown',\n 'onKeyDownCapture',\n 'onKeyPress',\n 'onKeyUp',\n 'onAbort',\n 'onCanPlay',\n 'onCanPlayThrough',\n 'onDurationChange',\n 'onEmptied',\n 'onEncrypted',\n 'onEnded',\n 'onLoadedData',\n 'onLoadedMetadata',\n 'onLoadStart',\n 'onPause',\n 'onPlay',\n 'onPlaying',\n 'onProgress',\n 'onRateChange',\n 'onSeeked',\n 'onSeeking',\n 'onStalled',\n 'onSuspend',\n 'onTimeUpdate',\n 'onVolumeChange',\n 'onWaiting',\n 'onClick',\n 'onClickCapture',\n 'onContextMenu',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragExit',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onMouseDown',\n 'onMouseDownCapture',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onMouseUpCapture',\n 'onSelect',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onScroll',\n 'onWheel',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onGotPointerCapture',\n 'onLostPointerCapture',\n]);\n\n/**\n * An array of element attributes which are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementProperties = toObjectMap([\n 'accessKey', // global\n 'children', // global\n 'className', // global\n 'contentEditable', // global\n 'dir', // global\n 'draggable', // global\n 'hidden', // global\n 'htmlFor', // global\n 'id', // global\n 'lang', // global\n 'ref', // global\n 'role', // global\n 'style', // global\n 'tabIndex', // global\n 'title', // global\n 'translate', // global\n 'spellCheck', // global\n 'name', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents);\n\n/**\n * An array of LABEL tag properties and events.\n *\n * @public\n */\nexport const labelProperties = toObjectMap(htmlElementProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of AUDIO tag properties and events.\n\n * @public\n */\nexport const audioProperties = toObjectMap(htmlElementProperties, [\n 'height', // canvas, embed, iframe, img, input, object, video\n 'loop', // audio, video\n 'muted', // audio, video\n 'preload', // audio, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of VIDEO tag properties and events.\n *\n * @public\n */\nexport const videoProperties = toObjectMap(audioProperties, [\n 'poster', // video\n]);\n\n/**\n * An array of OL tag properties and events.\n *\n * @public\n */\nexport const olProperties = toObjectMap(htmlElementProperties, [\n 'start', // ol\n]);\n\n/**\n * An array of LI tag properties and events.\n *\n * @public\n */\nexport const liProperties = toObjectMap(htmlElementProperties, [\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of A tag properties and events.\n *\n * @public\n */\nexport const anchorProperties = toObjectMap(htmlElementProperties, [\n 'download', // a, area\n 'href', // a, area, base, link\n 'hrefLang', // a, area, link\n 'media', // a, area, link, source, style\n 'rel', // a, area, link\n 'target', // a, area, base, form\n 'type', // a, button, input, link, menu, object, script, source, style\n]);\n\n/**\n * An array of BUTTON tag properties and events.\n *\n * @public\n */\nexport const buttonProperties = toObjectMap(htmlElementProperties, [\n 'autoFocus', // button, input, select, textarea\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'formAction', // input, button\n 'formEncType', // input, button\n 'formMethod', // input, button\n 'formNoValidate', // input, button\n 'formTarget', // input, button\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param,\n]);\n\n/**\n * An array of INPUT tag properties and events.\n *\n * @public\n */\nexport const inputProperties = toObjectMap(buttonProperties, [\n 'accept', // input\n 'alt', // area, img, input\n 'autoCapitalize', // input, textarea\n 'autoComplete', // form, input\n 'checked', // input\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'height', // canvas, embed, iframe, img, input, object, video\n 'inputMode', // input\n 'list', // input\n 'max', // input, meter\n 'maxLength', // input, textarea\n 'min', // input, meter\n 'multiple', // input, select\n 'pattern', // input\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'step', // input\n 'size', // input\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of TEXTAREA tag properties and events.\n *\n * @public\n */\nexport const textAreaProperties = toObjectMap(buttonProperties, [\n 'autoCapitalize', // input, textarea\n 'cols', // textarea\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'maxLength', // input, textarea\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'rows', // textarea\n 'wrap', // textarea\n]);\n\n/**\n * An array of SELECT tag properties and events.\n *\n * @public\n */\nexport const selectProperties = toObjectMap(buttonProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'multiple', // input, select\n 'required', // input, select, textarea\n]);\n\nexport const optionProperties = toObjectMap(htmlElementProperties, [\n 'selected', // option\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of TABLE tag properties and events.\n *\n * @public\n */\nexport const tableProperties = toObjectMap(htmlElementProperties, [\n 'cellPadding', // table\n 'cellSpacing', // table\n]);\n\n/**\n * An array of TR tag properties and events.\n *\n * @public\n */\nexport const trProperties = htmlElementProperties;\n\n/**\n * An array of TH tag properties and events.\n *\n * @public\n */\nexport const thProperties = toObjectMap(htmlElementProperties, [\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\n/**\n * An array of TD tag properties and events.\n *\n * @public\n */\nexport const tdProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td\n 'headers', // td\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\nexport const colGroupProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\nexport const colProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\n/**\n * An array of FORM tag properties and events.\n *\n * @public\n */\nexport const formProperties = toObjectMap(htmlElementProperties, [\n 'acceptCharset', // form\n 'action', // form\n 'encType', // form\n 'encType', // form\n 'method', // form\n 'noValidate', // form\n 'target', // form\n]);\n\n/**\n * An array of IFRAME tag properties and events.\n *\n * @public\n */\nexport const iframeProperties = toObjectMap(htmlElementProperties, [\n 'allow', // iframe\n 'allowFullScreen', // iframe\n 'allowPaymentRequest', // iframe\n 'allowTransparency', // iframe\n 'csp', // iframe\n 'height', // canvas, embed, iframe, img, input, object, video\n 'importance', // iframe\n 'referrerPolicy', // iframe\n 'sandbox', // iframe\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcDoc', // iframe\n 'width', // canvas, embed, iframe, img, input, object, video,\n]);\n\n/**\n * An array of IMAGE tag properties and events.\n *\n * @public\n */\nexport const imgProperties = toObjectMap(htmlElementProperties, [\n 'alt', // area, img, input\n 'crossOrigin', // img\n 'height', // canvas, embed, iframe, img, input, object, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcSet', // img, source\n 'useMap', // img, object,\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * @deprecated Use imgProperties for img elements.\n */\nexport const imageProperties = imgProperties;\n\n/**\n * An array of DIV tag properties and events.\n *\n * @public\n */\nexport const divProperties = htmlElementProperties;\n\n/**\n * Gets native supported props for an html element provided the allowance set. Use one of the property\n * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given\n * props set. Note that all data- and aria- prefixed attributes will be allowed.\n * NOTE: getNativeProps should always be applied first when adding props to a react component. The\n * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.\n * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to\n * the component after an onClick function is added, then the getNativeProps onClick will override it.\n *\n * @public\n * @param props - The unfiltered input props\n * @param allowedPropsNames - The array or record of allowed prop names.\n * @returns The filtered props\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeProps<T extends Record<string, any>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>,\n allowedPropNames: string[] | Record<string, number>,\n excludedPropNames?: string[],\n): T {\n // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for\n // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.\n // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then\n // return native props.\n // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797\n\n const isArray = Array.isArray(allowedPropNames);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n const keys = Object.keys(props);\n\n for (const key of keys) {\n const isNativeProp =\n (!isArray && (allowedPropNames as Record<string, number>)[key]) ||\n (isArray && (allowedPropNames as string[]).indexOf(key) >= 0) ||\n key.indexOf('data-') === 0 ||\n key.indexOf('aria-') === 0;\n\n if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result[key] = props![key] as any;\n }\n }\n\n return result as T;\n}\n"]}
1
+ {"version":3,"sources":["../../src/utils/properties.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,CAAC,GAAG,KAAJ,KAAoD;AACtE,QAAM,MAAM,GAA2B,EAAvC;;AAEA,OAAK,MAAM,IAAX,IAAmB,KAAnB,EAA0B;AACxB,UAAM,IAAI,GAAG,KAAK,CAAC,OAAN,CAAc,IAAd,IAAsB,IAAtB,GAA6B,MAAM,CAAC,IAAP,CAAY,IAAZ,CAA1C;;AAEA,SAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,CAAd;AACD;AACF;;AAED,SAAO,MAAP;AACD,CAZD;AAcA;;;;AAIG;;;AACH,OAAO,MAAM,iBAAiB,gBAAG,WAAW,CAAC,CAC3C,YAD2C,EAE3C,QAF2C,EAG3C,OAH2C,EAI3C,SAJ2C,EAK3C,kBAL2C,EAM3C,oBAN2C,EAO3C,qBAP2C,EAQ3C,SAR2C,EAS3C,gBAT2C,EAU3C,QAV2C,EAW3C,eAX2C,EAY3C,UAZ2C,EAa3C,SAb2C,EAc3C,UAd2C,EAe3C,QAf2C,EAgB3C,SAhB2C,EAiB3C,WAjB2C,EAkB3C,kBAlB2C,EAmB3C,YAnB2C,EAoB3C,SApB2C,EAqB3C,SArB2C,EAsB3C,WAtB2C,EAuB3C,kBAvB2C,EAwB3C,kBAxB2C,EAyB3C,WAzB2C,EA0B3C,aA1B2C,EA2B3C,SA3B2C,EA4B3C,cA5B2C,EA6B3C,kBA7B2C,EA8B3C,aA9B2C,EA+B3C,SA/B2C,EAgC3C,QAhC2C,EAiC3C,WAjC2C,EAkC3C,YAlC2C,EAmC3C,cAnC2C,EAoC3C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sC,GAAtC,KAA8C,CAD3D,IAEA,GAAG,CAAC,OAAJ,CAAY,OAAZ,MAAyB,CAFzB,IAGA,GAAG,CAAC,OAAJ,CAAY,OAAZ,MAAyB,CAJ3B;;AAMA,QAAI,YAAY,KAAK,CAAC,iBAAD,IAAsB,CAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAE,OAAnB,CAA2B,GAA3B,CAAA,MAAoC,CAAC,CAAhE,CAAhB,EAAoF;AAClF;AACA,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,KAAM,CAAC,GAAD,CAApB;AACD;AACF;;AAED,SAAO,MAAP;AACD","sourceRoot":""}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
4
+ *
5
+ * Useful for situations where a keydown needs to be transformed to a click event
6
+ */
7
+ export declare function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent): boolean;
@@ -0,0 +1,20 @@
1
+ import { Space, Enter } from '@fluentui/keyboard-keys';
2
+ /**
3
+ * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
4
+ *
5
+ * Useful for situations where a keydown needs to be transformed to a click event
6
+ */
7
+
8
+ export function shouldPreventDefaultOnKeyDown(e) {
9
+ const key = e.key;
10
+ const target = e.target;
11
+ const matchesByKey = key === Space || key === Enter;
12
+
13
+ if ((target === null || target === void 0 ? void 0 : target.tagName) === 'A') {
14
+ return key === Space;
15
+ }
16
+
17
+ 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;
18
+ return matchesByKey && !ignoredByTag;
19
+ }
20
+ //# sourceMappingURL=shouldPreventDefaultOnKeyDown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AAGA;;;;AAIG;;AACH,OAAM,SAAU,6BAAV,CAAwC,CAAxC,EAA8E;AAClF,QAAM,GAAG,GAAG,CAAC,CAAC,GAAd;AACA,QAAM,MAAM,GAA4B,CAAC,CAAC,MAA1C;AAEA,QAAM,YAAY,GAAG,GAAG,KAAK,KAAR,IAAiB,GAAG,KAAK,KAA9C;;AAEA,MAAI,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,GAAxB,EAA6B;AAC3B,WAAO,GAAG,KAAK,KAAf;AACD;;AAED,QAAM,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;AAGA,SAAO,YAAY,IAAI,CAAC,YAAxB;AACD","sourceRoot":""}
@@ -1,8 +1,16 @@
1
+ import * as React from 'react';
2
+ import { AsIntrinsicElement, ComponentState, ObjectShorthandPropsRecord, ObjectShorthandProps, UnionToIntersection } from './types';
3
+ export declare type Slots<S extends ObjectShorthandPropsRecord> = {
4
+ [K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? As : S[K] extends ObjectShorthandProps<infer P> ? React.ElementType<NonNullable<P>> : React.ElementType<NonNullable<S[K]>>;
5
+ };
6
+ declare type SlotProps<S extends ObjectShorthandPropsRecord> = {
7
+ [K in keyof S]-?: NonNullable<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : NonNullable<S[K]> extends ObjectShorthandProps<infer P> ? P : never;
8
+ };
1
9
  /**
2
10
  * Given the state and an array of slot names, will break out `slots` and `slotProps`
3
11
  * collections.
4
12
  *
5
- * The root is always derived from the `as` prop.
13
+ * The root is derived from a mix of `components` props and `as` prop.
6
14
  *
7
15
  * Slots will render as null if they are rendered as primitives with undefined children.
8
16
  *
@@ -14,7 +22,8 @@
14
22
  * @param slotNames - Name of which props are slots
15
23
  * @returns An object containing the `slots` map and `slotProps` map.
16
24
  */
17
- export declare const getSlots: (state: Record<string, any>, slotNames?: string[] | undefined) => {
18
- slots: Record<string, any>;
19
- slotProps: Record<string, any>;
25
+ export declare function getSlots<R extends ObjectShorthandPropsRecord>(state: ComponentState<R>, slotNames?: (keyof R)[]): {
26
+ slots: Slots<R>;
27
+ slotProps: SlotProps<R>;
20
28
  };
29
+ export {};