Liferay.Loader.define("portal-search-web@6.0.90/js/components/SystemSettingsFieldList",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/tooltip","liferay!frontend-js-react-web$react"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r("@frontend-taglib-clay$clayui/button"),n=_interopRequireDefault(r("@frontend-taglib-clay$clayui/form")),l=_interopRequireDefault(r("@frontend-taglib-clay$clayui/icon")),i=r("@frontend-taglib-clay$clayui/tooltip"),o=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 r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=a?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(r,n,l):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("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 _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e={borderRadius:"10px",height:"18px",padding:"2px",position:"absolute",width:"18px"};var c=function SystemSettingsFieldList({fieldHelp:t,fieldLabel:r,fieldName:c,initialValue:u,namespace:f}){const[d,s]=(0,o.useState)(u||[]),_handleAddItem=e=>()=>{s([...d.slice(0,e+1),"",...d.slice(e+1)])},_handleRemoveItem=e=>()=>{s(d.filter(((t,r)=>e!==r)))},_handleValueChange=e=>t=>{const r=d.map(((r,a)=>e===a?t.target.value:r));s(r)};return o.default.createElement("div",{className:"system-settings-field-list-container"},d.map(((u,f)=>o.default.createElement(o.default.Fragment,{key:f},o.default.createElement(n.default.Group,null,f>0&&o.default.createElement(a.ClayButtonWithIcon,{className:"system-settings-field-list-delete-button",onClick:_handleRemoveItem(f),style:_objectSpread(_objectSpread({},e),{},{right:"30px"}),symbol:"hr",title:Liferay.Language.get("remove")}),o.default.createElement(a.ClayButtonWithIcon,{className:"system-settings-field-list-add-button",onClick:_handleAddItem(f),style:_objectSpread(_objectSpread({},e),{},{right:"8px"}),symbol:"plus",title:Liferay.Language.get("duplicate")}),o.default.createElement("label",{htmlFor:"".concat(c).concat(f)},r,o.default.createElement(i.ClayTooltipProvider,null,o.default.createElement("span",{className:"ml-2","data-tooltip-align":"top",title:t},o.default.createElement(l.default,{symbol:"question-circle-full"})))),o.default.createElement("textarea",{className:"form-control",id:"".concat(c).concat(f),onChange:_handleValueChange(f),value:u}))))),o.default.createElement("input",{name:"".concat(f).concat(c),type:"hidden",value:d.filter((e=>""!==e.trim())).join("|")}))};t.default=c}}));
//# sourceMappingURL=SystemSettingsFieldList.js.map