@fluentui/react-utilities 9.7.1 → 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 +34 -1
  3. package/CHANGELOG.md +14 -2
  4. package/dist/index.d.ts +15 -3
  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,450 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- 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;
5
- var toObjectMap = function () {
6
- var items = [];
7
- for (var _i = 0; _i < arguments.length; _i++) {
8
- items[_i] = arguments[_i];
9
- }
10
- var result = {};
11
- for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {
12
- var item = items_1[_a];
13
- var keys = Array.isArray(item) ? item : Object.keys(item);
14
- for (var _b = 0, keys_1 = keys; _b < keys_1.length; _b++) {
15
- var key = keys_1[_b];
16
- result[key] = 1;
17
- }
18
- }
19
- return result;
20
- };
21
- /**
22
- * An array of events that are allowed on every html element type.
23
- *
24
- * @public
25
- */
26
- exports.baseElementEvents = toObjectMap([
27
- 'onAuxClick',
28
- 'onCopy',
29
- 'onCut',
30
- 'onPaste',
31
- 'onCompositionEnd',
32
- 'onCompositionStart',
33
- 'onCompositionUpdate',
34
- 'onFocus',
35
- 'onFocusCapture',
36
- 'onBlur',
37
- 'onBlurCapture',
38
- 'onChange',
39
- 'onInput',
40
- 'onSubmit',
41
- 'onLoad',
42
- 'onError',
43
- 'onKeyDown',
44
- 'onKeyDownCapture',
45
- 'onKeyPress',
46
- 'onKeyUp',
47
- 'onAbort',
48
- 'onCanPlay',
49
- 'onCanPlayThrough',
50
- 'onDurationChange',
51
- 'onEmptied',
52
- 'onEncrypted',
53
- 'onEnded',
54
- 'onLoadedData',
55
- 'onLoadedMetadata',
56
- 'onLoadStart',
57
- 'onPause',
58
- 'onPlay',
59
- 'onPlaying',
60
- 'onProgress',
61
- 'onRateChange',
62
- 'onSeeked',
63
- 'onSeeking',
64
- 'onStalled',
65
- 'onSuspend',
66
- 'onTimeUpdate',
67
- 'onVolumeChange',
68
- 'onWaiting',
69
- 'onClick',
70
- 'onClickCapture',
71
- 'onContextMenu',
72
- 'onDoubleClick',
73
- 'onDrag',
74
- 'onDragEnd',
75
- 'onDragEnter',
76
- 'onDragExit',
77
- 'onDragLeave',
78
- 'onDragOver',
79
- 'onDragStart',
80
- 'onDrop',
81
- 'onMouseDown',
82
- 'onMouseDownCapture',
83
- 'onMouseEnter',
84
- 'onMouseLeave',
85
- 'onMouseMove',
86
- 'onMouseOut',
87
- 'onMouseOver',
88
- 'onMouseUp',
89
- 'onMouseUpCapture',
90
- 'onSelect',
91
- 'onTouchCancel',
92
- 'onTouchEnd',
93
- 'onTouchMove',
94
- 'onTouchStart',
95
- 'onScroll',
96
- 'onWheel',
97
- 'onPointerCancel',
98
- 'onPointerDown',
99
- 'onPointerEnter',
100
- 'onPointerLeave',
101
- 'onPointerMove',
102
- 'onPointerOut',
103
- 'onPointerOver',
104
- 'onPointerUp',
105
- 'onGotPointerCapture',
106
- 'onLostPointerCapture',
107
- ]);
108
- /**
109
- * An array of element attributes which are allowed on every html element type.
110
- *
111
- * @public
112
- */
113
- exports.baseElementProperties = toObjectMap([
114
- 'accessKey',
115
- 'children',
116
- 'className',
117
- 'contentEditable',
118
- 'dir',
119
- 'draggable',
120
- 'hidden',
121
- 'htmlFor',
122
- 'id',
123
- 'lang',
124
- 'ref',
125
- 'role',
126
- 'style',
127
- 'tabIndex',
128
- 'title',
129
- 'translate',
130
- 'spellCheck',
131
- 'name', // global
132
- ]);
133
- /**
134
- * An array of microdata attributes that are allowed on every html element type.
135
- *
136
- * @public
137
- */
138
- exports.microdataProperties = toObjectMap([
139
- 'itemID',
140
- 'itemProp',
141
- 'itemRef',
142
- 'itemScope',
143
- 'itemType', // global
144
- ]);
145
- /**
146
- * An array of HTML element properties and events.
147
- *
148
- * @public
149
- */
150
- exports.htmlElementProperties = toObjectMap(exports.baseElementProperties, exports.baseElementEvents, exports.microdataProperties);
151
- /**
152
- * An array of LABEL tag properties and events.
153
- *
154
- * @public
155
- */
156
- exports.labelProperties = toObjectMap(exports.htmlElementProperties, [
157
- 'form', // button, fieldset, input, label, meter, object, output, select, textarea
158
- ]);
159
- /**
160
- * An array of AUDIO tag properties and events.
161
-
162
- * @public
163
- */
164
- exports.audioProperties = toObjectMap(exports.htmlElementProperties, [
165
- 'height',
166
- 'loop',
167
- 'muted',
168
- 'preload',
169
- 'src',
170
- 'width', // canvas, embed, iframe, img, input, object, video
171
- ]);
172
- /**
173
- * An array of VIDEO tag properties and events.
174
- *
175
- * @public
176
- */
177
- exports.videoProperties = toObjectMap(exports.audioProperties, [
178
- 'poster', // video
179
- ]);
180
- /**
181
- * An array of OL tag properties and events.
182
- *
183
- * @public
184
- */
185
- exports.olProperties = toObjectMap(exports.htmlElementProperties, [
186
- 'start', // ol
187
- ]);
188
- /**
189
- * An array of LI tag properties and events.
190
- *
191
- * @public
192
- */
193
- exports.liProperties = toObjectMap(exports.htmlElementProperties, [
194
- 'value', // button, input, li, option, meter, progress, param
195
- ]);
196
- /**
197
- * An array of A tag properties and events.
198
- *
199
- * @public
200
- */
201
- exports.anchorProperties = toObjectMap(exports.htmlElementProperties, [
202
- 'download',
203
- 'href',
204
- 'hrefLang',
205
- 'media',
206
- 'rel',
207
- 'target',
208
- 'type', // a, button, input, link, menu, object, script, source, style
209
- ]);
210
- /**
211
- * An array of TIME tag properties and events.
212
- *
213
- * @public
214
- */
215
- exports.timeProperties = toObjectMap(exports.htmlElementProperties, [
216
- 'dateTime', // time
217
- ]);
218
- /**
219
- * An array of BUTTON tag properties and events.
220
- *
221
- * @public
222
- */
223
- exports.buttonProperties = toObjectMap(exports.htmlElementProperties, [
224
- 'autoFocus',
225
- 'disabled',
226
- 'form',
227
- 'formAction',
228
- 'formEncType',
229
- 'formMethod',
230
- 'formNoValidate',
231
- 'formTarget',
232
- 'type',
233
- 'value', // button, input, li, option, meter, progress, param,
234
- ]);
235
- /**
236
- * An array of INPUT tag properties and events.
237
- *
238
- * @public
239
- */
240
- exports.inputProperties = toObjectMap(exports.buttonProperties, [
241
- 'accept',
242
- 'alt',
243
- 'autoCapitalize',
244
- 'autoComplete',
245
- 'checked',
246
- 'dirname',
247
- 'form',
248
- 'height',
249
- 'inputMode',
250
- 'list',
251
- 'max',
252
- 'maxLength',
253
- 'min',
254
- 'multiple',
255
- 'pattern',
256
- 'placeholder',
257
- 'readOnly',
258
- 'required',
259
- 'src',
260
- 'step',
261
- 'size',
262
- 'type',
263
- 'value',
264
- 'width', // canvas, embed, iframe, img, input, object, video
265
- ]);
266
- /**
267
- * An array of TEXTAREA tag properties and events.
268
- *
269
- * @public
270
- */
271
- exports.textAreaProperties = toObjectMap(exports.buttonProperties, [
272
- 'autoCapitalize',
273
- 'cols',
274
- 'dirname',
275
- 'form',
276
- 'maxLength',
277
- 'placeholder',
278
- 'readOnly',
279
- 'required',
280
- 'rows',
281
- 'wrap', // textarea
282
- ]);
283
- /**
284
- * An array of SELECT tag properties and events.
285
- *
286
- * @public
287
- */
288
- exports.selectProperties = toObjectMap(exports.buttonProperties, [
289
- 'form',
290
- 'multiple',
291
- 'required', // input, select, textarea
292
- ]);
293
- exports.optionProperties = toObjectMap(exports.htmlElementProperties, [
294
- 'selected',
295
- 'value', // button, input, li, option, meter, progress, param
296
- ]);
297
- /**
298
- * An array of TABLE tag properties and events.
299
- *
300
- * @public
301
- */
302
- exports.tableProperties = toObjectMap(exports.htmlElementProperties, [
303
- 'cellPadding',
304
- 'cellSpacing', // table
305
- ]);
306
- /**
307
- * An array of TR tag properties and events.
308
- *
309
- * @public
310
- */
311
- exports.trProperties = exports.htmlElementProperties;
312
- /**
313
- * An array of TH tag properties and events.
314
- *
315
- * @public
316
- */
317
- exports.thProperties = toObjectMap(exports.htmlElementProperties, [
318
- 'colSpan',
319
- 'rowSpan',
320
- 'scope', // th
321
- ]);
322
- /**
323
- * An array of TD tag properties and events.
324
- *
325
- * @public
326
- */
327
- exports.tdProperties = toObjectMap(exports.htmlElementProperties, [
328
- 'colSpan',
329
- 'headers',
330
- 'rowSpan',
331
- 'scope', // th
332
- ]);
333
- exports.colGroupProperties = toObjectMap(exports.htmlElementProperties, [
334
- 'span', // col, colgroup
335
- ]);
336
- exports.colProperties = toObjectMap(exports.htmlElementProperties, [
337
- 'span', // col, colgroup
338
- ]);
339
- /**
340
- * An array of FIELDSET tag properties and events.
341
- *
342
- * @public
343
- */
344
- exports.fieldsetProperties = toObjectMap(exports.htmlElementProperties, [
345
- 'disabled',
346
- 'form', // button, fieldset, input, label, meter, object, output, select, textarea
347
- ]);
348
- /**
349
- * An array of FORM tag properties and events.
350
- *
351
- * @public
352
- */
353
- exports.formProperties = toObjectMap(exports.htmlElementProperties, [
354
- 'acceptCharset',
355
- 'action',
356
- 'encType',
357
- 'encType',
358
- 'method',
359
- 'noValidate',
360
- 'target', // form
361
- ]);
362
- /**
363
- * An array of IFRAME tag properties and events.
364
- *
365
- * @public
366
- */
367
- exports.iframeProperties = toObjectMap(exports.htmlElementProperties, [
368
- 'allow',
369
- 'allowFullScreen',
370
- 'allowPaymentRequest',
371
- 'allowTransparency',
372
- 'csp',
373
- 'height',
374
- 'importance',
375
- 'referrerPolicy',
376
- 'sandbox',
377
- 'src',
378
- 'srcDoc',
379
- 'width', // canvas, embed, iframe, img, input, object, video,
380
- ]);
381
- /**
382
- * An array of IMAGE tag properties and events.
383
- *
384
- * @public
385
- */
386
- exports.imgProperties = toObjectMap(exports.htmlElementProperties, [
387
- 'alt',
388
- 'crossOrigin',
389
- 'height',
390
- 'src',
391
- 'srcSet',
392
- 'useMap',
393
- 'width', // canvas, embed, iframe, img, input, object, video
394
- ]);
395
- /**
396
- * An array of DIALOG tag properties and events.
397
- *
398
- * @public
399
- */
400
- exports.dialogProperties = toObjectMap(exports.htmlElementProperties, ['open', 'onCancel', 'onClose']);
401
- /**
402
- * An array of DIV tag properties and events.
403
- *
404
- * @public
405
- */
406
- exports.divProperties = exports.htmlElementProperties;
407
- /**
408
- * Gets native supported props for an html element provided the allowance set. Use one of the property
409
- * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given
410
- * props set. Note that all data- and aria- prefixed attributes will be allowed.
411
- * NOTE: getNativeProps should always be applied first when adding props to a react component. The
412
- * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.
413
- * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to
414
- * the component after an onClick function is added, then the getNativeProps onClick will override it.
415
- *
416
- * @public
417
- * @param props - The unfiltered input props
418
- * @param allowedPropNames - The array or record of allowed prop names.
419
- * @param excludedPropNames
420
- * @returns The filtered props
421
- */
422
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
423
- function getNativeProps(
424
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
425
- props, allowedPropNames, excludedPropNames) {
426
- // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
427
- // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
428
- // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
429
- // return native props.
430
- // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
431
- var isArray = Array.isArray(allowedPropNames);
432
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
433
- var result = {};
434
- var keys = Object.keys(props);
435
- for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
436
- var key = keys_2[_i];
437
- var isNativeProp = (!isArray && allowedPropNames[key]) ||
438
- (isArray && allowedPropNames.indexOf(key) >= 0) ||
439
- key.indexOf('data-') === 0 ||
440
- key.indexOf('aria-') === 0;
441
- if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
442
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
443
- result[key] = props[key];
444
- }
445
- }
446
- return result;
447
- }
448
- exports.getNativeProps = getNativeProps;
449
- });
450
- //# sourceMappingURL=properties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/properties.ts"],"names":[],"mappings":";;;;IAAA,IAAM,WAAW,GAAG;QAAC,eAA+C;aAA/C,UAA+C,EAA/C,qBAA+C,EAA/C,IAA+C;YAA/C,0BAA+C;;QAClE,IAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;YAArB,IAAM,IAAI,cAAA;YACb,IAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE5D,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;gBAAnB,IAAM,GAAG,aAAA;gBACZ,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACjB;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF;;;;OAIG;IACU,QAAA,iBAAiB,GAAG,WAAW,CAAC;QAC3C,YAAY;QACZ,QAAQ;QACR,OAAO;QACP,SAAS;QACT,kBAAkB;QAClB,oBAAoB;QACpB,qBAAqB;QACrB,SAAS;QACT,gBAAgB;QAChB,QAAQ;QACR,eAAe;QACf,UAAU;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D,iBAA4B;QAE5B,6GAA6G;QAC7G,2GAA2G;QAC3G,2GAA2G;QAC3G,uBAAuB;QACvB,0GAA0G;QAE1G,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAChD,8DAA8D;QAC9D,IAAM,MAAM,GAAwB,EAAE,CAAC;QACvC,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEhC,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAnB,IAAM,GAAG,aAAA;YACZ,IAAM,YAAY,GAChB,CAAC,CAAC,OAAO,IAAK,gBAA2C,CAAC,GAAG,CAAC,CAAC;gBAC/D,CAAC,OAAO,IAAK,gBAA6B,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC7D,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC1B,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAE7B,IAAI,YAAY,IAAI,CAAC,CAAC,iBAAiB,IAAI,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,OAAO,CAAC,GAAG,CAAC,MAAK,CAAC,CAAC,CAAC,EAAE;gBAClF,8DAA8D;gBAC9D,MAAM,CAAC,GAAG,CAAC,GAAG,KAAM,CAAC,GAAG,CAAQ,CAAC;aAClC;SACF;QAED,OAAO,MAAW,CAAC;IACrB,CAAC;IA/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 'onAuxClick',\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 microdata attributes that are allowed on every html element type.\n *\n * @public\n */\nexport const microdataProperties = toObjectMap([\n 'itemID', // global\n 'itemProp', // global\n 'itemRef', // global\n 'itemScope', // global\n 'itemType', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);\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 TIME tag properties and events.\n *\n * @public\n */\nexport const timeProperties = toObjectMap(htmlElementProperties, [\n 'dateTime', // time\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 'colSpan', // td, th\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 FIELDSET tag properties and events.\n *\n * @public\n */\nexport const fieldsetProperties = toObjectMap(htmlElementProperties, [\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\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 * An array of DIALOG tag properties and events.\n *\n * @public\n */\nexport const dialogProperties = toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);\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 allowedPropNames - The array or record of allowed prop names.\n * @param excludedPropNames\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"]}