"use strict";(()=>{var V=Object.defineProperty,K=Object.defineProperties;var M=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var v=(u,n,e)=>n in u?V(u,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[n]=e,m=(u,n)=>{for(var e in n||(n={}))O.call(n,e)&&v(u,e,n[e]);if(g)for(var e of g(n))z.call(n,e)&&v(u,e,n[e]);return u},B=(u,n)=>K(u,M(n));(self.webpackChunk_sap_ux_ui_components=self.webpackChunk_sap_ux_ui_components||[]).push([[530],{"./stories/UITranslationInput.story.tsx":(function(u,n,e){var S=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(n,"__esModule",{value:!0}),n.translationInput=void 0;const t=S(e("../../node_modules/.pnpm/react@16.14.0/node_modules/react/index.js")),T=e("../../node_modules/.pnpm/@fluentui+react@8.120.5_@types+react-dom@16.9.24_@types+react@16.14.55_react-dom@16.14.0_react@16.14.0/node_modules/@fluentui/react/lib-commonjs/index.js"),f=e("../../node_modules/.pnpm/@fluentui+react@8.120.5_@types+react-dom@16.9.24_@types+react@16.14.55_react-dom@16.14.0_react@16.14.0/node_modules/@fluentui/react/lib-commonjs/index.js"),d=e("./src/components/UITranslationInput/index.tsx"),D=e("./src/components/Icons.tsx"),U=e("./src/components/UITable/index.tsx"),C=e("./src/components/UIButton/index.tsx"),p=e("./src/components/UICheckbox/index.tsx");n.default={title:"Basic Inputs/Input"};const h={childrenGap:60},I="ui-components-i18n-bundle",w=()=>{let s={};try{s=JSON.parse(window.localStorage.getItem(I)||"")}catch(r){s={}}return s},k=s=>{window.localStorage.setItem(I,JSON.stringify(s))},N=()=>{const[s,r]=t.default.useState("Content"),[y,x]=t.default.useState(!1),[i,c]=t.default.useState(!1),[a,E]=t.default.useState(w()),_=(l,o)=>{r(o||"")},j=l=>{a[l.key.value]||(a[l.key.value]=[B(m({},l),{dummyPath:"dddd"})],k(a),E(m({},a)))},W=l=>{const o=document.querySelector(`div[data-i18n-key="${l.key.value}"]`);(o==null?void 0:o.parentElement).focus(),(0,T.setFocusVisibility)(!0,o==null?void 0:o.parentElement)},F=l=>{a[l]&&(delete a[l],k(a),E(m({},a)))},b=[];for(const l in a){const o=a[l];for(const R of o)b.push({key:l,value:R.value.value})}return t.default.createElement(f.Stack,{tokens:h,style:{width:"100%",height:"100%"}},t.default.createElement(f.Stack,{horizontal:!0,tokens:h},t.default.createElement(p.UICheckbox,{label:"Disabled",checked:y,onChange:(l,o)=>{x(o)}}),t.default.createElement(p.UICheckbox,{label:"Busy",checked:i,onChange:(l,o)=>{c(o)}})),t.default.createElement(f.Stack,{style:{width:"300px"}},t.default.createElement(d.UITranslationInput,{entries:a,id:"test",i18nPrefix:"i18n",allowedI18nPrefixes:["i18n","@i18n"],allowedPatterns:[d.TranslationTextPattern.SingleBracketBinding,d.TranslationTextPattern.DoubleBracketReplace],defaultPattern:d.TranslationTextPattern.SingleBracketBinding,value:s,onChange:_,onCreateNewEntry:j,onShowExistingEntry:W,disabled:y,busy:i?{busy:i,useMinWaitingTime:!0}:void 0})," "),t.default.createElement(P,{tableData:b,onDelete:F}))};n.translationInput=N;function P(s){const r=Array.from({length:3}).map((x,i)=>{const c={key:"test"+(i+1),name:"",fieldName:"",minWidth:100,maxWidth:300};return i===0?(c.name="Key",c.fieldName="key",c.onRender=a=>t.default.createElement("div",{"data-i18n-key":a.key},a.key)):i===1?(c.name="Value",c.fieldName="value"):i===2&&(c.name="Delete",c.minWidth=50,c.maxWidth=50,c.onRender=a=>t.default.createElement(C.UIIconButton,{onClick:()=>{s.onDelete(a.key)},iconProps:{iconName:D.UiIcons.TrashCan}})),c});return t.default.createElement(t.default.Fragment,null,t.default.createElement("style",null,".ms-Fabric--isFocusVisible .ms-DetailsList .ms-DetailsRow-cell:focus::after { z-index: -1; }"),t.default.createElement("div",{style:{position:"relative",height:"100%"}},t.default.createElement(U.UITable,{dataSetKey:"datasetkey",items:s.tableData,columns:r})))}})}]);})();
