Liferay.Loader.define("journal-web@5.0.108/js/ImageInput.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","frontend-js-web","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function ImageInput({name:e,portletNamespace:t,previewURL:a}){const[c,o]=(0,i.useState)(a||""),d="".concat(t).concat(e),f=(0,i.useRef)();return i.default.createElement("div",{className:"mb-3"},a?i.default.createElement("div",{className:"aspect-ratio aspect-ratio-16-to-9 mb-2 rounded"},i.default.createElement("img",{alt:Liferay.Language.get("preview"),className:"aspect-ratio-item-fluid",src:a})):null,e?i.default.createElement(l.default.Group,null,i.default.createElement("label",{className:"sr-only",htmlFor:d},Liferay.Language.get("image")),i.default.createElement(l.ClayInput.Group,{small:!0},i.default.createElement(l.ClayInput.GroupItem,null,i.default.createElement("input",{className:"sr-only",id:d,name:e,onChange:e=>{var t,a;return o((null===(t=e.target.files)||void 0===t||null===(a=t[0])||void 0===a?void 0:a.name)||"")},ref:f,type:"file"}),i.default.createElement(l.ClayInput,{onClick:()=>{var e;return null===(e=f.current)||void 0===e?void 0:e.click()},placeholder:Liferay.Language.get("select-image"),readOnly:!0,sizing:"sm",value:c})),i.default.createElement(l.ClayInput.GroupItem,{shrink:!0},i.default.createElement(r.default,{displayType:"secondary",monospaced:!0,onClick:()=>{var e;return null===(e=f.current)||void 0===e?void 0:e.click()},small:!0,title:(0,u.sub)(c?Liferay.Language.get("change-x"):Liferay.Language.get("select-x"),Liferay.Language.get("image"))},i.default.createElement(n.default,{className:"mt-0",symbol:c?"change":"plus"}))))):null)};var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),l=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),u=a("frontend-js-web"),i=_interopRequireWildcard(a("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=ImageInput.es.js.map