UNPKG

1.57 kBJavaScriptView Raw
1import { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps, } from './properties';
2var nativeElementMap = {
3 label: labelProperties,
4 audio: audioProperties,
5 video: videoProperties,
6 ol: olProperties,
7 li: liProperties,
8 a: anchorProperties,
9 button: buttonProperties,
10 input: inputProperties,
11 textarea: textAreaProperties,
12 select: selectProperties,
13 option: optionProperties,
14 table: tableProperties,
15 tr: trProperties,
16 th: thProperties,
17 td: tdProperties,
18 colGroup: colGroupProperties,
19 col: colProperties,
20 form: formProperties,
21 iframe: iframeProperties,
22 img: imgProperties,
23};
24/**
25 * Given an element tagname and user props, filters the props to only allowed props for the given
26 * element type.
27 * @param tagName - Tag name (e.g. "div")
28 * @param props - Props object
29 * @param excludedPropNames - List of props to disallow
30 */
31// eslint-disable-next-line @typescript-eslint/no-explicit-any
32export function getNativeElementProps(tagName, props, excludedPropNames) {
33 var allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;
34 return getNativeProps(props, allowedPropNames, excludedPropNames);
35}
36//# sourceMappingURL=getNativeElementProps.js.map
\No newline at end of file