@zohodesk/dot
Version:
In this Library, we Provide Some Basic Components to Build Your Application
109 lines (106 loc) • 3.49 kB
JavaScript
/**** Libraries ****/
import React, { Component } from 'react';
import { defaultProps } from "./props/defaultProps";
import { propTypes } from "./props/propTypes";
/**** Components ****/
import Lookup from "../../lookup/Lookup/Lookup";
import AlertHeader from "../AlertHeader/AlertHeader";
import Button from '@zohodesk/components/lib/Button/Button';
import Section from "../../lookup/Section/Section";
import FormAction from "../../FormAction/FormAction";
/**** CSS ****/
import style from "./AlertLookup.module.css";
export default class AlertLookup extends Component {
render() {
let {
isActive,
palette,
size,
type,
title,
message,
confirmationMessage,
submitText,
cancelText,
onSubmitClick,
onCancelClick,
children,
forwardRef,
onClose,
headerChildren,
wrapHeader,
sectionClassName,
dataId,
onLookupClick,
customClass,
needIcon,
iconName,
iconClass,
iconSize,
customProps,
isHtmlContent,
onEsc
} = this.props;
const {
LookupProps = {},
AlertHeaderProps = {},
PrimaryButtonProps = {},
SecondaryButtonProps = {}
} = customProps;
return /*#__PURE__*/React.createElement(Lookup, {
needFocusScope: true,
onClose: onEsc == 'close' ? onClose : onCancelClick,
isActive: isActive,
size: size,
dataId: dataId,
forwardRef: forwardRef,
onClick: onLookupClick,
customClass: customClass,
...LookupProps
}, /*#__PURE__*/React.createElement(AlertHeader, {
title: title,
palette: palette,
iconType: type,
needIcon: Boolean(type) || needIcon,
onClose: onClose,
breakChildren: wrapHeader,
iconName: iconName,
iconClass: iconClass,
iconSize: iconSize,
...AlertHeaderProps
}, headerChildren ? headerChildren() : null), /*#__PURE__*/React.createElement(Section, {
alignBox: "row",
className: style.section
}, /*#__PURE__*/React.createElement("div", {
className: `${style.innerSection} ${sectionClassName}`
}, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, isHtmlContent && message ? /*#__PURE__*/React.createElement("div", {
dangerouslySetInnerHTML: {
__html: message
}
}) : /*#__PURE__*/React.createElement("div", null, message), confirmationMessage && /*#__PURE__*/React.createElement("div", {
className: style.text
}, confirmationMessage))), submitText || onSubmitClick || cancelText || onCancelClick ? /*#__PURE__*/React.createElement(FormAction, {
size: "small",
paddingLeftSize: "xsmall"
}, /*#__PURE__*/React.createElement(Button, {
text: submitText,
dataId: dataId === 'alertPopup' ? 'alertConfirmButton' : `${dataId}_confirmButton`,
onClick: onSubmitClick,
palette: palette === 'primary' ? 'primaryFilled' : 'dangerFilled',
...PrimaryButtonProps
}), cancelText && /*#__PURE__*/React.createElement(Button, {
dataId: dataId === 'alertPopup' ? 'alertCancelButton' : `${dataId}_cancelButton`,
text: cancelText,
onClick: onCancelClick,
palette: "secondary",
...SecondaryButtonProps
})) : null));
}
}
AlertLookup.propTypes = propTypes;
AlertLookup.defaultProps = defaultProps; // if (__DOCS__) {
// AlertLookup.docs = {
// componentGroup: 'AlertLookup',
// folderName: 'Alert'
// };
// }