@chayns-components/core
Version:
A set of beautiful React components for developing your own applications with chayns.
25 lines (24 loc) • 601 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isTextOnlyElement = void 0;
var _react = require("react");
const isTextOnlyElement = element => {
if (typeof element === 'string') {
return true;
}
if (! /*#__PURE__*/(0, _react.isValidElement)(element)) {
return false;
}
const validTags = ['p', 'span', 'div'];
if (!validTags.includes(element.type)) {
return false;
}
const {
children
} = element.props;
return typeof children === 'string';
};
exports.isTextOnlyElement = isTextOnlyElement;
//# sourceMappingURL=tooltip.js.map