@fluentui/react-utilities 9.7.0 → 9.7.2

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 (216) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +49 -1
  3. package/CHANGELOG.md +23 -2
  4. package/dist/index.d.ts +16 -4
  5. package/lib/compose/getSlots.js +3 -3
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.js.map +1 -1
  8. package/lib/compose/isResolvedShorthand.js.map +1 -1
  9. package/lib/compose/resolveShorthand.js.map +1 -1
  10. package/lib/compose/types.js +1 -1
  11. package/lib/compose/types.js.map +1 -1
  12. package/lib/events/index.js.map +1 -1
  13. package/lib/events/mouseTouchHelpers.js +1 -0
  14. package/lib/events/mouseTouchHelpers.js.map +1 -1
  15. package/lib/hooks/index.js.map +1 -1
  16. package/lib/hooks/useControllableState.js.map +1 -1
  17. package/lib/hooks/useEventCallback.js.map +1 -1
  18. package/lib/hooks/useFirstMount.js.map +1 -1
  19. package/lib/hooks/useForceUpdate.js.map +1 -1
  20. package/lib/hooks/useId.js.map +1 -1
  21. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -2
  22. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  23. package/lib/hooks/useMergedRefs.js.map +1 -1
  24. package/lib/hooks/useOnClickOutside.js +16 -9
  25. package/lib/hooks/useOnClickOutside.js.map +1 -1
  26. package/lib/hooks/useOnScrollOutside.js +3 -1
  27. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  28. package/lib/hooks/usePrevious.js.map +1 -1
  29. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  30. package/lib/hooks/useTimeout.js.map +1 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib/ssr/SSRContext.js +2 -2
  33. package/lib/ssr/SSRContext.js.map +1 -1
  34. package/lib/ssr/canUseDOM.js +1 -2
  35. package/lib/ssr/canUseDOM.js.map +1 -1
  36. package/lib/ssr/index.js.map +1 -1
  37. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  38. package/lib/trigger/getTriggerChild.js.map +1 -1
  39. package/lib/trigger/index.js.map +1 -1
  40. package/lib/trigger/isFluentTrigger.js +1 -0
  41. package/lib/trigger/isFluentTrigger.js.map +1 -1
  42. package/lib/trigger/types.js +1 -1
  43. package/lib/trigger/types.js.map +1 -1
  44. package/lib/utils/clamp.js +1 -2
  45. package/lib/utils/clamp.js.map +1 -1
  46. package/lib/utils/getNativeElementProps.js +2 -2
  47. package/lib/utils/getNativeElementProps.js.map +1 -1
  48. package/lib/utils/getRTLSafeKey.js +1 -2
  49. package/lib/utils/getRTLSafeKey.js.map +1 -1
  50. package/lib/utils/getReactCallbackName.js +1 -0
  51. package/lib/utils/getReactCallbackName.js.map +1 -1
  52. package/lib/utils/index.js.map +1 -1
  53. package/lib/utils/isHTMLElement.js +12 -7
  54. package/lib/utils/isHTMLElement.js.map +1 -1
  55. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  56. package/lib/utils/mergeCallbacks.js +1 -2
  57. package/lib/utils/mergeCallbacks.js.map +1 -1
  58. package/lib/utils/omit.js +1 -2
  59. package/lib/utils/omit.js.map +1 -1
  60. package/lib/utils/properties.js +24 -51
  61. package/lib/utils/properties.js.map +1 -1
  62. package/lib-commonjs/compose/getSlots.js +48 -55
  63. package/lib-commonjs/compose/getSlots.js.map +1 -1
  64. package/lib-commonjs/compose/index.js +8 -7
  65. package/lib-commonjs/compose/index.js.map +1 -1
  66. package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
  67. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  68. package/lib-commonjs/compose/resolveShorthand.js +25 -32
  69. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  70. package/lib-commonjs/compose/types.js +5 -2
  71. package/lib-commonjs/compose/types.js.map +1 -1
  72. package/lib-commonjs/events/index.js +5 -4
  73. package/lib-commonjs/events/index.js.map +1 -1
  74. package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
  75. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  76. package/lib-commonjs/hooks/index.js +16 -15
  77. package/lib-commonjs/hooks/index.js.map +1 -1
  78. package/lib-commonjs/hooks/useControllableState.js +63 -64
  79. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  80. package/lib-commonjs/hooks/useEventCallback.js +25 -31
  81. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  82. package/lib-commonjs/hooks/useFirstMount.js +15 -23
  83. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  84. package/lib-commonjs/hooks/useForceUpdate.js +9 -11
  85. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  86. package/lib-commonjs/hooks/useId.js +47 -46
  87. package/lib-commonjs/hooks/useId.js.map +1 -1
  88. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
  89. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  90. package/lib-commonjs/hooks/useMergedRefs.js +25 -27
  91. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  92. package/lib-commonjs/hooks/useOnClickOutside.js +118 -114
  93. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  94. package/lib-commonjs/hooks/useOnScrollOutside.js +35 -36
  95. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  96. package/lib-commonjs/hooks/usePrevious.js +17 -15
  97. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  98. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  99. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  100. package/lib-commonjs/hooks/useTimeout.js +30 -30
  101. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  102. package/lib-commonjs/index.js +52 -214
  103. package/lib-commonjs/index.js.map +1 -1
  104. package/lib-commonjs/ssr/SSRContext.js +57 -59
  105. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  106. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  107. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  108. package/lib-commonjs/ssr/index.js +6 -5
  109. package/lib-commonjs/ssr/index.js.map +1 -1
  110. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
  111. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  112. package/lib-commonjs/trigger/getTriggerChild.js +16 -36
  113. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  114. package/lib-commonjs/trigger/index.js +8 -7
  115. package/lib-commonjs/trigger/index.js.map +1 -1
  116. package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
  117. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  118. package/lib-commonjs/trigger/types.js +5 -2
  119. package/lib-commonjs/trigger/types.js.map +1 -1
  120. package/lib-commonjs/utils/clamp.js +10 -9
  121. package/lib-commonjs/utils/clamp.js.map +1 -1
  122. package/lib-commonjs/utils/getNativeElementProps.js +54 -61
  123. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  124. package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
  125. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  126. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  127. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  128. package/lib-commonjs/utils/index.js +12 -11
  129. package/lib-commonjs/utils/index.js.map +1 -1
  130. package/lib-commonjs/utils/isHTMLElement.js +22 -15
  131. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  132. package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
  133. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  134. package/lib-commonjs/utils/mergeCallbacks.js +14 -13
  135. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  136. package/lib-commonjs/utils/omit.js +18 -17
  137. package/lib-commonjs/utils/omit.js.map +1 -1
  138. package/lib-commonjs/utils/properties.js +327 -223
  139. package/lib-commonjs/utils/properties.js.map +1 -1
  140. package/package.json +5 -4
  141. package/lib-amd/compose/getSlots.js +0 -58
  142. package/lib-amd/compose/getSlots.js.map +0 -1
  143. package/lib-amd/compose/index.js +0 -9
  144. package/lib-amd/compose/index.js.map +0 -1
  145. package/lib-amd/compose/isResolvedShorthand.js +0 -40
  146. package/lib-amd/compose/isResolvedShorthand.js.map +0 -1
  147. package/lib-amd/compose/resolveShorthand.js +0 -27
  148. package/lib-amd/compose/resolveShorthand.js.map +0 -1
  149. package/lib-amd/compose/types.js +0 -5
  150. package/lib-amd/compose/types.js.map +0 -1
  151. package/lib-amd/events/index.js +0 -6
  152. package/lib-amd/events/index.js.map +0 -1
  153. package/lib-amd/events/mouseTouchHelpers.js +0 -39
  154. package/lib-amd/events/mouseTouchHelpers.js.map +0 -1
  155. package/lib-amd/hooks/index.js +0 -17
  156. package/lib-amd/hooks/index.js.map +0 -1
  157. package/lib-amd/hooks/useControllableState.js +0 -81
  158. package/lib-amd/hooks/useControllableState.js.map +0 -1
  159. package/lib-amd/hooks/useEventCallback.js +0 -36
  160. package/lib-amd/hooks/useEventCallback.js.map +0 -1
  161. package/lib-amd/hooks/useFirstMount.js +0 -26
  162. package/lib-amd/hooks/useFirstMount.js.map +0 -1
  163. package/lib-amd/hooks/useForceUpdate.js +0 -14
  164. package/lib-amd/hooks/useForceUpdate.js.map +0 -1
  165. package/lib-amd/hooks/useId.js +0 -54
  166. package/lib-amd/hooks/useId.js.map +0 -1
  167. package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -17
  168. package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
  169. package/lib-amd/hooks/useMergedRefs.js +0 -34
  170. package/lib-amd/hooks/useMergedRefs.js.map +0 -1
  171. package/lib-amd/hooks/useOnClickOutside.js +0 -114
  172. package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
  173. package/lib-amd/hooks/useOnScrollOutside.js +0 -31
  174. package/lib-amd/hooks/useOnScrollOutside.js.map +0 -1
  175. package/lib-amd/hooks/usePrevious.js +0 -17
  176. package/lib-amd/hooks/usePrevious.js.map +0 -1
  177. package/lib-amd/hooks/useScrollbarWidth.js +0 -32
  178. package/lib-amd/hooks/useScrollbarWidth.js.map +0 -1
  179. package/lib-amd/hooks/useTimeout.js +0 -33
  180. package/lib-amd/hooks/useTimeout.js.map +0 -1
  181. package/lib-amd/index.js +0 -40
  182. package/lib-amd/index.js.map +0 -1
  183. package/lib-amd/ssr/SSRContext.js +0 -69
  184. package/lib-amd/ssr/SSRContext.js.map +0 -1
  185. package/lib-amd/ssr/canUseDOM.js +0 -16
  186. package/lib-amd/ssr/canUseDOM.js.map +0 -1
  187. package/lib-amd/ssr/index.js +0 -7
  188. package/lib-amd/ssr/index.js.map +0 -1
  189. package/lib-amd/trigger/applyTriggerPropsToChildren.js +0 -40
  190. package/lib-amd/trigger/applyTriggerPropsToChildren.js.map +0 -1
  191. package/lib-amd/trigger/getTriggerChild.js +0 -40
  192. package/lib-amd/trigger/getTriggerChild.js.map +0 -1
  193. package/lib-amd/trigger/index.js +0 -9
  194. package/lib-amd/trigger/index.js.map +0 -1
  195. package/lib-amd/trigger/isFluentTrigger.js +0 -15
  196. package/lib-amd/trigger/isFluentTrigger.js.map +0 -1
  197. package/lib-amd/trigger/types.js +0 -5
  198. package/lib-amd/trigger/types.js.map +0 -1
  199. package/lib-amd/utils/clamp.js +0 -16
  200. package/lib-amd/utils/clamp.js.map +0 -1
  201. package/lib-amd/utils/getNativeElementProps.js +0 -64
  202. package/lib-amd/utils/getNativeElementProps.js.map +0 -1
  203. package/lib-amd/utils/getRTLSafeKey.js +0 -24
  204. package/lib-amd/utils/getRTLSafeKey.js.map +0 -1
  205. package/lib-amd/utils/index.js +0 -13
  206. package/lib-amd/utils/index.js.map +0 -1
  207. package/lib-amd/utils/isHTMLElement.js +0 -22
  208. package/lib-amd/utils/isHTMLElement.js.map +0 -1
  209. package/lib-amd/utils/isInteractiveHTMLElement.js +0 -25
  210. package/lib-amd/utils/isInteractiveHTMLElement.js.map +0 -1
  211. package/lib-amd/utils/mergeCallbacks.js +0 -40
  212. package/lib-amd/utils/mergeCallbacks.js.map +0 -1
  213. package/lib-amd/utils/omit.js +0 -31
  214. package/lib-amd/utils/omit.js.map +0 -1
  215. package/lib-amd/utils/properties.js +0 -450
  216. package/lib-amd/utils/properties.js.map +0 -1
@@ -1,234 +1,338 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ baseElementEvents: ()=>baseElementEvents,
13
+ baseElementProperties: ()=>baseElementProperties,
14
+ microdataProperties: ()=>microdataProperties,
15
+ htmlElementProperties: ()=>htmlElementProperties,
16
+ labelProperties: ()=>labelProperties,
17
+ audioProperties: ()=>audioProperties,
18
+ videoProperties: ()=>videoProperties,
19
+ olProperties: ()=>olProperties,
20
+ liProperties: ()=>liProperties,
21
+ anchorProperties: ()=>anchorProperties,
22
+ timeProperties: ()=>timeProperties,
23
+ buttonProperties: ()=>buttonProperties,
24
+ inputProperties: ()=>inputProperties,
25
+ textAreaProperties: ()=>textAreaProperties,
26
+ selectProperties: ()=>selectProperties,
27
+ optionProperties: ()=>optionProperties,
28
+ tableProperties: ()=>tableProperties,
29
+ trProperties: ()=>trProperties,
30
+ thProperties: ()=>thProperties,
31
+ tdProperties: ()=>tdProperties,
32
+ colGroupProperties: ()=>colGroupProperties,
33
+ colProperties: ()=>colProperties,
34
+ fieldsetProperties: ()=>fieldsetProperties,
35
+ formProperties: ()=>formProperties,
36
+ iframeProperties: ()=>iframeProperties,
37
+ imgProperties: ()=>imgProperties,
38
+ dialogProperties: ()=>dialogProperties,
39
+ divProperties: ()=>divProperties,
40
+ getNativeProps: ()=>getNativeProps
5
41
  });
6
- exports.getNativeProps = exports.divProperties = exports.dialogProperties = exports.imgProperties = exports.iframeProperties = exports.formProperties = exports.fieldsetProperties = exports.colProperties = exports.colGroupProperties = exports.tdProperties = exports.thProperties = exports.trProperties = exports.tableProperties = exports.optionProperties = exports.selectProperties = exports.textAreaProperties = exports.inputProperties = exports.buttonProperties = exports.timeProperties = exports.anchorProperties = exports.liProperties = exports.olProperties = exports.videoProperties = exports.audioProperties = exports.labelProperties = exports.htmlElementProperties = exports.microdataProperties = exports.baseElementProperties = exports.baseElementEvents = void 0;
7
- const toObjectMap = (...items) => {
8
- const result = {};
9
- for (const item of items) {
10
- const keys = Array.isArray(item) ? item : Object.keys(item);
11
- for (const key of keys) {
12
- result[key] = 1;
42
+ const toObjectMap = (...items)=>{
43
+ const result = {};
44
+ for (const item of items){
45
+ const keys = Array.isArray(item) ? item : Object.keys(item);
46
+ for (const key of keys){
47
+ result[key] = 1;
48
+ }
13
49
  }
14
- }
15
- return result;
50
+ return result;
16
51
  };
17
- /**
18
- * An array of events that are allowed on every html element type.
19
- *
20
- * @public
21
- */
22
- 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']);
23
- /**
24
- * An array of element attributes which are allowed on every html element type.
25
- *
26
- * @public
27
- */
28
- exports.baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name' // global
29
- ]);
30
- /**
31
- * An array of microdata attributes that are allowed on every html element type.
32
- *
33
- * @public
34
- */
35
- exports.microdataProperties = /*#__PURE__*/toObjectMap(['itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType' // global
36
- ]);
37
- /**
38
- * An array of HTML element properties and events.
39
- *
40
- * @public
41
- */
42
- exports.htmlElementProperties = /*#__PURE__*/toObjectMap(exports.baseElementProperties, exports.baseElementEvents, exports.microdataProperties);
43
- /**
44
- * An array of LABEL tag properties and events.
45
- *
46
- * @public
47
- */
48
- exports.labelProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['form' // button, fieldset, input, label, meter, object, output, select, textarea
49
- ]);
50
- /**
51
- * An array of AUDIO tag properties and events.
52
-
53
- * @public
54
- */
55
- exports.audioProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width' // canvas, embed, iframe, img, input, object, video
56
- ]);
57
- /**
58
- * An array of VIDEO tag properties and events.
59
- *
60
- * @public
61
- */
62
- exports.videoProperties = /*#__PURE__*/toObjectMap(exports.audioProperties, ['poster' // video
63
- ]);
64
- /**
65
- * An array of OL tag properties and events.
66
- *
67
- * @public
68
- */
69
- exports.olProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['start' // ol
70
- ]);
71
- /**
72
- * An array of LI tag properties and events.
73
- *
74
- * @public
75
- */
76
- exports.liProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['value' // button, input, li, option, meter, progress, param
77
- ]);
78
- /**
79
- * An array of A tag properties and events.
80
- *
81
- * @public
82
- */
83
- exports.anchorProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
84
- ]);
85
- /**
86
- * An array of TIME tag properties and events.
87
- *
88
- * @public
89
- */
90
- exports.timeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['dateTime' // time
91
- ]);
92
- /**
93
- * An array of BUTTON tag properties and events.
94
- *
95
- * @public
96
- */
97
- exports.buttonProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value' // button, input, li, option, meter, progress, param,
98
- ]);
99
- /**
100
- * An array of INPUT tag properties and events.
101
- *
102
- * @public
103
- */
104
- 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' // canvas, embed, iframe, img, input, object, video
105
- ]);
106
- /**
107
- * An array of TEXTAREA tag properties and events.
108
- *
109
- * @public
110
- */
111
- exports.textAreaProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap' // textarea
112
- ]);
113
- /**
114
- * An array of SELECT tag properties and events.
115
- *
116
- * @public
117
- */
118
- exports.selectProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['form', 'multiple', 'required' // input, select, textarea
52
+ const baseElementEvents = /*#__PURE__*/ toObjectMap([
53
+ 'onAuxClick',
54
+ 'onCopy',
55
+ 'onCut',
56
+ 'onPaste',
57
+ 'onCompositionEnd',
58
+ 'onCompositionStart',
59
+ 'onCompositionUpdate',
60
+ 'onFocus',
61
+ 'onFocusCapture',
62
+ 'onBlur',
63
+ 'onBlurCapture',
64
+ 'onChange',
65
+ 'onInput',
66
+ 'onSubmit',
67
+ 'onLoad',
68
+ 'onError',
69
+ 'onKeyDown',
70
+ 'onKeyDownCapture',
71
+ 'onKeyPress',
72
+ 'onKeyUp',
73
+ 'onAbort',
74
+ 'onCanPlay',
75
+ 'onCanPlayThrough',
76
+ 'onDurationChange',
77
+ 'onEmptied',
78
+ 'onEncrypted',
79
+ 'onEnded',
80
+ 'onLoadedData',
81
+ 'onLoadedMetadata',
82
+ 'onLoadStart',
83
+ 'onPause',
84
+ 'onPlay',
85
+ 'onPlaying',
86
+ 'onProgress',
87
+ 'onRateChange',
88
+ 'onSeeked',
89
+ 'onSeeking',
90
+ 'onStalled',
91
+ 'onSuspend',
92
+ 'onTimeUpdate',
93
+ 'onVolumeChange',
94
+ 'onWaiting',
95
+ 'onClick',
96
+ 'onClickCapture',
97
+ 'onContextMenu',
98
+ 'onDoubleClick',
99
+ 'onDrag',
100
+ 'onDragEnd',
101
+ 'onDragEnter',
102
+ 'onDragExit',
103
+ 'onDragLeave',
104
+ 'onDragOver',
105
+ 'onDragStart',
106
+ 'onDrop',
107
+ 'onMouseDown',
108
+ 'onMouseDownCapture',
109
+ 'onMouseEnter',
110
+ 'onMouseLeave',
111
+ 'onMouseMove',
112
+ 'onMouseOut',
113
+ 'onMouseOver',
114
+ 'onMouseUp',
115
+ 'onMouseUpCapture',
116
+ 'onSelect',
117
+ 'onTouchCancel',
118
+ 'onTouchEnd',
119
+ 'onTouchMove',
120
+ 'onTouchStart',
121
+ 'onScroll',
122
+ 'onWheel',
123
+ 'onPointerCancel',
124
+ 'onPointerDown',
125
+ 'onPointerEnter',
126
+ 'onPointerLeave',
127
+ 'onPointerMove',
128
+ 'onPointerOut',
129
+ 'onPointerOver',
130
+ 'onPointerUp',
131
+ 'onGotPointerCapture',
132
+ 'onLostPointerCapture'
119
133
  ]);
120
-
121
- exports.optionProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['selected', 'value' // button, input, li, option, meter, progress, param
122
- ]);
123
- /**
124
- * An array of TABLE tag properties and events.
125
- *
126
- * @public
127
- */
128
- exports.tableProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['cellPadding', 'cellSpacing' // table
129
- ]);
130
- /**
131
- * An array of TR tag properties and events.
132
- *
133
- * @public
134
- */
135
- exports.trProperties = exports.htmlElementProperties;
136
- /**
137
- * An array of TH tag properties and events.
138
- *
139
- * @public
140
- */
141
- exports.thProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['colSpan', 'rowSpan', 'scope' // th
142
- ]);
143
- /**
144
- * An array of TD tag properties and events.
145
- *
146
- * @public
147
- */
148
- exports.tdProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope' // th
134
+ const baseElementProperties = /*#__PURE__*/ toObjectMap([
135
+ 'accessKey',
136
+ 'children',
137
+ 'className',
138
+ 'contentEditable',
139
+ 'dir',
140
+ 'draggable',
141
+ 'hidden',
142
+ 'htmlFor',
143
+ 'id',
144
+ 'lang',
145
+ 'ref',
146
+ 'role',
147
+ 'style',
148
+ 'tabIndex',
149
+ 'title',
150
+ 'translate',
151
+ 'spellCheck',
152
+ 'name'
149
153
  ]);
150
-
151
- exports.colGroupProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span' // col, colgroup
154
+ const microdataProperties = /*#__PURE__*/ toObjectMap([
155
+ 'itemID',
156
+ 'itemProp',
157
+ 'itemRef',
158
+ 'itemScope',
159
+ 'itemType'
152
160
  ]);
153
-
154
- exports.colProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span' // col, colgroup
155
- ]);
156
- /**
157
- * An array of FIELDSET tag properties and events.
158
- *
159
- * @public
160
- */
161
- exports.fieldsetProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['disabled', 'form' // button, fieldset, input, label, meter, object, output, select, textarea
162
- ]);
163
- /**
164
- * An array of FORM tag properties and events.
165
- *
166
- * @public
167
- */
168
- exports.formProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target' // form
169
- ]);
170
- /**
171
- * An array of IFRAME tag properties and events.
172
- *
173
- * @public
174
- */
175
- exports.iframeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width' // canvas, embed, iframe, img, input, object, video,
176
- ]);
177
- /**
178
- * An array of IMAGE tag properties and events.
179
- *
180
- * @public
181
- */
182
- exports.imgProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
183
- ]);
184
- /**
185
- * An array of DIALOG tag properties and events.
186
- *
187
- * @public
188
- */
189
- exports.dialogProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['open', 'onCancel', 'onClose']);
190
- /**
191
- * An array of DIV tag properties and events.
192
- *
193
- * @public
194
- */
195
- exports.divProperties = exports.htmlElementProperties;
196
- /**
197
- * Gets native supported props for an html element provided the allowance set. Use one of the property
198
- * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
199
- * props set. Note that all data- and aria- prefixed attributes will be allowed.
200
- * NOTE: getNativeProps should always be applied first when adding props to a react component. The
201
- * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.
202
- * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to
203
- * the component after an onClick function is added, then the getNativeProps onClick will override it.
204
- *
205
- * @public
206
- * @param props - The unfiltered input props
207
- * @param allowedPropNames - The array or record of allowed prop names.
208
- * @param excludedPropNames
209
- * @returns The filtered props
210
- */
211
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
212
- function getNativeProps(
213
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
161
+ const htmlElementProperties = /*#__PURE__*/ toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);
162
+ const labelProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
163
+ 'form'
164
+ ]);
165
+ const audioProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
166
+ 'height',
167
+ 'loop',
168
+ 'muted',
169
+ 'preload',
170
+ 'src',
171
+ 'width'
172
+ ]);
173
+ const videoProperties = /*#__PURE__*/ toObjectMap(audioProperties, [
174
+ 'poster'
175
+ ]);
176
+ const olProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
177
+ 'start'
178
+ ]);
179
+ const liProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
180
+ 'value'
181
+ ]);
182
+ const anchorProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
183
+ 'download',
184
+ 'href',
185
+ 'hrefLang',
186
+ 'media',
187
+ 'rel',
188
+ 'target',
189
+ 'type'
190
+ ]);
191
+ const timeProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
192
+ 'dateTime'
193
+ ]);
194
+ const buttonProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
195
+ 'autoFocus',
196
+ 'disabled',
197
+ 'form',
198
+ 'formAction',
199
+ 'formEncType',
200
+ 'formMethod',
201
+ 'formNoValidate',
202
+ 'formTarget',
203
+ 'type',
204
+ 'value'
205
+ ]);
206
+ const inputProperties = /*#__PURE__*/ toObjectMap(buttonProperties, [
207
+ 'accept',
208
+ 'alt',
209
+ 'autoCapitalize',
210
+ 'autoComplete',
211
+ 'checked',
212
+ 'dirname',
213
+ 'form',
214
+ 'height',
215
+ 'inputMode',
216
+ 'list',
217
+ 'max',
218
+ 'maxLength',
219
+ 'min',
220
+ 'multiple',
221
+ 'pattern',
222
+ 'placeholder',
223
+ 'readOnly',
224
+ 'required',
225
+ 'src',
226
+ 'step',
227
+ 'size',
228
+ 'type',
229
+ 'value',
230
+ 'width'
231
+ ]);
232
+ const textAreaProperties = /*#__PURE__*/ toObjectMap(buttonProperties, [
233
+ 'autoCapitalize',
234
+ 'cols',
235
+ 'dirname',
236
+ 'form',
237
+ 'maxLength',
238
+ 'placeholder',
239
+ 'readOnly',
240
+ 'required',
241
+ 'rows',
242
+ 'wrap'
243
+ ]);
244
+ const selectProperties = /*#__PURE__*/ toObjectMap(buttonProperties, [
245
+ 'form',
246
+ 'multiple',
247
+ 'required'
248
+ ]);
249
+ const optionProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
250
+ 'selected',
251
+ 'value'
252
+ ]);
253
+ const tableProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
254
+ 'cellPadding',
255
+ 'cellSpacing'
256
+ ]);
257
+ const trProperties = htmlElementProperties;
258
+ const thProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
259
+ 'colSpan',
260
+ 'rowSpan',
261
+ 'scope'
262
+ ]);
263
+ const tdProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
264
+ 'colSpan',
265
+ 'headers',
266
+ 'rowSpan',
267
+ 'scope'
268
+ ]);
269
+ const colGroupProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
270
+ 'span'
271
+ ]);
272
+ const colProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
273
+ 'span'
274
+ ]);
275
+ const fieldsetProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
276
+ 'disabled',
277
+ 'form'
278
+ ]);
279
+ const formProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
280
+ 'acceptCharset',
281
+ 'action',
282
+ 'encType',
283
+ 'encType',
284
+ 'method',
285
+ 'noValidate',
286
+ 'target'
287
+ ]);
288
+ const iframeProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
289
+ 'allow',
290
+ 'allowFullScreen',
291
+ 'allowPaymentRequest',
292
+ 'allowTransparency',
293
+ 'csp',
294
+ 'height',
295
+ 'importance',
296
+ 'referrerPolicy',
297
+ 'sandbox',
298
+ 'src',
299
+ 'srcDoc',
300
+ 'width'
301
+ ]);
302
+ const imgProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
303
+ 'alt',
304
+ 'crossOrigin',
305
+ 'height',
306
+ 'src',
307
+ 'srcSet',
308
+ 'useMap',
309
+ 'width'
310
+ ]);
311
+ const dialogProperties = /*#__PURE__*/ toObjectMap(htmlElementProperties, [
312
+ 'open',
313
+ 'onCancel',
314
+ 'onClose'
315
+ ]);
316
+ const divProperties = htmlElementProperties;
317
+ function getNativeProps(// eslint-disable-next-line @typescript-eslint/no-explicit-any
214
318
  props, allowedPropNames, excludedPropNames) {
215
- // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
216
- // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
217
- // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
218
- // return native props.
219
- // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
220
- const isArray = Array.isArray(allowedPropNames);
221
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
222
- const result = {};
223
- const keys = Object.keys(props);
224
- for (const key of keys) {
225
- const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
226
- if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
227
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
228
- result[key] = props[key];
319
+ // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
320
+ // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
321
+ // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
322
+ // return native props.
323
+ // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
324
+ const isArray = Array.isArray(allowedPropNames);
325
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
326
+ const result = {};
327
+ const keys = Object.keys(props);
328
+ for (const key of keys){
329
+ const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
330
+ if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
331
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
332
+ result[key] = props[key];
333
+ }
229
334
  }
230
- }
231
- return result;
232
- }
233
- exports.getNativeProps = getNativeProps;
335
+ return result;
336
+ } //# sourceMappingURL=properties.js.map
337
+
234
338
  //# sourceMappingURL=properties.js.map