@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,373 +1,178 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var toObjectMap = function () {
4
- var items = [];
5
- for (var _i = 0; _i < arguments.length; _i++) {
6
- items[_i] = arguments[_i];
7
- }
8
- var result = {};
9
- for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {
10
- var item = items_1[_a];
11
- var keys = Array.isArray(item) ? item : Object.keys(item);
12
- for (var _b = 0, keys_1 = keys; _b < keys_1.length; _b++) {
13
- var key = keys_1[_b];
14
- result[key] = 1;
15
- }
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getNativeProps = exports.divProperties = exports.imageProperties = exports.imgProperties = exports.iframeProperties = exports.formProperties = exports.colProperties = exports.colGroupProperties = exports.tdProperties = exports.thProperties = exports.trProperties = exports.tableProperties = exports.optionProperties = exports.selectProperties = exports.textAreaProperties = exports.inputProperties = exports.buttonProperties = exports.anchorProperties = exports.liProperties = exports.olProperties = exports.videoProperties = exports.audioProperties = exports.labelProperties = exports.htmlElementProperties = exports.baseElementProperties = exports.baseElementEvents = void 0;
7
+
8
+ const toObjectMap = (...items) => {
9
+ const result = {};
10
+
11
+ for (const item of items) {
12
+ const keys = Array.isArray(item) ? item : Object.keys(item);
13
+
14
+ for (const key of keys) {
15
+ result[key] = 1;
16
16
  }
17
- return result;
17
+ }
18
+
19
+ return result;
18
20
  };
19
21
  /**
20
22
  * An array of events that are allowed on every html element type.
21
23
  *
22
24
  * @public
23
25
  */
24
- exports.baseElementEvents = toObjectMap([
25
- 'onCopy',
26
- 'onCut',
27
- 'onPaste',
28
- 'onCompositionEnd',
29
- 'onCompositionStart',
30
- 'onCompositionUpdate',
31
- 'onFocus',
32
- 'onFocusCapture',
33
- 'onBlur',
34
- 'onBlurCapture',
35
- 'onChange',
36
- 'onInput',
37
- 'onSubmit',
38
- 'onLoad',
39
- 'onError',
40
- 'onKeyDown',
41
- 'onKeyDownCapture',
42
- 'onKeyPress',
43
- 'onKeyUp',
44
- 'onAbort',
45
- 'onCanPlay',
46
- 'onCanPlayThrough',
47
- 'onDurationChange',
48
- 'onEmptied',
49
- 'onEncrypted',
50
- 'onEnded',
51
- 'onLoadedData',
52
- 'onLoadedMetadata',
53
- 'onLoadStart',
54
- 'onPause',
55
- 'onPlay',
56
- 'onPlaying',
57
- 'onProgress',
58
- 'onRateChange',
59
- 'onSeeked',
60
- 'onSeeking',
61
- 'onStalled',
62
- 'onSuspend',
63
- 'onTimeUpdate',
64
- 'onVolumeChange',
65
- 'onWaiting',
66
- 'onClick',
67
- 'onClickCapture',
68
- 'onContextMenu',
69
- 'onDoubleClick',
70
- 'onDrag',
71
- 'onDragEnd',
72
- 'onDragEnter',
73
- 'onDragExit',
74
- 'onDragLeave',
75
- 'onDragOver',
76
- 'onDragStart',
77
- 'onDrop',
78
- 'onMouseDown',
79
- 'onMouseDownCapture',
80
- 'onMouseEnter',
81
- 'onMouseLeave',
82
- 'onMouseMove',
83
- 'onMouseOut',
84
- 'onMouseOver',
85
- 'onMouseUp',
86
- 'onMouseUpCapture',
87
- 'onSelect',
88
- 'onTouchCancel',
89
- 'onTouchEnd',
90
- 'onTouchMove',
91
- 'onTouchStart',
92
- 'onScroll',
93
- 'onWheel',
94
- 'onPointerCancel',
95
- 'onPointerDown',
96
- 'onPointerEnter',
97
- 'onPointerLeave',
98
- 'onPointerMove',
99
- 'onPointerOut',
100
- 'onPointerOver',
101
- 'onPointerUp',
102
- 'onGotPointerCapture',
103
- 'onLostPointerCapture',
104
- ]);
26
+
27
+
28
+ exports.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']);
105
29
  /**
106
30
  * An array of element attributes which are allowed on every html element type.
107
31
  *
108
32
  * @public
109
33
  */
110
- exports.baseElementProperties = toObjectMap([
111
- 'accessKey',
112
- 'children',
113
- 'className',
114
- 'contentEditable',
115
- 'dir',
116
- 'draggable',
117
- 'hidden',
118
- 'htmlFor',
119
- 'id',
120
- 'lang',
121
- 'ref',
122
- 'role',
123
- 'style',
124
- 'tabIndex',
125
- 'title',
126
- 'translate',
127
- 'spellCheck',
128
- 'name',
129
- ]);
34
+
35
+ exports.baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name']);
130
36
  /**
131
37
  * An array of HTML element properties and events.
132
38
  *
133
39
  * @public
134
40
  */
135
- exports.htmlElementProperties = toObjectMap(exports.baseElementProperties, exports.baseElementEvents);
41
+
42
+ exports.htmlElementProperties = /*#__PURE__*/toObjectMap(exports.baseElementProperties, exports.baseElementEvents);
136
43
  /**
137
44
  * An array of LABEL tag properties and events.
138
45
  *
139
46
  * @public
140
47
  */
141
- exports.labelProperties = toObjectMap(exports.htmlElementProperties, [
142
- 'form',
143
- ]);
48
+
49
+ exports.labelProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['form']);
144
50
  /**
145
51
  * An array of AUDIO tag properties and events.
146
52
 
147
53
  * @public
148
54
  */
149
- exports.audioProperties = toObjectMap(exports.htmlElementProperties, [
150
- 'height',
151
- 'loop',
152
- 'muted',
153
- 'preload',
154
- 'src',
155
- 'width',
156
- ]);
55
+
56
+ exports.audioProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width']);
157
57
  /**
158
58
  * An array of VIDEO tag properties and events.
159
59
  *
160
60
  * @public
161
61
  */
162
- exports.videoProperties = toObjectMap(exports.audioProperties, [
163
- 'poster',
164
- ]);
62
+
63
+ exports.videoProperties = /*#__PURE__*/toObjectMap(exports.audioProperties, ['poster']);
165
64
  /**
166
65
  * An array of OL tag properties and events.
167
66
  *
168
67
  * @public
169
68
  */
170
- exports.olProperties = toObjectMap(exports.htmlElementProperties, [
171
- 'start',
172
- ]);
69
+
70
+ exports.olProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['start']);
173
71
  /**
174
72
  * An array of LI tag properties and events.
175
73
  *
176
74
  * @public
177
75
  */
178
- exports.liProperties = toObjectMap(exports.htmlElementProperties, [
179
- 'value',
180
- ]);
76
+
77
+ exports.liProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['value']);
181
78
  /**
182
79
  * An array of A tag properties and events.
183
80
  *
184
81
  * @public
185
82
  */
186
- exports.anchorProperties = toObjectMap(exports.htmlElementProperties, [
187
- 'download',
188
- 'href',
189
- 'hrefLang',
190
- 'media',
191
- 'rel',
192
- 'target',
193
- 'type',
194
- ]);
83
+
84
+ exports.anchorProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type']);
195
85
  /**
196
86
  * An array of BUTTON tag properties and events.
197
87
  *
198
88
  * @public
199
89
  */
200
- exports.buttonProperties = toObjectMap(exports.htmlElementProperties, [
201
- 'autoFocus',
202
- 'disabled',
203
- 'form',
204
- 'formAction',
205
- 'formEncType',
206
- 'formMethod',
207
- 'formNoValidate',
208
- 'formTarget',
209
- 'type',
210
- 'value',
211
- ]);
90
+
91
+ exports.buttonProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value']);
212
92
  /**
213
93
  * An array of INPUT tag properties and events.
214
94
  *
215
95
  * @public
216
96
  */
217
- exports.inputProperties = toObjectMap(exports.buttonProperties, [
218
- 'accept',
219
- 'alt',
220
- 'autoCapitalize',
221
- 'autoComplete',
222
- 'checked',
223
- 'dirname',
224
- 'form',
225
- 'height',
226
- 'inputMode',
227
- 'list',
228
- 'max',
229
- 'maxLength',
230
- 'min',
231
- 'multiple',
232
- 'pattern',
233
- 'placeholder',
234
- 'readOnly',
235
- 'required',
236
- 'src',
237
- 'step',
238
- 'size',
239
- 'type',
240
- 'value',
241
- 'width',
242
- ]);
97
+
98
+ exports.inputProperties = /*#__PURE__*/toObjectMap(exports.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']);
243
99
  /**
244
100
  * An array of TEXTAREA tag properties and events.
245
101
  *
246
102
  * @public
247
103
  */
248
- exports.textAreaProperties = toObjectMap(exports.buttonProperties, [
249
- 'autoCapitalize',
250
- 'cols',
251
- 'dirname',
252
- 'form',
253
- 'maxLength',
254
- 'placeholder',
255
- 'readOnly',
256
- 'required',
257
- 'rows',
258
- 'wrap',
259
- ]);
104
+
105
+ exports.textAreaProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap']);
260
106
  /**
261
107
  * An array of SELECT tag properties and events.
262
108
  *
263
109
  * @public
264
110
  */
265
- exports.selectProperties = toObjectMap(exports.buttonProperties, [
266
- 'form',
267
- 'multiple',
268
- 'required',
269
- ]);
270
- exports.optionProperties = toObjectMap(exports.htmlElementProperties, [
271
- 'selected',
272
- 'value',
273
- ]);
111
+
112
+ exports.selectProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['form', 'multiple', 'required']);
113
+ exports.optionProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['selected', 'value']);
274
114
  /**
275
115
  * An array of TABLE tag properties and events.
276
116
  *
277
117
  * @public
278
118
  */
279
- exports.tableProperties = toObjectMap(exports.htmlElementProperties, [
280
- 'cellPadding',
281
- 'cellSpacing',
282
- ]);
119
+
120
+ exports.tableProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['cellPadding', 'cellSpacing']);
283
121
  /**
284
122
  * An array of TR tag properties and events.
285
123
  *
286
124
  * @public
287
125
  */
126
+
288
127
  exports.trProperties = exports.htmlElementProperties;
289
128
  /**
290
129
  * An array of TH tag properties and events.
291
130
  *
292
131
  * @public
293
132
  */
294
- exports.thProperties = toObjectMap(exports.htmlElementProperties, [
295
- 'rowSpan',
296
- 'scope',
297
- ]);
133
+
134
+ exports.thProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['rowSpan', 'scope']);
298
135
  /**
299
136
  * An array of TD tag properties and events.
300
137
  *
301
138
  * @public
302
139
  */
303
- exports.tdProperties = toObjectMap(exports.htmlElementProperties, [
304
- 'colSpan',
305
- 'headers',
306
- 'rowSpan',
307
- 'scope',
308
- ]);
309
- exports.colGroupProperties = toObjectMap(exports.htmlElementProperties, [
310
- 'span',
311
- ]);
312
- exports.colProperties = toObjectMap(exports.htmlElementProperties, [
313
- 'span',
314
- ]);
140
+
141
+ exports.tdProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope']);
142
+ exports.colGroupProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span']);
143
+ exports.colProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span']);
315
144
  /**
316
145
  * An array of FORM tag properties and events.
317
146
  *
318
147
  * @public
319
148
  */
320
- exports.formProperties = toObjectMap(exports.htmlElementProperties, [
321
- 'acceptCharset',
322
- 'action',
323
- 'encType',
324
- 'encType',
325
- 'method',
326
- 'noValidate',
327
- 'target',
328
- ]);
149
+
150
+ exports.formProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target']);
329
151
  /**
330
152
  * An array of IFRAME tag properties and events.
331
153
  *
332
154
  * @public
333
155
  */
334
- exports.iframeProperties = toObjectMap(exports.htmlElementProperties, [
335
- 'allow',
336
- 'allowFullScreen',
337
- 'allowPaymentRequest',
338
- 'allowTransparency',
339
- 'csp',
340
- 'height',
341
- 'importance',
342
- 'referrerPolicy',
343
- 'sandbox',
344
- 'src',
345
- 'srcDoc',
346
- 'width',
347
- ]);
156
+
157
+ exports.iframeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width']);
348
158
  /**
349
159
  * An array of IMAGE tag properties and events.
350
160
  *
351
161
  * @public
352
162
  */
353
- exports.imgProperties = toObjectMap(exports.htmlElementProperties, [
354
- 'alt',
355
- 'crossOrigin',
356
- 'height',
357
- 'src',
358
- 'srcSet',
359
- 'useMap',
360
- 'width',
361
- ]);
163
+
164
+ exports.imgProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width']);
362
165
  /**
363
166
  * @deprecated Use imgProperties for img elements.
364
167
  */
168
+
365
169
  exports.imageProperties = exports.imgProperties;
366
170
  /**
367
171
  * An array of DIV tag properties and events.
368
172
  *
369
173
  * @public
370
174
  */
175
+
371
176
  exports.divProperties = exports.htmlElementProperties;
372
177
  /**
373
178
  * Gets native supported props for an html element provided the allowance set. Use one of the property
@@ -384,31 +189,30 @@ exports.divProperties = exports.htmlElementProperties;
384
189
  * @returns The filtered props
385
190
  */
386
191
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
387
- function getNativeProps(
388
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
192
+
193
+ function getNativeProps( // eslint-disable-next-line @typescript-eslint/no-explicit-any
389
194
  props, allowedPropNames, excludedPropNames) {
390
- // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
391
- // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
392
- // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
393
- // return native props.
394
- // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
395
- var _a;
396
- var isArray = Array.isArray(allowedPropNames);
397
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
398
- var result = {};
399
- var keys = Object.keys(props);
400
- for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
401
- var key = keys_2[_i];
402
- var isNativeProp = (!isArray && allowedPropNames[key]) ||
403
- (isArray && allowedPropNames.indexOf(key) >= 0) ||
404
- key.indexOf('data-') === 0 ||
405
- key.indexOf('aria-') === 0;
406
- if (isNativeProp && (!excludedPropNames || ((_a = excludedPropNames) === null || _a === void 0 ? void 0 : _a.indexOf(key)) === -1)) {
407
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
408
- result[key] = props[key];
409
- }
195
+ // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
196
+ // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
197
+ // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
198
+ // return native props.
199
+ // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
200
+ const isArray = Array.isArray(allowedPropNames); // eslint-disable-next-line @typescript-eslint/no-explicit-any
201
+
202
+ const result = {};
203
+ const keys = Object.keys(props);
204
+
205
+ for (const key of keys) {
206
+ const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
207
+
208
+ if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
210
+ result[key] = props[key];
410
211
  }
411
- return result;
212
+ }
213
+
214
+ return result;
412
215
  }
216
+
413
217
  exports.getNativeProps = getNativeProps;
414
218
  //# 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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CAAC,CAAC;YAC7D,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;YAC1B,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,YAAY,IAAI,CAAC,CAAC,iBAAiB,IAAI,OAAA,iBAAiB,0CAAE,OAAO,CAAC,GAAG,OAAM,CAAC,CAAC,CAAC,EAAE;YAClF,8DAA8D;YAC9D,MAAM,CAAC,GAAG,CAAC,GAAG,KAAM,CAAC,GAAG,CAAQ,CAAC;SAClC;KACF;IAED,OAAO,MAAW,CAAC;AACrB,CAAC;AA/BD,wCA+BC","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;;;AACU,OAAA,CAAA,iBAAA,gBAAoB,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,SApB2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AAA,CAAA,eAAA,GAAkB,OAAA,CAAA,aAAlB;AAEb;;;;AAIG;;AACU,OAAA,CAAA,aAAA,GAAgB,OAAA,CAAA,qBAAhB;AAEb;;;;;;;;;;;;;AAaG;AACH;;AACA,SAAgB,cAAhB,EACE;AACA,KAFF,EAGE,gBAHF,EAIE,iBAJF,EAI8B;AAE5B;AACA;AACA;AACA;AACA;AAEA,QAAM,OAAO,GAAG,KAAK,CAAC,OAAN,CAAc,gBAAd,CAAhB,CAR4B,CAS5B;;AACA,QAAM,MAAM,GAAwB,EAApC;AACA,QAAM,IAAI,GAAG,MAAM,CAAC,IAAP,CAAY,KAAZ,CAAb;;AAEA,OAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,UAAM,YAAY,GACf,CAAC,OAAD,IAAa,gBAA2C,CAAC,GAAD,CAAzD,IACC,OAAO,IAAK,gBAA6B,CAAC,OAA9B,CAAsC,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;;AA/BD,OAAA,CAAA,cAAA,GAAA,cAAA","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,30 @@
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
+ * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
11
+ *
12
+ * Useful for situations where a keydown needs to be transformed to a click event
13
+ */
14
+
15
+
16
+ function shouldPreventDefaultOnKeyDown(e) {
17
+ const key = e.key;
18
+ const target = e.target;
19
+ const matchesByKey = key === keyboard_keys_1.Space || key === keyboard_keys_1.Enter;
20
+
21
+ if ((target === null || target === void 0 ? void 0 : target.tagName) === 'A') {
22
+ return key === keyboard_keys_1.Space;
23
+ }
24
+
25
+ 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;
26
+ return matchesByKey && !ignoredByTag;
27
+ }
28
+
29
+ exports.shouldPreventDefaultOnKeyDown = shouldPreventDefaultOnKeyDown;
30
+ //# sourceMappingURL=shouldPreventDefaultOnKeyDown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;;AAIG;;;AACH,SAAgB,6BAAhB,CAA8C,CAA9C,EAAoF;AAClF,QAAM,GAAG,GAAG,CAAC,CAAC,GAAd;AACA,QAAM,MAAM,GAA4B,CAAC,CAAC,MAA1C;AAEA,QAAM,YAAY,GAAG,GAAG,KAAK,eAAA,CAAA,KAAR,IAAiB,GAAG,KAAK,eAAA,CAAA,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,eAAA,CAAA,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;;AAdD,OAAA,CAAA,6BAAA,GAAA,6BAAA","sourceRoot":""}
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@fluentui/react-utilities",
3
- "version": "9.0.0-alpha.9",
3
+ "version": "9.0.0-beta.4",
4
4
  "description": "A set of general React-specific utilities.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
7
7
  "typings": "lib/index.d.ts",
8
+ "sideEffects": false,
8
9
  "repository": {
9
10
  "type": "git",
10
11
  "url": "https://github.com/microsoft/fluentui"
@@ -12,18 +13,20 @@
12
13
  "license": "MIT",
13
14
  "scripts": {
14
15
  "build": "just-scripts build",
16
+ "bundle-size": "bundle-size measure",
15
17
  "clean": "just-scripts clean",
16
18
  "code-style": "just-scripts code-style",
17
19
  "just": "just-scripts",
18
20
  "lint": "just-scripts lint",
19
- "start-test": "just-scripts jest-watch",
20
- "test": "just-scripts test",
21
- "update-snapshots": "just-scripts jest -u"
21
+ "test": "jest",
22
+ "docs": "api-extractor run --config=config/api-extractor.local.json --local",
23
+ "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-utilities/src && yarn docs",
24
+ "start": "yarn storybook",
25
+ "type-check": "tsc -b tsconfig.json"
22
26
  },
23
27
  "devDependencies": {
24
- "@fluentui/eslint-plugin": "^1.0.1",
28
+ "@fluentui/eslint-plugin": "*",
25
29
  "@fluentui/scripts": "^1.0.0",
26
- "@testing-library/react-hooks": "^5.0.3",
27
30
  "@types/enzyme": "3.10.3",
28
31
  "@types/enzyme-adapter-react-16": "1.0.3",
29
32
  "@types/react": "16.9.42",
@@ -31,18 +34,17 @@
31
34
  "enzyme": "~3.10.0",
32
35
  "enzyme-adapter-react-16": "^1.15.0",
33
36
  "react": "16.8.6",
34
- "react-app-polyfill": "~1.0.1",
35
37
  "react-test-renderer": "^16.3.0"
36
38
  },
37
39
  "dependencies": {
38
- "tslib": "^1.10.0"
40
+ "@fluentui/keyboard-keys": "9.0.0-beta.1",
41
+ "tslib": "^2.1.0"
39
42
  },
40
43
  "peerDependencies": {
41
44
  "@types/react": ">=16.8.0 <18.0.0",
42
45
  "react": ">=16.8.0 <18.0.0"
43
46
  },
44
47
  "beachball": {
45
- "tag": "alpha",
46
48
  "disallowedChangeTypes": [
47
49
  "major",
48
50
  "minor",
package/NOTICE.txt DELETED
File without changes