@e-llm-studio/instant-learning 1.3.0-alpha.124 → 1.3.0-alpha.125

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),t=require("lucide-react"),i=require("../queries/useApprovalQueries.js"),o=require("../store/useAuthStore.js"),s={root:{marginLeft:"1.5rem"},sectionLabel:{fontSize:"0.875rem",fontWeight:500,color:"#19213D"},requiredMark:{marginRight:"0.25rem",fontSize:"1rem",fontWeight:600,color:"#8F2C23"},dropdownWrapper:{position:"relative",marginTop:"0.375rem"},inputShell:{display:"flex",minHeight:"38px",width:"100%",cursor:"text",flexWrap:"wrap",alignItems:"center",gap:"0.375rem",borderRadius:"0.375rem",border:"1px solid #E2E8F0",padding:"0.375rem 0.5rem",boxSizing:"border-box",transition:"border-color 150ms ease-in-out, box-shadow 150ms ease-in-out"},searchIcon:{flexShrink:0,color:"#9CA3AF"},chip:{display:"flex",alignItems:"center",gap:"0.25rem",borderRadius:"9999px",backgroundColor:"#EFF6FF",padding:"0.125rem 0.625rem",fontSize:"0.75rem",fontWeight:500,color:"#1D4ED8"},chipRemoveButton:{marginLeft:"0.125rem",border:"none",borderRadius:"9999px",background:"transparent",padding:0,cursor:"pointer",outline:"none"},input:{minWidth:"120px",flex:1,border:"none",backgroundColor:"transparent",fontSize:"0.875rem",color:"#19213D",outline:"none"},dropdown:{position:"absolute",zIndex:50,marginTop:"0.25rem",maxHeight:"12rem",width:"100%",overflowY:"auto",borderRadius:"0.375rem",border:"1px solid #E2E8F0",backgroundColor:"#FFFFFF",padding:"0.25rem 0",listStyle:"none",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",boxSizing:"border-box"},skeletonItem:{padding:"0.5rem 0.75rem"},skeletonLinePrimary:{height:"1rem",width:"75%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB"},skeletonLineSecondary:{height:"0.75rem",width:"50%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB",marginTop:"0.375rem"},checkboxOption:{display:"flex",alignItems:"center",gap:"0.625rem",width:"100%",padding:"0.5rem 0.75rem",cursor:"pointer",boxSizing:"border-box"},checkboxInput:{width:"14px",height:"14px",flexShrink:0,cursor:"pointer",accentColor:"#2563EB",margin:0},optionTitle:{fontSize:"0.875rem",fontWeight:500,color:"#19213D",margin:0},optionSubtitle:{fontSize:"0.75rem",color:"#666F8D",margin:0}};exports.default=function(a){var u,l=a.selectedApprovers,c=a.selectedGroupOfApprovers,d=a.onApproversChange,p=a.onGroupsChange,h=o.default(function(e){return e.user}),g=(null==h?void 0:h.firstname)?"".concat(h.firstname," ").concat(null!==(u=h.lastname)&&void 0!==u?u:"").trim():null==h?void 0:h.email,m=r.useState(""),f=m[0],_=m[1],x=r.useState(""),b=x[0],v=x[1],y=r.useState(!1),S=y[0],j=y[1],k=r.useRef(null),E=r.useRef(null),F=r.useState(""),w=F[0],C=F[1],L=r.useState(""),D=L[0],M=L[1],B=r.useState(!1),z=B[0],A=B[1],R=r.useRef(null),I=r.useRef(null),T=r.useState(!1),q=T[0],W=T[1],O=r.useState(!1),P=O[0],G=O[1],Q=r.useState(null),H=Q[0],X=Q[1],Y=r.useState(null),J=Y[0],K=Y[1],N=r.useState(null),U=N[0],V=N[1],Z=r.useState(null),$=Z[0],ee=Z[1];r.useEffect(function(){if(!f.trim())return v(""),void j(!1);var e=setTimeout(function(){return v(f)},500);return function(){return clearTimeout(e)}},[f]),r.useEffect(function(){var e=setTimeout(function(){return M(w)},300);return function(){return clearTimeout(e)}},[w]);var ne=i.useApproverSearchQuery(b),re=ne.data,te=ne.isFetching,ie=(re||[]).filter(function(e){return!l.some(function(n){return n.id===e._id})&&e.email!==(null==h?void 0:h.email)}).slice(0,10).map(function(e){var n,r,t,i;return{id:e._id,email:null!==(n=e.email)&&void 0!==n?n:"",name:(null===(r=e.firstname)||void 0===r?void 0:r.trim())?"".concat(e.firstname," ").concat(null!==(t=e.lastname)&&void 0!==t?t:"").trim():null!==(i=e.email)&&void 0!==i?i:""}});r.useEffect(function(){b.trim()&&(te||ie.length>0)&&j(!0)},[te,ie.length,b]);var oe=i.useGroupSearchQuery(D),se=oe.data,ae=oe.isFetching,ue=(se||[]).filter(function(e){return!c.some(function(n){return n._id===e._id})}).slice(0,10);r.useEffect(function(){P&&(ae||ue.length>0)&&A(!0)},[ae,ue.length,P]),r.useEffect(function(){var e=function(e){k.current&&!k.current.contains(e.target)&&j(!1),R.current&&!R.current.contains(e.target)&&A(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);return n.jsxs("div",e.__assign({style:s.root},{children:[n.jsxs("label",e.__assign({htmlFor:"approver-search-input",style:s.sectionLabel},{children:[n.jsx("span",e.__assign({style:s.requiredMark},{children:"*"})),"Select who can approve"]})),n.jsxs("div",e.__assign({ref:k,style:s.dropdownWrapper},{children:[n.jsxs("label",e.__assign({htmlFor:"approver-search-input",style:e.__assign(e.__assign({},s.inputShell),{borderColor:q?"#2563EB":"#E2E8F0",boxShadow:q?"0 0 0 1px #2563EB":"none"})},{children:[n.jsx(t.Search,{size:14,style:s.searchIcon}),(null==h?void 0:h.email)&&n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},s.chip),{backgroundColor:"#F1F5F9",color:"#64748B"})},{children:[g," (You)"]})),l.map(function(r){return n.jsxs("span",e.__assign({style:s.chip,title:r.email},{children:[r.name||r.email,n.jsx("button",e.__assign({type:"button",onMouseDown:function(e){var n;e.preventDefault(),n=r.id,d(l.filter(function(e){return e.id!==n}))},onMouseEnter:function(){return V(r.id)},onMouseLeave:function(){return V(null)},style:e.__assign(e.__assign({},s.chipRemoveButton),{backgroundColor:U===r.id?"#DBEAFE":"transparent"})},{children:n.jsx(t.X,{size:12})}))]}),r.id)}),n.jsx("input",{ref:E,id:"approver-search-input",type:"text",value:f,onChange:function(e){return _(e.target.value)},onFocus:function(){W(!0),(ie.length>0||te)&&j(!0)},onBlur:function(){return W(!1)},placeholder:0===l.length?"Search by name or email...":"",style:s.input})]})),S&&(te||ie.length>0)&&n.jsx("ul",e.__assign({style:s.dropdown},{children:te?[1,2,3,4].map(function(r){return n.jsxs("li",e.__assign({style:s.skeletonItem},{children:[n.jsx("div",{style:s.skeletonLinePrimary}),n.jsx("div",{style:s.skeletonLineSecondary})]}),r)}):ie.map(function(r){return n.jsx("li",{children:n.jsxs("div",e.__assign({onMouseDown:function(n){n.preventDefault(),function(n){var r;d(e.__spreadArray(e.__spreadArray([],l,!0),[n],!1)),_(""),j(!1),null===(r=E.current)||void 0===r||r.focus()}(r)},onMouseEnter:function(){return X(r.id)},onMouseLeave:function(){return X(null)},style:e.__assign(e.__assign({},s.checkboxOption),{backgroundColor:H===r.id?"#F1F5F9":"transparent"})},{children:[n.jsx("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),n.jsxs("div",{children:[n.jsx("p",e.__assign({style:s.optionTitle},{children:r.name})),n.jsx("p",e.__assign({style:s.optionSubtitle},{children:r.email}))]})]}))},r.id)})}))]})),n.jsxs("label",e.__assign({htmlFor:"group-search-input",style:e.__assign(e.__assign({},s.sectionLabel),{display:"inline-block",marginTop:"0.375rem"})},{children:[n.jsx("span",e.__assign({style:s.requiredMark},{children:"*"})),"Select user group who can approve"]})),n.jsxs("div",e.__assign({ref:R,style:s.dropdownWrapper},{children:[n.jsxs("label",e.__assign({htmlFor:"group-search-input",style:e.__assign(e.__assign({},s.inputShell),{borderColor:P?"#2563EB":"#E2E8F0",boxShadow:P?"0 0 0 1px #2563EB":"none"})},{children:[n.jsx(t.Search,{size:14,style:s.searchIcon}),c.map(function(r){return n.jsxs("span",e.__assign({style:s.chip},{children:[r.name,n.jsx("button",e.__assign({type:"button",onMouseDown:function(e){var n;e.preventDefault(),n=r._id,p(c.filter(function(e){return e._id!==n}))},onMouseEnter:function(){return ee(r._id)},onMouseLeave:function(){return ee(null)},style:e.__assign(e.__assign({},s.chipRemoveButton),{backgroundColor:$===r._id?"#DBEAFE":"transparent"})},{children:n.jsx(t.X,{size:12})}))]}),r._id)}),n.jsx("input",{ref:I,id:"group-search-input",type:"text",value:w,onChange:function(e){return C(e.target.value)},onFocus:function(){G(!0)},onBlur:function(){return G(!1)},placeholder:0===c.length?"Search by group name...":"",style:s.input})]})),z&&(ae||ue.length>0)&&n.jsx("ul",e.__assign({style:s.dropdown},{children:ae?[1,2,3,4].map(function(r){return n.jsxs("li",e.__assign({style:s.skeletonItem},{children:[n.jsx("div",{style:s.skeletonLinePrimary}),n.jsx("div",{style:s.skeletonLineSecondary})]}),r)}):ue.map(function(r){return n.jsx("li",{children:n.jsxs("div",e.__assign({onMouseDown:function(n){n.preventDefault(),function(n){var r;p(e.__spreadArray(e.__spreadArray([],c,!0),[n],!1)),C(""),A(!1),null===(r=I.current)||void 0===r||r.focus()}(r)},onMouseEnter:function(){return K(r._id)},onMouseLeave:function(){return K(null)},style:e.__assign(e.__assign({},s.checkboxOption),{backgroundColor:J===r._id?"#F1F5F9":"transparent"})},{children:[n.jsx("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),n.jsxs("div",{children:[n.jsx("p",e.__assign({style:s.optionTitle},{children:r.name})),n.jsx("p",e.__assign({style:s.optionSubtitle},{children:r.description}))]})]}))},r._id)})}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),t=require("lucide-react"),i=require("../queries/useApprovalQueries.js"),o=require("../store/useAuthStore.js"),s={root:{marginLeft:"1.5rem"},sectionLabel:{fontSize:"0.875rem",fontWeight:500,color:"#19213D"},requiredMark:{marginRight:"0.25rem",fontSize:"1rem",fontWeight:600,color:"#8F2C23"},dropdownWrapper:{position:"relative",marginTop:"0.375rem"},inputShell:{display:"flex",minHeight:"38px",width:"100%",cursor:"text",flexWrap:"wrap",alignItems:"center",gap:"0.375rem",borderRadius:"0.375rem",border:"1px solid #E2E8F0",padding:"0.375rem 0.5rem",boxSizing:"border-box",transition:"border-color 150ms ease-in-out, box-shadow 150ms ease-in-out"},searchIcon:{flexShrink:0,color:"#9CA3AF"},chip:{display:"flex",alignItems:"center",gap:"0.25rem",borderRadius:"9999px",backgroundColor:"#EFF6FF",padding:"0.125rem 0.625rem",fontSize:"0.75rem",fontWeight:500,color:"#1D4ED8"},chipRemoveButton:{marginLeft:"0.125rem",border:"none",borderRadius:"9999px",background:"transparent",padding:0,cursor:"pointer",outline:"none"},input:{minWidth:"120px",flex:1,border:"none",backgroundColor:"transparent",fontSize:"0.875rem",color:"#19213D",outline:"none"},dropdown:{position:"absolute",zIndex:50,marginTop:"0.25rem",maxHeight:"12rem",width:"100%",overflowY:"auto",borderRadius:"0.375rem",border:"1px solid #E2E8F0",backgroundColor:"#FFFFFF",padding:"0.25rem 0",listStyle:"none",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",boxSizing:"border-box"},skeletonItem:{padding:"0.5rem 0.75rem"},skeletonLinePrimary:{height:"1rem",width:"75%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB"},skeletonLineSecondary:{height:"0.75rem",width:"50%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB",marginTop:"0.375rem"},checkboxOption:{display:"flex",alignItems:"center",gap:"0.625rem",width:"100%",padding:"0.5rem 0.75rem",cursor:"pointer",boxSizing:"border-box"},checkboxInput:{width:"14px",height:"14px",flexShrink:0,cursor:"pointer",accentColor:"#2563EB",margin:0},optionTitle:{fontSize:"0.875rem",fontWeight:500,color:"#19213D",margin:0},optionSubtitle:{fontSize:"0.75rem",color:"#666F8D",margin:0}};exports.default=function(a){var u,l=a.selectedApprovers,c=a.selectedGroupOfApprovers,d=a.onApproversChange,p=a.onGroupsChange,h=o.default(function(e){return e.user}),g=(null==h?void 0:h.firstname)?"".concat(h.firstname," ").concat(null!==(u=h.lastname)&&void 0!==u?u:"").trim():null==h?void 0:h.email,m=r.useState(""),f=m[0],_=m[1],x=r.useState(""),b=x[0],v=x[1],y=r.useState(!1),S=y[0],j=y[1],E=r.useRef(null),F=r.useRef(null),k=r.useState(""),w=k[0],C=k[1],L=r.useState(""),D=L[0],B=L[1],z=r.useState(!1),A=z[0],M=z[1],R=r.useRef(null),I=r.useRef(null),T=r.useState(!1),W=T[0],q=T[1],O=r.useState(!1),P=O[0],G=O[1],Q=r.useState(null),H=Q[0],X=Q[1],Y=r.useState(null),J=Y[0],K=Y[1],N=r.useState(null),U=N[0],V=N[1],Z=r.useState(null),$=Z[0],ee=Z[1];r.useEffect(function(){if(!f.trim())return v(""),void j(!1);var e=setTimeout(function(){return v(f)},500);return function(){return clearTimeout(e)}},[f]),r.useEffect(function(){var e=setTimeout(function(){return B(w)},300);return function(){return clearTimeout(e)}},[w]);var ne=i.useApproverSearchQuery(b),re=ne.data,te=ne.isFetching,ie=(re||[]).filter(function(e){return!l.some(function(n){return n.id===e._id})&&e.email!==(null==h?void 0:h.email)}).slice(0,10).map(function(e){var n,r,t,i;return{id:e._id,email:null!==(n=e.email)&&void 0!==n?n:"",name:(null===(r=e.firstname)||void 0===r?void 0:r.trim())?"".concat(e.firstname," ").concat(null!==(t=e.lastname)&&void 0!==t?t:"").trim():null!==(i=e.email)&&void 0!==i?i:""}});r.useEffect(function(){b.trim()&&(te||ie.length>0)&&j(!0)},[te,ie.length,b]);var oe=i.useGroupSearchQuery(D),se=oe.data,ae=oe.isFetching,ue=(se||[]).filter(function(e){return!c.some(function(n){return n._id===e._id})}).slice(0,10);r.useEffect(function(){P&&(ae||ue.length>0)&&M(!0)},[ae,ue.length,P]),r.useEffect(function(){var e=function(e){E.current&&!E.current.contains(e.target)&&j(!1),R.current&&!R.current.contains(e.target)&&M(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);return n.jsxs("div",e.__assign({style:s.root},{children:[n.jsx("label",e.__assign({htmlFor:"approver-search-input",style:s.sectionLabel},{children:"Select who can approve"})),n.jsxs("div",e.__assign({ref:E,style:s.dropdownWrapper},{children:[n.jsxs("label",e.__assign({htmlFor:"approver-search-input",style:e.__assign(e.__assign({},s.inputShell),{borderColor:W?"#2563EB":"#E2E8F0",boxShadow:W?"0 0 0 1px #2563EB":"none"})},{children:[n.jsx(t.Search,{size:14,style:s.searchIcon}),(null==h?void 0:h.email)&&n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},s.chip),{backgroundColor:"#F1F5F9",color:"#64748B"})},{children:[g," (You)"]})),l.map(function(r){return n.jsxs("span",e.__assign({style:s.chip,title:r.email},{children:[r.name||r.email,n.jsx("button",e.__assign({type:"button",onMouseDown:function(e){var n;e.preventDefault(),n=r.id,d(l.filter(function(e){return e.id!==n}))},onMouseEnter:function(){return V(r.id)},onMouseLeave:function(){return V(null)},style:e.__assign(e.__assign({},s.chipRemoveButton),{backgroundColor:U===r.id?"#DBEAFE":"transparent"})},{children:n.jsx(t.X,{size:12})}))]}),r.id)}),n.jsx("input",{ref:F,id:"approver-search-input",type:"text",value:f,onChange:function(e){return _(e.target.value)},onFocus:function(){q(!0),(ie.length>0||te)&&j(!0)},onBlur:function(){return q(!1)},placeholder:0===l.length?"Search by name or email...":"",style:s.input})]})),S&&(te||ie.length>0)&&n.jsx("ul",e.__assign({style:s.dropdown},{children:te?[1,2,3,4].map(function(r){return n.jsxs("li",e.__assign({style:s.skeletonItem},{children:[n.jsx("div",{style:s.skeletonLinePrimary}),n.jsx("div",{style:s.skeletonLineSecondary})]}),r)}):ie.map(function(r){return n.jsx("li",{children:n.jsxs("div",e.__assign({onMouseDown:function(n){n.preventDefault(),function(n){var r;d(e.__spreadArray(e.__spreadArray([],l,!0),[n],!1)),_(""),j(!1),null===(r=F.current)||void 0===r||r.focus()}(r)},onMouseEnter:function(){return X(r.id)},onMouseLeave:function(){return X(null)},style:e.__assign(e.__assign({},s.checkboxOption),{backgroundColor:H===r.id?"#F1F5F9":"transparent"})},{children:[n.jsx("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),n.jsxs("div",{children:[n.jsx("p",e.__assign({style:s.optionTitle},{children:r.name})),n.jsx("p",e.__assign({style:s.optionSubtitle},{children:r.email}))]})]}))},r.id)})}))]})),n.jsx("label",e.__assign({htmlFor:"group-search-input",style:e.__assign(e.__assign({},s.sectionLabel),{display:"inline-block",marginTop:"0.375rem"})},{children:"Select user group who can approve"})),n.jsxs("div",e.__assign({ref:R,style:s.dropdownWrapper},{children:[n.jsxs("label",e.__assign({htmlFor:"group-search-input",style:e.__assign(e.__assign({},s.inputShell),{borderColor:P?"#2563EB":"#E2E8F0",boxShadow:P?"0 0 0 1px #2563EB":"none"})},{children:[n.jsx(t.Search,{size:14,style:s.searchIcon}),c.map(function(r){return n.jsxs("span",e.__assign({style:s.chip},{children:[r.name,n.jsx("button",e.__assign({type:"button",onMouseDown:function(e){var n;e.preventDefault(),n=r._id,p(c.filter(function(e){return e._id!==n}))},onMouseEnter:function(){return ee(r._id)},onMouseLeave:function(){return ee(null)},style:e.__assign(e.__assign({},s.chipRemoveButton),{backgroundColor:$===r._id?"#DBEAFE":"transparent"})},{children:n.jsx(t.X,{size:12})}))]}),r._id)}),n.jsx("input",{ref:I,id:"group-search-input",type:"text",value:w,onChange:function(e){return C(e.target.value)},onFocus:function(){G(!0)},onBlur:function(){return G(!1)},placeholder:0===c.length?"Search by group name...":"",style:s.input})]})),A&&(ae||ue.length>0)&&n.jsx("ul",e.__assign({style:s.dropdown},{children:ae?[1,2,3,4].map(function(r){return n.jsxs("li",e.__assign({style:s.skeletonItem},{children:[n.jsx("div",{style:s.skeletonLinePrimary}),n.jsx("div",{style:s.skeletonLineSecondary})]}),r)}):ue.map(function(r){return n.jsx("li",{children:n.jsxs("div",e.__assign({onMouseDown:function(n){n.preventDefault(),function(n){var r;p(e.__spreadArray(e.__spreadArray([],c,!0),[n],!1)),C(""),M(!1),null===(r=I.current)||void 0===r||r.focus()}(r)},onMouseEnter:function(){return K(r._id)},onMouseLeave:function(){return K(null)},style:e.__assign(e.__assign({},s.checkboxOption),{backgroundColor:J===r._id?"#F1F5F9":"transparent"})},{children:[n.jsx("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),n.jsxs("div",{children:[n.jsx("p",e.__assign({style:s.optionTitle},{children:r.name})),n.jsx("p",e.__assign({style:s.optionSubtitle},{children:r.description}))]})]}))},r._id)})}))]}))]}))};
2
2
  //# sourceMappingURL=AddScopeApprovalSearchComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as n}from"tslib";import{jsxs as r,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as i,useEffect as l}from"react";import{Search as u,X as a}from"lucide-react";import{useApproverSearchQuery as c,useGroupSearchQuery as d}from"../queries/useApprovalQueries.js";import p from"../store/useAuthStore.js";var s={root:{marginLeft:"1.5rem"},sectionLabel:{fontSize:"0.875rem",fontWeight:500,color:"#19213D"},requiredMark:{marginRight:"0.25rem",fontSize:"1rem",fontWeight:600,color:"#8F2C23"},dropdownWrapper:{position:"relative",marginTop:"0.375rem"},inputShell:{display:"flex",minHeight:"38px",width:"100%",cursor:"text",flexWrap:"wrap",alignItems:"center",gap:"0.375rem",borderRadius:"0.375rem",border:"1px solid #E2E8F0",padding:"0.375rem 0.5rem",boxSizing:"border-box",transition:"border-color 150ms ease-in-out, box-shadow 150ms ease-in-out"},searchIcon:{flexShrink:0,color:"#9CA3AF"},chip:{display:"flex",alignItems:"center",gap:"0.25rem",borderRadius:"9999px",backgroundColor:"#EFF6FF",padding:"0.125rem 0.625rem",fontSize:"0.75rem",fontWeight:500,color:"#1D4ED8"},chipRemoveButton:{marginLeft:"0.125rem",border:"none",borderRadius:"9999px",background:"transparent",padding:0,cursor:"pointer",outline:"none"},input:{minWidth:"120px",flex:1,border:"none",backgroundColor:"transparent",fontSize:"0.875rem",color:"#19213D",outline:"none"},dropdown:{position:"absolute",zIndex:50,marginTop:"0.25rem",maxHeight:"12rem",width:"100%",overflowY:"auto",borderRadius:"0.375rem",border:"1px solid #E2E8F0",backgroundColor:"#FFFFFF",padding:"0.25rem 0",listStyle:"none",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",boxSizing:"border-box"},skeletonItem:{padding:"0.5rem 0.75rem"},skeletonLinePrimary:{height:"1rem",width:"75%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB"},skeletonLineSecondary:{height:"0.75rem",width:"50%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB",marginTop:"0.375rem"},checkboxOption:{display:"flex",alignItems:"center",gap:"0.625rem",width:"100%",padding:"0.5rem 0.75rem",cursor:"pointer",boxSizing:"border-box"},checkboxInput:{width:"14px",height:"14px",flexShrink:0,cursor:"pointer",accentColor:"#2563EB",margin:0},optionTitle:{fontSize:"0.875rem",fontWeight:500,color:"#19213D",margin:0},optionSubtitle:{fontSize:"0.75rem",color:"#666F8D",margin:0}},m=function(m){var h,f=m.selectedApprovers,g=m.selectedGroupOfApprovers,b=m.onApproversChange,v=m.onGroupsChange,y=p(function(e){return e.user}),x=(null==y?void 0:y.firstname)?"".concat(y.firstname," ").concat(null!==(h=y.lastname)&&void 0!==h?h:"").trim():null==y?void 0:y.email,k=o(""),F=k[0],E=k[1],S=o(""),w=S[0],C=S[1],L=o(!1),D=L[0],B=L[1],M=i(null),z=i(null),I=o(""),_=I[0],T=I[1],R=o(""),A=R[0],W=R[1],q=o(!1),O=q[0],j=q[1],P=i(null),G=i(null),H=o(!1),Y=H[0],Q=H[1],J=o(!1),K=J[0],N=J[1],U=o(null),V=U[0],X=U[1],Z=o(null),$=Z[0],ee=Z[1],ne=o(null),re=ne[0],te=ne[1],oe=o(null),ie=oe[0],le=oe[1];l(function(){if(!F.trim())return C(""),void B(!1);var e=setTimeout(function(){return C(F)},500);return function(){return clearTimeout(e)}},[F]),l(function(){var e=setTimeout(function(){return W(_)},300);return function(){return clearTimeout(e)}},[_]);var ue=c(w),ae=ue.data,ce=ue.isFetching,de=(ae||[]).filter(function(e){return!f.some(function(n){return n.id===e._id})&&e.email!==(null==y?void 0:y.email)}).slice(0,10).map(function(e){var n,r,t,o;return{id:e._id,email:null!==(n=e.email)&&void 0!==n?n:"",name:(null===(r=e.firstname)||void 0===r?void 0:r.trim())?"".concat(e.firstname," ").concat(null!==(t=e.lastname)&&void 0!==t?t:"").trim():null!==(o=e.email)&&void 0!==o?o:""}});l(function(){w.trim()&&(ce||de.length>0)&&B(!0)},[ce,de.length,w]);var pe=d(A),se=pe.data,me=pe.isFetching,he=(se||[]).filter(function(e){return!g.some(function(n){return n._id===e._id})}).slice(0,10);l(function(){K&&(me||he.length>0)&&j(!0)},[me,he.length,K]),l(function(){var e=function(e){M.current&&!M.current.contains(e.target)&&B(!1),P.current&&!P.current.contains(e.target)&&j(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);return r("div",e({style:s.root},{children:[r("label",e({htmlFor:"approver-search-input",style:s.sectionLabel},{children:[t("span",e({style:s.requiredMark},{children:"*"})),"Select who can approve"]})),r("div",e({ref:M,style:s.dropdownWrapper},{children:[r("label",e({htmlFor:"approver-search-input",style:e(e({},s.inputShell),{borderColor:Y?"#2563EB":"#E2E8F0",boxShadow:Y?"0 0 0 1px #2563EB":"none"})},{children:[t(u,{size:14,style:s.searchIcon}),(null==y?void 0:y.email)&&r("span",e({style:e(e({},s.chip),{backgroundColor:"#F1F5F9",color:"#64748B"})},{children:[x," (You)"]})),f.map(function(n){return r("span",e({style:s.chip,title:n.email},{children:[n.name||n.email,t("button",e({type:"button",onMouseDown:function(e){var r;e.preventDefault(),r=n.id,b(f.filter(function(e){return e.id!==r}))},onMouseEnter:function(){return te(n.id)},onMouseLeave:function(){return te(null)},style:e(e({},s.chipRemoveButton),{backgroundColor:re===n.id?"#DBEAFE":"transparent"})},{children:t(a,{size:12})}))]}),n.id)}),t("input",{ref:z,id:"approver-search-input",type:"text",value:F,onChange:function(e){return E(e.target.value)},onFocus:function(){Q(!0),(de.length>0||ce)&&B(!0)},onBlur:function(){return Q(!1)},placeholder:0===f.length?"Search by name or email...":"",style:s.input})]})),D&&(ce||de.length>0)&&t("ul",e({style:s.dropdown},{children:ce?[1,2,3,4].map(function(n){return r("li",e({style:s.skeletonItem},{children:[t("div",{style:s.skeletonLinePrimary}),t("div",{style:s.skeletonLineSecondary})]}),n)}):de.map(function(o){return t("li",{children:r("div",e({onMouseDown:function(e){e.preventDefault(),function(e){var r;b(n(n([],f,!0),[e],!1)),E(""),B(!1),null===(r=z.current)||void 0===r||r.focus()}(o)},onMouseEnter:function(){return X(o.id)},onMouseLeave:function(){return X(null)},style:e(e({},s.checkboxOption),{backgroundColor:V===o.id?"#F1F5F9":"transparent"})},{children:[t("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),r("div",{children:[t("p",e({style:s.optionTitle},{children:o.name})),t("p",e({style:s.optionSubtitle},{children:o.email}))]})]}))},o.id)})}))]})),r("label",e({htmlFor:"group-search-input",style:e(e({},s.sectionLabel),{display:"inline-block",marginTop:"0.375rem"})},{children:[t("span",e({style:s.requiredMark},{children:"*"})),"Select user group who can approve"]})),r("div",e({ref:P,style:s.dropdownWrapper},{children:[r("label",e({htmlFor:"group-search-input",style:e(e({},s.inputShell),{borderColor:K?"#2563EB":"#E2E8F0",boxShadow:K?"0 0 0 1px #2563EB":"none"})},{children:[t(u,{size:14,style:s.searchIcon}),g.map(function(n){return r("span",e({style:s.chip},{children:[n.name,t("button",e({type:"button",onMouseDown:function(e){var r;e.preventDefault(),r=n._id,v(g.filter(function(e){return e._id!==r}))},onMouseEnter:function(){return le(n._id)},onMouseLeave:function(){return le(null)},style:e(e({},s.chipRemoveButton),{backgroundColor:ie===n._id?"#DBEAFE":"transparent"})},{children:t(a,{size:12})}))]}),n._id)}),t("input",{ref:G,id:"group-search-input",type:"text",value:_,onChange:function(e){return T(e.target.value)},onFocus:function(){N(!0)},onBlur:function(){return N(!1)},placeholder:0===g.length?"Search by group name...":"",style:s.input})]})),O&&(me||he.length>0)&&t("ul",e({style:s.dropdown},{children:me?[1,2,3,4].map(function(n){return r("li",e({style:s.skeletonItem},{children:[t("div",{style:s.skeletonLinePrimary}),t("div",{style:s.skeletonLineSecondary})]}),n)}):he.map(function(o){return t("li",{children:r("div",e({onMouseDown:function(e){e.preventDefault(),function(e){var r;v(n(n([],g,!0),[e],!1)),T(""),j(!1),null===(r=G.current)||void 0===r||r.focus()}(o)},onMouseEnter:function(){return ee(o._id)},onMouseLeave:function(){return ee(null)},style:e(e({},s.checkboxOption),{backgroundColor:$===o._id?"#F1F5F9":"transparent"})},{children:[t("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),r("div",{children:[t("p",e({style:s.optionTitle},{children:o.name})),t("p",e({style:s.optionSubtitle},{children:o.description}))]})]}))},o._id)})}))]}))]}))};export{m as default};
1
+ import{__assign as e,__spreadArray as n}from"tslib";import{jsxs as r,jsx as o}from"react/jsx-runtime";import{useState as t,useRef as i,useEffect as l}from"react";import{Search as u,X as a}from"lucide-react";import{useApproverSearchQuery as c,useGroupSearchQuery as d}from"../queries/useApprovalQueries.js";import p from"../store/useAuthStore.js";var s={root:{marginLeft:"1.5rem"},sectionLabel:{fontSize:"0.875rem",fontWeight:500,color:"#19213D"},requiredMark:{marginRight:"0.25rem",fontSize:"1rem",fontWeight:600,color:"#8F2C23"},dropdownWrapper:{position:"relative",marginTop:"0.375rem"},inputShell:{display:"flex",minHeight:"38px",width:"100%",cursor:"text",flexWrap:"wrap",alignItems:"center",gap:"0.375rem",borderRadius:"0.375rem",border:"1px solid #E2E8F0",padding:"0.375rem 0.5rem",boxSizing:"border-box",transition:"border-color 150ms ease-in-out, box-shadow 150ms ease-in-out"},searchIcon:{flexShrink:0,color:"#9CA3AF"},chip:{display:"flex",alignItems:"center",gap:"0.25rem",borderRadius:"9999px",backgroundColor:"#EFF6FF",padding:"0.125rem 0.625rem",fontSize:"0.75rem",fontWeight:500,color:"#1D4ED8"},chipRemoveButton:{marginLeft:"0.125rem",border:"none",borderRadius:"9999px",background:"transparent",padding:0,cursor:"pointer",outline:"none"},input:{minWidth:"120px",flex:1,border:"none",backgroundColor:"transparent",fontSize:"0.875rem",color:"#19213D",outline:"none"},dropdown:{position:"absolute",zIndex:50,marginTop:"0.25rem",maxHeight:"12rem",width:"100%",overflowY:"auto",borderRadius:"0.375rem",border:"1px solid #E2E8F0",backgroundColor:"#FFFFFF",padding:"0.25rem 0",listStyle:"none",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",boxSizing:"border-box"},skeletonItem:{padding:"0.5rem 0.75rem"},skeletonLinePrimary:{height:"1rem",width:"75%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB"},skeletonLineSecondary:{height:"0.75rem",width:"50%",borderRadius:"0.25rem",backgroundColor:"#E5E7EB",marginTop:"0.375rem"},checkboxOption:{display:"flex",alignItems:"center",gap:"0.625rem",width:"100%",padding:"0.5rem 0.75rem",cursor:"pointer",boxSizing:"border-box"},checkboxInput:{width:"14px",height:"14px",flexShrink:0,cursor:"pointer",accentColor:"#2563EB",margin:0},optionTitle:{fontSize:"0.875rem",fontWeight:500,color:"#19213D",margin:0},optionSubtitle:{fontSize:"0.75rem",color:"#666F8D",margin:0}},m=function(m){var h,f=m.selectedApprovers,g=m.selectedGroupOfApprovers,b=m.onApproversChange,v=m.onGroupsChange,y=p(function(e){return e.user}),x=(null==y?void 0:y.firstname)?"".concat(y.firstname," ").concat(null!==(h=y.lastname)&&void 0!==h?h:"").trim():null==y?void 0:y.email,F=t(""),k=F[0],E=F[1],S=t(""),w=S[0],C=S[1],L=t(!1),D=L[0],B=L[1],z=i(null),I=i(null),M=t(""),_=M[0],T=M[1],R=t(""),A=R[0],W=R[1],O=t(!1),j=O[0],P=O[1],q=i(null),G=i(null),H=t(!1),Y=H[0],Q=H[1],J=t(!1),K=J[0],N=J[1],U=t(null),V=U[0],X=U[1],Z=t(null),$=Z[0],ee=Z[1],ne=t(null),re=ne[0],oe=ne[1],te=t(null),ie=te[0],le=te[1];l(function(){if(!k.trim())return C(""),void B(!1);var e=setTimeout(function(){return C(k)},500);return function(){return clearTimeout(e)}},[k]),l(function(){var e=setTimeout(function(){return W(_)},300);return function(){return clearTimeout(e)}},[_]);var ue=c(w),ae=ue.data,ce=ue.isFetching,de=(ae||[]).filter(function(e){return!f.some(function(n){return n.id===e._id})&&e.email!==(null==y?void 0:y.email)}).slice(0,10).map(function(e){var n,r,o,t;return{id:e._id,email:null!==(n=e.email)&&void 0!==n?n:"",name:(null===(r=e.firstname)||void 0===r?void 0:r.trim())?"".concat(e.firstname," ").concat(null!==(o=e.lastname)&&void 0!==o?o:"").trim():null!==(t=e.email)&&void 0!==t?t:""}});l(function(){w.trim()&&(ce||de.length>0)&&B(!0)},[ce,de.length,w]);var pe=d(A),se=pe.data,me=pe.isFetching,he=(se||[]).filter(function(e){return!g.some(function(n){return n._id===e._id})}).slice(0,10);l(function(){K&&(me||he.length>0)&&P(!0)},[me,he.length,K]),l(function(){var e=function(e){z.current&&!z.current.contains(e.target)&&B(!1),q.current&&!q.current.contains(e.target)&&P(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);return r("div",e({style:s.root},{children:[o("label",e({htmlFor:"approver-search-input",style:s.sectionLabel},{children:"Select who can approve"})),r("div",e({ref:z,style:s.dropdownWrapper},{children:[r("label",e({htmlFor:"approver-search-input",style:e(e({},s.inputShell),{borderColor:Y?"#2563EB":"#E2E8F0",boxShadow:Y?"0 0 0 1px #2563EB":"none"})},{children:[o(u,{size:14,style:s.searchIcon}),(null==y?void 0:y.email)&&r("span",e({style:e(e({},s.chip),{backgroundColor:"#F1F5F9",color:"#64748B"})},{children:[x," (You)"]})),f.map(function(n){return r("span",e({style:s.chip,title:n.email},{children:[n.name||n.email,o("button",e({type:"button",onMouseDown:function(e){var r;e.preventDefault(),r=n.id,b(f.filter(function(e){return e.id!==r}))},onMouseEnter:function(){return oe(n.id)},onMouseLeave:function(){return oe(null)},style:e(e({},s.chipRemoveButton),{backgroundColor:re===n.id?"#DBEAFE":"transparent"})},{children:o(a,{size:12})}))]}),n.id)}),o("input",{ref:I,id:"approver-search-input",type:"text",value:k,onChange:function(e){return E(e.target.value)},onFocus:function(){Q(!0),(de.length>0||ce)&&B(!0)},onBlur:function(){return Q(!1)},placeholder:0===f.length?"Search by name or email...":"",style:s.input})]})),D&&(ce||de.length>0)&&o("ul",e({style:s.dropdown},{children:ce?[1,2,3,4].map(function(n){return r("li",e({style:s.skeletonItem},{children:[o("div",{style:s.skeletonLinePrimary}),o("div",{style:s.skeletonLineSecondary})]}),n)}):de.map(function(t){return o("li",{children:r("div",e({onMouseDown:function(e){e.preventDefault(),function(e){var r;b(n(n([],f,!0),[e],!1)),E(""),B(!1),null===(r=I.current)||void 0===r||r.focus()}(t)},onMouseEnter:function(){return X(t.id)},onMouseLeave:function(){return X(null)},style:e(e({},s.checkboxOption),{backgroundColor:V===t.id?"#F1F5F9":"transparent"})},{children:[o("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),r("div",{children:[o("p",e({style:s.optionTitle},{children:t.name})),o("p",e({style:s.optionSubtitle},{children:t.email}))]})]}))},t.id)})}))]})),o("label",e({htmlFor:"group-search-input",style:e(e({},s.sectionLabel),{display:"inline-block",marginTop:"0.375rem"})},{children:"Select user group who can approve"})),r("div",e({ref:q,style:s.dropdownWrapper},{children:[r("label",e({htmlFor:"group-search-input",style:e(e({},s.inputShell),{borderColor:K?"#2563EB":"#E2E8F0",boxShadow:K?"0 0 0 1px #2563EB":"none"})},{children:[o(u,{size:14,style:s.searchIcon}),g.map(function(n){return r("span",e({style:s.chip},{children:[n.name,o("button",e({type:"button",onMouseDown:function(e){var r;e.preventDefault(),r=n._id,v(g.filter(function(e){return e._id!==r}))},onMouseEnter:function(){return le(n._id)},onMouseLeave:function(){return le(null)},style:e(e({},s.chipRemoveButton),{backgroundColor:ie===n._id?"#DBEAFE":"transparent"})},{children:o(a,{size:12})}))]}),n._id)}),o("input",{ref:G,id:"group-search-input",type:"text",value:_,onChange:function(e){return T(e.target.value)},onFocus:function(){N(!0)},onBlur:function(){return N(!1)},placeholder:0===g.length?"Search by group name...":"",style:s.input})]})),j&&(me||he.length>0)&&o("ul",e({style:s.dropdown},{children:me?[1,2,3,4].map(function(n){return r("li",e({style:s.skeletonItem},{children:[o("div",{style:s.skeletonLinePrimary}),o("div",{style:s.skeletonLineSecondary})]}),n)}):he.map(function(t){return o("li",{children:r("div",e({onMouseDown:function(e){e.preventDefault(),function(e){var r;v(n(n([],g,!0),[e],!1)),T(""),P(!1),null===(r=G.current)||void 0===r||r.focus()}(t)},onMouseEnter:function(){return ee(t._id)},onMouseLeave:function(){return ee(null)},style:e(e({},s.checkboxOption),{backgroundColor:$===t._id?"#F1F5F9":"transparent"})},{children:[o("input",{type:"checkbox",checked:!1,onChange:function(){},style:s.checkboxInput}),r("div",{children:[o("p",e({style:s.optionTitle},{children:t.name})),o("p",e({style:s.optionSubtitle},{children:t.description}))]})]}))},t._id)})}))]}))]}))};export{m as default};
2
2
  //# sourceMappingURL=AddScopeApprovalSearchComponent.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/instant-learning",
3
- "version": "1.3.0-alpha.124",
3
+ "version": "1.3.0-alpha.125",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",