solace-ui-components 17.0.8 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/charts.js +1 -1
  2. package/dist/charts.modern.mjs +1 -1
  3. package/dist/{chunk-NNUFUUDL.modern.mjs → chunk-2RTZL4CF.modern.mjs} +3 -3
  4. package/dist/chunk-2RTZL4CF.modern.mjs.map +1 -0
  5. package/dist/chunk-4XH33OL7.js +384 -0
  6. package/dist/chunk-4XH33OL7.js.map +1 -0
  7. package/dist/chunk-7SKICMGL.js +2 -0
  8. package/dist/{chunk-3NKPHQNZ.js.map → chunk-7SKICMGL.js.map} +1 -1
  9. package/dist/{chunk-KQ4FCALU.js → chunk-AOKITPX2.js} +2 -2
  10. package/dist/{chunk-KQ4FCALU.js.map → chunk-AOKITPX2.js.map} +1 -1
  11. package/dist/chunk-GDZZVHFP.js +2 -0
  12. package/dist/{chunk-MIW6EPF2.js.map → chunk-GDZZVHFP.js.map} +1 -1
  13. package/dist/chunk-HLXBN2OE.modern.mjs +2 -0
  14. package/dist/{chunk-BRCNJ6YU.modern.mjs.map → chunk-HLXBN2OE.modern.mjs.map} +1 -1
  15. package/dist/chunk-IHSXSGCC.modern.mjs +384 -0
  16. package/dist/chunk-IHSXSGCC.modern.mjs.map +1 -0
  17. package/dist/{chunk-VEVQME3E.modern.mjs → chunk-QV564WAK.modern.mjs} +2 -2
  18. package/dist/{chunk-VEVQME3E.modern.mjs.map → chunk-QV564WAK.modern.mjs.map} +1 -1
  19. package/dist/{chunk-3EP6QO5T.modern.mjs → chunk-ROSPS5NM.modern.mjs} +2 -2
  20. package/dist/{chunk-3EP6QO5T.modern.mjs.map → chunk-ROSPS5NM.modern.mjs.map} +1 -1
  21. package/dist/{chunk-37IHMN4Z.js → chunk-TSSPQLS6.js} +3 -3
  22. package/dist/chunk-TSSPQLS6.js.map +1 -0
  23. package/dist/{chunk-ER6Q72GN.js → chunk-UFDVHFXE.js} +2 -2
  24. package/dist/{chunk-ER6Q72GN.js.map → chunk-UFDVHFXE.js.map} +1 -1
  25. package/dist/chunk-ULYCLLUO.modern.mjs +2 -0
  26. package/dist/{chunk-OIYJ7CVG.modern.mjs.map → chunk-ULYCLLUO.modern.mjs.map} +1 -1
  27. package/dist/code-editor.js +1 -1
  28. package/dist/code-editor.js.map +1 -1
  29. package/dist/code-editor.modern.mjs +1 -1
  30. package/dist/code-editor.modern.mjs.map +1 -1
  31. package/dist/datepicker.js +1 -1
  32. package/dist/datepicker.modern.mjs +1 -1
  33. package/dist/drag-drop.js +1 -1
  34. package/dist/drag-drop.modern.mjs +1 -1
  35. package/dist/index.js +56 -56
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.modern.mjs +56 -56
  38. package/dist/index.modern.mjs.map +1 -1
  39. package/dist/json-schema-form.js +1 -1
  40. package/dist/json-schema-form.modern.mjs +1 -1
  41. package/dist/textDiff.js +2 -2
  42. package/dist/textDiff.modern.mjs +1 -1
  43. package/migrate-imports.js +2 -2
  44. package/package.json +32 -46
  45. package/dist/chunk-37IHMN4Z.js.map +0 -1
  46. package/dist/chunk-3NKPHQNZ.js +0 -2
  47. package/dist/chunk-3R3N5YG6.js +0 -365
  48. package/dist/chunk-3R3N5YG6.js.map +0 -1
  49. package/dist/chunk-BRCNJ6YU.modern.mjs +0 -2
  50. package/dist/chunk-GQTRWH6F.modern.mjs +0 -365
  51. package/dist/chunk-GQTRWH6F.modern.mjs.map +0 -1
  52. package/dist/chunk-MIW6EPF2.js +0 -2
  53. package/dist/chunk-NNUFUUDL.modern.mjs.map +0 -1
  54. package/dist/chunk-OIYJ7CVG.modern.mjs +0 -2
package/dist/drag-drop.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkER6Q72GN_js=require('./chunk-ER6Q72GN.js'),chunk3NKPHQNZ_js=require('./chunk-3NKPHQNZ.js');require('./chunk-MIW6EPF2.js');var chunk3R3N5YG6_js=require('./chunk-3R3N5YG6.js'),be=require('react'),dnd=require('@hello-pangea/dnd'),jsxRuntime=require('react/jsx-runtime'),reactVirtuoso=require('react-virtuoso');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var be__default=/*#__PURE__*/_interopDefault(be);var re=({fill:e,opacity:r})=>jsxRuntime.jsx(chunk3R3N5YG6_js.La,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("g",{transform:"translate(5,3)",children:jsxRuntime.jsx("path",{d:"M9.5 0H4.5L3.5 1H0.401C0.179 1 0 1.179 0 1.401V2.599C0 2.821 0.179 3 0.401 3H13.599C13.821 3 14 2.821 14 2.599V1.401C14 1.179 13.821 1 13.599 1H10.5L9.5 0ZM10.875 6L10.118 16H3.882L3.125 6H10.875ZM12.59 4H1.39C1.159 4 0.982 4.196 1 4.426L2 17.634C2.016 17.841 2.193 18 2.4 18H11.6C11.807 18 11.984 17.841 12 17.635L13 4.427C13.018 4.196 12.82 4 12.59 4Z",fill:e,opacity:r})})});var te=({fill:e,opacity:r})=>jsxRuntime.jsx(chunk3R3N5YG6_js.La,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("g",{transform:"translate(7,4)",children:jsxRuntime.jsx("path",{d:"M4 14C4 15.1 3.1 16 2 16C0.9 16 0 15.1 0 14C0 12.9 0.9 12 2 12C3.1 12 4 12.9 4 14ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0ZM8 4C9.1 4 10 3.1 10 2C10 0.9 9.1 0 8 0C6.9 0 6 0.9 6 2C6 3.1 6.9 4 8 4ZM8 6C6.9 6 6 6.9 6 8C6 9.1 6.9 10 8 10C9.1 10 10 9.1 10 8C10 6.9 9.1 6 8 6ZM8 12C6.9 12 6 12.9 6 14C6 15.1 6.9 16 8 16C9.1 16 10 15.1 10 14C10 12.9 9.1 12 8 12Z",fill:e,fillOpacity:r})})});var pe=(e,r,a,l)=>{let p="";return r!==null&&a!==null&&(r&&a+1===l||!r&&a===l)&&(p=`1px solid ${e.palette.ux.accent.n2.wMain}`),p},ce=chunk3R3N5YG6_js.ua("div",{shouldForwardProp:e=>e!=="isDragging"&&e!=="dropOverIndex"&&e!=="dropFromTop"&&e!=="readOnly"&&e!=="disableReorder"})(({theme:e,isDragging:r,dropOverIndex:a,index:l,dropFromTop:p,readOnly:s,disableReorder:b})=>({...e.mixins.formComponent_AVPItem.container,backgroundColor:r?e.palette.ux.brand.w10:"inherit",borderTop:pe(e,p,a,l),gridTemplateColumns:s?"0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px":b?"0px 1fr 8px 1fr 40px":"32px 1fr 8px 1fr 40px"})),me=chunk3R3N5YG6_js.ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForKey})),de=chunk3R3N5YG6_js.ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForValue})),ge=chunk3R3N5YG6_js.ua("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="isDragging"&&e!=="readOnly"})(({theme:e,ghostItem:r,isDragging:a,readOnly:l})=>({...e.mixins.formComponent_AVPItem.moveButton,cursor:r?"default":a?"move":"pointer",display:l?"none":"inherit"})),fe=chunk3R3N5YG6_js.ua("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="cursor"&&e!=="background"&&e!=="readOnly"})(({theme:e,ghostItem:r,cursor:a,background:l,readOnly:p})=>({...e.mixins.formComponent_AVPItem.deleteButton,cursor:a,display:p?"none":"inherit",height:"fit-content",":hover":{backgroundColor:l,svg:{path:{fill:r?e.palette.ux.secondary.w40:e.palette.ux.deprecated.primary.wMain}}},paddingBottom:e.spacing(.5),marginLeft:e.spacing(1)})),oe=chunk3R3N5YG6_js.ua("div")(({theme:e})=>({paddingTop:"7px",color:e.palette.ux.secondary.text.wMain}));var U=({id:e,index:r,avpKey:a,avpValue:l,dataTags:p,ghostItem:s=false,onDelete:b,onChange:v,onKeyUp:C,onBlur:F,keyErrorText:M,valueErrorText:E,dropOverIndex:w,dropFromTop:T,readOnly:u,emptyFieldDisplayValue:S="",disableReorder:h=false})=>{let f=chunk3R3N5YG6_js.sa();return jsxRuntime.jsx(dnd.Draggable,{draggableId:e,index:r,isDragDisabled:s||h,children:(x,c)=>jsxRuntime.jsxs(ce,{ref:x.innerRef,...x.draggableProps,isDragging:c.isDragging,dropOverIndex:w,dropFromTop:T,index:r,readOnly:!!u,disableReorder:h,children:[!h&&jsxRuntime.jsx(ge,{...x.dragHandleProps,isDragging:c.isDragging,ghostItem:s,readOnly:!!u,"data-qa":`avpMove-${r}`,children:jsxRuntime.jsx(te,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})}),jsxRuntime.jsxs(me,{children:[!a&&l&&u&&jsxRuntime.jsx(oe,{"data-qa":`avpKey-${r}`,children:S}),(a||!a&&!u)&&jsxRuntime.jsx(chunkER6Q72GN_js.d,{name:"key",dataQa:`avpKey-${r}`,dataTags:p,value:a,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!M,helperText:s?"":M,readOnly:u})]}),jsxRuntime.jsxs(de,{children:[a&&!l&&u&&jsxRuntime.jsx(oe,{"data-qa":`avpValue-${r}`,children:S}),(l||!l&&!u)&&jsxRuntime.jsx(chunkER6Q72GN_js.d,{name:"value",dataQa:`avpValue-${r}`,dataTags:p,value:l,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!E,helperText:s?"":E,readOnly:u})]}),jsxRuntime.jsx(fe,{onClick:i=>b(i,r),tabIndex:0,ghostItem:s,cursor:s?"default":"pointer",background:s?"inherit":f.palette.ux.secondary.w10,readOnly:!!u,"data-qa":`avpDelete-${r}`,children:jsxRuntime.jsx(re,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})})]})})};var Se=chunk3R3N5YG6_js.ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.container})),he=chunk3R3N5YG6_js.ua("div")(({theme:e,readOnly:r,disableReorder:a,hasScrollBar:l})=>({...e.mixins.formComponent_AVPForm.labelWrapper,gridTemplateColumns:r?`0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px${l?" 16px":""}`:a?`0px 1fr 8px 1fr 32px${l?" 16px":""}`:`32px 1fr 8px 1fr 32px${l?" 16px":""}`})),ae=chunk3R3N5YG6_js.ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.listWrapper})),Ve=(e,r,a)=>{let l=Array.from(e),[p]=l.splice(r,1);return l.splice(a,0,p),l},ne=(e,r)=>e[r].key===""&&e[r].value==="";var Ie=(e,r,a)=>{e==="ArrowUp"&&r-1>0?a[r-2].select():e==="ArrowDown"&&r+2<a.length?a[r+2].select():e==="Enter"&&r+2<a.length&&(r%2===0?a[r+2].select():r%2===1&&a[r+1].select());},le=be__default.default.forwardRef((e,r)=>{let a=e.context?.headerRef,l=e.context?.virtualizedAvpListOption,p=e.style;return jsxRuntime.jsx(ae,{...e,ref:r,style:{...p,width:l?.height&&a.current?a.current.offsetWidth-16:"100%"}})});le.displayName="List";var Ae=({id:e,name:r,readOnly:a,labelForKeys:l="Name",labelForValues:p="DisplayName",avpList:s=[],onAVPListUpdate:b,avpKeyValidationCallback:v,avpValueValidationCallback:C,enableRequiredKeyFieldIndicator:F,enableRequiredValueFieldIndicator:M,emptyFieldDisplayValue:E="",keyRequired:w=true,keyIsRequiredMessage:T="Required",helperText:u="",hasErrors:S=false,hasWarnings:h=false,disableReorder:f=false,avpListMaxHeight:x,virtualizedAvpListOption:c})=>{let[i,V]=be.useState(s),[N,R]=be.useState(null),[_,B]=be.useState(null),D=be.useRef(null);be.useEffect(()=>{let n=[...s];n.push({key:"",value:""}),V(n);},[s]);let I=be.useCallback(n=>{V(n),b&&ne(n,n.length-1)&&b(n.slice(0,-1)),R(null),B(null);},[b]),ie=n=>{if(!n.destination||n.destination.index===n.source.index||n.destination.index===i.length-1)return;let t=Ve(i,n.source.index,n.destination.index);V(t),b&&ne(t,t.length-1)&&b(t.slice(0,-1)),R(null),B(null);},se=n=>{let t=n.source.index,o=n?.destination?.index??null,m=o,y=null;t!==null&&o!==null&&(t>o?y=false:t<o&&(y=true)),R(m),B(y);},J=be.useCallback((n,t)=>{let o=n.name,m=n.value,y=[...i];y[t][o]=m,o&&y.length-1===t&&y.push({key:"",value:""}),V(y),I(y);},[i,I]),L=be.useCallback(n=>n===i.length-1,[i.length]),X=be.useCallback((n,t)=>{if(n.type==="click"&&!L(t)&&i.length>1){let o=[...i];o.splice(t,1),V(o),I(o);}},[i,I,L]),Q=be.useCallback(n=>{let t=document.querySelectorAll("[data-tags='avpInput']"),o=document.activeElement;for(let m=0;m<t.length;m++)t[m].getAttribute("data-qa")===o?.getAttribute("data-qa")&&Ie(n.key,m,t);},[]),Y=be.useCallback((n,t)=>{let o=[...i];if(o[t].key=o[t].key.trim(),o[t].value=o[t].value.trim(),n.target.getAttribute("name")==="key"&&v){let m=v(n.target.value,o.slice(0,-1));m?o[t].keyErrorText=m:delete o[t].keyErrorText;}if(n.target.getAttribute("name")==="value"&&C){let m=C(n.target.value,o.slice(0,-1));m?o[t].valueErrorText=m:delete o[t].valueErrorText;}w&&!o[t].key?o[t].keyErrorText=T:o[t].keyErrorText===T&&delete o[t].keyErrorText,V(o),I(o);},[i,w,v,C,T,I]);return jsxRuntime.jsxs(dnd.DragDropContext,{onDragEnd:ie,onDragUpdate:se,children:[jsxRuntime.jsx(dnd.Droppable,{droppableId:e??r,isDropDisabled:!!f||!!a,children:n=>jsxRuntime.jsxs(Se,{ref:n.innerRef,...n.droppableProps,children:[jsxRuntime.jsxs(he,{ref:D,readOnly:!!a,disableReorder:!!f,hasScrollBar:!!x||!!c?.height,children:[jsxRuntime.jsx(chunkER6Q72GN_js.a,{id:"avpLabelForKeys",required:F,children:l}),jsxRuntime.jsx(chunkER6Q72GN_js.a,{id:"avpLabelForValues",required:M,children:p})]}),c&&D.current&&jsxRuntime.jsx(reactVirtuoso.Virtuoso,{context:{headerRef:D,virtualizedAvpListOption:c},style:{height:c.height?c.height:"auto",minHeight:c.minHeight?c.minHeight:40},useWindowScroll:c.useWindowScrolling,increaseViewportBy:c.increaseViewportBy,components:{List:le},initialTopMostItemIndex:c.initialTopMostItemIndex??0,data:i,itemContent:(t,o)=>jsxRuntime.jsx(U,{id:`${t}`,index:t,avpKey:o.key,avpValue:o.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(t),onBlur:Y,keyErrorText:o.keyErrorText,valueErrorText:o.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a,emptyFieldDisplayValue:E,disableReorder:f},`${t}`)}),!c&&D.current&&jsxRuntime.jsx("div",{style:x?{maxHeight:x,overflowY:"auto"}:void 0,children:jsxRuntime.jsx(ae,{style:{width:x?D.current.offsetWidth-16:"100%"},children:i.map((t,o)=>jsxRuntime.jsx(U,{id:`${o}`,index:o,avpKey:t.key,avpValue:t.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(o),onBlur:Y,keyErrorText:t.keyErrorText,valueErrorText:t.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a,emptyFieldDisplayValue:E,disableReorder:f},`${o}`))})}),n.placeholder]})}),u&&jsxRuntime.jsxs("div",{style:{paddingLeft:"16px"},children:[u&&!h&&!S&&jsxRuntime.jsx(chunk3NKPHQNZ_js.c,{children:u}),u&&!S&&h&&jsxRuntime.jsx(chunk3NKPHQNZ_js.g,{children:u}),u&&S&&jsxRuntime.jsx(chunk3NKPHQNZ_js.e,{children:u})]})]})},Ee=Ae;exports.SolaceAttributeValuePairForm=Ee;//# sourceMappingURL=drag-drop.js.map
1
+ 'use strict';var chunkUFDVHFXE_js=require('./chunk-UFDVHFXE.js'),chunk7SKICMGL_js=require('./chunk-7SKICMGL.js');require('./chunk-GDZZVHFP.js');var chunk4XH33OL7_js=require('./chunk-4XH33OL7.js'),be=require('react'),dnd=require('@hello-pangea/dnd'),jsxRuntime=require('react/jsx-runtime'),reactVirtuoso=require('react-virtuoso');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var be__default=/*#__PURE__*/_interopDefault(be);var re=({fill:e,opacity:r})=>jsxRuntime.jsx(chunk4XH33OL7_js.Na,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("g",{transform:"translate(5,3)",children:jsxRuntime.jsx("path",{d:"M9.5 0H4.5L3.5 1H0.401C0.179 1 0 1.179 0 1.401V2.599C0 2.821 0.179 3 0.401 3H13.599C13.821 3 14 2.821 14 2.599V1.401C14 1.179 13.821 1 13.599 1H10.5L9.5 0ZM10.875 6L10.118 16H3.882L3.125 6H10.875ZM12.59 4H1.39C1.159 4 0.982 4.196 1 4.426L2 17.634C2.016 17.841 2.193 18 2.4 18H11.6C11.807 18 11.984 17.841 12 17.635L13 4.427C13.018 4.196 12.82 4 12.59 4Z",fill:e,opacity:r})})});var te=({fill:e,opacity:r})=>jsxRuntime.jsx(chunk4XH33OL7_js.Na,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("g",{transform:"translate(7,4)",children:jsxRuntime.jsx("path",{d:"M4 14C4 15.1 3.1 16 2 16C0.9 16 0 15.1 0 14C0 12.9 0.9 12 2 12C3.1 12 4 12.9 4 14ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0ZM8 4C9.1 4 10 3.1 10 2C10 0.9 9.1 0 8 0C6.9 0 6 0.9 6 2C6 3.1 6.9 4 8 4ZM8 6C6.9 6 6 6.9 6 8C6 9.1 6.9 10 8 10C9.1 10 10 9.1 10 8C10 6.9 9.1 6 8 6ZM8 12C6.9 12 6 12.9 6 14C6 15.1 6.9 16 8 16C9.1 16 10 15.1 10 14C10 12.9 9.1 12 8 12Z",fill:e,fillOpacity:r})})});var pe=(e,r,a,l)=>{let p="";return r!==null&&a!==null&&(r&&a+1===l||!r&&a===l)&&(p=`1px solid ${e.palette.ux.accent.n2.wMain}`),p},ce=chunk4XH33OL7_js.wa("div",{shouldForwardProp:e=>e!=="isDragging"&&e!=="dropOverIndex"&&e!=="dropFromTop"&&e!=="readOnly"&&e!=="disableReorder"})(({theme:e,isDragging:r,dropOverIndex:a,index:l,dropFromTop:p,readOnly:s,disableReorder:b})=>({...e.mixins.formComponent_AVPItem.container,backgroundColor:r?e.palette.ux.brand.w10:"inherit",borderTop:pe(e,p,a,l),gridTemplateColumns:s?"0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px":b?"0px 1fr 8px 1fr 40px":"32px 1fr 8px 1fr 40px"})),me=chunk4XH33OL7_js.wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForKey})),de=chunk4XH33OL7_js.wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForValue})),ge=chunk4XH33OL7_js.wa("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="isDragging"&&e!=="readOnly"})(({theme:e,ghostItem:r,isDragging:a,readOnly:l})=>({...e.mixins.formComponent_AVPItem.moveButton,cursor:r?"default":a?"move":"pointer",display:l?"none":"inherit"})),fe=chunk4XH33OL7_js.wa("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="cursor"&&e!=="background"&&e!=="readOnly"})(({theme:e,ghostItem:r,cursor:a,background:l,readOnly:p})=>({...e.mixins.formComponent_AVPItem.deleteButton,cursor:a,display:p?"none":"inherit",height:"fit-content",":hover":{backgroundColor:l,svg:{path:{fill:r?e.palette.ux.secondary.w40:e.palette.ux.deprecated.primary.wMain}}},paddingBottom:e.spacing(.5),marginLeft:e.spacing(1)})),oe=chunk4XH33OL7_js.wa("div")(({theme:e})=>({paddingTop:"7px",color:e.palette.ux.secondary.text.wMain}));var U=({id:e,index:r,avpKey:a,avpValue:l,dataTags:p,ghostItem:s=false,onDelete:b,onChange:v,onKeyUp:C,onBlur:F,keyErrorText:M,valueErrorText:E,dropOverIndex:w,dropFromTop:T,readOnly:u,emptyFieldDisplayValue:S="",disableReorder:h=false})=>{let f=chunk4XH33OL7_js.ua();return jsxRuntime.jsx(dnd.Draggable,{draggableId:e,index:r,isDragDisabled:s||h,children:(x,c)=>jsxRuntime.jsxs(ce,{ref:x.innerRef,...x.draggableProps,isDragging:c.isDragging,dropOverIndex:w,dropFromTop:T,index:r,readOnly:!!u,disableReorder:h,children:[!h&&jsxRuntime.jsx(ge,{...x.dragHandleProps,isDragging:c.isDragging,ghostItem:s,readOnly:!!u,"data-qa":`avpMove-${r}`,children:jsxRuntime.jsx(te,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})}),jsxRuntime.jsxs(me,{children:[!a&&l&&u&&jsxRuntime.jsx(oe,{"data-qa":`avpKey-${r}`,children:S}),(a||!a&&!u)&&jsxRuntime.jsx(chunkUFDVHFXE_js.d,{name:"key",dataQa:`avpKey-${r}`,dataTags:p,value:a,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!M,helperText:s?"":M,readOnly:u})]}),jsxRuntime.jsxs(de,{children:[a&&!l&&u&&jsxRuntime.jsx(oe,{"data-qa":`avpValue-${r}`,children:S}),(l||!l&&!u)&&jsxRuntime.jsx(chunkUFDVHFXE_js.d,{name:"value",dataQa:`avpValue-${r}`,dataTags:p,value:l,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!E,helperText:s?"":E,readOnly:u})]}),jsxRuntime.jsx(fe,{onClick:i=>b(i,r),tabIndex:0,ghostItem:s,cursor:s?"default":"pointer",background:s?"inherit":f.palette.ux.secondary.w10,readOnly:!!u,"data-qa":`avpDelete-${r}`,children:jsxRuntime.jsx(re,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})})]})})};var Se=chunk4XH33OL7_js.wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.container})),he=chunk4XH33OL7_js.wa("div")(({theme:e,readOnly:r,disableReorder:a,hasScrollBar:l})=>({...e.mixins.formComponent_AVPForm.labelWrapper,gridTemplateColumns:r?`0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px${l?" 16px":""}`:a?`0px 1fr 8px 1fr 32px${l?" 16px":""}`:`32px 1fr 8px 1fr 32px${l?" 16px":""}`})),ae=chunk4XH33OL7_js.wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.listWrapper})),Ve=(e,r,a)=>{let l=Array.from(e),[p]=l.splice(r,1);return l.splice(a,0,p),l},ne=(e,r)=>e[r].key===""&&e[r].value==="";var Ie=(e,r,a)=>{e==="ArrowUp"&&r-1>0?a[r-2].select():e==="ArrowDown"&&r+2<a.length?a[r+2].select():e==="Enter"&&r+2<a.length&&(r%2===0?a[r+2].select():r%2===1&&a[r+1].select());},le=be__default.default.forwardRef((e,r)=>{let a=e.context?.headerRef,l=e.context?.virtualizedAvpListOption,p=e.style;return jsxRuntime.jsx(ae,{...e,ref:r,style:{...p,width:l?.height&&a.current?a.current.offsetWidth-16:"100%"}})});le.displayName="List";var Ae=({id:e,name:r,readOnly:a,labelForKeys:l="Name",labelForValues:p="DisplayName",avpList:s=[],onAVPListUpdate:b,avpKeyValidationCallback:v,avpValueValidationCallback:C,enableRequiredKeyFieldIndicator:F,enableRequiredValueFieldIndicator:M,emptyFieldDisplayValue:E="",keyRequired:w=true,keyIsRequiredMessage:T="Required",helperText:u="",hasErrors:S=false,hasWarnings:h=false,disableReorder:f=false,avpListMaxHeight:x,virtualizedAvpListOption:c})=>{let[i,V]=be.useState(s),[N,R]=be.useState(null),[_,B]=be.useState(null),D=be.useRef(null);be.useEffect(()=>{let n=[...s];n.push({key:"",value:""}),V(n);},[s]);let I=be.useCallback(n=>{V(n),b&&ne(n,n.length-1)&&b(n.slice(0,-1)),R(null),B(null);},[b]),ie=n=>{if(!n.destination||n.destination.index===n.source.index||n.destination.index===i.length-1)return;let t=Ve(i,n.source.index,n.destination.index);V(t),b&&ne(t,t.length-1)&&b(t.slice(0,-1)),R(null),B(null);},se=n=>{let t=n.source.index,o=n?.destination?.index??null,m=o,y=null;t!==null&&o!==null&&(t>o?y=false:t<o&&(y=true)),R(m),B(y);},J=be.useCallback((n,t)=>{let o=n.name,m=n.value,y=[...i];y[t][o]=m,o&&y.length-1===t&&y.push({key:"",value:""}),V(y),I(y);},[i,I]),L=be.useCallback(n=>n===i.length-1,[i.length]),X=be.useCallback((n,t)=>{if(n.type==="click"&&!L(t)&&i.length>1){let o=[...i];o.splice(t,1),V(o),I(o);}},[i,I,L]),Q=be.useCallback(n=>{let t=document.querySelectorAll("[data-tags='avpInput']"),o=document.activeElement;for(let m=0;m<t.length;m++)t[m].getAttribute("data-qa")===o?.getAttribute("data-qa")&&Ie(n.key,m,t);},[]),Y=be.useCallback((n,t)=>{let o=[...i];if(o[t].key=o[t].key.trim(),o[t].value=o[t].value.trim(),n.target.getAttribute("name")==="key"&&v){let m=v(n.target.value,o.slice(0,-1));m?o[t].keyErrorText=m:delete o[t].keyErrorText;}if(n.target.getAttribute("name")==="value"&&C){let m=C(n.target.value,o.slice(0,-1));m?o[t].valueErrorText=m:delete o[t].valueErrorText;}w&&!o[t].key?o[t].keyErrorText=T:o[t].keyErrorText===T&&delete o[t].keyErrorText,V(o),I(o);},[i,w,v,C,T,I]);return jsxRuntime.jsxs(dnd.DragDropContext,{onDragEnd:ie,onDragUpdate:se,children:[jsxRuntime.jsx(dnd.Droppable,{droppableId:e??r,isDropDisabled:!!f||!!a,children:n=>jsxRuntime.jsxs(Se,{ref:n.innerRef,...n.droppableProps,children:[jsxRuntime.jsxs(he,{ref:D,readOnly:!!a,disableReorder:!!f,hasScrollBar:!!x||!!c?.height,children:[jsxRuntime.jsx(chunkUFDVHFXE_js.a,{id:"avpLabelForKeys",required:F,children:l}),jsxRuntime.jsx(chunkUFDVHFXE_js.a,{id:"avpLabelForValues",required:M,children:p})]}),c&&D.current&&jsxRuntime.jsx(reactVirtuoso.Virtuoso,{context:{headerRef:D,virtualizedAvpListOption:c},style:{height:c.height?c.height:"auto",minHeight:c.minHeight?c.minHeight:40},useWindowScroll:c.useWindowScrolling,increaseViewportBy:c.increaseViewportBy,components:{List:le},initialTopMostItemIndex:c.initialTopMostItemIndex??0,data:i,itemContent:(t,o)=>jsxRuntime.jsx(U,{id:`${t}`,index:t,avpKey:o.key,avpValue:o.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(t),onBlur:Y,keyErrorText:o.keyErrorText,valueErrorText:o.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a,emptyFieldDisplayValue:E,disableReorder:f},`${t}`)}),!c&&D.current&&jsxRuntime.jsx("div",{style:x?{maxHeight:x,overflowY:"auto"}:void 0,children:jsxRuntime.jsx(ae,{style:{width:x?D.current.offsetWidth-16:"100%"},children:i.map((t,o)=>jsxRuntime.jsx(U,{id:`${o}`,index:o,avpKey:t.key,avpValue:t.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(o),onBlur:Y,keyErrorText:t.keyErrorText,valueErrorText:t.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a,emptyFieldDisplayValue:E,disableReorder:f},`${o}`))})}),n.placeholder]})}),u&&jsxRuntime.jsxs("div",{style:{paddingLeft:"16px"},children:[u&&!h&&!S&&jsxRuntime.jsx(chunk7SKICMGL_js.c,{children:u}),u&&!S&&h&&jsxRuntime.jsx(chunk7SKICMGL_js.g,{children:u}),u&&S&&jsxRuntime.jsx(chunk7SKICMGL_js.e,{children:u})]})]})},Ee=Ae;exports.SolaceAttributeValuePairForm=Ee;//# sourceMappingURL=drag-drop.js.map
2
2
  //# sourceMappingURL=drag-drop.js.map
@@ -1,2 +1,2 @@
1
- import {a,d}from'./chunk-VEVQME3E.modern.mjs';import {c,g,e}from'./chunk-OIYJ7CVG.modern.mjs';import'./chunk-3EP6QO5T.modern.mjs';import {ua,sa,La}from'./chunk-GQTRWH6F.modern.mjs';import be,{useState,useRef,useEffect,useCallback}from'react';import {DragDropContext,Droppable,Draggable}from'@hello-pangea/dnd';import {jsx,jsxs}from'react/jsx-runtime';import {Virtuoso}from'react-virtuoso';var re=({fill:e,opacity:r})=>jsx(La,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("g",{transform:"translate(5,3)",children:jsx("path",{d:"M9.5 0H4.5L3.5 1H0.401C0.179 1 0 1.179 0 1.401V2.599C0 2.821 0.179 3 0.401 3H13.599C13.821 3 14 2.821 14 2.599V1.401C14 1.179 13.821 1 13.599 1H10.5L9.5 0ZM10.875 6L10.118 16H3.882L3.125 6H10.875ZM12.59 4H1.39C1.159 4 0.982 4.196 1 4.426L2 17.634C2.016 17.841 2.193 18 2.4 18H11.6C11.807 18 11.984 17.841 12 17.635L13 4.427C13.018 4.196 12.82 4 12.59 4Z",fill:e,opacity:r})})});var te=({fill:e,opacity:r})=>jsx(La,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("g",{transform:"translate(7,4)",children:jsx("path",{d:"M4 14C4 15.1 3.1 16 2 16C0.9 16 0 15.1 0 14C0 12.9 0.9 12 2 12C3.1 12 4 12.9 4 14ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0ZM8 4C9.1 4 10 3.1 10 2C10 0.9 9.1 0 8 0C6.9 0 6 0.9 6 2C6 3.1 6.9 4 8 4ZM8 6C6.9 6 6 6.9 6 8C6 9.1 6.9 10 8 10C9.1 10 10 9.1 10 8C10 6.9 9.1 6 8 6ZM8 12C6.9 12 6 12.9 6 14C6 15.1 6.9 16 8 16C9.1 16 10 15.1 10 14C10 12.9 9.1 12 8 12Z",fill:e,fillOpacity:r})})});var pe=(e,r,a,l)=>{let p="";return r!==null&&a!==null&&(r&&a+1===l||!r&&a===l)&&(p=`1px solid ${e.palette.ux.accent.n2.wMain}`),p},ce=ua("div",{shouldForwardProp:e=>e!=="isDragging"&&e!=="dropOverIndex"&&e!=="dropFromTop"&&e!=="readOnly"&&e!=="disableReorder"})(({theme:e,isDragging:r,dropOverIndex:a,index:l,dropFromTop:p,readOnly:s,disableReorder:b})=>({...e.mixins.formComponent_AVPItem.container,backgroundColor:r?e.palette.ux.brand.w10:"inherit",borderTop:pe(e,p,a,l),gridTemplateColumns:s?"0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px":b?"0px 1fr 8px 1fr 40px":"32px 1fr 8px 1fr 40px"})),me=ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForKey})),de=ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForValue})),ge=ua("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="isDragging"&&e!=="readOnly"})(({theme:e,ghostItem:r,isDragging:a,readOnly:l})=>({...e.mixins.formComponent_AVPItem.moveButton,cursor:r?"default":a?"move":"pointer",display:l?"none":"inherit"})),fe=ua("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="cursor"&&e!=="background"&&e!=="readOnly"})(({theme:e,ghostItem:r,cursor:a,background:l,readOnly:p})=>({...e.mixins.formComponent_AVPItem.deleteButton,cursor:a,display:p?"none":"inherit",height:"fit-content",":hover":{backgroundColor:l,svg:{path:{fill:r?e.palette.ux.secondary.w40:e.palette.ux.deprecated.primary.wMain}}},paddingBottom:e.spacing(.5),marginLeft:e.spacing(1)})),oe=ua("div")(({theme:e})=>({paddingTop:"7px",color:e.palette.ux.secondary.text.wMain}));var U=({id:e,index:r,avpKey:a,avpValue:l,dataTags:p,ghostItem:s=false,onDelete:b,onChange:v,onKeyUp:C,onBlur:F,keyErrorText:M,valueErrorText:E,dropOverIndex:w,dropFromTop:T,readOnly:u,emptyFieldDisplayValue:S="",disableReorder:h=false})=>{let f=sa();return jsx(Draggable,{draggableId:e,index:r,isDragDisabled:s||h,children:(x,c)=>jsxs(ce,{ref:x.innerRef,...x.draggableProps,isDragging:c.isDragging,dropOverIndex:w,dropFromTop:T,index:r,readOnly:!!u,disableReorder:h,children:[!h&&jsx(ge,{...x.dragHandleProps,isDragging:c.isDragging,ghostItem:s,readOnly:!!u,"data-qa":`avpMove-${r}`,children:jsx(te,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})}),jsxs(me,{children:[!a&&l&&u&&jsx(oe,{"data-qa":`avpKey-${r}`,children:S}),(a||!a&&!u)&&jsx(d,{name:"key",dataQa:`avpKey-${r}`,dataTags:p,value:a,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!M,helperText:s?"":M,readOnly:u})]}),jsxs(de,{children:[a&&!l&&u&&jsx(oe,{"data-qa":`avpValue-${r}`,children:S}),(l||!l&&!u)&&jsx(d,{name:"value",dataQa:`avpValue-${r}`,dataTags:p,value:l,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!E,helperText:s?"":E,readOnly:u})]}),jsx(fe,{onClick:i=>b(i,r),tabIndex:0,ghostItem:s,cursor:s?"default":"pointer",background:s?"inherit":f.palette.ux.secondary.w10,readOnly:!!u,"data-qa":`avpDelete-${r}`,children:jsx(re,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})})]})})};var Se=ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.container})),he=ua("div")(({theme:e,readOnly:r,disableReorder:a,hasScrollBar:l})=>({...e.mixins.formComponent_AVPForm.labelWrapper,gridTemplateColumns:r?`0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px${l?" 16px":""}`:a?`0px 1fr 8px 1fr 32px${l?" 16px":""}`:`32px 1fr 8px 1fr 32px${l?" 16px":""}`})),ae=ua("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.listWrapper})),Ve=(e,r,a)=>{let l=Array.from(e),[p]=l.splice(r,1);return l.splice(a,0,p),l},ne=(e,r)=>e[r].key===""&&e[r].value==="";var Ie=(e,r,a)=>{e==="ArrowUp"&&r-1>0?a[r-2].select():e==="ArrowDown"&&r+2<a.length?a[r+2].select():e==="Enter"&&r+2<a.length&&(r%2===0?a[r+2].select():r%2===1&&a[r+1].select());},le=be.forwardRef((e,r)=>{let a=e.context?.headerRef,l=e.context?.virtualizedAvpListOption,p=e.style;return jsx(ae,{...e,ref:r,style:{...p,width:l?.height&&a.current?a.current.offsetWidth-16:"100%"}})});le.displayName="List";var Ae=({id:e$1,name:r,readOnly:a$1,labelForKeys:l="Name",labelForValues:p="DisplayName",avpList:s=[],onAVPListUpdate:b,avpKeyValidationCallback:v,avpValueValidationCallback:C,enableRequiredKeyFieldIndicator:F,enableRequiredValueFieldIndicator:M,emptyFieldDisplayValue:E="",keyRequired:w=true,keyIsRequiredMessage:T="Required",helperText:u="",hasErrors:S=false,hasWarnings:h=false,disableReorder:f=false,avpListMaxHeight:x,virtualizedAvpListOption:c$1})=>{let[i,V]=useState(s),[N,R]=useState(null),[_,B]=useState(null),D=useRef(null);useEffect(()=>{let n=[...s];n.push({key:"",value:""}),V(n);},[s]);let I=useCallback(n=>{V(n),b&&ne(n,n.length-1)&&b(n.slice(0,-1)),R(null),B(null);},[b]),ie=n=>{if(!n.destination||n.destination.index===n.source.index||n.destination.index===i.length-1)return;let t=Ve(i,n.source.index,n.destination.index);V(t),b&&ne(t,t.length-1)&&b(t.slice(0,-1)),R(null),B(null);},se=n=>{let t=n.source.index,o=n?.destination?.index??null,m=o,y=null;t!==null&&o!==null&&(t>o?y=false:t<o&&(y=true)),R(m),B(y);},J=useCallback((n,t)=>{let o=n.name,m=n.value,y=[...i];y[t][o]=m,o&&y.length-1===t&&y.push({key:"",value:""}),V(y),I(y);},[i,I]),L=useCallback(n=>n===i.length-1,[i.length]),X=useCallback((n,t)=>{if(n.type==="click"&&!L(t)&&i.length>1){let o=[...i];o.splice(t,1),V(o),I(o);}},[i,I,L]),Q=useCallback(n=>{let t=document.querySelectorAll("[data-tags='avpInput']"),o=document.activeElement;for(let m=0;m<t.length;m++)t[m].getAttribute("data-qa")===o?.getAttribute("data-qa")&&Ie(n.key,m,t);},[]),Y=useCallback((n,t)=>{let o=[...i];if(o[t].key=o[t].key.trim(),o[t].value=o[t].value.trim(),n.target.getAttribute("name")==="key"&&v){let m=v(n.target.value,o.slice(0,-1));m?o[t].keyErrorText=m:delete o[t].keyErrorText;}if(n.target.getAttribute("name")==="value"&&C){let m=C(n.target.value,o.slice(0,-1));m?o[t].valueErrorText=m:delete o[t].valueErrorText;}w&&!o[t].key?o[t].keyErrorText=T:o[t].keyErrorText===T&&delete o[t].keyErrorText,V(o),I(o);},[i,w,v,C,T,I]);return jsxs(DragDropContext,{onDragEnd:ie,onDragUpdate:se,children:[jsx(Droppable,{droppableId:e$1??r,isDropDisabled:!!f||!!a$1,children:n=>jsxs(Se,{ref:n.innerRef,...n.droppableProps,children:[jsxs(he,{ref:D,readOnly:!!a$1,disableReorder:!!f,hasScrollBar:!!x||!!c$1?.height,children:[jsx(a,{id:"avpLabelForKeys",required:F,children:l}),jsx(a,{id:"avpLabelForValues",required:M,children:p})]}),c$1&&D.current&&jsx(Virtuoso,{context:{headerRef:D,virtualizedAvpListOption:c$1},style:{height:c$1.height?c$1.height:"auto",minHeight:c$1.minHeight?c$1.minHeight:40},useWindowScroll:c$1.useWindowScrolling,increaseViewportBy:c$1.increaseViewportBy,components:{List:le},initialTopMostItemIndex:c$1.initialTopMostItemIndex??0,data:i,itemContent:(t,o)=>jsx(U,{id:`${t}`,index:t,avpKey:o.key,avpValue:o.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(t),onBlur:Y,keyErrorText:o.keyErrorText,valueErrorText:o.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a$1,emptyFieldDisplayValue:E,disableReorder:f},`${t}`)}),!c$1&&D.current&&jsx("div",{style:x?{maxHeight:x,overflowY:"auto"}:void 0,children:jsx(ae,{style:{width:x?D.current.offsetWidth-16:"100%"},children:i.map((t,o)=>jsx(U,{id:`${o}`,index:o,avpKey:t.key,avpValue:t.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(o),onBlur:Y,keyErrorText:t.keyErrorText,valueErrorText:t.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a$1,emptyFieldDisplayValue:E,disableReorder:f},`${o}`))})}),n.placeholder]})}),u&&jsxs("div",{style:{paddingLeft:"16px"},children:[u&&!h&&!S&&jsx(c,{children:u}),u&&!S&&h&&jsx(g,{children:u}),u&&S&&jsx(e,{children:u})]})]})},Ee=Ae;export{Ee as SolaceAttributeValuePairForm};//# sourceMappingURL=drag-drop.modern.mjs.map
1
+ import {a,d}from'./chunk-QV564WAK.modern.mjs';import {c,g,e}from'./chunk-ULYCLLUO.modern.mjs';import'./chunk-ROSPS5NM.modern.mjs';import {wa,ua,Na}from'./chunk-IHSXSGCC.modern.mjs';import be,{useState,useRef,useEffect,useCallback}from'react';import {DragDropContext,Droppable,Draggable}from'@hello-pangea/dnd';import {jsx,jsxs}from'react/jsx-runtime';import {Virtuoso}from'react-virtuoso';var re=({fill:e,opacity:r})=>jsx(Na,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("g",{transform:"translate(5,3)",children:jsx("path",{d:"M9.5 0H4.5L3.5 1H0.401C0.179 1 0 1.179 0 1.401V2.599C0 2.821 0.179 3 0.401 3H13.599C13.821 3 14 2.821 14 2.599V1.401C14 1.179 13.821 1 13.599 1H10.5L9.5 0ZM10.875 6L10.118 16H3.882L3.125 6H10.875ZM12.59 4H1.39C1.159 4 0.982 4.196 1 4.426L2 17.634C2.016 17.841 2.193 18 2.4 18H11.6C11.807 18 11.984 17.841 12 17.635L13 4.427C13.018 4.196 12.82 4 12.59 4Z",fill:e,opacity:r})})});var te=({fill:e,opacity:r})=>jsx(Na,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("g",{transform:"translate(7,4)",children:jsx("path",{d:"M4 14C4 15.1 3.1 16 2 16C0.9 16 0 15.1 0 14C0 12.9 0.9 12 2 12C3.1 12 4 12.9 4 14ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0ZM8 4C9.1 4 10 3.1 10 2C10 0.9 9.1 0 8 0C6.9 0 6 0.9 6 2C6 3.1 6.9 4 8 4ZM8 6C6.9 6 6 6.9 6 8C6 9.1 6.9 10 8 10C9.1 10 10 9.1 10 8C10 6.9 9.1 6 8 6ZM8 12C6.9 12 6 12.9 6 14C6 15.1 6.9 16 8 16C9.1 16 10 15.1 10 14C10 12.9 9.1 12 8 12Z",fill:e,fillOpacity:r})})});var pe=(e,r,a,l)=>{let p="";return r!==null&&a!==null&&(r&&a+1===l||!r&&a===l)&&(p=`1px solid ${e.palette.ux.accent.n2.wMain}`),p},ce=wa("div",{shouldForwardProp:e=>e!=="isDragging"&&e!=="dropOverIndex"&&e!=="dropFromTop"&&e!=="readOnly"&&e!=="disableReorder"})(({theme:e,isDragging:r,dropOverIndex:a,index:l,dropFromTop:p,readOnly:s,disableReorder:b})=>({...e.mixins.formComponent_AVPItem.container,backgroundColor:r?e.palette.ux.brand.w10:"inherit",borderTop:pe(e,p,a,l),gridTemplateColumns:s?"0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px":b?"0px 1fr 8px 1fr 40px":"32px 1fr 8px 1fr 40px"})),me=wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForKey})),de=wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPItem.inputWrapperForValue})),ge=wa("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="isDragging"&&e!=="readOnly"})(({theme:e,ghostItem:r,isDragging:a,readOnly:l})=>({...e.mixins.formComponent_AVPItem.moveButton,cursor:r?"default":a?"move":"pointer",display:l?"none":"inherit"})),fe=wa("div",{shouldForwardProp:e=>e!=="ghostItem"&&e!=="cursor"&&e!=="background"&&e!=="readOnly"})(({theme:e,ghostItem:r,cursor:a,background:l,readOnly:p})=>({...e.mixins.formComponent_AVPItem.deleteButton,cursor:a,display:p?"none":"inherit",height:"fit-content",":hover":{backgroundColor:l,svg:{path:{fill:r?e.palette.ux.secondary.w40:e.palette.ux.deprecated.primary.wMain}}},paddingBottom:e.spacing(.5),marginLeft:e.spacing(1)})),oe=wa("div")(({theme:e})=>({paddingTop:"7px",color:e.palette.ux.secondary.text.wMain}));var U=({id:e,index:r,avpKey:a,avpValue:l,dataTags:p,ghostItem:s=false,onDelete:b,onChange:v,onKeyUp:C,onBlur:F,keyErrorText:M,valueErrorText:E,dropOverIndex:w,dropFromTop:T,readOnly:u,emptyFieldDisplayValue:S="",disableReorder:h=false})=>{let f=ua();return jsx(Draggable,{draggableId:e,index:r,isDragDisabled:s||h,children:(x,c)=>jsxs(ce,{ref:x.innerRef,...x.draggableProps,isDragging:c.isDragging,dropOverIndex:w,dropFromTop:T,index:r,readOnly:!!u,disableReorder:h,children:[!h&&jsx(ge,{...x.dragHandleProps,isDragging:c.isDragging,ghostItem:s,readOnly:!!u,"data-qa":`avpMove-${r}`,children:jsx(te,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})}),jsxs(me,{children:[!a&&l&&u&&jsx(oe,{"data-qa":`avpKey-${r}`,children:S}),(a||!a&&!u)&&jsx(d,{name:"key",dataQa:`avpKey-${r}`,dataTags:p,value:a,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!M,helperText:s?"":M,readOnly:u})]}),jsxs(de,{children:[a&&!l&&u&&jsx(oe,{"data-qa":`avpValue-${r}`,children:S}),(l||!l&&!u)&&jsx(d,{name:"value",dataQa:`avpValue-${r}`,dataTags:p,value:l,onChange:i=>v(i,r),onKeyUp:C,onBlur:i=>F(i,r),hasErrors:s?false:!!E,helperText:s?"":E,readOnly:u})]}),jsx(fe,{onClick:i=>b(i,r),tabIndex:0,ghostItem:s,cursor:s?"default":"pointer",background:s?"inherit":f.palette.ux.secondary.w10,readOnly:!!u,"data-qa":`avpDelete-${r}`,children:jsx(re,{fill:s?f.palette.ux.secondary.w40:f.palette.ux.secondary.wMain,opacity:1})})]})})};var Se=wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.container})),he=wa("div")(({theme:e,readOnly:r,disableReorder:a,hasScrollBar:l})=>({...e.mixins.formComponent_AVPForm.labelWrapper,gridTemplateColumns:r?`0px minmax(0, 1fr) 8px minmax(0, 1fr) 0px${l?" 16px":""}`:a?`0px 1fr 8px 1fr 32px${l?" 16px":""}`:`32px 1fr 8px 1fr 32px${l?" 16px":""}`})),ae=wa("div")(({theme:e})=>({...e.mixins.formComponent_AVPForm.listWrapper})),Ve=(e,r,a)=>{let l=Array.from(e),[p]=l.splice(r,1);return l.splice(a,0,p),l},ne=(e,r)=>e[r].key===""&&e[r].value==="";var Ie=(e,r,a)=>{e==="ArrowUp"&&r-1>0?a[r-2].select():e==="ArrowDown"&&r+2<a.length?a[r+2].select():e==="Enter"&&r+2<a.length&&(r%2===0?a[r+2].select():r%2===1&&a[r+1].select());},le=be.forwardRef((e,r)=>{let a=e.context?.headerRef,l=e.context?.virtualizedAvpListOption,p=e.style;return jsx(ae,{...e,ref:r,style:{...p,width:l?.height&&a.current?a.current.offsetWidth-16:"100%"}})});le.displayName="List";var Ae=({id:e$1,name:r,readOnly:a$1,labelForKeys:l="Name",labelForValues:p="DisplayName",avpList:s=[],onAVPListUpdate:b,avpKeyValidationCallback:v,avpValueValidationCallback:C,enableRequiredKeyFieldIndicator:F,enableRequiredValueFieldIndicator:M,emptyFieldDisplayValue:E="",keyRequired:w=true,keyIsRequiredMessage:T="Required",helperText:u="",hasErrors:S=false,hasWarnings:h=false,disableReorder:f=false,avpListMaxHeight:x,virtualizedAvpListOption:c$1})=>{let[i,V]=useState(s),[N,R]=useState(null),[_,B]=useState(null),D=useRef(null);useEffect(()=>{let n=[...s];n.push({key:"",value:""}),V(n);},[s]);let I=useCallback(n=>{V(n),b&&ne(n,n.length-1)&&b(n.slice(0,-1)),R(null),B(null);},[b]),ie=n=>{if(!n.destination||n.destination.index===n.source.index||n.destination.index===i.length-1)return;let t=Ve(i,n.source.index,n.destination.index);V(t),b&&ne(t,t.length-1)&&b(t.slice(0,-1)),R(null),B(null);},se=n=>{let t=n.source.index,o=n?.destination?.index??null,m=o,y=null;t!==null&&o!==null&&(t>o?y=false:t<o&&(y=true)),R(m),B(y);},J=useCallback((n,t)=>{let o=n.name,m=n.value,y=[...i];y[t][o]=m,o&&y.length-1===t&&y.push({key:"",value:""}),V(y),I(y);},[i,I]),L=useCallback(n=>n===i.length-1,[i.length]),X=useCallback((n,t)=>{if(n.type==="click"&&!L(t)&&i.length>1){let o=[...i];o.splice(t,1),V(o),I(o);}},[i,I,L]),Q=useCallback(n=>{let t=document.querySelectorAll("[data-tags='avpInput']"),o=document.activeElement;for(let m=0;m<t.length;m++)t[m].getAttribute("data-qa")===o?.getAttribute("data-qa")&&Ie(n.key,m,t);},[]),Y=useCallback((n,t)=>{let o=[...i];if(o[t].key=o[t].key.trim(),o[t].value=o[t].value.trim(),n.target.getAttribute("name")==="key"&&v){let m=v(n.target.value,o.slice(0,-1));m?o[t].keyErrorText=m:delete o[t].keyErrorText;}if(n.target.getAttribute("name")==="value"&&C){let m=C(n.target.value,o.slice(0,-1));m?o[t].valueErrorText=m:delete o[t].valueErrorText;}w&&!o[t].key?o[t].keyErrorText=T:o[t].keyErrorText===T&&delete o[t].keyErrorText,V(o),I(o);},[i,w,v,C,T,I]);return jsxs(DragDropContext,{onDragEnd:ie,onDragUpdate:se,children:[jsx(Droppable,{droppableId:e$1??r,isDropDisabled:!!f||!!a$1,children:n=>jsxs(Se,{ref:n.innerRef,...n.droppableProps,children:[jsxs(he,{ref:D,readOnly:!!a$1,disableReorder:!!f,hasScrollBar:!!x||!!c$1?.height,children:[jsx(a,{id:"avpLabelForKeys",required:F,children:l}),jsx(a,{id:"avpLabelForValues",required:M,children:p})]}),c$1&&D.current&&jsx(Virtuoso,{context:{headerRef:D,virtualizedAvpListOption:c$1},style:{height:c$1.height?c$1.height:"auto",minHeight:c$1.minHeight?c$1.minHeight:40},useWindowScroll:c$1.useWindowScrolling,increaseViewportBy:c$1.increaseViewportBy,components:{List:le},initialTopMostItemIndex:c$1.initialTopMostItemIndex??0,data:i,itemContent:(t,o)=>jsx(U,{id:`${t}`,index:t,avpKey:o.key,avpValue:o.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(t),onBlur:Y,keyErrorText:o.keyErrorText,valueErrorText:o.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a$1,emptyFieldDisplayValue:E,disableReorder:f},`${t}`)}),!c$1&&D.current&&jsx("div",{style:x?{maxHeight:x,overflowY:"auto"}:void 0,children:jsx(ae,{style:{width:x?D.current.offsetWidth-16:"100%"},children:i.map((t,o)=>jsx(U,{id:`${o}`,index:o,avpKey:t.key,avpValue:t.value,dataTags:"avpInput",onChange:J,onDelete:X,onKeyUp:Q,ghostItem:L(o),onBlur:Y,keyErrorText:t.keyErrorText,valueErrorText:t.valueErrorText,dropOverIndex:N,dropFromTop:_,readOnly:a$1,emptyFieldDisplayValue:E,disableReorder:f},`${o}`))})}),n.placeholder]})}),u&&jsxs("div",{style:{paddingLeft:"16px"},children:[u&&!h&&!S&&jsx(c,{children:u}),u&&!S&&h&&jsx(g,{children:u}),u&&S&&jsx(e,{children:u})]})]})},Ee=Ae;export{Ee as SolaceAttributeValuePairForm};//# sourceMappingURL=drag-drop.modern.mjs.map
2
2
  //# sourceMappingURL=drag-drop.modern.mjs.map