myprojectpackageprav
Version:
My package in npm
102 lines • 7.34 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var react_1 = tslib_1.__importStar(require("react"));
var input_select_1 = tslib_1.__importDefault(require("../../utils/controls/input-select"));
var actionbutton_1 = tslib_1.__importDefault(require("../buttons/actionbutton"));
var input_text_1 = tslib_1.__importDefault(require("../../utils/controls/input-text"));
var upload_file_1 = tslib_1.__importDefault(require("../upload/upload-file"));
var input_textarea_1 = tslib_1.__importDefault(require("../../utils/controls/input-textarea"));
require("./feedback.css");
var buttons_1 = tslib_1.__importDefault(require("../buttons/buttons"));
var popupTop = '';
var xpositionvalue = '';
var offsetLeftValue = '';
var offsetTopValue = '';
var elementHeightValue = '';
var offsetWidthValue = '';
function Feedback() {
/***** Responsive Popup Code Start*****/
var sitefeedback = (0, react_1.useRef)(null);
var popupbtnRef = (0, react_1.useRef)(null);
var _a = (0, react_1.useState)(1), xpositionvalueupdate = _a[0], setpopupwidthupdate = _a[1];
var _b = (0, react_1.useState)(1), popupheight = _b[0], setpopupheight = _b[1];
var _c = (0, react_1.useState)({
sitefeedback: false,
}), showActionPopups = _c[0], setShowActionPopups = _c[1];
var initialValues = ['sitefeedback'];
var _d = (0, react_1.useState)({
sitefeedback: false,
}), btnActionshowhide = _d[0], setActionbtnshowhide = _d[1];
(0, react_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 = tslib_1.__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(tslib_1.__assign(tslib_1.__assign({}, showhide), (_a = {}, _a[type] = value, _a)));
setShowActionPopups(tslib_1.__assign(tslib_1.__assign({}, showhide), (_b = {}, _b[type] = value, _b)));
}
}
return (react_1.default.createElement(react_1.default.Fragment, null,
react_1.default.createElement("div", { className: "mx-2" },
react_1.default.createElement(actionbutton_1.default, { 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_1.default.createElement("div", { className: 'popup', ref: popupbtnRef, style: { top: popupTop + 8, position: "absolute", overflow: "auto", left: xpositionvalueupdate, maxHeight: popupheight } },
react_1.default.createElement("h3", null, "Site Feedback"),
react_1.default.createElement("div", { className: "subtitle-color font-9 montserratregular" }, "Please let us know how we can make this site more usefull to you"),
react_1.default.createElement("div", { className: "pt-2" },
react_1.default.createElement(input_text_1.default, { inputProps: {
id: 'subject',
name: 'Subject',
className: 'font-12',
placeholder: 'Subject',
}, label: 'Subject', className: 'form-sm', isMandatory: true, formClassName: "ms-auto form-vertical" })),
react_1.default.createElement("div", { className: "pt-2" },
react_1.default.createElement(input_select_1.default, { inputProps: {
id: 'feedbackabout',
name: 'Feedback About',
placeholder: 'Select',
className: 'font-12',
}, label: 'Feedback About', formClassName: "form-vertical", className: 'form-sm' })),
react_1.default.createElement("div", { className: "pt-2" },
react_1.default.createElement(upload_file_1.default, null)),
react_1.default.createElement("div", { className: "pt-2" },
react_1.default.createElement(input_textarea_1.default, { inputProps: {
id: 'message',
name: 'Message',
className: 'font-12',
placeholder: 'Message',
}, label: 'Message', isMandatory: true, formClassName: "ms-auto form-vertical" })),
react_1.default.createElement("div", { className: 'pt-2 d-flex gap-2' },
react_1.default.createElement(buttons_1.default, { 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_1.default.createElement(actionbutton_1.default, { 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 })))
: ''));
}
exports.default = Feedback;
//# sourceMappingURL=feedback.js.map