cometchat-react-ui-kit2
Version:
CometChat UI Kit for React App
134 lines (133 loc) • 5.59 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.typingTextStyle = exports.titleStyle = exports.subTitleStyle = exports.subMenuStyles = exports.listItemStyle = exports.itemTitleStyle = exports.itemThumbnailStyle = exports.itemThreadIndicatorStyle = exports.itemSubTitleStyle = exports.itemDetailStyle = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _ = require("../..");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var listItemStyle = function listItemStyle(style, theme, isActive) {
return {
display: "flex",
flexDirection: "row",
justifyContent: "left",
alignItems: "center",
cursor: "pointer",
width: style === null || style === void 0 ? void 0 : style.width,
padding: "0px 8px",
position: "relative",
background: isActive ? style === null || style === void 0 ? void 0 : style.activeBackground : style === null || style === void 0 ? void 0 : style.background
};
};
exports.listItemStyle = listItemStyle;
var itemThumbnailStyle = function itemThumbnailStyle() {
return {
display: "flex",
position: "relative",
flexShrink: "0",
justifyContent: "center",
alignItems: "center",
padding: "8px 0px"
};
};
exports.itemThumbnailStyle = itemThumbnailStyle;
var itemDetailStyle = function itemDetailStyle(style, theme) {
var margin = _.CometChatLocalize.isRTL() ? {
marginRight: "16px"
} : {
marginLeft: "16px"
};
return _objectSpread({
//TODO: This needs to be replaced with Divider
borderBottom: (style === null || style === void 0 ? void 0 : style.border) || "1px solid " + (theme === null || theme === void 0 ? void 0 : theme.palette.getAccent200()),
padding: "8px 0px",
width: "100%",
height: "100%"
}, margin);
};
exports.itemDetailStyle = itemDetailStyle;
var itemTitleStyle = function itemTitleStyle() {
return {
display: "flex",
justifyContent: "space-between",
alignItems: "center"
};
};
exports.itemTitleStyle = itemTitleStyle;
var itemSubTitleStyle = function itemSubTitleStyle() {
return {
display: "flex",
justifyContent: "space-between",
alignItems: "center"
};
};
exports.itemSubTitleStyle = itemSubTitleStyle;
var titleStyle = function titleStyle(style) {
return {
font: style === null || style === void 0 ? void 0 : style.titleFont,
color: style === null || style === void 0 ? void 0 : style.titleColor,
display: "block",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
lineHeight: "22px",
width: "75%",
minWidth: "100px"
};
};
exports.titleStyle = titleStyle;
var subTitleStyle = function subTitleStyle(style) {
return {
font: style === null || style === void 0 ? void 0 : style.subtitleFont,
color: style === null || style === void 0 ? void 0 : style.subtitleColor,
width: "calc(100% - 24px)",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
lineHeight: "1",
margin: "0"
};
};
exports.subTitleStyle = subTitleStyle;
var typingTextStyle = function typingTextStyle(style) {
return {
font: style === null || style === void 0 ? void 0 : style.typingIndicatorTextFont,
color: style === null || style === void 0 ? void 0 : style.typingIndicatorTextColor,
width: "calc(100% - 24px)",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
lineHeight: "1",
margin: "0"
};
};
exports.typingTextStyle = typingTextStyle;
var itemThreadIndicatorStyle = function itemThreadIndicatorStyle(style) {
return {
font: style === null || style === void 0 ? void 0 : style.subtitleFont,
color: style === null || style === void 0 ? void 0 : style.subtitleColor,
width: "calc(100% - 24px)",
lineHeight: "20px"
};
};
exports.itemThreadIndicatorStyle = itemThreadIndicatorStyle;
var subMenuStyles = function subMenuStyles(style, theme) {
var _theme$palette, _theme$palette2;
var leftRightPosition = _.CometChatLocalize.isRTL() ? {
left: "0"
} : {
right: "0"
};
return _objectSpread({
position: "absolute",
width: "auto",
height: style === null || style === void 0 ? void 0 : style.height,
padding: "0px 16px",
moreIconTint: theme === null || theme === void 0 ? void 0 : (_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.getAccent50(),
iconTint: theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.getAccent(),
top: 0
}, leftRightPosition);
};
exports.subMenuStyles = subMenuStyles;