Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.121/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","dynamic-data-mapping-form-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")),l=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),u=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),c=_interopRequireDefault(a("dynamic-data-mapping-form-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 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}}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(l.ClayInput.Group,null,i.default.createElement(l.ClayInput.GroupItem,{prepend:!0},i.default.createElement(l.ClayInput,{readOnly:!0,ref:c,value:e}),t&&i.default.createElement(l.default.FeedbackGroup,null,i.default.createElement(l.default.FeedbackItem,null,Liferay.Language.get("copied-to-clipboard")))),i.default.createElement(l.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(n.default,{symbol:"check"})):i.default.createElement("span",{className:"publish-button-text"},Liferay.Language.get("copy"))))))};t.default=_default}}));
//# sourceMappingURL=Link.es.js.map