UNPKG

wix-style-react

Version:
43 lines (37 loc) 2.26 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["children"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } import React from 'react'; import PropTypes from 'prop-types'; import Text from '../../Text'; import { dataHooks } from '../constants'; import { classes } from '../Notification.st.css'; import { EllipsisCommonProps } from '../../common/PropTypes/EllipsisCommon'; import { FontUpgradeContext } from '../../FontUpgrade/context'; var TextLabel = function TextLabel(_ref) { var children = _ref.children, ellipsisProps = _objectWithoutProperties(_ref, _excluded); return /*#__PURE__*/React.createElement(FontUpgradeContext.Consumer, null, function (_ref2) { var isMadefor = _ref2.active; return /*#__PURE__*/React.createElement("div", { className: classes.label }, /*#__PURE__*/React.createElement(Text, _extends({ weight: isMadefor ? 'normal' : 'thin' }, ellipsisProps, { light: true, dataHook: dataHooks.notificationLabel }), children)); }); }; TextLabel.propTypes = _objectSpread({ children: PropTypes.node }, EllipsisCommonProps); TextLabel.defaultProps = { ellipsis: true, placement: 'bottom' }; TextLabel.displayName = 'Notification.TextLabel'; export default TextLabel;