Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.150/admin/js/components/share-form/Link.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-dependencies-web$clipboard","liferay!frontend-js-react-web$react","../../util/dom"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),u=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),c=_interopRequireDefault(a("liferay!frontend-js-dependencies-web$clipboard")),i=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),o=a("../../util/dom");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 n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const useClipboardJS=e=>{(0,i.useEffect)((()=>{const t=new c.default(".ddm-copy-clipboard");return t.on("success",e),()=>{t.destroy()}}),[e])};var _default=({url:e})=>{const[t,a]=(0,i.useState)(!1),c=(0,i.useRef)(null);return useClipboardJS((0,i.useCallback)((()=>a(!t)),[t])),(0,i.useEffect)((()=>{t&&(0,o.selectText)(c.current)}),[t]),i.default.createElement("div",{className:(0,u.default)("share-form-modal-item-link form-group m-0",{"has-success":t})},i.default.createElement(n.ClayInput.Group,null,i.default.createElement(n.ClayInput.GroupItem,{prepend:!0},i.default.createElement(n.ClayInput,{readOnly:!0,ref:c,value:e}),t&&i.default.createElement(n.default.FeedbackGroup,null,i.default.createElement(n.default.FeedbackItem,null,Liferay.Language.get("copied-to-clipboard")))),i.default.createElement(n.ClayInput.GroupItem,{append:!0,shrink:!0},i.default.createElement(r.default,{"aria-label":t?Liferay.Language.get("copied"):Liferay.Language.get("copy"),className:"ddm-copy-clipboard","data-clipboard-text":e,displayType:t?"success":"secondary"},t?i.default.createElement("span",{className:"pl-2 pr-2 publish-button-success-icon"},i.default.createElement(l.default,{symbol:"check"})):i.default.createElement("span",{className:"publish-button-text"},Liferay.Language.get("copy"))))))};t.default=_default}}));
//# sourceMappingURL=Link.es.js.map