@momentum-ui/react-collaboration
Version:
Cisco Momentum UI Framework for React Collaboration Applications
51 lines • 2.11 kB
JavaScript
/** @component label */
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React from 'react';
import PropTypes from 'prop-types';
var Label = function (_a) {
var children = _a.children, className = _a.className, htmlFor = _a.htmlFor, label = _a.label, theme = _a.theme, props = __rest(_a, ["children", "className", "htmlFor", "label", "theme"]);
return (React.createElement("label", __assign({ className: 'md-label' + "".concat(className ? " ".concat(className) : '') + "".concat(theme ? " md-label--".concat(theme) : ''), htmlFor: htmlFor }, props), label ? React.createElement("span", null, label) : children));
};
Label.propTypes = {
/** @prop Children nodes to render inside the Label | null */
children: PropTypes.node,
/** @prop HTML class name for associated Input | '' */
className: PropTypes.string,
/** @prop HTML ID for associated Input | null */
htmlFor: PropTypes.string.isRequired,
/** @prop Required Label text | null */
label: PropTypes.string,
/** @prop Set Label's color theme | '' */
theme: PropTypes.string,
};
Label.defaultProps = {
children: null,
className: '',
htmlFor: null,
label: null,
theme: '',
};
Label.displayName = 'Label';
export default Label;
//# sourceMappingURL=index.js.map