cometchat-react-ui-kit2
Version:
CometChat UI Kit for React App
80 lines (79 loc) • 7 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.startConversationBtnStyle = exports.getListBaseStyle = exports.getConversationListStyle = exports.containerStyle = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _Shared = require("../../Shared");
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 containerStyle = function containerStyle(style, theme) {
var _theme$palette;
return {
height: style === null || style === void 0 ? void 0 : style.height,
width: style === null || style === void 0 ? void 0 : style.width,
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
position: "relative",
margin: '0px',
background: (style === null || style === void 0 ? void 0 : style.background) || (theme === null || theme === void 0 ? void 0 : (_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.getBackground())
};
};
exports.containerStyle = containerStyle;
var startConversationBtnStyle = function startConversationBtnStyle(style, theme, startConversationIconURL) {
var _theme$palette2;
var direction = _Shared.CometChatLocalize.isRTL() ? {
left: "16px"
} : {
right: "16px"
};
return _objectSpread({
WebkitMask: "url(".concat(startConversationIconURL, ")no-repeat left center "),
backgroundColor: "".concat((style === null || style === void 0 ? void 0 : style.startConversationIconTint) || (theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.getPrimary())),
height: "24px",
width: "24px",
cursor: "pointer",
position: "absolute",
top: "12px"
}, direction);
};
exports.startConversationBtnStyle = startConversationBtnStyle;
var getListBaseStyle = function getListBaseStyle(style, theme) {
var _theme$palette3, _theme$typography, _theme$palette4, _theme$palette5, _theme$palette6, _theme$palette7, _theme$typography2, _theme$palette8, _theme$palette9;
return {
width: "100%",
height: "100%",
border: style === null || style === void 0 ? void 0 : style.border,
borderRadius: "0",
background: (style === null || style === void 0 ? void 0 : style.background) || (theme === null || theme === void 0 ? void 0 : (_theme$palette3 = theme.palette) === null || _theme$palette3 === void 0 ? void 0 : _theme$palette3.getBackground()),
titleFont: (0, _Shared.fontHelper)(theme === null || theme === void 0 ? void 0 : (_theme$typography = theme.typography) === null || _theme$typography === void 0 ? void 0 : _theme$typography.heading),
titleColor: (style === null || style === void 0 ? void 0 : style.titleColor) || (theme === null || theme === void 0 ? void 0 : (_theme$palette4 = theme.palette) === null || _theme$palette4 === void 0 ? void 0 : _theme$palette4.getAccent()),
backIconTint: (style === null || style === void 0 ? void 0 : style.backIconTint) || (theme === null || theme === void 0 ? void 0 : (_theme$palette5 = theme.palette) === null || _theme$palette5 === void 0 ? void 0 : _theme$palette5.getPrimary()),
searchBorder: (style === null || style === void 0 ? void 0 : style.searchBorder) || "1px solid ".concat(theme === null || theme === void 0 ? void 0 : (_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.getAccent50()),
searchBorderRadius: style === null || style === void 0 ? void 0 : style.searchBorderRadius,
searchBackground: (style === null || style === void 0 ? void 0 : style.searchBackground) || (theme === null || theme === void 0 ? void 0 : (_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.getAccent50()),
searchTextFont: (style === null || style === void 0 ? void 0 : style.searchTextFont) || (0, _Shared.fontHelper)(theme === null || theme === void 0 ? void 0 : (_theme$typography2 = theme.typography) === null || _theme$typography2 === void 0 ? void 0 : _theme$typography2.subtitle1),
searchTextColor: (style === null || style === void 0 ? void 0 : style.searchTextColor) || (theme === null || theme === void 0 ? void 0 : (_theme$palette8 = theme.palette) === null || _theme$palette8 === void 0 ? void 0 : _theme$palette8.getAccent500()),
searchIconTint: (style === null || style === void 0 ? void 0 : style.searchIconTint) || (theme === null || theme === void 0 ? void 0 : (_theme$palette9 = theme.palette) === null || _theme$palette9 === void 0 ? void 0 : _theme$palette9.getAccent500())
};
};
exports.getListBaseStyle = getListBaseStyle;
var getConversationListStyle = function getConversationListStyle(style, theme) {
var _theme$palette10, _theme$typography3, _theme$palette11, _theme$typography4, _theme$palette12;
return {
width: "100%",
height: "100%",
background: style === null || style === void 0 ? void 0 : style.background,
border: "none",
borderRadius: "0",
loadingIconTint: theme === null || theme === void 0 ? void 0 : (_theme$palette10 = theme.palette) === null || _theme$palette10 === void 0 ? void 0 : _theme$palette10.getAccent600(),
emptyStateTextFont: (0, _Shared.fontHelper)(theme === null || theme === void 0 ? void 0 : (_theme$typography3 = theme.typography) === null || _theme$typography3 === void 0 ? void 0 : _theme$typography3.heading),
emptyStateTextColor: theme === null || theme === void 0 ? void 0 : (_theme$palette11 = theme.palette) === null || _theme$palette11 === void 0 ? void 0 : _theme$palette11.getAccent400(),
errorStateTextFont: (0, _Shared.fontHelper)(theme === null || theme === void 0 ? void 0 : (_theme$typography4 = theme.typography) === null || _theme$typography4 === void 0 ? void 0 : _theme$typography4.heading),
errorStateTextColor: theme === null || theme === void 0 ? void 0 : (_theme$palette12 = theme.palette) === null || _theme$palette12 === void 0 ? void 0 : _theme$palette12.getAccent400()
};
};
exports.getConversationListStyle = getConversationListStyle;