@viswa-test/creative-workspace-ui-component 0.0.67 → 0.0.68

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("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),s=require("lucide-react"),a=require("./AssignLevelAccordions.js"),l=require("./components/CustomCheckbox.js"),t=require("./assets/FileCheckCorner.js"),r=require("./styles/AssignReminderStyles.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(i),d=[{label:"Edit",icon:n.jsx(s.PenLine,{size:14})},{label:"Approve",icon:n.jsx(s.UserRoundCheck,{size:14})},{label:"Edit & Approve",icon:n.jsx(t.default,{})},{label:"Notify",icon:n.jsx(s.Bell,{size:14})}],c=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},p=function(e,n){var i,s=n>0?null===(i=e[n-1])||void 0===i?void 0:i.dueDate:null;return c(s||new Date)},_=function(e,n,i){var s,a=null===(s=e[n+1])||void 0===s?void 0:s.dueDate;return a?c(a):i?c(i):null};exports.AssignReminderLevels=function(i){var t=i.title,o=i.levels,v=void 0===o?[]:o,f=i.requireFinalApproval,g=void 0!==f&&f,x=i.additionalInfo,h=i.setLevels,j=i.setRequireFinalApproval,y=i.fetchUsers,A=i.accessLevelOptions,m=void 0===A?d:A,D=i.customInfoIcon,L=i.onValidationError,E=i.customStyles,S=void 0===E?{}:E,b=i.totalLevels,I=i.finalApprovalDueDate,F=i.displayConfig,R=u.default.useState(!1),M=R[0],w=R[1],C=!!(null==F?void 0:F.disableRequiredButtonOnUserAdd),T=function(e){return(null!=e?e:[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)||!!(null==e?void 0:e.name)})};u.default.useEffect(function(){C&&(null==h||h(function(n){var i=!1,s=n.map(function(n){var s,a,l=(null!==(a=null===(s=n.assignees)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0;return n.isHidden||n.isMandatory||!l?n:(i=!0,e.__assign(e.__assign({},n),{isMandatory:!0}))});return i?s:n}))},[v,h,C]);var q,N=u.default.useMemo(function(){return Array.from({length:null!=b?b:3},function(e,n){var i;return null!==(i=v[n])&&void 0!==i?i:{title:"Level ".concat(n+1),headerName:"L ".concat(n+1),isMandatory:!1,dueDate:null,assignees:[],hasDueDate:!0}})},[v,b]),z=(v.length>0?v:N).filter(function(e){return!e.isHidden});return n.jsxs("div",e.__assign({style:e.__assign({padding:"8px",display:"flex",flexDirection:"column",gap:"18px"},S.container)},{children:[n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.header),S.levelsHeader)},{children:[n.jsx("span",{children:null!=t?t:"Assignee Levels"}),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.infoIconWrapper),S.infoIconWrapper),onMouseEnter:function(){return w(!0)},onMouseLeave:function(){return w(!1)}},{children:[null!=D?D:n.jsx(s.InfoIcon,{width:18,height:18}),n.jsx("div",e.__assign({style:e.__assign(e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.tooltip),S.tooltip),M?e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.tooltipVisible),S.tooltipVisible):{})},{children:x||n.jsxs("span",{children:[n.jsx("b",{children:"How it works:"}),n.jsx("br",{}),"Level 1 is required by default, Enable Level 2 and Level 3 to add sequential approval steps for the review"]})}))]}))]})),n.jsx("div",e.__assign({style:e.__assign({display:"flex",flexDirection:"column",gap:"16px"},S.accordionsContainer)},{children:z.map(function(i,s){return n.jsx(a.default,{level:C&&T(i.assignees)?e.__assign(e.__assign({},i),{isMandatory:!0}):i,id:String(s),accessLevelOptions:m,fetchUsers:y,onToggleMandatory:function(){return function(n){var i,s,a,l=(null!==(a=null===(s=null===(i=v[n])||void 0===i?void 0:i.assignees)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0;C&&l||null==h||h(function(i){return i.map(function(i,s){return s===n?e.__assign(e.__assign({},i),{isMandatory:!i.isMandatory}):i})})}(s)},onDueDateChange:function(n){return function(n,i){var s;if(i){var a=c(i),l=p(v,n),t=_(v,n,I);if(a<l)return void(null==L||L(0===n?"Level 1 due date cannot be before today":"Level ".concat(n+1," due date cannot be before Level ").concat(n," due date")));if(t&&a>t)return void(null==L||L((null===(s=v[n+1])||void 0===s?void 0:s.dueDate)?"Level ".concat(n+1," due date cannot be after Level ").concat(n+2," due date"):"Level due date cannot be after final approval due date"))}null==h||h(function(s){return s.map(function(s,a){return a===n?e.__assign(e.__assign({},s),{dueDate:i?c(i):null}):s})})}(s,n)},onAssigneesChange:function(n){return i=s,l=(null!=(a=n)?a:[]).map(function(n){var i=n.accessLevel||n.role||"";return e.__assign(e.__assign({},n),{role:i,accessLevel:i})}),t=C&&T(l),void(null==h||h(function(n){return n.map(function(n,s){return s===i?e.__assign(e.__assign({},n),{assignees:l,isMandatory:!!t||n.isMandatory}):n})}));var i,a,l,t},onTitleChange:function(n){return function(n,i){null==h||h(function(s){return s.map(function(s,a){return a===n?e.__assign(e.__assign({},s),{title:i}):s})})}(s,n)},minDueDate:p(z,s),maxDueDate:_(z,s,I),finalApprovalDueDate:I,displayConfig:F},s)})})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.finalApprovalBox),S.finalApprovalBox)},{children:[n.jsx(l.default,{getter:g,setter:null!=j?j:function(){}}),n.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:"column",alignItems:"baseline",fontSize:"14px",fontWeight:400},S.finalApprovalTextWrapper)},{children:[n.jsx("span",e.__assign({style:e.__assign({fontWeight:500},S.finalApprovalTitle)},{children:"Require Final Approval"})),n.jsx("span",e.__assign({style:S.finalApprovalDesc},{children:"After all assignees approve, you (the owner) will be notified to give final sign-off before the redline is settled."}))]}))]})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.currentApprovalFlow),S.currentApprovalFlow)},{children:[n.jsx("span",e.__assign({style:e.__assign({fontSize:"14px",fontWeight:600},S.currentApprovalFlowTitle)},{children:"Current Approval Flow"})),(q=v.filter(function(e){var n,i;return(null!==(i=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0}),n.jsx("div",e.__assign({style:e.__assign({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"4px"},S.approvalFlowItemsWrapper)},{children:q.map(function(i,a){var l,t,r=i.isHidden,o=!i.isMandatory&&!r,d=null!==(l=i.assignees)&&void 0!==l?l:[],c=r?n.jsx(s.User,{size:16}):function(e){switch(e){case 0:return n.jsx(s.Edit2,{size:16});case 1:return n.jsx(s.FileCheck,{size:16});case 2:return n.jsx(s.User,{size:16});default:return n.jsx(s.CheckSquare,{size:16})}}(a);return n.jsxs(u.default.Fragment,{children:[n.jsxs("div",e.__assign({style:e.__assign({display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",fontWeight:500,color:o?"#64748B":"#374151",border:o?"1px dashed #CBD5E1":void 0,borderRadius:o?"6px":void 0,padding:o?"2px 6px":void 0},S.approvalFlowItem),title:i.title||"Level ".concat(a+1)},{children:[c,n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[d.map(function(i,s){var a,l,t=i.role||i.accessLevel||"No role assigned";return n.jsxs(u.default.Fragment,{children:[s>0&&n.jsx("span",e.__assign({style:{color:"#9CA3AF"}},{children:"/"})),n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n.jsx("span",{children:i.name}),n.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:t}))]}))]},null!==(l=null!==(a=i.id)&&void 0!==a?a:i.email)&&void 0!==l?l:s)}),o&&n.jsx("span",{children:"(Optional)"})]}))]})),a<q.length-1&&n.jsx(s.ArrowRight,{size:16,color:"#9CA3AF"})]},null!==(t=i.id)&&void 0!==t?t:a)})})))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),s=require("lucide-react"),a=require("./AssignLevelAccordions.js"),l=require("./components/CustomCheckbox.js"),t=require("./assets/FileCheckCorner.js"),r=require("./styles/AssignReminderStyles.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(i),d=[{label:"Edit & Approve",icon:n.jsx(t.default,{})},{label:"Edit",icon:n.jsx(s.PenLine,{size:14})},{label:"Approve",icon:n.jsx(s.UserRoundCheck,{size:14})},{label:"Notify",icon:n.jsx(s.Bell,{size:14})}],c=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},p=function(e,n){var i,s=n>0?null===(i=e[n-1])||void 0===i?void 0:i.dueDate:null;return c(s||new Date)},_=function(e,n,i){var s,a=null===(s=e[n+1])||void 0===s?void 0:s.dueDate;return a?c(a):i?c(i):null};exports.AssignReminderLevels=function(i){var t=i.title,o=i.levels,v=void 0===o?[]:o,f=i.requireFinalApproval,g=void 0!==f&&f,x=i.additionalInfo,h=i.setLevels,j=i.setRequireFinalApproval,y=i.fetchUsers,A=i.accessLevelOptions,m=void 0===A?d:A,D=i.customInfoIcon,L=i.onValidationError,E=i.customStyles,S=void 0===E?{}:E,b=i.totalLevels,I=i.finalApprovalDueDate,F=i.displayConfig,R=u.default.useState(!1),M=R[0],w=R[1],C=!!(null==F?void 0:F.disableRequiredButtonOnUserAdd),T=function(e){return(null!=e?e:[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)||!!(null==e?void 0:e.name)})};u.default.useEffect(function(){C&&(null==h||h(function(n){var i=!1,s=n.map(function(n){var s,a,l=(null!==(a=null===(s=n.assignees)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0;return n.isHidden||n.isMandatory||!l?n:(i=!0,e.__assign(e.__assign({},n),{isMandatory:!0}))});return i?s:n}))},[v,h,C]);var q,N=u.default.useMemo(function(){return Array.from({length:null!=b?b:3},function(e,n){var i;return null!==(i=v[n])&&void 0!==i?i:{title:"Level ".concat(n+1),headerName:"L ".concat(n+1),isMandatory:!1,dueDate:null,assignees:[],hasDueDate:!0}})},[v,b]),z=(v.length>0?v:N).filter(function(e){return!e.isHidden});return n.jsxs("div",e.__assign({style:e.__assign({padding:"8px",display:"flex",flexDirection:"column",gap:"18px"},S.container)},{children:[n.jsxs("span",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.header),S.levelsHeader)},{children:[n.jsx("span",{children:null!=t?t:"Assignee Levels"}),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.infoIconWrapper),S.infoIconWrapper),onMouseEnter:function(){return w(!0)},onMouseLeave:function(){return w(!1)}},{children:[null!=D?D:n.jsx(s.InfoIcon,{width:18,height:18}),n.jsx("div",e.__assign({style:e.__assign(e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.tooltip),S.tooltip),M?e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.tooltipVisible),S.tooltipVisible):{})},{children:x||n.jsxs("span",{children:[n.jsx("b",{children:"How it works:"}),n.jsx("br",{}),"Level 1 is required by default, Enable Level 2 and Level 3 to add sequential approval steps for the review"]})}))]}))]})),n.jsx("div",e.__assign({style:e.__assign({display:"flex",flexDirection:"column",gap:"16px"},S.accordionsContainer)},{children:z.map(function(i,s){return n.jsx(a.default,{level:C&&T(i.assignees)?e.__assign(e.__assign({},i),{isMandatory:!0}):i,id:String(s),accessLevelOptions:m,fetchUsers:y,onToggleMandatory:function(){return function(n){var i,s,a,l=(null!==(a=null===(s=null===(i=v[n])||void 0===i?void 0:i.assignees)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0;C&&l||null==h||h(function(i){return i.map(function(i,s){return s===n?e.__assign(e.__assign({},i),{isMandatory:!i.isMandatory}):i})})}(s)},onDueDateChange:function(n){return function(n,i){var s;if(i){var a=c(i),l=p(v,n),t=_(v,n,I);if(a<l)return void(null==L||L(0===n?"Level 1 due date cannot be before today":"Level ".concat(n+1," due date cannot be before Level ").concat(n," due date")));if(t&&a>t)return void(null==L||L((null===(s=v[n+1])||void 0===s?void 0:s.dueDate)?"Level ".concat(n+1," due date cannot be after Level ").concat(n+2," due date"):"Level due date cannot be after final approval due date"))}null==h||h(function(s){return s.map(function(s,a){return a===n?e.__assign(e.__assign({},s),{dueDate:i?c(i):null}):s})})}(s,n)},onAssigneesChange:function(n){return i=s,l=(null!=(a=n)?a:[]).map(function(n){var i=n.accessLevel||n.role||"";return e.__assign(e.__assign({},n),{role:i,accessLevel:i})}),t=C&&T(l),void(null==h||h(function(n){return n.map(function(n,s){return s===i?e.__assign(e.__assign({},n),{assignees:l,isMandatory:!!t||n.isMandatory}):n})}));var i,a,l,t},onTitleChange:function(n){return function(n,i){null==h||h(function(s){return s.map(function(s,a){return a===n?e.__assign(e.__assign({},s),{title:i}):s})})}(s,n)},minDueDate:p(z,s),maxDueDate:_(z,s,I),finalApprovalDueDate:I,displayConfig:F},s)})})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.finalApprovalBox),S.finalApprovalBox)},{children:[n.jsx(l.default,{getter:g,setter:null!=j?j:function(){}}),n.jsxs("div",e.__assign({style:e.__assign({display:"flex",flexDirection:"column",alignItems:"baseline",fontSize:"14px",fontWeight:400},S.finalApprovalTextWrapper)},{children:[n.jsx("span",e.__assign({style:e.__assign({fontWeight:500},S.finalApprovalTitle)},{children:"Require Final Approval"})),n.jsx("span",e.__assign({style:S.finalApprovalDesc},{children:"After all assignees approve, you (the owner) will be notified to give final sign-off before the redline is settled."}))]}))]})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},r.DEFAULT_ASSIGN_REMINDER_STYLES.currentApprovalFlow),S.currentApprovalFlow)},{children:[n.jsx("span",e.__assign({style:e.__assign({fontSize:"14px",fontWeight:600},S.currentApprovalFlowTitle)},{children:"Current Approval Flow"})),(q=v.filter(function(e){var n,i;return(null!==(i=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0}),n.jsx("div",e.__assign({style:e.__assign({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"4px"},S.approvalFlowItemsWrapper)},{children:q.map(function(i,a){var l,t,r=i.isHidden,o=!i.isMandatory&&!r,d=null!==(l=i.assignees)&&void 0!==l?l:[],c=r?n.jsx(s.User,{size:16}):function(e){switch(e){case 0:return n.jsx(s.Edit2,{size:16});case 1:return n.jsx(s.FileCheck,{size:16});case 2:return n.jsx(s.User,{size:16});default:return n.jsx(s.CheckSquare,{size:16})}}(a);return n.jsxs(u.default.Fragment,{children:[n.jsxs("div",e.__assign({style:e.__assign({display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",fontWeight:500,color:o?"#64748B":"#374151",border:o?"1px dashed #CBD5E1":void 0,borderRadius:o?"6px":void 0,padding:o?"2px 6px":void 0},S.approvalFlowItem),title:i.title||"Level ".concat(a+1)},{children:[c,n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[d.map(function(i,s){var a,l,t=i.role||i.accessLevel||"No role assigned";return n.jsxs(u.default.Fragment,{children:[s>0&&n.jsx("span",e.__assign({style:{color:"#9CA3AF"}},{children:"/"})),n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n.jsx("span",{children:i.name}),n.jsx("span",e.__assign({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:t}))]}))]},null!==(l=null!==(a=i.id)&&void 0!==a?a:i.email)&&void 0!==l?l:s)}),o&&n.jsx("span",{children:"(Optional)"})]}))]})),a<q.length-1&&n.jsx(s.ArrowRight,{size:16,color:"#9CA3AF"})]},null!==(t=i.id)&&void 0!==t?t:a)})})))]}))]}))};
2
2
  //# sourceMappingURL=AssignReminderLevels.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"../../_virtual/_tslib.js";import{jsx as n,jsxs as i}from"react/jsx-runtime";import l from"react";import{PenLine as t,UserRoundCheck as r,Bell as o,InfoIcon as a,User as s,ArrowRight as d,CheckSquare as u,FileCheck as c,Edit2 as p}from"lucide-react";import v from"./AssignLevelAccordions.js";import f from"./components/CustomCheckbox.js";import g from"./assets/FileCheckCorner.js";import{DEFAULT_ASSIGN_REMINDER_STYLES as h}from"./styles/AssignReminderStyles.js";var m=[{label:"Edit",icon:n(t,{size:14})},{label:"Approve",icon:n(r,{size:14})},{label:"Edit & Approve",icon:n(g,{})},{label:"Notify",icon:n(o,{size:14})}],y=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},x=function(e,n){var i,l=n>0?null===(i=e[n-1])||void 0===i?void 0:i.dueDate:null;return y(l||new Date)},A=function(e,n,i){var l,t=null===(l=e[n+1])||void 0===l?void 0:l.dueDate;return t?y(t):i?y(i):null};function b(t){var r=t.title,o=t.levels,g=void 0===o?[]:o,b=t.requireFinalApproval,D=void 0!==b&&b,L=t.additionalInfo,F=t.setLevels,w=t.setRequireFinalApproval,C=t.fetchUsers,z=t.accessLevelOptions,M=void 0===z?m:z,I=t.customInfoIcon,W=t.onValidationError,E=t.customStyles,S=void 0===E?{}:E,H=t.totalLevels,j=t.finalApprovalDueDate,q=t.displayConfig,R=l.useState(!1),T=R[0],B=R[1],k=!!(null==q?void 0:q.disableRequiredButtonOnUserAdd),O=function(e){return(null!=e?e:[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)||!!(null==e?void 0:e.name)})};l.useEffect(function(){k&&(null==F||F(function(n){var i=!1,l=n.map(function(n){var l,t,r=(null!==(t=null===(l=n.assignees)||void 0===l?void 0:l.length)&&void 0!==t?t:0)>0;return n.isHidden||n.isMandatory||!r?n:(i=!0,e(e({},n),{isMandatory:!0}))});return i?l:n}))},[g,F,k]);var N,U=l.useMemo(function(){return Array.from({length:null!=H?H:3},function(e,n){var i;return null!==(i=g[n])&&void 0!==i?i:{title:"Level ".concat(n+1),headerName:"L ".concat(n+1),isMandatory:!1,dueDate:null,assignees:[],hasDueDate:!0}})},[g,H]),V=(g.length>0?g:U).filter(function(e){return!e.isHidden});return i("div",e({style:e({padding:"8px",display:"flex",flexDirection:"column",gap:"18px"},S.container)},{children:[i("span",e({style:e(e({},h.header),S.levelsHeader)},{children:[n("span",{children:null!=r?r:"Assignee Levels"}),i("div",e({style:e(e({},h.infoIconWrapper),S.infoIconWrapper),onMouseEnter:function(){return B(!0)},onMouseLeave:function(){return B(!1)}},{children:[null!=I?I:n(a,{width:18,height:18}),n("div",e({style:e(e(e({},h.tooltip),S.tooltip),T?e(e({},h.tooltipVisible),S.tooltipVisible):{})},{children:L||i("span",{children:[n("b",{children:"How it works:"}),n("br",{}),"Level 1 is required by default, Enable Level 2 and Level 3 to add sequential approval steps for the review"]})}))]}))]})),n("div",e({style:e({display:"flex",flexDirection:"column",gap:"16px"},S.accordionsContainer)},{children:V.map(function(i,l){return n(v,{level:k&&O(i.assignees)?e(e({},i),{isMandatory:!0}):i,id:String(l),accessLevelOptions:M,fetchUsers:C,onToggleMandatory:function(){return function(n){var i,l,t,r=(null!==(t=null===(l=null===(i=g[n])||void 0===i?void 0:i.assignees)||void 0===l?void 0:l.length)&&void 0!==t?t:0)>0;k&&r||null==F||F(function(i){return i.map(function(i,l){return l===n?e(e({},i),{isMandatory:!i.isMandatory}):i})})}(l)},onDueDateChange:function(n){return function(n,i){var l;if(i){var t=y(i),r=x(g,n),o=A(g,n,j);if(t<r)return void(null==W||W(0===n?"Level 1 due date cannot be before today":"Level ".concat(n+1," due date cannot be before Level ").concat(n," due date")));if(o&&t>o)return void(null==W||W((null===(l=g[n+1])||void 0===l?void 0:l.dueDate)?"Level ".concat(n+1," due date cannot be after Level ").concat(n+2," due date"):"Level due date cannot be after final approval due date"))}null==F||F(function(l){return l.map(function(l,t){return t===n?e(e({},l),{dueDate:i?y(i):null}):l})})}(l,n)},onAssigneesChange:function(n){return i=l,r=(null!=(t=n)?t:[]).map(function(n){var i=n.accessLevel||n.role||"";return e(e({},n),{role:i,accessLevel:i})}),o=k&&O(r),void(null==F||F(function(n){return n.map(function(n,l){return l===i?e(e({},n),{assignees:r,isMandatory:!!o||n.isMandatory}):n})}));var i,t,r,o},onTitleChange:function(n){return function(n,i){null==F||F(function(l){return l.map(function(l,t){return t===n?e(e({},l),{title:i}):l})})}(l,n)},minDueDate:x(V,l),maxDueDate:A(V,l,j),finalApprovalDueDate:j,displayConfig:q},l)})})),i("div",e({style:e(e({},h.finalApprovalBox),S.finalApprovalBox)},{children:[n(f,{getter:D,setter:null!=w?w:function(){}}),i("div",e({style:e({display:"flex",flexDirection:"column",alignItems:"baseline",fontSize:"14px",fontWeight:400},S.finalApprovalTextWrapper)},{children:[n("span",e({style:e({fontWeight:500},S.finalApprovalTitle)},{children:"Require Final Approval"})),n("span",e({style:S.finalApprovalDesc},{children:"After all assignees approve, you (the owner) will be notified to give final sign-off before the redline is settled."}))]}))]})),i("div",e({style:e(e({},h.currentApprovalFlow),S.currentApprovalFlow)},{children:[n("span",e({style:e({fontSize:"14px",fontWeight:600},S.currentApprovalFlowTitle)},{children:"Current Approval Flow"})),(N=g.filter(function(e){var n,i;return(null!==(i=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0}),n("div",e({style:e({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"4px"},S.approvalFlowItemsWrapper)},{children:N.map(function(t,r){var o,a,v=t.isHidden,f=!t.isMandatory&&!v,g=null!==(o=t.assignees)&&void 0!==o?o:[],h=v?n(s,{size:16}):function(e){switch(e){case 0:return n(p,{size:16});case 1:return n(c,{size:16});case 2:return n(s,{size:16});default:return n(u,{size:16})}}(r);return i(l.Fragment,{children:[i("div",e({style:e({display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",fontWeight:500,color:f?"#64748B":"#374151",border:f?"1px dashed #CBD5E1":void 0,borderRadius:f?"6px":void 0,padding:f?"2px 6px":void 0},S.approvalFlowItem),title:t.title||"Level ".concat(r+1)},{children:[h,i("span",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[g.map(function(t,r){var o,a,s=t.role||t.accessLevel||"No role assigned";return i(l.Fragment,{children:[r>0&&n("span",e({style:{color:"#9CA3AF"}},{children:"/"})),i("span",e({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n("span",{children:t.name}),n("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:s}))]}))]},null!==(a=null!==(o=t.id)&&void 0!==o?o:t.email)&&void 0!==a?a:r)}),f&&n("span",{children:"(Optional)"})]}))]})),r<N.length-1&&n(d,{size:16,color:"#9CA3AF"})]},null!==(a=t.id)&&void 0!==a?a:r)})})))]}))]}))}export{b as AssignReminderLevels};
1
+ import{__assign as e}from"../../_virtual/_tslib.js";import{jsx as n,jsxs as i}from"react/jsx-runtime";import l from"react";import{PenLine as t,UserRoundCheck as r,Bell as o,InfoIcon as a,User as s,ArrowRight as d,CheckSquare as u,FileCheck as c,Edit2 as p}from"lucide-react";import v from"./AssignLevelAccordions.js";import f from"./components/CustomCheckbox.js";import g from"./assets/FileCheckCorner.js";import{DEFAULT_ASSIGN_REMINDER_STYLES as h}from"./styles/AssignReminderStyles.js";var m=[{label:"Edit & Approve",icon:n(g,{})},{label:"Edit",icon:n(t,{size:14})},{label:"Approve",icon:n(r,{size:14})},{label:"Notify",icon:n(o,{size:14})}],y=function(e){var n=new Date(e);return n.setHours(0,0,0,0),n},x=function(e,n){var i,l=n>0?null===(i=e[n-1])||void 0===i?void 0:i.dueDate:null;return y(l||new Date)},A=function(e,n,i){var l,t=null===(l=e[n+1])||void 0===l?void 0:l.dueDate;return t?y(t):i?y(i):null};function b(t){var r=t.title,o=t.levels,g=void 0===o?[]:o,b=t.requireFinalApproval,D=void 0!==b&&b,L=t.additionalInfo,F=t.setLevels,w=t.setRequireFinalApproval,C=t.fetchUsers,z=t.accessLevelOptions,M=void 0===z?m:z,I=t.customInfoIcon,W=t.onValidationError,E=t.customStyles,S=void 0===E?{}:E,H=t.totalLevels,j=t.finalApprovalDueDate,q=t.displayConfig,R=l.useState(!1),T=R[0],B=R[1],k=!!(null==q?void 0:q.disableRequiredButtonOnUserAdd),O=function(e){return(null!=e?e:[]).some(function(e){return!!(null==e?void 0:e.email)||!!(null==e?void 0:e.id)||!!(null==e?void 0:e.name)})};l.useEffect(function(){k&&(null==F||F(function(n){var i=!1,l=n.map(function(n){var l,t,r=(null!==(t=null===(l=n.assignees)||void 0===l?void 0:l.length)&&void 0!==t?t:0)>0;return n.isHidden||n.isMandatory||!r?n:(i=!0,e(e({},n),{isMandatory:!0}))});return i?l:n}))},[g,F,k]);var N,U=l.useMemo(function(){return Array.from({length:null!=H?H:3},function(e,n){var i;return null!==(i=g[n])&&void 0!==i?i:{title:"Level ".concat(n+1),headerName:"L ".concat(n+1),isMandatory:!1,dueDate:null,assignees:[],hasDueDate:!0}})},[g,H]),V=(g.length>0?g:U).filter(function(e){return!e.isHidden});return i("div",e({style:e({padding:"8px",display:"flex",flexDirection:"column",gap:"18px"},S.container)},{children:[i("span",e({style:e(e({},h.header),S.levelsHeader)},{children:[n("span",{children:null!=r?r:"Assignee Levels"}),i("div",e({style:e(e({},h.infoIconWrapper),S.infoIconWrapper),onMouseEnter:function(){return B(!0)},onMouseLeave:function(){return B(!1)}},{children:[null!=I?I:n(a,{width:18,height:18}),n("div",e({style:e(e(e({},h.tooltip),S.tooltip),T?e(e({},h.tooltipVisible),S.tooltipVisible):{})},{children:L||i("span",{children:[n("b",{children:"How it works:"}),n("br",{}),"Level 1 is required by default, Enable Level 2 and Level 3 to add sequential approval steps for the review"]})}))]}))]})),n("div",e({style:e({display:"flex",flexDirection:"column",gap:"16px"},S.accordionsContainer)},{children:V.map(function(i,l){return n(v,{level:k&&O(i.assignees)?e(e({},i),{isMandatory:!0}):i,id:String(l),accessLevelOptions:M,fetchUsers:C,onToggleMandatory:function(){return function(n){var i,l,t,r=(null!==(t=null===(l=null===(i=g[n])||void 0===i?void 0:i.assignees)||void 0===l?void 0:l.length)&&void 0!==t?t:0)>0;k&&r||null==F||F(function(i){return i.map(function(i,l){return l===n?e(e({},i),{isMandatory:!i.isMandatory}):i})})}(l)},onDueDateChange:function(n){return function(n,i){var l;if(i){var t=y(i),r=x(g,n),o=A(g,n,j);if(t<r)return void(null==W||W(0===n?"Level 1 due date cannot be before today":"Level ".concat(n+1," due date cannot be before Level ").concat(n," due date")));if(o&&t>o)return void(null==W||W((null===(l=g[n+1])||void 0===l?void 0:l.dueDate)?"Level ".concat(n+1," due date cannot be after Level ").concat(n+2," due date"):"Level due date cannot be after final approval due date"))}null==F||F(function(l){return l.map(function(l,t){return t===n?e(e({},l),{dueDate:i?y(i):null}):l})})}(l,n)},onAssigneesChange:function(n){return i=l,r=(null!=(t=n)?t:[]).map(function(n){var i=n.accessLevel||n.role||"";return e(e({},n),{role:i,accessLevel:i})}),o=k&&O(r),void(null==F||F(function(n){return n.map(function(n,l){return l===i?e(e({},n),{assignees:r,isMandatory:!!o||n.isMandatory}):n})}));var i,t,r,o},onTitleChange:function(n){return function(n,i){null==F||F(function(l){return l.map(function(l,t){return t===n?e(e({},l),{title:i}):l})})}(l,n)},minDueDate:x(V,l),maxDueDate:A(V,l,j),finalApprovalDueDate:j,displayConfig:q},l)})})),i("div",e({style:e(e({},h.finalApprovalBox),S.finalApprovalBox)},{children:[n(f,{getter:D,setter:null!=w?w:function(){}}),i("div",e({style:e({display:"flex",flexDirection:"column",alignItems:"baseline",fontSize:"14px",fontWeight:400},S.finalApprovalTextWrapper)},{children:[n("span",e({style:e({fontWeight:500},S.finalApprovalTitle)},{children:"Require Final Approval"})),n("span",e({style:S.finalApprovalDesc},{children:"After all assignees approve, you (the owner) will be notified to give final sign-off before the redline is settled."}))]}))]})),i("div",e({style:e(e({},h.currentApprovalFlow),S.currentApprovalFlow)},{children:[n("span",e({style:e({fontSize:"14px",fontWeight:600},S.currentApprovalFlowTitle)},{children:"Current Approval Flow"})),(N=g.filter(function(e){var n,i;return(null!==(i=null===(n=e.assignees)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0}),n("div",e({style:e({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"4px"},S.approvalFlowItemsWrapper)},{children:N.map(function(t,r){var o,a,v=t.isHidden,f=!t.isMandatory&&!v,g=null!==(o=t.assignees)&&void 0!==o?o:[],h=v?n(s,{size:16}):function(e){switch(e){case 0:return n(p,{size:16});case 1:return n(c,{size:16});case 2:return n(s,{size:16});default:return n(u,{size:16})}}(r);return i(l.Fragment,{children:[i("div",e({style:e({display:"flex",alignItems:"center",gap:"6px",fontSize:"14px",fontWeight:500,color:f?"#64748B":"#374151",border:f?"1px dashed #CBD5E1":void 0,borderRadius:f?"6px":void 0,padding:f?"2px 6px":void 0},S.approvalFlowItem),title:t.title||"Level ".concat(r+1)},{children:[h,i("span",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[g.map(function(t,r){var o,a,s=t.role||t.accessLevel||"No role assigned";return i(l.Fragment,{children:[r>0&&n("span",e({style:{color:"#9CA3AF"}},{children:"/"})),i("span",e({style:{display:"flex",alignItems:"center",gap:"6px"}},{children:[n("span",{children:t.name}),n("span",e({style:{fontSize:"11px",fontWeight:500,color:"#475569",backgroundColor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"999px",padding:"2px 8px",lineHeight:"16px"}},{children:s}))]}))]},null!==(a=null!==(o=t.id)&&void 0!==o?o:t.email)&&void 0!==a?a:r)}),f&&n("span",{children:"(Optional)"})]}))]})),r<N.length-1&&n(d,{size:16,color:"#9CA3AF"})]},null!==(a=t.id)&&void 0!==a?a:r)})})))]}))]}))}export{b as AssignReminderLevels};
2
2
  //# sourceMappingURL=AssignReminderLevels.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/creative-workspace-ui-component",
3
- "version": "0.0.67",
3
+ "version": "0.0.68",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",