@fluentui/react-utilities 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230321-0440.1
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.
- package/CHANGELOG.json +5 -5
- package/CHANGELOG.md +5 -5
- package/lib/compose/getSlots.js +7 -6
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.js +4 -4
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js +2 -2
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/resolveShorthand.js +3 -3
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.js +1 -1
- package/lib/compose/types.js.map +1 -1
- package/lib/events/index.js +1 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/mouseTouchHelpers.js +4 -5
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/index.js +12 -12
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js +7 -7
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +3 -3
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +6 -6
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +4 -3
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +2 -2
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +23 -20
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +7 -7
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js +5 -5
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.js +6 -5
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js +3 -2
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js +2 -2
- package/lib/ssr/index.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js +2 -2
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/index.js +4 -4
- package/lib/trigger/index.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js +0 -1
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/trigger/types.js +1 -1
- package/lib/trigger/types.js.map +1 -1
- package/lib/utils/clamp.js +2 -1
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +4 -4
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +7 -6
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +2 -3
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js +8 -8
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js +4 -2
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js +5 -5
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js +4 -3
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js +2 -1
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +55 -28
- package/lib/utils/properties.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +55 -47
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js +7 -8
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +37 -9
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +32 -25
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js +2 -5
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/events/index.js +4 -5
- package/lib-commonjs/events/index.js.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.js +37 -40
- package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
- package/lib-commonjs/hooks/index.js +15 -16
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +64 -63
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +31 -25
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +23 -15
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +11 -9
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +47 -48
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +16 -10
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +27 -25
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +115 -109
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +36 -33
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +15 -17
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
- package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +30 -30
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +214 -52
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +59 -56
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js +12 -12
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +5 -6
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +31 -29
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +36 -16
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +7 -8
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js +11 -10
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js +2 -5
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +9 -10
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +61 -54
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +21 -22
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js +24 -24
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +11 -12
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +12 -12
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +24 -20
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js +13 -14
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js +17 -18
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +223 -327
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/package.json +5 -4
- package/.swcrc +0 -39
@@ -1,338 +1,234 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
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
|
4
|
+
value: true
|
41
5
|
});
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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;
|
49
13
|
}
|
50
|
-
|
14
|
+
}
|
15
|
+
return result;
|
51
16
|
};
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
]);
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
const microdataProperties = /*#__PURE__*/ toObjectMap([
|
155
|
-
"itemID",
|
156
|
-
"itemProp",
|
157
|
-
"itemRef",
|
158
|
-
"itemScope",
|
159
|
-
"itemType"
|
160
|
-
]);
|
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"
|
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
|
301
119
|
]);
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
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
|
310
149
|
]);
|
311
|
-
|
312
|
-
|
313
|
-
"onCancel",
|
314
|
-
"onClose"
|
150
|
+
|
151
|
+
exports.colGroupProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span' // col, colgroup
|
315
152
|
]);
|
316
|
-
|
317
|
-
|
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
|
318
214
|
props, allowedPropNames, excludedPropNames) {
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
}
|
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];
|
334
229
|
}
|
335
|
-
|
336
|
-
|
337
|
-
|
230
|
+
}
|
231
|
+
return result;
|
232
|
+
}
|
233
|
+
exports.getNativeProps = getNativeProps;
|
338
234
|
//# sourceMappingURL=properties.js.map
|