myprojectpackageprav
Version:
My package in npm
99 lines • 6.69 kB
JavaScript
import { __assign } from "tslib";
import React, { useState, useRef, useEffect } from "react";
import InputSelect from "../../utils/controls/input-select";
import ActionButtons from '../buttons/actionbutton';
import InputText from '../../utils/controls/input-text';
import FileUpload from "../upload/upload-file";
import InputTextarea from "../../utils/controls/input-textarea";
import "./feedback.css";
import Buttons from "../buttons/buttons";
var popupTop = '';
var xpositionvalue = '';
var offsetLeftValue = '';
var offsetTopValue = '';
var elementHeightValue = '';
var offsetWidthValue = '';
export default function Feedback() {
/***** Responsive Popup Code Start*****/
var sitefeedback = useRef(null);
var popupbtnRef = useRef(null);
var _a = useState(1), xpositionvalueupdate = _a[0], setpopupwidthupdate = _a[1];
var _b = useState(1), popupheight = _b[0], setpopupheight = _b[1];
var _c = useState({
sitefeedback: false,
}), showActionPopups = _c[0], setShowActionPopups = _c[1];
var initialValues = ['sitefeedback'];
var _d = useState({
sitefeedback: false,
}), btnActionshowhide = _d[0], setActionbtnshowhide = _d[1];
useEffect(function () {
setpopupheight(window.innerHeight - (Number(offsetTopValue) + 58));
var popupwidthdata = popupbtnRef.current ? popupbtnRef.current.offsetWidth : 0;
// setpopupwidth(popupwidthdata)
if (popupwidthdata < xpositionvalue) {
xpositionvalue = xpositionvalue - popupwidthdata;
setpopupwidthupdate(xpositionvalue);
}
else if (popupwidthdata > offsetLeftValue && popupwidthdata < (window.innerWidth - (offsetLeftValue + offsetWidthValue))) {
xpositionvalue = offsetLeftValue;
setpopupwidthupdate(xpositionvalue);
}
else if (popupwidthdata > offsetLeftValue && popupwidthdata > (window.innerWidth - (offsetLeftValue + offsetWidthValue))) {
xpositionvalue = 0;
setpopupwidthupdate(xpositionvalue);
}
}, [showActionPopups]);
var showhide = __assign({}, btnActionshowhide);
function popupCloseOpenFunctionality(type, value, top, xposition, left, Ref, elementHeight, offsetWidth) {
var _a, _b;
popupTop = top;
xpositionvalue = xposition;
offsetLeftValue = left;
offsetTopValue = top;
elementHeightValue = elementHeight;
offsetWidthValue = offsetWidth;
initialValues.forEach(function (element) {
showhide[element] = false;
});
setActionbtnshowhide(showhide);
if (type) {
setActionbtnshowhide(__assign(__assign({}, showhide), (_a = {}, _a[type] = value, _a)));
setShowActionPopups(__assign(__assign({}, showhide), (_b = {}, _b[type] = value, _b)));
}
}
return (React.createElement(React.Fragment, null,
React.createElement("div", { className: "mx-2" },
React.createElement(ActionButtons, { label: "Site Feedback", name: 'Site Feedback', className: (btnActionshowhide === null || btnActionshowhide === void 0 ? void 0 : btnActionshowhide.sitefeedback) ? 'btn-border btn btn-sm font-0 font-md-14 btn-border-radius3 p-relative popup-arrow' : 'btn-border btn btn-sm font-0 font-md-14 btn-border-radius3 p-relative', icon: "icon-feedback color-primary font-16 me-md-1 bold", isClick: 'sitefeedback', type: "button", ref: sitefeedback, popupCloseOpenFunctionality: popupCloseOpenFunctionality, showhide: showActionPopups.sitefeedback, props: undefined, inputProps: undefined, onClick: undefined, reference: undefined, btnclassName: undefined, id: undefined, badgeinfo: undefined, badge: undefined, ricon: undefined, "aria-label": undefined })),
(btnActionshowhide === null || btnActionshowhide === void 0 ? void 0 : btnActionshowhide.sitefeedback) ?
React.createElement("div", { className: 'popup', ref: popupbtnRef, style: { top: popupTop + 8, position: "absolute", overflow: "auto", left: xpositionvalueupdate, maxHeight: popupheight } },
React.createElement("h3", null, "Site Feedback"),
React.createElement("div", { className: "subtitle-color font-9 montserratregular" }, "Please let us know how we can make this site more usefull to you"),
React.createElement("div", { className: "pt-2" },
React.createElement(InputText, { inputProps: {
id: 'subject',
name: 'Subject',
className: 'font-12',
placeholder: 'Subject',
}, label: 'Subject', className: 'form-sm', isMandatory: true, formClassName: "ms-auto form-vertical" })),
React.createElement("div", { className: "pt-2" },
React.createElement(InputSelect, { inputProps: {
id: 'feedbackabout',
name: 'Feedback About',
placeholder: 'Select',
className: 'font-12',
}, label: 'Feedback About', formClassName: "form-vertical", className: 'form-sm' })),
React.createElement("div", { className: "pt-2" },
React.createElement(FileUpload, null)),
React.createElement("div", { className: "pt-2" },
React.createElement(InputTextarea, { inputProps: {
id: 'message',
name: 'Message',
className: 'font-12',
placeholder: 'Message',
}, label: 'Message', isMandatory: true, formClassName: "ms-auto form-vertical" })),
React.createElement("div", { className: 'pt-2 d-flex gap-2' },
React.createElement(Buttons, { label: "Ok", "aria-label": "Ok", icon: "icon-checked font-12 me-1", className: 'btn btn-sm btn-primary whitetext font-0 font-md-14 btn-border-radius3 ms-auto ' }),
React.createElement(ActionButtons, { label: "Cancel", name: "Cancel", className: 'btn-bgcolor5 whitetext btn btn-sm font-0 font-md-14 btn-border-radius3', icon: "icon-close font-10 me-1", type: "button", isClick: 'sitefeedback', ref: sitefeedback, popupCloseOpenFunctionality: popupCloseOpenFunctionality, showhide: showActionPopups.sitefeedback, props: undefined, inputProps: undefined, onClick: undefined, reference: undefined, btnclassName: undefined, id: undefined, badgeinfo: undefined, badge: undefined, ricon: undefined, "aria-label": undefined })))
: ''));
}
//# sourceMappingURL=feedback.js.map