@lax-wp/design-system 0.11.62 → 0.11.63
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
-webkit-box-shadow: 0 0 0px 1000px white inset !important;
|
|
34
34
|
transition: background-color 5000s ease-in-out 0s;
|
|
35
35
|
}
|
|
36
|
-
`}),(e||r)&&l.jsx("label",{id:t,htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${_?"":"capitalize"} ${P||"!uppercse"}`,children:l.jsxs("div",{className:"flex flex-wrap items-center justify-between w-full",children:[l.jsxs("div",{className:"inline-flex flex-wrap items-center gap-1",children:[(e||s||o)&&l.jsx(Gt,{label:e??"",required:s||!1,isRequiredConditional:o||!1}),g?.length>0&&g!==W.value&&l.jsx(Ge.Tooltip,{placement:"top",title:g,children:l.jsx("button",{className:"cursor-pointer",onClick:()=>n(g),type:"button",children:l.jsx(fD,{size:16,className:"cursor-pointer pb-0.5 text-primary-600"})})}),D&&l.jsx(de.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),S&&!Bt(k)&&l.jsx(En,{}),l.jsx($r,{labels:u}),b&&l.jsx(Ge.Tooltip,{placement:"top",title:b,children:l.jsx("div",{className:"cursor-pointer",children:l.jsx(Zr,{})})}),r]}),l.jsxs("div",{className:"flex items-center gap-1",children:[Bt(k)&&w?l.jsx(we,{placement:"top-end",title:T||"",className:"cursor-pointer",children:l.jsxs("div",{className:F("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",ti(w)),onClick:()=>ee?.(V),children:[l.jsx(pn,{size:12,fill:kn(w),fillSecondary:wn(w)}),l.jsxs("span",{className:F("text-xs font-medium leading-4",ri(w)),children:[k,"%"]})]})}):null,E&&Le&&z?l.jsx("button",{id:`btn-base-input-field-add-to-document-${t}`,className:"cursor-pointer",onClick:()=>pe(W?.value),type:"button",children:l.jsx(Ge.Tooltip,{placement:"top",title:Y("Add to document"),children:l.jsx(de.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),l.jsx("label",{className:"relative block",children:l.jsxs("div",{className:"relative",children:[h.createElement("input",{...W,ref:m||B,id:t||e,key:t,required:s,style:{"--input-bg-color":"var(--tw-bg-opacity, 1) rgb(var(--bg-color))",...N},className:F("border border-solid h-[32px] text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium disabled:opacity-70 focus:outline-none focus:ring-0 disabled:!bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400",y||"text-sm",c||"text-neutral-900 dark:text-black-100",A&&A,C||"",i?F("rounded-md border-red-300 dark:border-red-500 bg-white hover:border-red-400 dark:bg-black-600 dark:hover:border-red-400 focus:border-red-600 focus:shadow-[0_0_0_1.5px_rgba(239,68,68,0.22)] dark:focus:border-red-500 dark:focus:shadow-[0_0_0_1.5px_rgba(248,113,113,0.25)]"):a?F("rounded-md border-green-300 bg-white hover:border-green-400 dark:border-green-600 dark:bg-black-600 dark:hover:border-green-500 focus:border-green-600 focus:shadow-[0_0_0_1.5px_rgba(34,197,94,0.22)] dark:focus:border-green-500"):re&&H?.color?F("rounded-md hover:border-primary-500 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",`bg-${H.color}-50 border-${H.color}-300`):Z?"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254_202_202_/_0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]":Q?"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254_223_137_/_0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]":te?"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187_247_208_/_0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]":"rounded-md border-neutral-200 bg-white hover:border-primary-500 dark:border-black-600 dark:bg-black-600 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]"),onChange:ce=>{n(ce.target.value)},onClick:ce=>ce.stopPropagation(),autoComplete:"off",onBlur:L}),f?l.jsx("button",{className:"absolute inset-y-0 flex items-center cursor-pointer right-2",onClick:()=>{le(!$),p?.(!$)},type:"button",children:$?l.jsx(uD,{className:"text-gray-400",size:16}):l.jsx(cD,{className:"text-gray-400",size:16})}):R&&W.value?l.jsx("button",{id:`btn-input-field-clear-${t}`,className:"absolute inset-y-0 flex items-center cursor-pointer right-2 focus:outline-none",onClick:ce=>{ce.stopPropagation(),n("")},type:"button",children:l.jsx(dD,{className:"text-neutral-200 dark:text-black-500",size:16})}):x?l.jsx("div",{className:"absolute inset-y-0 flex items-center right-2",children:x}):null]})}),l.jsx(We.AnimatePresence,{children:i&&l.jsx(We.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:l.jsx(ne,{className:"mt-1 text-error-500",appearance:"custom",size:"extra-small",variant:"medium",children:i})})}),l.jsx(We.AnimatePresence,{children:a&&l.jsx(We.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:l.jsx(ne,{className:"mt-1 text-success-500 dark:text-success-300",appearance:"custom",size:"extra-small",variant:"medium",children:a})})})]}),Le&&H&&M&&I&&l.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:ce=>ce.stopPropagation(),onMouseDown:ce=>ce.preventDefault(),onKeyDown:ce=>{ce.key==="Escape"&&Ce(!1)},children:l.jsx(I,{riskDetails:H})})]})});Fi.displayName="BaseInputField";const pD=h.forwardRef(({label:t,placeholder:e,value:r,onChange:n,rows:i=4,message:a,messageType:s="default",defaultValue:o,required:A=!1,disabled:u=!1,className:c,inputRef:d,maxLength:f,originalCase:p=!1,noBorder:m=!1,id:b,inputStyle:x,...g},_)=>{const y=C=>{if(C.key==="Enter"&&!C.shiftKey){C.preventDefault();const N=C.target.closest("form");if(N){const P=N.querySelector('button[type="submit"]');P?P.click():N.requestSubmit()}}g.onKeyDown?.(C)},S=b||`textarea-${Math.random().toString(36).substr(2,9)}`,E=r?.length||0,k=f&&E>f-Math.min(50,f/5),w=f&&E>=f,T=()=>s==="error"?"border-red-300 dark:border-red-500":s==="success"?"border-green-300 dark:border-green-500":s==="info"?"border-blue-300 dark:border-blue-500":"border-gray-300 dark:border-gray-600",O=()=>s==="error"?"text-red-500 dark:text-red-400":s==="success"?"text-green-500 dark:text-green-400":s==="info"?"text-blue-500 dark:text-blue-400":"text-gray-500 dark:text-gray-400";return l.jsxs("div",{className:F("flex flex-col gap-0.5 relative",c),children:[t&&l.jsx("label",{htmlFor:S,className:F("mb-1 text-xs font-medium text-gray-600 dark:text-gray-300 inline-flex items-center gap-1",{capitalize:!p}),children:l.jsx(Gt,{label:t||"",required:A||!1})}),l.jsx("textarea",{...g,onKeyDown:y,id:S,ref:_||d,onChange:C=>n(C.target.value),defaultValue:o,value:r,required:A,disabled:u,rows:i,placeholder:e,maxLength:f||void 0,style:x,className:F("border rounded-lg bg-white dark:bg-black-600 block w-full py-2.5 px-3","font-inter font-medium text-sm transition-colors duration-200","resize-vertical min-h-[2.5rem] focus:outline-none focus:ring-0","hover:border-primary-500 dark:hover:border-primary-400","focus:border-primary-600 dark:focus:border-primary-400","focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",!m&&T(),{"border-none focus:border-none focus:ring-0 focus:shadow-none":m,"bg-gray-50 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":u,"placeholder:text-gray-400 dark:placeholder:text-gray-500":u,"text-gray-900 dark:text-gray-100":!u,"placeholder:text-gray-400 dark:placeholder:text-gray-400":!u}),onClick:C=>C.stopPropagation(),"aria-invalid":a&&s==="error"?"true":"false","aria-describedby":a?`${S}-message`:void 0}),f&&l.jsxs(ne,{className:"mt-0.5 text-right text-gray-600 dark:text-gray-400",appearance:"custom",size:"extra-small",children:[l.jsx("span",{className:F({"text-red-500 dark:text-red-400":w,"text-yellow-500 dark:text-yellow-400":k&&!w}),children:E}),l.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[" ","/ ",f]})]}),l.jsx(We.AnimatePresence,{children:a&&l.jsx(We.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},id:`${S}-message`,role:s==="error"?"alert":void 0,children:l.jsx(ne,{className:F("mt-1",O()),appearance:"custom",size:"extra-small",variant:"medium",children:a})})})]})}),Eb=h.forwardRef(({label:t,placeholder:e,value:r,onChange:n,row:i=4,errorMessage:a,defaultValue:s,required:o,isRequiredConditional:A=!1,tags:u=[],disabled:c,className:d,inputRef:f,maxLength:p=void 0,tooltip:m="",originalCase:b=!1,isAiExtracted:x=!1,confidenceScore:g,confidenceType:_="high",confidenceTooltip:y,sourceMeta:S=[],onConfidenceScoreClick:E,isGTN:k=!1,gtnName:w="",noBorder:T=!1,id:O,inputStyle:C,labelClassName:N,isLiveField:P=!1,onBlur:L,riskDetails:D,isRiskAnalysisOpen:R=!1,RiskDetailsCard:H,onAddGTNToDocument:M,...I},z)=>{const{t:V}=Qt.useTranslation(),[X,ee]=h.useState(!1),W=Y=>{if(Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault();const re=Y.target.closest("form");if(re){const Q=re.querySelector('button[type="submit"]');Q?Q.click():re.requestSubmit()}}I.onKeyDown?.(Y)},B=()=>{M&&M({key:w,value:r||""})};return l.jsxs("div",{ref:z,id:O,className:F("flex gap-0.5 relative",X&&k?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>ee(!0),onMouseLeave:()=>ee(!1),children:[k&&!X?l.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,l.jsxs("div",{className:F("w-full flex flex-col"),children:[l.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 dark:text-black-300 inline-flex items-center gap-1 ${b?"":"capitalize"} ${N||""}`,children:l.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[l.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[l.jsx(Gt,{label:t||"",required:o||!1,isRequiredConditional:A||!1}),P&&l.jsx(de.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),x&&!Bt(g)&&l.jsx(En,{}),l.jsx($r,{labels:u||[]}),m&&l.jsx(Ge.Tooltip,{placement:"top",title:m,children:l.jsx("div",{className:"cursor-pointer",role:"button",tabIndex:0,onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&Y.preventDefault()},children:l.jsx(Zr,{})})})]}),l.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[Bt(g)&&_?l.jsx(we,{placement:"top-end",title:y??"",hideTooltip:y==null,className:"cursor-pointer",children:l.jsxs("div",{className:F("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",ti(_)),onClick:()=>E?.(S),children:[l.jsx(pn,{size:12,fill:kn(_),fillSecondary:wn(_)}),l.jsxs("span",{className:F("text-xs font-medium leading-4",ri(_)),children:[g,"%"]})]})}):null,k&&X?l.jsx("button",{id:"btn-textarea-field-add-to-document",className:"cursor-pointer",onClick:B,type:"button",children:l.jsx(Ge.Tooltip,{placement:"top",title:V("Add to document"),children:l.jsx(de.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),l.jsx("textarea",{...I,onKeyDown:W,onBlur:L,onChange:Y=>n(Y.target.value),defaultValue:s,value:r,required:o,className:F(`border rounded-lg bg-white dark:bg-black-600 focus:outline-none focus:ring-0 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]
|
|
36
|
+
`}),(e||r)&&l.jsx("label",{id:t,htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${_?"":"capitalize"} ${P||"!uppercse"}`,children:l.jsxs("div",{className:"flex flex-wrap items-center justify-between w-full",children:[l.jsxs("div",{className:"inline-flex flex-wrap items-center gap-1",children:[(e||s||o)&&l.jsx(Gt,{label:e??"",required:s||!1,isRequiredConditional:o||!1}),g?.length>0&&g!==W.value&&l.jsx(Ge.Tooltip,{placement:"top",title:g,children:l.jsx("button",{className:"cursor-pointer",onClick:()=>n(g),type:"button",children:l.jsx(fD,{size:16,className:"cursor-pointer pb-0.5 text-primary-600"})})}),D&&l.jsx(de.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),S&&!Bt(k)&&l.jsx(En,{}),l.jsx($r,{labels:u}),b&&l.jsx(Ge.Tooltip,{placement:"top",title:b,children:l.jsx("div",{className:"cursor-pointer",children:l.jsx(Zr,{})})}),r]}),l.jsxs("div",{className:"flex items-center gap-1",children:[Bt(k)&&w?l.jsx(we,{placement:"top-end",title:T||"",className:"cursor-pointer",children:l.jsxs("div",{className:F("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",ti(w)),onClick:()=>ee?.(V),children:[l.jsx(pn,{size:12,fill:kn(w),fillSecondary:wn(w)}),l.jsxs("span",{className:F("text-xs font-medium leading-4",ri(w)),children:[k,"%"]})]})}):null,E&&Le&&z?l.jsx("button",{id:`btn-base-input-field-add-to-document-${t}`,className:"cursor-pointer",onClick:()=>pe(W?.value),type:"button",children:l.jsx(Ge.Tooltip,{placement:"top",title:Y("Add to document"),children:l.jsx(de.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),l.jsx("label",{className:"relative block",children:l.jsxs("div",{className:"relative",children:[h.createElement("input",{...W,ref:m||B,id:t||e,key:t,required:s,style:{"--input-bg-color":"var(--tw-bg-opacity, 1) rgb(var(--bg-color))",...N},className:F("border border-solid h-[32px] text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium disabled:opacity-70 focus:outline-none focus:ring-0 disabled:!bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400",y||"text-sm",c||"text-neutral-900 dark:text-black-100",A&&A,C||"",i?F("rounded-md border-red-300 dark:border-red-500 bg-white hover:border-red-400 dark:bg-black-600 dark:hover:border-red-400 focus:border-red-600 focus:shadow-[0_0_0_1.5px_rgba(239,68,68,0.22)] dark:focus:border-red-500 dark:focus:shadow-[0_0_0_1.5px_rgba(248,113,113,0.25)]"):a?F("rounded-md border-green-300 bg-white hover:border-green-400 dark:border-green-600 dark:bg-black-600 dark:hover:border-green-500 focus:border-green-600 focus:shadow-[0_0_0_1.5px_rgba(34,197,94,0.22)] dark:focus:border-green-500"):re&&H?.color?F("rounded-md hover:border-primary-500 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",`bg-${H.color}-50 border-${H.color}-300`):Z?"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254_202_202_/_0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)] dark:disabled:!bg-[var(--Error-50,#FEF2F2)]":Q?"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254_223_137_/_0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)] dark:disabled:!bg-[var(--Warning-50,#FFFAEB)]":te?"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187_247_208_/_0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)] dark:disabled:!bg-[var(--Success-50,#F0FDF4)] disabled:!text-[#101828] dark:disabled:!text-[#101828]":"rounded-md border-neutral-200 bg-white hover:border-primary-500 dark:border-black-600 dark:bg-black-600 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]"),onChange:ce=>{n(ce.target.value)},onClick:ce=>ce.stopPropagation(),autoComplete:"off",onBlur:L}),f?l.jsx("button",{className:"absolute inset-y-0 flex items-center cursor-pointer right-2",onClick:()=>{le(!$),p?.(!$)},type:"button",children:$?l.jsx(uD,{className:"text-gray-400",size:16}):l.jsx(cD,{className:"text-gray-400",size:16})}):R&&W.value?l.jsx("button",{id:`btn-input-field-clear-${t}`,className:"absolute inset-y-0 flex items-center cursor-pointer right-2 focus:outline-none",onClick:ce=>{ce.stopPropagation(),n("")},type:"button",children:l.jsx(dD,{className:"text-neutral-200 dark:text-black-500",size:16})}):x?l.jsx("div",{className:"absolute inset-y-0 flex items-center right-2",children:x}):null]})}),l.jsx(We.AnimatePresence,{children:i&&l.jsx(We.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:l.jsx(ne,{className:"mt-1 text-error-500",appearance:"custom",size:"extra-small",variant:"medium",children:i})})}),l.jsx(We.AnimatePresence,{children:a&&l.jsx(We.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:l.jsx(ne,{className:"mt-1 text-success-500 dark:text-success-300",appearance:"custom",size:"extra-small",variant:"medium",children:a})})})]}),Le&&H&&M&&I&&l.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:ce=>ce.stopPropagation(),onMouseDown:ce=>ce.preventDefault(),onKeyDown:ce=>{ce.key==="Escape"&&Ce(!1)},children:l.jsx(I,{riskDetails:H})})]})});Fi.displayName="BaseInputField";const pD=h.forwardRef(({label:t,placeholder:e,value:r,onChange:n,rows:i=4,message:a,messageType:s="default",defaultValue:o,required:A=!1,disabled:u=!1,className:c,inputRef:d,maxLength:f,originalCase:p=!1,noBorder:m=!1,id:b,inputStyle:x,...g},_)=>{const y=C=>{if(C.key==="Enter"&&!C.shiftKey){C.preventDefault();const N=C.target.closest("form");if(N){const P=N.querySelector('button[type="submit"]');P?P.click():N.requestSubmit()}}g.onKeyDown?.(C)},S=b||`textarea-${Math.random().toString(36).substr(2,9)}`,E=r?.length||0,k=f&&E>f-Math.min(50,f/5),w=f&&E>=f,T=()=>s==="error"?"border-red-300 dark:border-red-500":s==="success"?"border-green-300 dark:border-green-500":s==="info"?"border-blue-300 dark:border-blue-500":"border-gray-300 dark:border-gray-600",O=()=>s==="error"?"text-red-500 dark:text-red-400":s==="success"?"text-green-500 dark:text-green-400":s==="info"?"text-blue-500 dark:text-blue-400":"text-gray-500 dark:text-gray-400";return l.jsxs("div",{className:F("flex flex-col gap-0.5 relative",c),children:[t&&l.jsx("label",{htmlFor:S,className:F("mb-1 text-xs font-medium text-gray-600 dark:text-gray-300 inline-flex items-center gap-1",{capitalize:!p}),children:l.jsx(Gt,{label:t||"",required:A||!1})}),l.jsx("textarea",{...g,onKeyDown:y,id:S,ref:_||d,onChange:C=>n(C.target.value),defaultValue:o,value:r,required:A,disabled:u,rows:i,placeholder:e,maxLength:f||void 0,style:x,className:F("border rounded-lg bg-white dark:bg-black-600 block w-full py-2.5 px-3","font-inter font-medium text-sm transition-colors duration-200","resize-vertical min-h-[2.5rem] focus:outline-none focus:ring-0","hover:border-primary-500 dark:hover:border-primary-400","focus:border-primary-600 dark:focus:border-primary-400","focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",!m&&T(),{"border-none focus:border-none focus:ring-0 focus:shadow-none":m,"bg-gray-50 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":u,"placeholder:text-gray-400 dark:placeholder:text-gray-500":u,"text-gray-900 dark:text-gray-100":!u,"placeholder:text-gray-400 dark:placeholder:text-gray-400":!u}),onClick:C=>C.stopPropagation(),"aria-invalid":a&&s==="error"?"true":"false","aria-describedby":a?`${S}-message`:void 0}),f&&l.jsxs(ne,{className:"mt-0.5 text-right text-gray-600 dark:text-gray-400",appearance:"custom",size:"extra-small",children:[l.jsx("span",{className:F({"text-red-500 dark:text-red-400":w,"text-yellow-500 dark:text-yellow-400":k&&!w}),children:E}),l.jsxs("span",{className:"text-gray-400 dark:text-gray-500",children:[" ","/ ",f]})]}),l.jsx(We.AnimatePresence,{children:a&&l.jsx(We.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},id:`${S}-message`,role:s==="error"?"alert":void 0,children:l.jsx(ne,{className:F("mt-1",O()),appearance:"custom",size:"extra-small",variant:"medium",children:a})})})]})}),Eb=h.forwardRef(({label:t,placeholder:e,value:r,onChange:n,row:i=4,errorMessage:a,defaultValue:s,required:o,isRequiredConditional:A=!1,tags:u=[],disabled:c,className:d,inputRef:f,maxLength:p=void 0,tooltip:m="",originalCase:b=!1,isAiExtracted:x=!1,confidenceScore:g,confidenceType:_="high",confidenceTooltip:y,sourceMeta:S=[],onConfidenceScoreClick:E,isGTN:k=!1,gtnName:w="",noBorder:T=!1,id:O,inputStyle:C,labelClassName:N,isLiveField:P=!1,onBlur:L,riskDetails:D,isRiskAnalysisOpen:R=!1,RiskDetailsCard:H,onAddGTNToDocument:M,...I},z)=>{const{t:V}=Qt.useTranslation(),[X,ee]=h.useState(!1),W=Y=>{if(Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault();const re=Y.target.closest("form");if(re){const Q=re.querySelector('button[type="submit"]');Q?Q.click():re.requestSubmit()}}I.onKeyDown?.(Y)},B=()=>{M&&M({key:w,value:r||""})};return l.jsxs("div",{ref:z,id:O,className:F("flex gap-0.5 relative",X&&k?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>ee(!0),onMouseLeave:()=>ee(!1),children:[k&&!X?l.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,l.jsxs("div",{className:F("w-full flex flex-col"),children:[l.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 dark:text-black-300 inline-flex items-center gap-1 ${b?"":"capitalize"} ${N||""}`,children:l.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[l.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[l.jsx(Gt,{label:t||"",required:o||!1,isRequiredConditional:A||!1}),P&&l.jsx(de.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),x&&!Bt(g)&&l.jsx(En,{}),l.jsx($r,{labels:u||[]}),m&&l.jsx(Ge.Tooltip,{placement:"top",title:m,children:l.jsx("div",{className:"cursor-pointer",role:"button",tabIndex:0,onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&Y.preventDefault()},children:l.jsx(Zr,{})})})]}),l.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[Bt(g)&&_?l.jsx(we,{placement:"top-end",title:y??"",hideTooltip:y==null,className:"cursor-pointer",children:l.jsxs("div",{className:F("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",ti(_)),onClick:()=>E?.(S),children:[l.jsx(pn,{size:12,fill:kn(_),fillSecondary:wn(_)}),l.jsxs("span",{className:F("text-xs font-medium leading-4",ri(_)),children:[g,"%"]})]})}):null,k&&X?l.jsx("button",{id:"btn-textarea-field-add-to-document",className:"cursor-pointer",onClick:B,type:"button",children:l.jsx(Ge.Tooltip,{placement:"top",title:V("Add to document"),children:l.jsx(de.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),l.jsx("textarea",{...I,onKeyDown:W,onBlur:L,onChange:Y=>n(Y.target.value),defaultValue:s,value:r,required:o,className:F(`border rounded-lg bg-white dark:bg-black-600 focus:outline-none focus:ring-0 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]
|
|
37
37
|
block w-full py-2.5 px-3 font-inter font-medium text-sm
|
|
38
38
|
disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400`,{"border-red-300":a,"border-gray-300 dark:border-black-700":!a,"text-neutral-400 dark:text-neutral-500":c,"text-neutral-900 dark:text-neutral-50":!c,"border-none":T,"focus:border-none":T,"placeholder:text-neutral-400 dark:placeholder:text-black-400":c,"placeholder:text-neutral-400 dark:placeholder:text-black-300":!c},d,R&&D?.color&&`!bg-${D.color}-50 border-${D.color}-300`),style:R&&D?{backgroundColor:D.hexBgColor||void 0,borderColor:D.hexBorderColor||void 0,...C}:C,rows:i,placeholder:e,disabled:c,maxLength:p||void 0,id:O,ref:f,onClick:Y=>Y.stopPropagation(),autoComplete:"off"}),p?l.jsxs(ne,{className:"mt-0.5 text-right text-neutral-900 dark:text-white",appearance:"custom",size:"extra-small",children:[l.jsxs("span",{className:`${r?.length>=p?"text-error-500":r?.length>p-Math.min(50,p/5)?"text-warning-500 dark:text-warning-300":""}`,children:[r?.length||0," "]}),"/ ",p]}):null,a&&l.jsx(ne,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:a})]}),X&&R&&D&&H&&l.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:Y=>Y.stopPropagation(),onMouseDown:Y=>Y.preventDefault(),onKeyDown:Y=>{Y.key==="Escape"&&ee(!1)},children:l.jsx(H,{riskDetails:D})})]})});Eb.displayName="TextAreaField";const Ar=({children:t,className:e,variant:r="default",onClick:n,disabled:i,tooltip:a,tooltipPlacement:s="top",noborder:o,id:A,type:u="button"})=>{const c="flex items-center",d={default:`bg-white dark:bg-black-800 hover:bg-neutral-100 dark:hover:bg-black-700 rounded-lg ${o?"":"border border-neutral-300 dark:border-neutral-800"} p-2 hover:opacity-80`,secondary:`bg-transparent rounded-lg ${o?"":"border border-neutral-300 dark:border-black-400"} p-2 hover:opacity-80`,native:`bg-transparent rounded-lg ${o?"":"border border-neutral-300"} p-2 hover:opacity-80`,ghost:"text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 p-1 cursor-pointer rounded-full hover:scale-75 transition-all duration-500 ease-in-out"},f=i?"cursor-not-allowed opacity-50":"cursor-pointer";return l.jsx(we,{title:a,placement:s,delayShow:!0,children:l.jsx("button",{id:A,disabled:i,className:`${c} ${d[r]} ${e||""} ${f}`,onClick:n,type:u,children:t})})},oS=h.forwardRef(({id:t,label:e,placeholder:r,value:n,onChange:i,errorMessage:a,defaultValue:s,required:o=!1,isRequiredConditional:A=!1,masterDataName:u,masterDataColumnName:c,masterDataFormula:d,masterDataFilters:f,tags:p,index:m,tooltip:b="",originalCase:x=!1,color:g="",isGTN:_=!1,labelClassName:y,gtnName:S=null,isAiExtracted:E=!1,confidenceScore:k,confidenceType:w="high",confidenceTooltip:T,sourceMeta:O=[],onConfidenceScoreClick:C,disabled:N=!1,reference:P={},isLiveField:L=!1,onBlur:D,onAddGTNToDocument:R,riskDetails:H,isRiskAnalysisOpen:M=!1,RiskDetailsCard:I,primaryColorShades:z,setDisableActions:V,showDeprecatedFieldWarning:X,MasterDataModal:ee,parseMasterDataFormula:W},B)=>{const{t:Y}=Qt.useTranslation(),[re,Q]=h.useState(!1),[Z,te]=h.useState(null),[$,le]=h.useState(!1),[Le,Ce]=h.useState(""),[pe,ce]=h.useState(null),[he,ve]=h.useState(!1),_e=h.useRef(null),ue=B||_e;h.useEffect(()=>{const ke=()=>{const Ie=ue.current||_e.current;Ie&&ve(Ie.scrollWidth>Ie.clientWidth)};return ke(),window.addEventListener("resize",ke),()=>window.removeEventListener("resize",ke)},[Z,n]),h.useEffect(()=>{te(n)},[m,n]),h.useEffect(()=>{Z!==null&&Z!==n&&i(Z,pe)},[Z,pe]);const G=()=>{V?.(!$),le(!$)},ae=ke=>{if(ke.keyCode===9||ke.key==="Enter"){const Ie=ue.current||_e.current;Ie&&(te(Le),Ie.blur())}},Ee=(ke,Ie)=>{let ge=ke;d&&W&&(ge=W(d,Ie)),Ce(""),te(ge),G(),ce(Ie)},ze=()=>{te(""),ce(null)},Ye=ke=>{R&&S&&R({key:S,value:ke})},Ke=()=>{const ke="border h-[32px] text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium",Ie=a?"border-red-300":M&&H?.color?`border-${H?.color}-300`:"border-gray-300 dark:border-black-600",ge="placeholder:text-neutral-900 dark:placeholder:text-black-400",De=`${M&&H?.color?`bg-${H?.color}-50`:"bg-gray-200 dark:bg-black-600 "} ${g||"text-neutral-900 dark:text-black-200"}`;return`${ke} ${Ie} ${De} ${ge}`},Ue=()=>Z!==null?Z:d&&W?W(d,P):n;return h.useEffect(()=>{$&&!u&&(X?.(),le(!1))},[$,u,X]),l.jsxs("div",{className:F("flex gap-0.5 w-full relative",re&&_?"border rounded-lg border-primary-100 bg-primary-50 p-1":"",{"error-field":!!a}),onMouseEnter:()=>Q(!0),onMouseLeave:()=>Q(!1),children:[_&&!re?l.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,l.jsxs("div",{className:F("flex flex-col w-full"),children:[l.jsx("label",{htmlFor:"text",className:`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${x?"":"capitalize"} ${y||""}`,children:l.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[l.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[l.jsx(Gt,{label:e||"",required:o||!1,isRequiredConditional:A||!1}),L&&l.jsx(de.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),E&&!Bt(k)&&l.jsx(En,{}),l.jsx($r,{labels:p}),b&&l.jsx(we,{placement:"top",title:`${b}${d?` | ${d}`:""}`,children:l.jsx("div",{className:"cursor-pointer",children:l.jsx(Zr,{})})})]}),l.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[Bt(k)&&w?l.jsx(we,{placement:"top-end",title:T??"",hideTooltip:T==null,className:"cursor-pointer",children:l.jsxs("div",{className:F("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",ti(w)),onClick:()=>C?.(O),children:[l.jsx(pn,{size:12,fill:kn(w),fillSecondary:wn(w)}),l.jsxs("span",{className:F("text-xs font-medium leading-4",ri(w)),children:[k,"%"]})]})}):null,_&&re&&R?l.jsx("button",{id:"btn-master-data-input-add-to-document",className:"cursor-pointer",onClick:()=>Ye(n?.toString()||""),type:"button",children:l.jsx(Ge.Tooltip,{placement:"top",title:Y("Add to document"),children:l.jsx(de.NoteAddOutlined,{sx:{fontSize:16,color:z?.[600]||"var(--color-primary-600)"}})})}):null]})]})}),l.jsxs("label",{className:"relative block mt-1",children:[l.jsx(we,{title:he?Ue():"",children:l.jsx("input",{id:t,ref:ue,required:o,placeholder:r,className:Ke(),onChange:ke=>{i(ke.target.value,pe),te(ke.target?.value)},onKeyDown:ae,value:Ue(),defaultValue:s,disabled:!0,autoComplete:"off",onBlur:D})}),l.jsx(Ar,{id:"btn-dynamic-data-input-rx-cross",onClick:ze,className:"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:N,children:l.jsx(de.CloseRounded,{className:"text-neutral-900 dark:text-black-300",sx:{fontSize:16}})}),l.jsx(Ar,{id:"btn-dynamic-data-input-ai-outline-pic-center",onClick:G,className:"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:N,children:l.jsx(de.TableChartRounded,{className:"text-neutral-900 dark:text-black-300",sx:{fontSize:16}})})]}),a&&l.jsx(ne,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:a}),$&&ee&&l.jsx(ee,{isVisible:$,onSelected:Ee,onClose:G,masterDataColumnName:c,masterDataFilters:f,masterDataName:u,masterDataId:u,showFilters:!0})]}),re&&H&&M&&I&&l.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:ke=>ke.stopPropagation(),onMouseDown:ke=>ke.preventDefault(),onKeyDown:ke=>{ke.key==="Escape"&&Q(!1)},children:l.jsx(I,{riskDetails:H})})]})});oS.displayName="MasterDataInputField";const hD=t=>Array.isArray(t)?t.map(e=>typeof e=="string"||typeof e=="number"?e:e.value):t||null,mD=t=>t.filter((e,r,n)=>n.findIndex(i=>i.value===e.value&&i.label===e.label)===r),gD=({options:t,value:e,defaultValue:r})=>t?.length?mD(t.map(n=>({...n,color:n.color}))):Array.isArray(e)&&e.length&&typeof e[0]=="object"&&"label"in e[0]?e.map(n=>({label:String(n?.label||""),value:String(n?.value||""),color:n?.color})):e&&typeof e=="object"&&"label"in e?[{label:String(e.label||""),value:String(e.value||""),color:e?.color}]:Array.isArray(r)&&r.length&&typeof r[0]=="object"&&"label"in r[0]?r.map(n=>({label:String(n?.label||""),value:String(n?.value||""),color:n?.color})):r&&typeof r=="object"&&"label"in r?[{label:String(r.label||""),value:String(r.value||""),color:r?.color}]:[],bD=({hasExistingData:t})=>l.jsx("div",{className:"!w-full px-3 py-1.5",children:t?l.jsx(Ge.Skeleton,{paragraph:{rows:1,width:"100%"}}):l.jsx(Ge.Skeleton,{})}),xD=({showSelectAll:t,mode:e,options:r,searchValue:n,handleSelectAll:i,isAllSelected:a,menu:s,isLoading:o,hasExistingData:A,t:u})=>l.jsxs(l.Fragment,{children:[t&&e==="multiple"&&r.length>0&&n.trim().length===0&&l.jsx("div",{role:"button",tabIndex:0,className:"px-3 py-2 border-b border-gray-200 dark:border-gray-600 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700",onClick:c=>{c.stopPropagation(),i()},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),i())},children:l.jsx(ne,{size:"small",variant:"semibold",className:"text-primary-600 dark:text-primary-300",appearance:"custom",children:u(a?"Deselect all":"Select all")})}),s,o&&l.jsx(bD,{hasExistingData:A})]}),sl=h.forwardRef(({label:t,value:e,mode:r,errorMessage:n,selectOptions:i=[],required:a=!1,tags:s,className:o,onInputChange:A,tooltip:u,originalCase:c=!1,isAiExtracted:d=!1,confidenceScore:f,confidenceType:p="high",confidenceTooltip:m,sourceMeta:b=[],onConfidenceScoreClick:x,isGTN:g=!1,gtnName:_=null,onChange:y,onSearch:S,debounceTimeout:E=500,filterOption:k=!0,onScroll:w,isLoading:T=!1,allowClear:O=!0,autoClearSearchValue:C=!0,fullOpacityLabel:N=!1,showAllTags:P=!1,customTagRender:L,inputStyles:D,disabled:R=!1,showSelectAll:H=!1,labelClassName:M,riskDetails:I,isRiskAnalysisOpen:z=!1,RiskDetailsCard:V,AddToDocumentIcon:X,primaryColorShades:ee,UserAvatar:W,onAddGTNToDocument:B,isRequiredConditional:Y,isLiveField:re=!1,...Q},Z)=>{const{t:te}=Qt.useTranslation(),[$,le]=h.useState(!1),Le=h.useRef(null),[Ce,pe]=h.useState(!1),[ce,he]=h.useState("");h.useEffect(()=>{const ge="select-field-scrollbar-styles";if(document.getElementById(ge))return;const De=document.createElement("style");De.id=ge,De.textContent=`
|
|
39
39
|
[class*="virtual-list-scrollbar"]:not([class*="thumb"]) {
|