UNPKG

2.16 kBJavaScriptView Raw
1/*
2 * Copyright 2018 Palantir Technologies, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { __assign, __rest } from "tslib";
17import classNames from "classnames";
18import * as React from "react";
19import { BLOCKQUOTE, CODE, CODE_BLOCK, HEADING, LABEL, LIST } from "../../common/classes";
20function htmlElement(tagName, tagClassName) {
21 /* eslint-disable-next-line react/display-name */
22 return function (props) {
23 var className = props.className, elementRef = props.elementRef, children = props.children, htmlProps = __rest(props, ["className", "elementRef", "children"]);
24 return React.createElement(tagName, __assign(__assign({}, htmlProps), { className: classNames(tagClassName, className), ref: elementRef }), children);
25 };
26}
27// the following components are linted by blueprint-html-components because
28// they should rarely be used without the Blueprint classes/styles:
29export var H1 = htmlElement("h1", HEADING);
30export var H2 = htmlElement("h2", HEADING);
31export var H3 = htmlElement("h3", HEADING);
32export var H4 = htmlElement("h4", HEADING);
33export var H5 = htmlElement("h5", HEADING);
34export var H6 = htmlElement("h6", HEADING);
35export var Blockquote = htmlElement("blockquote", BLOCKQUOTE);
36export var Code = htmlElement("code", CODE);
37export var Pre = htmlElement("pre", CODE_BLOCK);
38export var Label = htmlElement("label", LABEL);
39// these two are not linted by blueprint-html-components because there are valid
40// uses of these elements without Blueprint styles:
41export var OL = htmlElement("ol", LIST);
42export var UL = htmlElement("ul", LIST);
43//# sourceMappingURL=html.js.map
\No newline at end of file