cometchat-react-ui-kit2
Version:
CometChat UI Kit for React App
214 lines (213 loc) • 9.15 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.passwordInputStyle = exports.nameInputStyle = exports.errorTextStyle = exports.errorIconStyle = exports.errorContainerStyle = exports.createGroupWrapperStyle = exports.createGroupTitleStyle = exports.createGroupTabStyle = exports.createGroupTabListStyle = exports.createGroupTabContainerStyle = exports.createGroupInputPassword = exports.createGroupInputName = exports.createGroupInput = exports.createGroupHeader = exports.createGroupButton = exports.createGroupBodyStyle = exports.createButtonStyle = exports.closeIconStyle = 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 createGroupWrapperStyle = function createGroupWrapperStyle(style, theme) {
return {
width: style === null || style === void 0 ? void 0 : style.width,
height: style === null || style === void 0 ? void 0 : style.height,
border: (style === null || style === void 0 ? void 0 : style.border) || "1px solid ".concat(theme.palette.accent50[theme.palette.mode]),
boxShadow: style.boxShadow || "".concat(theme.palette.accent50[theme.palette.mode], " 0 16px 32px, ").concat(theme.palette.accent50[theme.palette.mode], " 0 0 0 1px"),
background: (style === null || style === void 0 ? void 0 : style.background) || theme.palette.background[theme.palette.mode],
borderRadius: style === null || style === void 0 ? void 0 : style.borderRadius,
overflow: "hidden",
position: "fixed",
margin: "0 auto",
cursor: "default"
};
};
exports.createGroupWrapperStyle = createGroupWrapperStyle;
var createGroupBodyStyle = function createGroupBodyStyle() {
return {
display: "flex",
flexDirection: "column",
position: "relative",
width: "100%",
height: "calc(100% - 65px)",
padding: "16px"
};
};
exports.createGroupBodyStyle = createGroupBodyStyle;
var closeIconStyle = function closeIconStyle(style, img, theme) {
var _theme$palette;
return {
position: "absolute",
width: "24px",
height: "24px",
top: "3%",
right: "3%",
WebkitMask: "url(".concat(img, ") center center no-repeat"),
background: style.closeIconTint || (theme === null || theme === void 0 ? void 0 : (_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.getPrimary()),
cursor: "pointer"
};
};
exports.closeIconStyle = closeIconStyle;
var createGroupHeader = function createGroupHeader() {
return {
padding: "20px"
};
};
exports.createGroupHeader = createGroupHeader;
var createGroupTitleStyle = function createGroupTitleStyle(style, theme) {
var _theme$palette2;
return {
margin: "0",
font: style.titleFont || (0, _Shared.fontHelper)(theme.typography.heading),
color: style.titleColor || (theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.getAccent()),
textAlign: "center"
};
};
exports.createGroupTitleStyle = createGroupTitleStyle;
var createGroupTabContainerStyle = function createGroupTabContainerStyle(style) {
return {
borderRadius: "8px",
width: style === null || style === void 0 ? void 0 : style.width,
margin: "0"
};
};
exports.createGroupTabContainerStyle = createGroupTabContainerStyle;
var createGroupTabListStyle = function createGroupTabListStyle(style) {
return {
padding: "0",
borderRadius: "8px",
display: "flex",
alignItems: "center",
justifyContent: "center",
margin: "auto",
height: "inherit",
width: "inherit",
background: style === null || style === void 0 ? void 0 : style.groupTypeTextBackground
};
};
exports.createGroupTabListStyle = createGroupTabListStyle;
var createGroupTabStyle = function createGroupTabStyle(style, theme, activeTab, tab, isHovering) {
var activeTabStyle;
if (activeTab === tab) {
activeTabStyle = {
background: style === null || style === void 0 ? void 0 : style.groupTypeTextActiveBackground,
height: "28px",
boxShadow: "".concat(theme.palette.getAccent50(), " 0px 0px 0px 1px"),
borderRadius: "8px"
};
}
return _objectSpread({
width: "110px",
textFont: style === null || style === void 0 ? void 0 : style.groupTypeTextFont,
textColor: style === null || style === void 0 ? void 0 : style.groupTypeTextColor,
display: "flex",
alignItems: "center",
justifyContent: "center",
background: isHovering ? style === null || style === void 0 ? void 0 : style.groupTypeTextActiveBackground : "transparent"
}, activeTabStyle);
};
exports.createGroupTabStyle = createGroupTabStyle;
var createGroupInput = function createGroupInput(style) {
return {
width: style === null || style === void 0 ? void 0 : style.width,
border: "none",
outline: "none"
};
};
exports.createGroupInput = createGroupInput;
var createGroupInputName = function createGroupInputName() {
return {
margin: "20px 0px 8px 0px",
padding: "4px 0px"
};
};
exports.createGroupInputName = createGroupInputName;
var createGroupInputPassword = function createGroupInputPassword() {
return {
padding: "4px 0px"
};
};
exports.createGroupInputPassword = createGroupInputPassword;
var nameInputStyle = function nameInputStyle(style, theme) {
return {
background: style.nameInputBackground,
border: style.nameInputBorder,
borderRadius: style.nameInputBorderRadius || "8px",
boxShadow: style.nameInputBoxShadow,
width: style === null || style === void 0 ? void 0 : style.width,
height: "46px",
outline: "none",
padding: "6px 12px"
};
};
exports.nameInputStyle = nameInputStyle;
var passwordInputStyle = function passwordInputStyle(style, theme) {
return {
background: style.passwordInputBackground,
border: style.passwordInputBorder,
borderRadius: style.passwordInputBorderRadius || "8px",
boxShadow: style.passInputBoxShadow,
width: style === null || style === void 0 ? void 0 : style.width,
height: "46px",
outline: "none",
padding: "6px 12px"
};
};
exports.passwordInputStyle = passwordInputStyle;
var errorContainerStyle = function errorContainerStyle(style, theme) {
return {
width: style === null || style === void 0 ? void 0 : style.width,
padding: "10px 0px",
marginTop: "16px",
display: "flex",
justifyContent: "center",
alignItems: "center",
background: style.errorTextBackground || "rgba(255, 59, 48, 0.1)",
border: (style === null || style === void 0 ? void 0 : style.errorTextBorder) || "none",
borderRadius: (style === null || style === void 0 ? void 0 : style.errorTextBorderRadius) || "8px"
};
};
exports.errorContainerStyle = errorContainerStyle;
var errorIconStyle = function errorIconStyle() {
return {
iconBackground: "RGB(255, 59, 48)",
iconTint: "white",
iconBackgroundWidth: "38px",
iconBackgroundHeight: "38px",
iconWidth: "24px",
iconHeight: "24px",
margin: "0px 12px"
};
};
exports.errorIconStyle = errorIconStyle;
var errorTextStyle = function errorTextStyle(style, theme) {
return {
color: (style === null || style === void 0 ? void 0 : style.errorTextColor) || theme.palette.getError(),
font: (style === null || style === void 0 ? void 0 : style.errorTextFont) || (0, _Shared.fontHelper)(theme.typography.text1)
};
};
exports.errorTextStyle = errorTextStyle;
var createGroupButton = function createGroupButton(style) {
return {
display: "inline-block",
width: "calc(100% - 30px)",
position: "absolute",
bottom: "0",
right: "0",
left: "0",
margin: "16px"
};
};
exports.createGroupButton = createGroupButton;
var createButtonStyle = function createButtonStyle(style, theme) {
return {
width: style === null || style === void 0 ? void 0 : style.width,
height: "46px",
outline: "0",
borderRadius: style.createGroupButtonBorderRadius || "8px",
font: style.createGroupButtonTextFont,
color: style.createGroupButtonTextColor,
background: style.createGroupButtonBackground
};
};
exports.createButtonStyle = createButtonStyle;