UNPKG

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