@lax-wp/design-system 0.13.39-beta.0 → 0.13.39-beta.2

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,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../_virtual/index.cjs.js"),n=require("react"),Ie=require("antd"),Fe=require("react-i18next"),Ee=require("../../data-display/typography/Typography.cjs.js"),qe=require("../../data-display/label/Label.cjs.js"),q=require("@mui/icons-material"),Ne=require("../../icons/AIExtractedIndicator.cjs.js"),Be=require("../../icons/AIStarIcon.cjs.js"),Ae=require("../../icons/HelpIcon.cjs.js"),N=require("../../tooltip/Tooltip.cjs.js"),D=require("../../button/IconButton.cjs.js"),Re=require("../shared/InputLabel.cjs.js"),x=require("../../../utils/confidenceScoreUtils.cjs.js"),ze=require("../../icon/icons.generated.cjs.js"),T=n.forwardRef(({id:U,label:J,labelExtra:Q,placeholder:X,value:i,onChange:B,errorMessage:s,defaultValue:Y,required:A=!1,isRequiredConditional:Z=!1,masterDataName:g,masterDataColumnName:G,masterDataFormula:a,masterDataFilters:ee,tags:te,index:re,tooltip:R="",originalCase:ne=!1,color:c="",isGTN:k=!1,labelClassName:le,gtnName:z=null,isAiExtracted:se=!1,confidenceScore:v,confidenceType:f="high",confidenceTooltip:j,sourceMeta:ae=[],onConfidenceScoreClick:oe,disabled:V=!1,reference:ie={},isLiveField:ce=!1,onBlur:de,onAddGTNToDocument:S,riskDetails:d,isRiskAnalysisOpen:L=!1,RiskDetailsCard:$,primaryColorShades:ue,setDisableActions:M,showDeprecatedFieldWarning:O,MasterDataModal:W,parseMasterDataFormula:p,inputEmphasis:w="default"},xe)=>{const{t:fe}=Fe.useTranslation(),h=!!(L&&d?.color),be=w==="modified"&&!s&&!h,ge=w==="deleted"&&!s&&!h,pe=w==="success"&&!s&&!h,[m,y]=n.useState(!1),[o,b]=n.useState(null),[u,H]=n.useState(!1),[he,me]=n.useState(""),[C,P]=n.useState(null),[ke,ve]=n.useState(!1),I=n.useRef(null),F=xe||I;n.useEffect(()=>{const t=()=>{const r=F.current||I.current;r&&ve(r.scrollWidth>r.clientWidth)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[o,i]),n.useEffect(()=>{b(i)},[re,i]),n.useEffect(()=>{o!==null&&o!==i&&B(o,C)},[o,C]);const E=()=>{M?.(!u),H(!u)},je=t=>{if(t.keyCode===9||t.key==="Enter"){const r=F.current||I.current;r&&(b(he),r.blur())}},Se=(t,r)=>{let _=t;a&&p&&(_=p(a,r)),me(""),b(_),E(),P(r)},we=()=>{b(""),P(null)},ye=t=>{S&&z&&S({key:z,value:t})},Ce=()=>{const t="border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium",r="placeholder:text-neutral-900 dark:placeholder:text-black-400";return s?l(t,r,"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",c||"text-neutral-900 dark:text-black-200"):h&&d?.color?l(t,r,`border-${d.color}-300 bg-${d.color}-50`,c||"text-neutral-900 dark:text-black-200"):ge?l(t,r,"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]"):be?l(t,r,"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]"):pe?l(t,r,"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]"):l(t,r,"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",c||"text-neutral-900 dark:text-black-200")},K=()=>o!==null?o:a&&p?p(a,ie):i;return n.useEffect(()=>{u&&!g&&(O?.(),H(!1))},[u,g,O]),e.jsxs("div",{className:l("flex gap-0.5 w-full relative",m&&k?"border rounded-lg border-primary-100 p-1":"",{"error-field":!!s}),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:[k&&!m?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:l("flex flex-col w-full"),children:[e.jsx("label",{htmlFor:"text",className:`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${ne?"":"capitalize"} ${le||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Re.InputLabel,{label:J||"",required:A||!1,isRequiredConditional:Z||!1}),ce&&e.jsx(q.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),se&&!x.shouldShowConfidenceScore(v)&&e.jsx(Ne.AIExtractedIndicator,{}),e.jsx(qe.Label,{labels:te}),R&&e.jsx(N,{placement:"top",title:`${R}${a?` | ${a}`:""}`,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(Ae.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),Q]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[x.shouldShowConfidenceScore(v)&&f?e.jsx(N,{placement:"top-end",title:j??"",hideTooltip:j==null,className:"cursor-pointer",children:e.jsxs("div",{className:l("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",x.getConfidenceScoreBadgeClass(f)),onClick:()=>oe?.(ae),children:[e.jsx(Be.AIStarIcon,{size:12,fill:x.getConfidenceScoreBadgeColor(f),fillSecondary:x.getConfidenceScoreBadgeFill(f)}),e.jsxs("span",{className:l("text-xs font-medium leading-4",x.getConfidenceScoreBadgeTextColor(f)),children:[v,"%"]})]})}):null,k&&m&&S?e.jsx("button",{id:"btn-master-data-input-add-to-document",className:"cursor-pointer",onClick:()=>ye(i?.toString()||""),type:"button",children:e.jsx(Ie.Tooltip,{placement:"top",title:fe("Add to document"),children:e.jsx(q.NoteAddOutlined,{sx:{fontSize:16,color:ue?.[600]||"var(--color-primary-600)"}})})}):null]})]})}),e.jsxs("label",{className:"relative block mt-1",children:[e.jsx(N,{title:ke?K():"",children:e.jsx("input",{id:U,ref:F,required:A,placeholder:X,className:Ce(),onChange:t=>{B(t.target.value,C),b(t.target?.value)},onKeyDown:je,value:K(),defaultValue:Y,disabled:!0,autoComplete:"off",onBlur:de})}),e.jsx(D,{id:"btn-dynamic-data-input-rx-cross",onClick:we,className:"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:V,children:e.jsx(ze.CloseIcon,{className:"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm"})}),e.jsx(D,{id:"btn-dynamic-data-input-ai-outline-pic-center",onClick:E,className:"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:V,children:e.jsx(q.TableChartRounded,{className:"text-neutral-500 dark:text-neutral-400 w-sm h-sm"})})]}),s&&e.jsx(Ee.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:s}),u&&W&&e.jsx(W,{isVisible:u,onSelected:Se,onClose:E,masterDataColumnName:G,masterDataFilters:ee,masterDataName:g,masterDataId:g,masterDataFormula:a,showFilters:!0,enableRootDrag:!0})]}),m&&d&&L&&$&&e.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:t=>t.stopPropagation(),onMouseDown:t=>t.preventDefault(),onKeyDown:t=>{t.key==="Escape"&&y(!1)},children:e.jsx($,{riskDetails:d})})]})});T.displayName="MasterDataInputField";exports.MasterDataInputField=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../../_virtual/index.cjs.js"),l=require("react"),Ie=require("antd"),Ee=require("react-i18next"),qe=require("../../data-display/typography/Typography.cjs.js"),Ne=require("../../data-display/label/Label.cjs.js"),F=require("@mui/icons-material"),Fe=require("../../icons/AIExtractedIndicator.cjs.js"),Be=require("../../icons/AIStarIcon.cjs.js"),Ae=require("../../icons/HelpIcon.cjs.js"),B=require("../../tooltip/Tooltip.cjs.js"),U=require("../../button/IconButton.cjs.js"),ze=require("../shared/InputLabel.cjs.js"),f=require("../../../utils/confidenceScoreUtils.cjs.js"),Le=require("../../icon/icons.generated.cjs.js"),J=l.forwardRef(({id:Q,label:X,labelExtra:Y,placeholder:Z,value:a,onChange:A,errorMessage:o,defaultValue:G,required:z=!1,isRequiredConditional:D=!1,masterDataName:h,masterDataColumnName:ee,masterDataFormula:n,masterDataFilters:te,tags:re,index:ne,tooltip:L="",originalCase:le=!1,color:d="",isGTN:v=!1,labelClassName:se,gtnName:R=null,isAiExtracted:oe=!1,confidenceScore:m,confidenceType:b="high",confidenceTooltip:S,sourceMeta:ie=[],onConfidenceScoreClick:ce,disabled:$=!1,reference:j={},isLiveField:ae=!1,onBlur:de,onAddGTNToDocument:w,riskDetails:u,isRiskAnalysisOpen:V=!1,RiskDetailsCard:M,primaryColorShades:ue,setDisableActions:O,showDeprecatedFieldWarning:P,MasterDataModal:W,parseMasterDataFormula:i,inputEmphasis:y="default"},xe)=>{const{t:fe}=Ee.useTranslation(),p=!!(V&&u?.color),be=y==="modified"&&!o&&!p,ge=y==="deleted"&&!o&&!p,he=y==="success"&&!o&&!p,[k,C]=l.useState(!1),[c,g]=l.useState(null),[x,H]=l.useState(!1),[pe,ke]=l.useState(""),[I,K]=l.useState(null),[ve,me]=l.useState(!1),E=l.useRef(null),q=xe||E;l.useEffect(()=>{const t=()=>{const r=q.current||E.current;r&&me(r.scrollWidth>r.clientWidth)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[c,a]),l.useEffect(()=>{g(a)},[ne,a]),l.useEffect(()=>{c!==null&&c!==a&&A(c,I)},[c,I]);const N=()=>{O?.(!x),H(!x)},Se=t=>{if(t.keyCode===9||t.key==="Enter"){const r=q.current||E.current;r&&(g(pe),r.blur())}},je=(t,r)=>{let T=t;console.log("handleSetMasterData called with:",t,r,n,i),n&&i&&(console.log("handleSetMasterData called with:",t,r,n,i(n,r)),T=i(n,r)),ke(""),g(T),N(),K(r)},we=()=>{g(""),K(null)},ye=t=>{w&&R&&w({key:R,value:t})},Ce=()=>{const t="border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium",r="placeholder:text-neutral-900 dark:placeholder:text-black-400";return o?s(t,r,"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",d||"text-neutral-900 dark:text-black-200"):p&&u?.color?s(t,r,`border-${u.color}-300 bg-${u.color}-50`,d||"text-neutral-900 dark:text-black-200"):ge?s(t,r,"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]"):be?s(t,r,"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]"):he?s(t,r,"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]"):s(t,r,"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",d||"text-neutral-900 dark:text-black-200")},_=()=>c!==null?c:n&&i?(console.log("Parsing master data formula with reference:",n,j,i(n,j)),i(n,j)):a;return l.useEffect(()=>{x&&!h&&(P?.(),H(!1))},[x,h,P]),e.jsxs("div",{className:s("flex gap-0.5 w-full relative",k&&v?"border rounded-lg border-primary-100 p-1":"",{"error-field":!!o}),onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:[v&&!k?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:s("flex flex-col w-full"),children:[e.jsx("label",{htmlFor:"text",className:`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${le?"":"capitalize"} ${se||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(ze.InputLabel,{label:X||"",required:z||!1,isRequiredConditional:D||!1}),ae&&e.jsx(F.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),oe&&!f.shouldShowConfidenceScore(m)&&e.jsx(Fe.AIExtractedIndicator,{}),e.jsx(Ne.Label,{labels:re}),L&&e.jsx(B,{placement:"top",title:`${L}${n?` | ${n}`:""}`,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(Ae.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),Y]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[f.shouldShowConfidenceScore(m)&&b?e.jsx(B,{placement:"top-end",title:S??"",hideTooltip:S==null,className:"cursor-pointer",children:e.jsxs("div",{className:s("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",f.getConfidenceScoreBadgeClass(b)),onClick:()=>ce?.(ie),children:[e.jsx(Be.AIStarIcon,{size:12,fill:f.getConfidenceScoreBadgeColor(b),fillSecondary:f.getConfidenceScoreBadgeFill(b)}),e.jsxs("span",{className:s("text-xs font-medium leading-4",f.getConfidenceScoreBadgeTextColor(b)),children:[m,"%"]})]})}):null,v&&k&&w?e.jsx("button",{id:"btn-master-data-input-add-to-document",className:"cursor-pointer",onClick:()=>ye(a?.toString()||""),type:"button",children:e.jsx(Ie.Tooltip,{placement:"top",title:fe("Add to document"),children:e.jsx(F.NoteAddOutlined,{sx:{fontSize:16,color:ue?.[600]||"var(--color-primary-600)"}})})}):null]})]})}),e.jsxs("label",{className:"relative block mt-1",children:[e.jsx(B,{title:ve?_():"",children:e.jsx("input",{id:Q,ref:q,required:z,placeholder:Z,className:Ce(),onChange:t=>{A(t.target.value,I),g(t.target?.value)},onKeyDown:Se,value:_(),defaultValue:G,disabled:!0,autoComplete:"off",onBlur:de})}),e.jsx(U,{id:"btn-dynamic-data-input-rx-cross",onClick:we,className:"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:$,children:e.jsx(Le.CloseIcon,{className:"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm"})}),e.jsx(U,{id:"btn-dynamic-data-input-ai-outline-pic-center",onClick:N,className:"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:$,children:e.jsx(F.TableChartRounded,{className:"text-neutral-500 dark:text-neutral-400 w-sm h-sm"})})]}),o&&e.jsx(qe.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:o}),x&&W&&e.jsx(W,{isVisible:x,onSelected:je,onClose:N,masterDataColumnName:ee,masterDataFilters:te,masterDataName:h,masterDataId:h,masterDataFormula:n,showFilters:!0,enableRootDrag:!0})]}),k&&u&&V&&M&&e.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:t=>t.stopPropagation(),onMouseDown:t=>t.preventDefault(),onKeyDown:t=>{t.key==="Escape"&&C(!1)},children:e.jsx(M,{riskDetails:u})})]})});J.displayName="MasterDataInputField";exports.MasterDataInputField=J;
2
2
  //# sourceMappingURL=MasterDataInputField.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MasterDataInputField.cjs.js","sources":["../../../../src/components/forms/master-data-input/MasterDataInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport {\n BoltOutlined,\n CloseRounded,\n NoteAddOutlined,\n TableChartRounded,\n} from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport IconButton from \"../../button/IconButton\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { CloseIcon, CloseSmallIcon } from \"../../icon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/** Visual emphasis for the input surface (background + border) */\nexport type MasterDataInputFieldEmphasis =\n | \"default\"\n | \"modified\"\n | \"deleted\"\n | \"success\";\n\n/**\n * Props for the MasterDataModal component\n */\nexport interface MasterDataModalProps {\n isVisible: boolean;\n onSelected?: (masterDataValue: any, masterDataRow?: any) => void;\n onClose: () => void;\n masterDataColumnName?: string;\n masterDataFilters?: any;\n masterDataName?: string;\n masterDataId: string | null;\n masterDataFormula?: string;\n setFieldFilters?: any;\n showFilters?: boolean;\n enableRootDrag?: boolean;\n}\n\n/**\n * Props for the MasterDataInputField component\n */\nexport interface MasterDataInputFieldProps {\n /** Unique identifier for the input */\n id: string;\n /** Label text to display above the input */\n label: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Current value of the input */\n value: any;\n /** Callback function called when value changes */\n onChange: (value: any, masterDataRowValue?: any) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Callback to set error message */\n setErrorMessage: (message: string) => void;\n /** Callback to remove error message */\n removeErrorMessage: () => void;\n /** Default value for the input */\n defaultValue?: any;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Name of the master data source */\n masterDataName: string;\n /** Column name in the master data */\n masterDataColumnName: string;\n /** Formula for computing master data value */\n masterDataFormula?: string;\n /** Filters for master data */\n masterDataFilters?: any;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Index for array fields */\n index?: number;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Color for the input text */\n color?: string;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Reference data for formula computation */\n reference?: any;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function called when input loses focus */\n onBlur?: () => void;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Primary color shades for styling */\n primaryColorShades?: Record<number, string>;\n /** Callback to set disable actions state */\n setDisableActions?: (disabled: boolean) => void;\n /** Toast function for deprecated field warning */\n showDeprecatedFieldWarning?: () => void;\n /** Master data modal component */\n MasterDataModal?: React.ComponentType<MasterDataModalProps>;\n /** Function to parse master data formula */\n parseMasterDataFormula?: (formula: string, row: any) => string;\n /** Input surface style: `'modified'` — `--Warning-50` / `--Warning-200`; `'deleted'` — `--Error-50` / `--Error-200`, text `#475467`; `'success'` — `--Success-50` / `--Success-200`, text `#101828`. */\n inputEmphasis?: MasterDataInputFieldEmphasis;\n}\n\n/**\n * A highly customizable master data input component with label, validation, and styling support.\n * Features master data modal integration, GTN support, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <MasterDataInputField\n * id=\"master-field\"\n * label=\"Master Field\"\n * value={fieldValue}\n * onChange={(value, rowValue) => setFieldValue(value)}\n * setErrorMessage={(msg) => setError(msg)}\n * removeErrorMessage={() => setError('')}\n * masterDataName=\"customers\"\n * masterDataColumnName=\"name\"\n * required\n * />\n * ```\n */\nexport const MasterDataInputField = forwardRef<\n HTMLInputElement,\n MasterDataInputFieldProps\n>(\n (\n {\n id,\n label,\n labelExtra,\n placeholder,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n masterDataName,\n masterDataColumnName,\n masterDataFormula,\n masterDataFilters,\n tags,\n index,\n tooltip = \"\",\n originalCase = false,\n color = \"\",\n isGTN = false,\n labelClassName,\n gtnName = null,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n disabled = false,\n reference = {},\n isLiveField = false,\n onBlur,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n primaryColorShades,\n setDisableActions,\n showDeprecatedFieldWarning,\n MasterDataModal,\n parseMasterDataFormula,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" && !errorMessage && !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" && !errorMessage && !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" && !errorMessage && !showRiskSkin;\n const [isHovered, setIsHovered] = useState(false);\n const [inputValue, setInputValue] = useState<string | null>(null);\n const [showMasterDataModal, setShowMasterDataModal] = useState(false);\n const [suggestion, setSuggestion] = useState(\"\");\n const [masterDataRowValue, setMasterDataRowValue] = useState<any>(null);\n const [isTextOverflowing, setIsTextOverflowing] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Use forwarded ref or internal ref\n const combinedRef = (ref as React.RefObject<HTMLInputElement>) || inputRef;\n\n // Check if text is overflowing\n useEffect(() => {\n const checkOverflow = () => {\n const input = combinedRef.current || inputRef.current;\n if (input) {\n setIsTextOverflowing(input.scrollWidth > input.clientWidth);\n }\n };\n\n checkOverflow();\n // Recheck on window resize\n window.addEventListener('resize', checkOverflow);\n return () => window.removeEventListener('resize', checkOverflow);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue, value]);\n\n useEffect(() => {\n setInputValue(value);\n }, [index, value]);\n\n useEffect(() => {\n if (inputValue !== null && inputValue !== value) {\n onChange(inputValue, masterDataRowValue);\n }\n }, [inputValue, masterDataRowValue]);\n\n const toggleMasterDataModal = () => {\n if (showMasterDataModal) {\n setDisableActions?.(false);\n } else {\n setDisableActions?.(true);\n }\n setShowMasterDataModal(!showMasterDataModal);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.keyCode === 9 || event.key === \"Enter\") {\n const currentRef = combinedRef.current || inputRef.current;\n if (currentRef) {\n setInputValue(suggestion);\n currentRef.blur();\n }\n }\n };\n\n const handleSetMasterData = (masterDataValue: any, masterDataRow?: any) => {\n let _value = masterDataValue;\n\n if (masterDataFormula && parseMasterDataFormula) {\n _value = parseMasterDataFormula(masterDataFormula, masterDataRow);\n }\n\n setSuggestion(\"\");\n setInputValue(_value);\n toggleMasterDataModal();\n setMasterDataRowValue(masterDataRow);\n };\n\n const handleClear = () => {\n setInputValue(\"\");\n setMasterDataRowValue(null);\n };\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument && gtnName) {\n const keyValuePair = {\n key: gtnName,\n value: _value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium\";\n const placeholderColor = `placeholder:text-neutral-900 dark:placeholder:text-black-400`;\n\n if (errorMessage) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (showRiskSkin && riskDetails?.color) {\n return cn(\n baseClasses,\n placeholderColor,\n `border-${riskDetails.color}-300 bg-${riskDetails.color}-50`,\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (emphasisDeletedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]\"\n );\n }\n if (emphasisModifiedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]\"\n );\n }\n if (emphasisSuccessSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]\"\n );\n }\n\n return cn(\n baseClasses,\n placeholderColor,\n \"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n };\n\n const resolveMasterDataValue = () => {\n if (inputValue !== null) {\n return inputValue;\n }\n if (masterDataFormula && parseMasterDataFormula) {\n return parseMasterDataFormula(masterDataFormula, reference);\n }\n\n return value;\n };\n\n useEffect(() => {\n if (showMasterDataModal && !masterDataName) {\n showDeprecatedFieldWarning?.();\n setShowMasterDataModal(false);\n }\n }, [showMasterDataModal, masterDataName, showDeprecatedFieldWarning]);\n\n return (\n <div\n className={cn(\n `flex gap-0.5 w-full relative`,\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 p-1\"\n : \"\",\n { \"error-field\": !!errorMessage }\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n\n <div className={cn(`flex flex-col w-full`)}>\n <label\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip\n placement=\"top\"\n title={`${tooltip}${masterDataFormula ? ` | ${masterDataFormula}` : \"\"}`}\n >\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </div>\n\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-master-data-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(value?.toString() || \"\")}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n sx={{\n fontSize: 16,\n color:\n primaryColorShades?.[600] || \"var(--color-primary-600)\",\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n <label className=\"relative block mt-1\">\n <Tooltip\n title={isTextOverflowing ? resolveMasterDataValue() : \"\"}\n >\n <input\n id={id}\n ref={combinedRef}\n required={required}\n placeholder={placeholder}\n className={getClassName()}\n onChange={(e) => {\n onChange(e.target.value, masterDataRowValue);\n setInputValue(e.target?.value);\n }}\n onKeyDown={handleKeyDown}\n value={resolveMasterDataValue()}\n defaultValue={defaultValue}\n disabled={true}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n </Tooltip>\n\n <IconButton\n id={`btn-dynamic-data-input-rx-cross`}\n onClick={handleClear}\n className=\"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <CloseIcon className=\"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm\" />\n </IconButton>\n\n <IconButton\n id={`btn-dynamic-data-input-ai-outline-pic-center`}\n onClick={toggleMasterDataModal}\n className=\"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <TableChartRounded\n className=\"text-neutral-500 dark:text-neutral-400 w-sm h-sm\"\n />\n </IconButton>\n </label>\n\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n\n {showMasterDataModal && MasterDataModal && (\n <MasterDataModal\n isVisible={showMasterDataModal}\n onSelected={handleSetMasterData}\n onClose={toggleMasterDataModal}\n masterDataColumnName={masterDataColumnName}\n masterDataFilters={masterDataFilters}\n masterDataName={masterDataName}\n masterDataId={masterDataName}\n masterDataFormula={masterDataFormula}\n showFilters\n enableRootDrag\n />\n )}\n </div>\n\n {isHovered &&\n riskDetails &&\n isRiskAnalysisOpen &&\n RiskDetailsCard && (\n <div\n role=\"tooltip\"\n tabIndex={0}\n className=\"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl\"\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.preventDefault()}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n setIsHovered(false);\n }\n }}\n >\n <RiskDetailsCard riskDetails={riskDetails} />\n </div>\n )}\n </div>\n );\n }\n);\n\nMasterDataInputField.displayName = \"MasterDataInputField\";\n\n"],"names":["MasterDataInputField","forwardRef","id","label","labelExtra","placeholder","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","masterDataName","masterDataColumnName","masterDataFormula","masterDataFilters","tags","index","tooltip","originalCase","color","isGTN","labelClassName","gtnName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","disabled","reference","isLiveField","onBlur","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","primaryColorShades","setDisableActions","showDeprecatedFieldWarning","MasterDataModal","parseMasterDataFormula","inputEmphasis","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isHovered","setIsHovered","useState","inputValue","setInputValue","showMasterDataModal","setShowMasterDataModal","suggestion","setSuggestion","masterDataRowValue","setMasterDataRowValue","isTextOverflowing","setIsTextOverflowing","inputRef","useRef","combinedRef","useEffect","checkOverflow","input","toggleMasterDataModal","handleKeyDown","event","currentRef","handleSetMasterData","masterDataValue","masterDataRow","_value","handleClear","handleAddGTNToDocument","getClassName","baseClasses","placeholderColor","cn","resolveMasterDataValue","jsxs","jsx","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","e","IconButton","CloseIcon","TableChartRounded","Typography"],"mappings":"0uBAmNaA,EAAuBC,EAAAA,WAIlC,CACE,CACE,GAAAC,EACA,MAAAC,E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,kBAAAE,EACA,YAAW,GACX,eAAc,EAAA,CAAA,CAChB,EAEJ,EAECqC,GACChB,GACAC,GACAC,GACEiD,EAAAA,IAAC,MAAA,CACC,KAAK,UACL,SAAU,EACV,UAAU,oFACV,QAAUe,GAAMA,EAAE,gBAAA,EAClB,YAAcA,GAAMA,EAAE,eAAA,EACtB,UAAYA,GAAM,CACZA,EAAE,MAAQ,UACZjD,EAAa,EAAK,CAEtB,EAEA,SAAAkC,EAAAA,IAACjD,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEAnC,EAAqB,YAAc"}
1
+ {"version":3,"file":"MasterDataInputField.cjs.js","sources":["../../../../src/components/forms/master-data-input/MasterDataInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport {\n BoltOutlined,\n CloseRounded,\n NoteAddOutlined,\n TableChartRounded,\n} from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport IconButton from \"../../button/IconButton\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { CloseIcon, CloseSmallIcon } from \"../../icon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/** Visual emphasis for the input surface (background + border) */\nexport type MasterDataInputFieldEmphasis =\n | \"default\"\n | \"modified\"\n | \"deleted\"\n | \"success\";\n\n/**\n * Props for the MasterDataModal component\n */\nexport interface MasterDataModalProps {\n isVisible: boolean;\n onSelected?: (masterDataValue: any, masterDataRow?: any) => void;\n onClose: () => void;\n masterDataColumnName?: string;\n masterDataFilters?: any;\n masterDataName?: string;\n masterDataId: string | null;\n masterDataFormula?: string;\n setFieldFilters?: any;\n showFilters?: boolean;\n enableRootDrag?: boolean;\n}\n\n/**\n * Props for the MasterDataInputField component\n */\nexport interface MasterDataInputFieldProps {\n /** Unique identifier for the input */\n id: string;\n /** Label text to display above the input */\n label: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Current value of the input */\n value: any;\n /** Callback function called when value changes */\n onChange: (value: any, masterDataRowValue?: any) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Callback to set error message */\n setErrorMessage: (message: string) => void;\n /** Callback to remove error message */\n removeErrorMessage: () => void;\n /** Default value for the input */\n defaultValue?: any;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Name of the master data source */\n masterDataName: string;\n /** Column name in the master data */\n masterDataColumnName: string;\n /** Formula for computing master data value */\n masterDataFormula?: string;\n /** Filters for master data */\n masterDataFilters?: any;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Index for array fields */\n index?: number;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Color for the input text */\n color?: string;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Reference data for formula computation */\n reference?: any;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function called when input loses focus */\n onBlur?: () => void;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Primary color shades for styling */\n primaryColorShades?: Record<number, string>;\n /** Callback to set disable actions state */\n setDisableActions?: (disabled: boolean) => void;\n /** Toast function for deprecated field warning */\n showDeprecatedFieldWarning?: () => void;\n /** Master data modal component */\n MasterDataModal?: React.ComponentType<MasterDataModalProps>;\n /** Function to parse master data formula */\n parseMasterDataFormula?: (formula: string, row: any) => string;\n /** Input surface style: `'modified'` — `--Warning-50` / `--Warning-200`; `'deleted'` — `--Error-50` / `--Error-200`, text `#475467`; `'success'` — `--Success-50` / `--Success-200`, text `#101828`. */\n inputEmphasis?: MasterDataInputFieldEmphasis;\n}\n\n/**\n * A highly customizable master data input component with label, validation, and styling support.\n * Features master data modal integration, GTN support, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <MasterDataInputField\n * id=\"master-field\"\n * label=\"Master Field\"\n * value={fieldValue}\n * onChange={(value, rowValue) => setFieldValue(value)}\n * setErrorMessage={(msg) => setError(msg)}\n * removeErrorMessage={() => setError('')}\n * masterDataName=\"customers\"\n * masterDataColumnName=\"name\"\n * required\n * />\n * ```\n */\nexport const MasterDataInputField = forwardRef<\n HTMLInputElement,\n MasterDataInputFieldProps\n>(\n (\n {\n id,\n label,\n labelExtra,\n placeholder,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n masterDataName,\n masterDataColumnName,\n masterDataFormula,\n masterDataFilters,\n tags,\n index,\n tooltip = \"\",\n originalCase = false,\n color = \"\",\n isGTN = false,\n labelClassName,\n gtnName = null,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n disabled = false,\n reference = {},\n isLiveField = false,\n onBlur,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n primaryColorShades,\n setDisableActions,\n showDeprecatedFieldWarning,\n MasterDataModal,\n parseMasterDataFormula,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" && !errorMessage && !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" && !errorMessage && !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" && !errorMessage && !showRiskSkin;\n const [isHovered, setIsHovered] = useState(false);\n const [inputValue, setInputValue] = useState<string | null>(null);\n const [showMasterDataModal, setShowMasterDataModal] = useState(false);\n const [suggestion, setSuggestion] = useState(\"\");\n const [masterDataRowValue, setMasterDataRowValue] = useState<any>(null);\n const [isTextOverflowing, setIsTextOverflowing] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Use forwarded ref or internal ref\n const combinedRef = (ref as React.RefObject<HTMLInputElement>) || inputRef;\n\n // Check if text is overflowing\n useEffect(() => {\n const checkOverflow = () => {\n const input = combinedRef.current || inputRef.current;\n if (input) {\n setIsTextOverflowing(input.scrollWidth > input.clientWidth);\n }\n };\n\n checkOverflow();\n // Recheck on window resize\n window.addEventListener('resize', checkOverflow);\n return () => window.removeEventListener('resize', checkOverflow);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue, value]);\n\n useEffect(() => {\n setInputValue(value);\n }, [index, value]);\n\n useEffect(() => {\n if (inputValue !== null && inputValue !== value) {\n onChange(inputValue, masterDataRowValue);\n }\n }, [inputValue, masterDataRowValue]);\n\n const toggleMasterDataModal = () => {\n if (showMasterDataModal) {\n setDisableActions?.(false);\n } else {\n setDisableActions?.(true);\n }\n setShowMasterDataModal(!showMasterDataModal);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.keyCode === 9 || event.key === \"Enter\") {\n const currentRef = combinedRef.current || inputRef.current;\n if (currentRef) {\n setInputValue(suggestion);\n currentRef.blur();\n }\n }\n };\n\n const handleSetMasterData = (masterDataValue: any, masterDataRow?: any) => {\n let _value = masterDataValue;\n\n console.log(\"handleSetMasterData called with:\", masterDataValue, masterDataRow, masterDataFormula, parseMasterDataFormula);\n\n if (masterDataFormula && parseMasterDataFormula) {\n console.log(\"handleSetMasterData called with:\", masterDataValue, masterDataRow, masterDataFormula, parseMasterDataFormula(masterDataFormula, masterDataRow));\n\n _value = parseMasterDataFormula(masterDataFormula, masterDataRow);\n }\n\n setSuggestion(\"\");\n setInputValue(_value);\n toggleMasterDataModal();\n setMasterDataRowValue(masterDataRow);\n };\n\n const handleClear = () => {\n setInputValue(\"\");\n setMasterDataRowValue(null);\n };\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument && gtnName) {\n const keyValuePair = {\n key: gtnName,\n value: _value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium\";\n const placeholderColor = `placeholder:text-neutral-900 dark:placeholder:text-black-400`;\n\n if (errorMessage) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (showRiskSkin && riskDetails?.color) {\n return cn(\n baseClasses,\n placeholderColor,\n `border-${riskDetails.color}-300 bg-${riskDetails.color}-50`,\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (emphasisDeletedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]\"\n );\n }\n if (emphasisModifiedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]\"\n );\n }\n if (emphasisSuccessSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]\"\n );\n }\n\n return cn(\n baseClasses,\n placeholderColor,\n \"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n };\n\n const resolveMasterDataValue = () => {\n if (inputValue !== null) {\n return inputValue;\n }\n if (masterDataFormula && parseMasterDataFormula) {\n console.log(\"Parsing master data formula with reference:\", masterDataFormula, reference, parseMasterDataFormula(masterDataFormula, reference));\n return parseMasterDataFormula(masterDataFormula, reference);\n }\n\n return value;\n };\n\n useEffect(() => {\n if (showMasterDataModal && !masterDataName) {\n showDeprecatedFieldWarning?.();\n setShowMasterDataModal(false);\n }\n }, [showMasterDataModal, masterDataName, showDeprecatedFieldWarning]);\n\n return (\n <div\n className={cn(\n `flex gap-0.5 w-full relative`,\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 p-1\"\n : \"\",\n { \"error-field\": !!errorMessage }\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n\n <div className={cn(`flex flex-col w-full`)}>\n <label\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip\n placement=\"top\"\n title={`${tooltip}${masterDataFormula ? ` | ${masterDataFormula}` : \"\"}`}\n >\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </div>\n\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-master-data-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(value?.toString() || \"\")}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n sx={{\n fontSize: 16,\n color:\n primaryColorShades?.[600] || \"var(--color-primary-600)\",\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n <label className=\"relative block mt-1\">\n <Tooltip\n title={isTextOverflowing ? resolveMasterDataValue() : \"\"}\n >\n <input\n id={id}\n ref={combinedRef}\n required={required}\n placeholder={placeholder}\n className={getClassName()}\n onChange={(e) => {\n onChange(e.target.value, masterDataRowValue);\n setInputValue(e.target?.value);\n }}\n onKeyDown={handleKeyDown}\n value={resolveMasterDataValue()}\n defaultValue={defaultValue}\n disabled={true}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n </Tooltip>\n\n <IconButton\n id={`btn-dynamic-data-input-rx-cross`}\n onClick={handleClear}\n className=\"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <CloseIcon className=\"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm\" />\n </IconButton>\n\n <IconButton\n id={`btn-dynamic-data-input-ai-outline-pic-center`}\n onClick={toggleMasterDataModal}\n className=\"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <TableChartRounded\n className=\"text-neutral-500 dark:text-neutral-400 w-sm h-sm\"\n />\n </IconButton>\n </label>\n\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n\n {showMasterDataModal && MasterDataModal && (\n <MasterDataModal\n isVisible={showMasterDataModal}\n onSelected={handleSetMasterData}\n onClose={toggleMasterDataModal}\n masterDataColumnName={masterDataColumnName}\n masterDataFilters={masterDataFilters}\n masterDataName={masterDataName}\n masterDataId={masterDataName}\n masterDataFormula={masterDataFormula}\n showFilters\n enableRootDrag\n />\n )}\n </div>\n\n {isHovered &&\n riskDetails &&\n isRiskAnalysisOpen &&\n RiskDetailsCard && (\n <div\n role=\"tooltip\"\n tabIndex={0}\n className=\"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl\"\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.preventDefault()}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n setIsHovered(false);\n }\n }}\n >\n <RiskDetailsCard riskDetails={riskDetails} />\n </div>\n )}\n </div>\n );\n }\n);\n\nMasterDataInputField.displayName = \"MasterDataInputField\";\n\n"],"names":["MasterDataInputField","forwardRef","id","label","labelExtra","placeholder","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","masterDataName","masterDataColumnName","masterDataFormula","masterDataFilters","tags","index","tooltip","originalCase","color","isGTN","labelClassName","gtnName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","disabled","reference","isLiveField","onBlur","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","primaryColorShades","setDisableActions","showDeprecatedFieldWarning","MasterDataModal","parseMasterDataFormula","inputEmphasis","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isHovered","setIsHovered","useState","inputValue","setInputValue","showMasterDataModal","setShowMasterDataModal","suggestion","setSuggestion","masterDataRowValue","setMasterDataRowValue","isTextOverflowing","setIsTextOverflowing","inputRef","useRef","combinedRef","useEffect","checkOverflow","input","toggleMasterDataModal","handleKeyDown","event","currentRef","handleSetMasterData","masterDataValue","masterDataRow","_value","handleClear","handleAddGTNToDocument","getClassName","baseClasses","placeholderColor","cn","resolveMasterDataValue","jsxs","jsx","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","e","IconButton","CloseIcon","TableChartRounded","Typography"],"mappings":"0uBAmNaA,EAAuBC,EAAAA,WAIlC,CACE,CACE,GAAAC,EACA,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,MAAAC,EACA,SAAAC,EACA,aAAAC,EACA,aAAAC,EACA,SAAAC,EAAW,GACX,sBAAAC,EAAwB,GACxB,eAAAC,EACA,qBAAAC,GACA,kBAAAC,EACA,kBAAAC,GACA,KAAAC,GAAA,MACAC,GACA,QAAAC,EAAU,GACV,aAAAC,GAAe,GACf,MAAAC,EAAQ,GACR,MAAAC,EAAQ,GACR,eAAAC,GACA,QAAAC,EAAU,KACV,cAAAC,GAAgB,GAChB,gBAAAC,EACA,eAAAC,EAAiB,OACjB,kBAAAC,EACA,WAAAC,GAAa,CAAA,EACb,uBAAAC,GACA,SAAAC,EAAW,GACX,UAAAC,EAAY,CAAA,EACZ,YAAAC,GAAc,GACd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,EAAE,MAAQ,UACZjD,EAAa,EAAK,CAEtB,EAEA,SAAAkC,EAAAA,IAACjD,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEAnC,EAAqB,YAAc"}
@@ -1,149 +1,149 @@
1
- import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
- import l from "../../../_virtual/index.es.js";
3
- import { forwardRef as Ee, useState as f, useRef as Ne, useEffect as k } from "react";
4
- import { Tooltip as Ie } from "antd";
5
- import { useTranslation as Be } from "react-i18next";
1
+ import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
+ import n from "../../../_virtual/index.es.js";
3
+ import { forwardRef as Ne, useState as m, useRef as Ie, useEffect as k } from "react";
4
+ import { Tooltip as Be } from "antd";
5
+ import { useTranslation as Fe } from "react-i18next";
6
6
  import { Typography as ze } from "../../data-display/typography/Typography.es.js";
7
- import { Label as Re } from "../../data-display/label/Label.es.js";
8
- import { BoltOutlined as Ve, NoteAddOutlined as $e, TableChartRounded as Ae } from "@mui/icons-material";
9
- import { AIExtractedIndicator as Le } from "../../icons/AIExtractedIndicator.es.js";
7
+ import { Label as $e } from "../../data-display/label/Label.es.js";
8
+ import { BoltOutlined as Ae, NoteAddOutlined as Ve, TableChartRounded as Le } from "@mui/icons-material";
9
+ import { AIExtractedIndicator as Re } from "../../icons/AIExtractedIndicator.es.js";
10
10
  import { AIStarIcon as We } from "../../icons/AIStarIcon.es.js";
11
- import { HelpIcon as Me } from "../../icons/HelpIcon.es.js";
12
- import z from "../../tooltip/Tooltip.es.js";
13
- import D from "../../button/IconButton.es.js";
14
- import { InputLabel as Oe } from "../shared/InputLabel.es.js";
15
- import { shouldShowConfidenceScore as J, getConfidenceScoreBadgeFill as je, getConfidenceScoreBadgeColor as He, getConfidenceScoreBadgeTextColor as Ke, getConfidenceScoreBadgeClass as Pe } from "../../../utils/confidenceScoreUtils.es.js";
11
+ import { HelpIcon as Oe } from "../../icons/HelpIcon.es.js";
12
+ import $ from "../../tooltip/Tooltip.es.js";
13
+ import Q from "../../button/IconButton.es.js";
14
+ import { InputLabel as Pe } from "../shared/InputLabel.es.js";
15
+ import { shouldShowConfidenceScore as T, getConfidenceScoreBadgeFill as je, getConfidenceScoreBadgeColor as He, getConfidenceScoreBadgeTextColor as Ke, getConfidenceScoreBadgeClass as Me } from "../../../utils/confidenceScoreUtils.es.js";
16
16
  import { CloseIcon as _e } from "../../icon/icons.generated.es.js";
17
- const qe = Ee(
17
+ const qe = Ne(
18
18
  ({
19
- id: Q,
20
- label: T,
21
- labelExtra: U,
22
- placeholder: X,
19
+ id: U,
20
+ label: X,
21
+ labelExtra: Y,
22
+ placeholder: Z,
23
23
  value: s,
24
- onChange: R,
25
- errorMessage: o,
26
- defaultValue: Y,
24
+ onChange: A,
25
+ errorMessage: i,
26
+ defaultValue: G,
27
27
  required: V = !1,
28
- isRequiredConditional: Z = !1,
29
- masterDataName: b,
30
- masterDataColumnName: G,
31
- masterDataFormula: a,
32
- masterDataFilters: ee,
33
- tags: te,
34
- index: re,
35
- tooltip: $ = "",
36
- originalCase: le = !1,
37
- color: d = "",
28
+ isRequiredConditional: D = !1,
29
+ masterDataName: g,
30
+ masterDataColumnName: ee,
31
+ masterDataFormula: l,
32
+ masterDataFilters: te,
33
+ tags: re,
34
+ index: le,
35
+ tooltip: L = "",
36
+ originalCase: ne = !1,
37
+ color: c = "",
38
38
  isGTN: v = !1,
39
- labelClassName: ne,
40
- gtnName: A = null,
41
- isAiExtracted: oe = !1,
39
+ labelClassName: oe,
40
+ gtnName: R = null,
41
+ isAiExtracted: ie = !1,
42
42
  confidenceScore: w,
43
- confidenceType: m = "high",
43
+ confidenceType: p = "high",
44
44
  confidenceTooltip: C,
45
45
  sourceMeta: ae = [],
46
- onConfidenceScoreClick: ie,
47
- disabled: L = !1,
48
- reference: se = {},
49
- isLiveField: de = !1,
46
+ onConfidenceScoreClick: de,
47
+ disabled: W = !1,
48
+ reference: S = {},
49
+ isLiveField: se = !1,
50
50
  onBlur: ce,
51
51
  onAddGTNToDocument: y,
52
- riskDetails: c,
53
- isRiskAnalysisOpen: W = !1,
54
- RiskDetailsCard: M,
55
- primaryColorShades: ue,
56
- setDisableActions: O,
57
- showDeprecatedFieldWarning: j,
58
- MasterDataModal: H,
59
- parseMasterDataFormula: g,
60
- inputEmphasis: S = "default"
61
- }, fe) => {
62
- const { t: me } = Be(), x = !!(W && c?.color), pe = S === "modified" && !o && !x, be = S === "deleted" && !o && !x, ge = S === "success" && !o && !x, [h, F] = f(!1), [i, p] = f(null), [u, K] = f(!1), [xe, he] = f(""), [E, P] = f(null), [ke, ve] = f(!1), N = Ne(null), I = fe || N;
52
+ riskDetails: f,
53
+ isRiskAnalysisOpen: O = !1,
54
+ RiskDetailsCard: P,
55
+ primaryColorShades: fe,
56
+ setDisableActions: j,
57
+ showDeprecatedFieldWarning: H,
58
+ MasterDataModal: K,
59
+ parseMasterDataFormula: a,
60
+ inputEmphasis: E = "default"
61
+ }, ue) => {
62
+ const { t: me } = Fe(), h = !!(O && f?.color), pe = E === "modified" && !i && !h, be = E === "deleted" && !i && !h, ge = E === "success" && !i && !h, [x, N] = m(!1), [d, b] = m(null), [u, M] = m(!1), [he, xe] = m(""), [I, _] = m(null), [ke, ve] = m(!1), B = Ie(null), F = ue || B;
63
63
  k(() => {
64
64
  const e = () => {
65
- const r = I.current || N.current;
65
+ const r = F.current || B.current;
66
66
  r && ve(r.scrollWidth > r.clientWidth);
67
67
  };
68
68
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
69
- }, [i, s]), k(() => {
70
- p(s);
71
- }, [re, s]), k(() => {
72
- i !== null && i !== s && R(i, E);
73
- }, [i, E]);
74
- const B = () => {
75
- O?.(!u), K(!u);
69
+ }, [d, s]), k(() => {
70
+ b(s);
71
+ }, [le, s]), k(() => {
72
+ d !== null && d !== s && A(d, I);
73
+ }, [d, I]);
74
+ const z = () => {
75
+ j?.(!u), M(!u);
76
76
  }, we = (e) => {
77
77
  if (e.keyCode === 9 || e.key === "Enter") {
78
- const r = I.current || N.current;
79
- r && (p(xe), r.blur());
78
+ const r = F.current || B.current;
79
+ r && (b(he), r.blur());
80
80
  }
81
81
  }, Ce = (e, r) => {
82
- let q = e;
83
- a && g && (q = g(a, r)), he(""), p(q), B(), P(r);
84
- }, ye = () => {
85
- p(""), P(null);
86
- }, Se = (e) => {
87
- y && A && y({
88
- key: A,
82
+ let J = e;
83
+ console.log("handleSetMasterData called with:", e, r, l, a), l && a && (console.log("handleSetMasterData called with:", e, r, l, a(l, r)), J = a(l, r)), xe(""), b(J), z(), _(r);
84
+ }, Se = () => {
85
+ b(""), _(null);
86
+ }, ye = (e) => {
87
+ y && R && y({
88
+ key: R,
89
89
  value: e
90
90
  });
91
- }, Fe = () => {
91
+ }, Ee = () => {
92
92
  const e = "border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium", r = "placeholder:text-neutral-900 dark:placeholder:text-black-400";
93
- return o ? l(
93
+ return i ? n(
94
94
  e,
95
95
  r,
96
96
  "border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",
97
- d || "text-neutral-900 dark:text-black-200"
98
- ) : x && c?.color ? l(
97
+ c || "text-neutral-900 dark:text-black-200"
98
+ ) : h && f?.color ? n(
99
99
  e,
100
100
  r,
101
- `border-${c.color}-300 bg-${c.color}-50`,
102
- d || "text-neutral-900 dark:text-black-200"
103
- ) : be ? l(
101
+ `border-${f.color}-300 bg-${f.color}-50`,
102
+ c || "text-neutral-900 dark:text-black-200"
103
+ ) : be ? n(
104
104
  e,
105
105
  r,
106
106
  "border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]"
107
- ) : pe ? l(
107
+ ) : pe ? n(
108
108
  e,
109
109
  r,
110
110
  "border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]"
111
- ) : ge ? l(
111
+ ) : ge ? n(
112
112
  e,
113
113
  r,
114
114
  "border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]"
115
- ) : l(
115
+ ) : n(
116
116
  e,
117
117
  r,
118
118
  "border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",
119
- d || "text-neutral-900 dark:text-black-200"
119
+ c || "text-neutral-900 dark:text-black-200"
120
120
  );
121
- }, _ = () => i !== null ? i : a && g ? g(a, se) : s;
121
+ }, q = () => d !== null ? d : l && a ? (console.log("Parsing master data formula with reference:", l, S, a(l, S)), a(l, S)) : s;
122
122
  return k(() => {
123
- u && !b && (j?.(), K(!1));
124
- }, [u, b, j]), /* @__PURE__ */ n(
123
+ u && !g && (H?.(), M(!1));
124
+ }, [u, g, H]), /* @__PURE__ */ o(
125
125
  "div",
126
126
  {
127
- className: l(
127
+ className: n(
128
128
  "flex gap-0.5 w-full relative",
129
- h && v ? "border rounded-lg border-primary-100 p-1" : "",
130
- { "error-field": !!o }
129
+ x && v ? "border rounded-lg border-primary-100 p-1" : "",
130
+ { "error-field": !!i }
131
131
  ),
132
- onMouseEnter: () => F(!0),
133
- onMouseLeave: () => F(!1),
132
+ onMouseEnter: () => N(!0),
133
+ onMouseLeave: () => N(!1),
134
134
  children: [
135
- v && !h ? /* @__PURE__ */ t("div", { className: "w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5" }) : null,
136
- /* @__PURE__ */ n("div", { className: l("flex flex-col w-full"), children: [
135
+ v && !x ? /* @__PURE__ */ t("div", { className: "w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5" }) : null,
136
+ /* @__PURE__ */ o("div", { className: n("flex flex-col w-full"), children: [
137
137
  /* @__PURE__ */ t(
138
138
  "label",
139
139
  {
140
140
  htmlFor: "text",
141
- className: `text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${le ? "" : "capitalize"} ${ne || ""}`,
142
- children: /* @__PURE__ */ n("div", { className: "grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1", children: [
143
- /* @__PURE__ */ n("div", { className: "inline-flex min-w-0 items-center gap-1 flex-wrap", children: [
144
- /* @__PURE__ */ t(Oe, { label: T || "", required: V || !1, isRequiredConditional: Z || !1 }),
145
- de && /* @__PURE__ */ t(
146
- Ve,
141
+ className: `text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${ne ? "" : "capitalize"} ${oe || ""}`,
142
+ children: /* @__PURE__ */ o("div", { className: "grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1", children: [
143
+ /* @__PURE__ */ o("div", { className: "inline-flex min-w-0 items-center gap-1 flex-wrap", children: [
144
+ /* @__PURE__ */ t(Pe, { label: X || "", required: V || !1, isRequiredConditional: D || !1 }),
145
+ se && /* @__PURE__ */ t(
146
+ Ae,
147
147
  {
148
148
  sx: {
149
149
  fontSize: 16,
@@ -152,44 +152,44 @@ const qe = Ee(
152
152
  }
153
153
  }
154
154
  ),
155
- oe && !J(w) && /* @__PURE__ */ t(Le, {}),
156
- /* @__PURE__ */ t(Re, { labels: te }),
157
- $ && /* @__PURE__ */ t(
158
- z,
155
+ ie && !T(w) && /* @__PURE__ */ t(Re, {}),
156
+ /* @__PURE__ */ t($e, { labels: re }),
157
+ L && /* @__PURE__ */ t(
158
+ $,
159
159
  {
160
160
  placement: "top",
161
- title: `${$}${a ? ` | ${a}` : ""}`,
162
- children: /* @__PURE__ */ t("div", { className: "cursor-pointer", children: /* @__PURE__ */ t(Me, { className: "w-icon-sm h-icon-sm" }) })
161
+ title: `${L}${l ? ` | ${l}` : ""}`,
162
+ children: /* @__PURE__ */ t("div", { className: "cursor-pointer", children: /* @__PURE__ */ t(Oe, { className: "w-icon-sm h-icon-sm" }) })
163
163
  }
164
164
  ),
165
- U
165
+ Y
166
166
  ] }),
167
- /* @__PURE__ */ n("div", { className: "flex items-center gap-1 justify-self-end", children: [
168
- J(w) && m ? /* @__PURE__ */ t(
169
- z,
167
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-1 justify-self-end", children: [
168
+ T(w) && p ? /* @__PURE__ */ t(
169
+ $,
170
170
  {
171
171
  placement: "top-end",
172
172
  title: C ?? "",
173
173
  hideTooltip: C == null,
174
174
  className: "cursor-pointer",
175
- children: /* @__PURE__ */ n(
175
+ children: /* @__PURE__ */ o(
176
176
  "div",
177
177
  {
178
- className: l(
178
+ className: n(
179
179
  "inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",
180
- Pe(m)
180
+ Me(p)
181
181
  ),
182
- onClick: () => ie?.(ae),
182
+ onClick: () => de?.(ae),
183
183
  children: [
184
184
  /* @__PURE__ */ t(
185
185
  We,
186
186
  {
187
187
  size: 12,
188
- fill: He(m),
189
- fillSecondary: je(m)
188
+ fill: He(p),
189
+ fillSecondary: je(p)
190
190
  }
191
191
  ),
192
- /* @__PURE__ */ n("span", { className: l("text-xs font-medium leading-4", Ke(m)), children: [
192
+ /* @__PURE__ */ o("span", { className: n("text-xs font-medium leading-4", Ke(p)), children: [
193
193
  w,
194
194
  "%"
195
195
  ] })
@@ -198,19 +198,19 @@ const qe = Ee(
198
198
  )
199
199
  }
200
200
  ) : null,
201
- v && h && y ? /* @__PURE__ */ t(
201
+ v && x && y ? /* @__PURE__ */ t(
202
202
  "button",
203
203
  {
204
204
  id: "btn-master-data-input-add-to-document",
205
205
  className: "cursor-pointer",
206
- onClick: () => Se(s?.toString() || ""),
206
+ onClick: () => ye(s?.toString() || ""),
207
207
  type: "button",
208
- children: /* @__PURE__ */ t(Ie, { placement: "top", title: me("Add to document"), children: /* @__PURE__ */ t(
209
- $e,
208
+ children: /* @__PURE__ */ t(Be, { placement: "top", title: me("Add to document"), children: /* @__PURE__ */ t(
209
+ Ve,
210
210
  {
211
211
  sx: {
212
212
  fontSize: 16,
213
- color: ue?.[600] || "var(--color-primary-600)"
213
+ color: fe?.[600] || "var(--color-primary-600)"
214
214
  }
215
215
  }
216
216
  ) })
@@ -220,25 +220,25 @@ const qe = Ee(
220
220
  ] })
221
221
  }
222
222
  ),
223
- /* @__PURE__ */ n("label", { className: "relative block mt-1", children: [
223
+ /* @__PURE__ */ o("label", { className: "relative block mt-1", children: [
224
224
  /* @__PURE__ */ t(
225
- z,
225
+ $,
226
226
  {
227
- title: ke ? _() : "",
227
+ title: ke ? q() : "",
228
228
  children: /* @__PURE__ */ t(
229
229
  "input",
230
230
  {
231
- id: Q,
232
- ref: I,
231
+ id: U,
232
+ ref: F,
233
233
  required: V,
234
- placeholder: X,
235
- className: Fe(),
234
+ placeholder: Z,
235
+ className: Ee(),
236
236
  onChange: (e) => {
237
- R(e.target.value, E), p(e.target?.value);
237
+ A(e.target.value, I), b(e.target?.value);
238
238
  },
239
239
  onKeyDown: we,
240
- value: _(),
241
- defaultValue: Y,
240
+ value: q(),
241
+ defaultValue: G,
242
242
  disabled: !0,
243
243
  autoComplete: "off",
244
244
  onBlur: ce
@@ -247,26 +247,26 @@ const qe = Ee(
247
247
  }
248
248
  ),
249
249
  /* @__PURE__ */ t(
250
- D,
250
+ Q,
251
251
  {
252
252
  id: "btn-dynamic-data-input-rx-cross",
253
- onClick: ye,
253
+ onClick: Se,
254
254
  className: "absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent",
255
255
  variant: "ghost",
256
- disabled: L,
256
+ disabled: W,
257
257
  children: /* @__PURE__ */ t(_e, { className: "w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm" })
258
258
  }
259
259
  ),
260
260
  /* @__PURE__ */ t(
261
- D,
261
+ Q,
262
262
  {
263
263
  id: "btn-dynamic-data-input-ai-outline-pic-center",
264
- onClick: B,
264
+ onClick: z,
265
265
  className: "absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent",
266
266
  variant: "ghost",
267
- disabled: L,
267
+ disabled: W,
268
268
  children: /* @__PURE__ */ t(
269
- Ae,
269
+ Le,
270
270
  {
271
271
  className: "text-neutral-500 dark:text-neutral-400 w-sm h-sm"
272
272
  }
@@ -274,33 +274,33 @@ const qe = Ee(
274
274
  }
275
275
  )
276
276
  ] }),
277
- o && /* @__PURE__ */ t(
277
+ i && /* @__PURE__ */ t(
278
278
  ze,
279
279
  {
280
280
  className: "text-error-500 mt-1",
281
281
  appearance: "custom",
282
282
  size: "extra-small",
283
283
  variant: "medium",
284
- children: o
284
+ children: i
285
285
  }
286
286
  ),
287
- u && H && /* @__PURE__ */ t(
288
- H,
287
+ u && K && /* @__PURE__ */ t(
288
+ K,
289
289
  {
290
290
  isVisible: u,
291
291
  onSelected: Ce,
292
- onClose: B,
293
- masterDataColumnName: G,
294
- masterDataFilters: ee,
295
- masterDataName: b,
296
- masterDataId: b,
297
- masterDataFormula: a,
292
+ onClose: z,
293
+ masterDataColumnName: ee,
294
+ masterDataFilters: te,
295
+ masterDataName: g,
296
+ masterDataId: g,
297
+ masterDataFormula: l,
298
298
  showFilters: !0,
299
299
  enableRootDrag: !0
300
300
  }
301
301
  )
302
302
  ] }),
303
- h && c && W && M && /* @__PURE__ */ t(
303
+ x && f && O && P && /* @__PURE__ */ t(
304
304
  "div",
305
305
  {
306
306
  role: "tooltip",
@@ -309,9 +309,9 @@ const qe = Ee(
309
309
  onClick: (e) => e.stopPropagation(),
310
310
  onMouseDown: (e) => e.preventDefault(),
311
311
  onKeyDown: (e) => {
312
- e.key === "Escape" && F(!1);
312
+ e.key === "Escape" && N(!1);
313
313
  },
314
- children: /* @__PURE__ */ t(M, { riskDetails: c })
314
+ children: /* @__PURE__ */ t(P, { riskDetails: f })
315
315
  }
316
316
  )
317
317
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"MasterDataInputField.es.js","sources":["../../../../src/components/forms/master-data-input/MasterDataInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport {\n BoltOutlined,\n CloseRounded,\n NoteAddOutlined,\n TableChartRounded,\n} from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport IconButton from \"../../button/IconButton\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { CloseIcon, CloseSmallIcon } from \"../../icon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/** Visual emphasis for the input surface (background + border) */\nexport type MasterDataInputFieldEmphasis =\n | \"default\"\n | \"modified\"\n | \"deleted\"\n | \"success\";\n\n/**\n * Props for the MasterDataModal component\n */\nexport interface MasterDataModalProps {\n isVisible: boolean;\n onSelected?: (masterDataValue: any, masterDataRow?: any) => void;\n onClose: () => void;\n masterDataColumnName?: string;\n masterDataFilters?: any;\n masterDataName?: string;\n masterDataId: string | null;\n masterDataFormula?: string;\n setFieldFilters?: any;\n showFilters?: boolean;\n enableRootDrag?: boolean;\n}\n\n/**\n * Props for the MasterDataInputField component\n */\nexport interface MasterDataInputFieldProps {\n /** Unique identifier for the input */\n id: string;\n /** Label text to display above the input */\n label: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Current value of the input */\n value: any;\n /** Callback function called when value changes */\n onChange: (value: any, masterDataRowValue?: any) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Callback to set error message */\n setErrorMessage: (message: string) => void;\n /** Callback to remove error message */\n removeErrorMessage: () => void;\n /** Default value for the input */\n defaultValue?: any;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Name of the master data source */\n masterDataName: string;\n /** Column name in the master data */\n masterDataColumnName: string;\n /** Formula for computing master data value */\n masterDataFormula?: string;\n /** Filters for master data */\n masterDataFilters?: any;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Index for array fields */\n index?: number;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Color for the input text */\n color?: string;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Reference data for formula computation */\n reference?: any;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function called when input loses focus */\n onBlur?: () => void;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Primary color shades for styling */\n primaryColorShades?: Record<number, string>;\n /** Callback to set disable actions state */\n setDisableActions?: (disabled: boolean) => void;\n /** Toast function for deprecated field warning */\n showDeprecatedFieldWarning?: () => void;\n /** Master data modal component */\n MasterDataModal?: React.ComponentType<MasterDataModalProps>;\n /** Function to parse master data formula */\n parseMasterDataFormula?: (formula: string, row: any) => string;\n /** Input surface style: `'modified'` — `--Warning-50` / `--Warning-200`; `'deleted'` — `--Error-50` / `--Error-200`, text `#475467`; `'success'` — `--Success-50` / `--Success-200`, text `#101828`. */\n inputEmphasis?: MasterDataInputFieldEmphasis;\n}\n\n/**\n * A highly customizable master data input component with label, validation, and styling support.\n * Features master data modal integration, GTN support, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <MasterDataInputField\n * id=\"master-field\"\n * label=\"Master Field\"\n * value={fieldValue}\n * onChange={(value, rowValue) => setFieldValue(value)}\n * setErrorMessage={(msg) => setError(msg)}\n * removeErrorMessage={() => setError('')}\n * masterDataName=\"customers\"\n * masterDataColumnName=\"name\"\n * required\n * />\n * ```\n */\nexport const MasterDataInputField = forwardRef<\n HTMLInputElement,\n MasterDataInputFieldProps\n>(\n (\n {\n id,\n label,\n labelExtra,\n placeholder,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n masterDataName,\n masterDataColumnName,\n masterDataFormula,\n masterDataFilters,\n tags,\n index,\n tooltip = \"\",\n originalCase = false,\n color = \"\",\n isGTN = false,\n labelClassName,\n gtnName = null,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n disabled = false,\n reference = {},\n isLiveField = false,\n onBlur,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n primaryColorShades,\n setDisableActions,\n showDeprecatedFieldWarning,\n MasterDataModal,\n parseMasterDataFormula,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" && !errorMessage && !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" && !errorMessage && !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" && !errorMessage && !showRiskSkin;\n const [isHovered, setIsHovered] = useState(false);\n const [inputValue, setInputValue] = useState<string | null>(null);\n const [showMasterDataModal, setShowMasterDataModal] = useState(false);\n const [suggestion, setSuggestion] = useState(\"\");\n const [masterDataRowValue, setMasterDataRowValue] = useState<any>(null);\n const [isTextOverflowing, setIsTextOverflowing] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Use forwarded ref or internal ref\n const combinedRef = (ref as React.RefObject<HTMLInputElement>) || inputRef;\n\n // Check if text is overflowing\n useEffect(() => {\n const checkOverflow = () => {\n const input = combinedRef.current || inputRef.current;\n if (input) {\n setIsTextOverflowing(input.scrollWidth > input.clientWidth);\n }\n };\n\n checkOverflow();\n // Recheck on window resize\n window.addEventListener('resize', checkOverflow);\n return () => window.removeEventListener('resize', checkOverflow);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue, value]);\n\n useEffect(() => {\n setInputValue(value);\n }, [index, value]);\n\n useEffect(() => {\n if (inputValue !== null && inputValue !== value) {\n onChange(inputValue, masterDataRowValue);\n }\n }, [inputValue, masterDataRowValue]);\n\n const toggleMasterDataModal = () => {\n if (showMasterDataModal) {\n setDisableActions?.(false);\n } else {\n setDisableActions?.(true);\n }\n setShowMasterDataModal(!showMasterDataModal);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.keyCode === 9 || event.key === \"Enter\") {\n const currentRef = combinedRef.current || inputRef.current;\n if (currentRef) {\n setInputValue(suggestion);\n currentRef.blur();\n }\n }\n };\n\n const handleSetMasterData = (masterDataValue: any, masterDataRow?: any) => {\n let _value = masterDataValue;\n\n if (masterDataFormula && parseMasterDataFormula) {\n _value = parseMasterDataFormula(masterDataFormula, masterDataRow);\n }\n\n setSuggestion(\"\");\n setInputValue(_value);\n toggleMasterDataModal();\n setMasterDataRowValue(masterDataRow);\n };\n\n const handleClear = () => {\n setInputValue(\"\");\n setMasterDataRowValue(null);\n };\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument && gtnName) {\n const keyValuePair = {\n key: gtnName,\n value: _value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium\";\n const placeholderColor = `placeholder:text-neutral-900 dark:placeholder:text-black-400`;\n\n if (errorMessage) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (showRiskSkin && riskDetails?.color) {\n return cn(\n baseClasses,\n placeholderColor,\n `border-${riskDetails.color}-300 bg-${riskDetails.color}-50`,\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (emphasisDeletedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]\"\n );\n }\n if (emphasisModifiedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]\"\n );\n }\n if (emphasisSuccessSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]\"\n );\n }\n\n return cn(\n baseClasses,\n placeholderColor,\n \"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n };\n\n const resolveMasterDataValue = () => {\n if (inputValue !== null) {\n return inputValue;\n }\n if (masterDataFormula && parseMasterDataFormula) {\n return parseMasterDataFormula(masterDataFormula, reference);\n }\n\n return value;\n };\n\n useEffect(() => {\n if (showMasterDataModal && !masterDataName) {\n showDeprecatedFieldWarning?.();\n setShowMasterDataModal(false);\n }\n }, [showMasterDataModal, masterDataName, showDeprecatedFieldWarning]);\n\n return (\n <div\n className={cn(\n `flex gap-0.5 w-full relative`,\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 p-1\"\n : \"\",\n { \"error-field\": !!errorMessage }\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n\n <div className={cn(`flex flex-col w-full`)}>\n <label\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip\n placement=\"top\"\n title={`${tooltip}${masterDataFormula ? ` | ${masterDataFormula}` : \"\"}`}\n >\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </div>\n\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-master-data-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(value?.toString() || \"\")}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n sx={{\n fontSize: 16,\n color:\n primaryColorShades?.[600] || \"var(--color-primary-600)\",\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n <label className=\"relative block mt-1\">\n <Tooltip\n title={isTextOverflowing ? resolveMasterDataValue() : \"\"}\n >\n <input\n id={id}\n ref={combinedRef}\n required={required}\n placeholder={placeholder}\n className={getClassName()}\n onChange={(e) => {\n onChange(e.target.value, masterDataRowValue);\n setInputValue(e.target?.value);\n }}\n onKeyDown={handleKeyDown}\n value={resolveMasterDataValue()}\n defaultValue={defaultValue}\n disabled={true}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n </Tooltip>\n\n <IconButton\n id={`btn-dynamic-data-input-rx-cross`}\n onClick={handleClear}\n className=\"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <CloseIcon className=\"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm\" />\n </IconButton>\n\n <IconButton\n id={`btn-dynamic-data-input-ai-outline-pic-center`}\n onClick={toggleMasterDataModal}\n className=\"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <TableChartRounded\n className=\"text-neutral-500 dark:text-neutral-400 w-sm h-sm\"\n />\n </IconButton>\n </label>\n\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n\n {showMasterDataModal && MasterDataModal && (\n <MasterDataModal\n isVisible={showMasterDataModal}\n onSelected={handleSetMasterData}\n onClose={toggleMasterDataModal}\n masterDataColumnName={masterDataColumnName}\n masterDataFilters={masterDataFilters}\n masterDataName={masterDataName}\n masterDataId={masterDataName}\n masterDataFormula={masterDataFormula}\n showFilters\n enableRootDrag\n />\n )}\n </div>\n\n {isHovered &&\n riskDetails &&\n isRiskAnalysisOpen &&\n RiskDetailsCard && (\n <div\n role=\"tooltip\"\n tabIndex={0}\n className=\"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl\"\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.preventDefault()}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n setIsHovered(false);\n }\n }}\n >\n <RiskDetailsCard riskDetails={riskDetails} />\n </div>\n )}\n </div>\n );\n }\n);\n\nMasterDataInputField.displayName = \"MasterDataInputField\";\n\n"],"names":["MasterDataInputField","forwardRef","id","label","labelExtra","placeholder","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","masterDataName","masterDataColumnName","masterDataFormula","masterDataFilters","tags","index","tooltip","originalCase","color","isGTN","labelClassName","gtnName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","disabled","reference","isLiveField","onBlur","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","primaryColorShades","setDisableActions","showDeprecatedFieldWarning","MasterDataModal","parseMasterDataFormula","inputEmphasis","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isHovered","setIsHovered","useState","inputValue","setInputValue","showMasterDataModal","setShowMasterDataModal","suggestion","setSuggestion","masterDataRowValue","setMasterDataRowValue","isTextOverflowing","setIsTextOverflowing","inputRef","useRef","combinedRef","useEffect","checkOverflow","input","toggleMasterDataModal","handleKeyDown","event","currentRef","handleSetMasterData","masterDataValue","masterDataRow","_value","handleClear","handleAddGTNToDocument","getClassName","baseClasses","placeholderColor","cn","resolveMasterDataValue","jsxs","jsx","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","IconButton","CloseIcon","TableChartRounded","Typography"],"mappings":";;;;;;;;;;;;;;;;A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Z;AAAA,cAAA;AAAA,YACF,GACF;AAAA,YAEC/F,KACC,gBAAA8E;AAAA,cAACkB;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,SAAQ;AAAA,gBAEP,UAAAhG;AAAA,cAAA;AAAA,YAAA;AAAA,YAIJgD,KAAuBf,KACtB,gBAAA6C;AAAA,cAAC7C;AAAA,cAAA;AAAA,gBACC,WAAWe;AAAA,gBACX,YAAYkB;AAAA,gBACZ,SAASJ;AAAA,gBACT,sBAAAzD;AAAA,gBACA,mBAAAE;AAAA,gBACA,gBAAAH;AAAA,gBACA,cAAcA;AAAA,gBACd,mBAAAE;AAAA,gBACA,aAAW;AAAA,gBACX,gBAAc;AAAA,cAAA;AAAA,YAAA;AAAA,UAChB,GAEJ;AAAA,UAECqC,KACChB,KACAC,KACAC,KACE,gBAAAiD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,WAAU;AAAA,cACV,SAAS,CAAC,MAAM,EAAE,gBAAA;AAAA,cAClB,aAAa,CAAC,MAAM,EAAE,eAAA;AAAA,cACtB,WAAW,CAAC,MAAM;AAChB,gBAAI,EAAE,QAAQ,YACZlC,EAAa,EAAK;AAAA,cAEtB;AAAA,cAEA,UAAA,gBAAAkC,EAACjD,KAAgB,aAAAF,EAAA,CAA0B;AAAA,YAAA;AAAA,UAAA;AAAA,QAC7C;AAAA,MAAA;AAAA,IAAA;AAAA,EAIV;AACF;AAEAnC,GAAqB,cAAc;"}
1
+ {"version":3,"file":"MasterDataInputField.es.js","sources":["../../../../src/components/forms/master-data-input/MasterDataInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport {\n BoltOutlined,\n CloseRounded,\n NoteAddOutlined,\n TableChartRounded,\n} from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport IconButton from \"../../button/IconButton\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { CloseIcon, CloseSmallIcon } from \"../../icon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/** Visual emphasis for the input surface (background + border) */\nexport type MasterDataInputFieldEmphasis =\n | \"default\"\n | \"modified\"\n | \"deleted\"\n | \"success\";\n\n/**\n * Props for the MasterDataModal component\n */\nexport interface MasterDataModalProps {\n isVisible: boolean;\n onSelected?: (masterDataValue: any, masterDataRow?: any) => void;\n onClose: () => void;\n masterDataColumnName?: string;\n masterDataFilters?: any;\n masterDataName?: string;\n masterDataId: string | null;\n masterDataFormula?: string;\n setFieldFilters?: any;\n showFilters?: boolean;\n enableRootDrag?: boolean;\n}\n\n/**\n * Props for the MasterDataInputField component\n */\nexport interface MasterDataInputFieldProps {\n /** Unique identifier for the input */\n id: string;\n /** Label text to display above the input */\n label: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Current value of the input */\n value: any;\n /** Callback function called when value changes */\n onChange: (value: any, masterDataRowValue?: any) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Callback to set error message */\n setErrorMessage: (message: string) => void;\n /** Callback to remove error message */\n removeErrorMessage: () => void;\n /** Default value for the input */\n defaultValue?: any;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Name of the master data source */\n masterDataName: string;\n /** Column name in the master data */\n masterDataColumnName: string;\n /** Formula for computing master data value */\n masterDataFormula?: string;\n /** Filters for master data */\n masterDataFilters?: any;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Index for array fields */\n index?: number;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Color for the input text */\n color?: string;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Reference data for formula computation */\n reference?: any;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function called when input loses focus */\n onBlur?: () => void;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Primary color shades for styling */\n primaryColorShades?: Record<number, string>;\n /** Callback to set disable actions state */\n setDisableActions?: (disabled: boolean) => void;\n /** Toast function for deprecated field warning */\n showDeprecatedFieldWarning?: () => void;\n /** Master data modal component */\n MasterDataModal?: React.ComponentType<MasterDataModalProps>;\n /** Function to parse master data formula */\n parseMasterDataFormula?: (formula: string, row: any) => string;\n /** Input surface style: `'modified'` — `--Warning-50` / `--Warning-200`; `'deleted'` — `--Error-50` / `--Error-200`, text `#475467`; `'success'` — `--Success-50` / `--Success-200`, text `#101828`. */\n inputEmphasis?: MasterDataInputFieldEmphasis;\n}\n\n/**\n * A highly customizable master data input component with label, validation, and styling support.\n * Features master data modal integration, GTN support, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <MasterDataInputField\n * id=\"master-field\"\n * label=\"Master Field\"\n * value={fieldValue}\n * onChange={(value, rowValue) => setFieldValue(value)}\n * setErrorMessage={(msg) => setError(msg)}\n * removeErrorMessage={() => setError('')}\n * masterDataName=\"customers\"\n * masterDataColumnName=\"name\"\n * required\n * />\n * ```\n */\nexport const MasterDataInputField = forwardRef<\n HTMLInputElement,\n MasterDataInputFieldProps\n>(\n (\n {\n id,\n label,\n labelExtra,\n placeholder,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n masterDataName,\n masterDataColumnName,\n masterDataFormula,\n masterDataFilters,\n tags,\n index,\n tooltip = \"\",\n originalCase = false,\n color = \"\",\n isGTN = false,\n labelClassName,\n gtnName = null,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n disabled = false,\n reference = {},\n isLiveField = false,\n onBlur,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n primaryColorShades,\n setDisableActions,\n showDeprecatedFieldWarning,\n MasterDataModal,\n parseMasterDataFormula,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" && !errorMessage && !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" && !errorMessage && !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" && !errorMessage && !showRiskSkin;\n const [isHovered, setIsHovered] = useState(false);\n const [inputValue, setInputValue] = useState<string | null>(null);\n const [showMasterDataModal, setShowMasterDataModal] = useState(false);\n const [suggestion, setSuggestion] = useState(\"\");\n const [masterDataRowValue, setMasterDataRowValue] = useState<any>(null);\n const [isTextOverflowing, setIsTextOverflowing] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Use forwarded ref or internal ref\n const combinedRef = (ref as React.RefObject<HTMLInputElement>) || inputRef;\n\n // Check if text is overflowing\n useEffect(() => {\n const checkOverflow = () => {\n const input = combinedRef.current || inputRef.current;\n if (input) {\n setIsTextOverflowing(input.scrollWidth > input.clientWidth);\n }\n };\n\n checkOverflow();\n // Recheck on window resize\n window.addEventListener('resize', checkOverflow);\n return () => window.removeEventListener('resize', checkOverflow);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue, value]);\n\n useEffect(() => {\n setInputValue(value);\n }, [index, value]);\n\n useEffect(() => {\n if (inputValue !== null && inputValue !== value) {\n onChange(inputValue, masterDataRowValue);\n }\n }, [inputValue, masterDataRowValue]);\n\n const toggleMasterDataModal = () => {\n if (showMasterDataModal) {\n setDisableActions?.(false);\n } else {\n setDisableActions?.(true);\n }\n setShowMasterDataModal(!showMasterDataModal);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.keyCode === 9 || event.key === \"Enter\") {\n const currentRef = combinedRef.current || inputRef.current;\n if (currentRef) {\n setInputValue(suggestion);\n currentRef.blur();\n }\n }\n };\n\n const handleSetMasterData = (masterDataValue: any, masterDataRow?: any) => {\n let _value = masterDataValue;\n\n console.log(\"handleSetMasterData called with:\", masterDataValue, masterDataRow, masterDataFormula, parseMasterDataFormula);\n\n if (masterDataFormula && parseMasterDataFormula) {\n console.log(\"handleSetMasterData called with:\", masterDataValue, masterDataRow, masterDataFormula, parseMasterDataFormula(masterDataFormula, masterDataRow));\n\n _value = parseMasterDataFormula(masterDataFormula, masterDataRow);\n }\n\n setSuggestion(\"\");\n setInputValue(_value);\n toggleMasterDataModal();\n setMasterDataRowValue(masterDataRow);\n };\n\n const handleClear = () => {\n setInputValue(\"\");\n setMasterDataRowValue(null);\n };\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument && gtnName) {\n const keyValuePair = {\n key: gtnName,\n value: _value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium\";\n const placeholderColor = `placeholder:text-neutral-900 dark:placeholder:text-black-400`;\n\n if (errorMessage) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (showRiskSkin && riskDetails?.color) {\n return cn(\n baseClasses,\n placeholderColor,\n `border-${riskDetails.color}-300 bg-${riskDetails.color}-50`,\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (emphasisDeletedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]\"\n );\n }\n if (emphasisModifiedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]\"\n );\n }\n if (emphasisSuccessSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]\"\n );\n }\n\n return cn(\n baseClasses,\n placeholderColor,\n \"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n };\n\n const resolveMasterDataValue = () => {\n if (inputValue !== null) {\n return inputValue;\n }\n if (masterDataFormula && parseMasterDataFormula) {\n console.log(\"Parsing master data formula with reference:\", masterDataFormula, reference, parseMasterDataFormula(masterDataFormula, reference));\n return parseMasterDataFormula(masterDataFormula, reference);\n }\n\n return value;\n };\n\n useEffect(() => {\n if (showMasterDataModal && !masterDataName) {\n showDeprecatedFieldWarning?.();\n setShowMasterDataModal(false);\n }\n }, [showMasterDataModal, masterDataName, showDeprecatedFieldWarning]);\n\n return (\n <div\n className={cn(\n `flex gap-0.5 w-full relative`,\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 p-1\"\n : \"\",\n { \"error-field\": !!errorMessage }\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n\n <div className={cn(`flex flex-col w-full`)}>\n <label\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip\n placement=\"top\"\n title={`${tooltip}${masterDataFormula ? ` | ${masterDataFormula}` : \"\"}`}\n >\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </div>\n\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-master-data-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(value?.toString() || \"\")}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n sx={{\n fontSize: 16,\n color:\n primaryColorShades?.[600] || \"var(--color-primary-600)\",\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n <label className=\"relative block mt-1\">\n <Tooltip\n title={isTextOverflowing ? resolveMasterDataValue() : \"\"}\n >\n <input\n id={id}\n ref={combinedRef}\n required={required}\n placeholder={placeholder}\n className={getClassName()}\n onChange={(e) => {\n onChange(e.target.value, masterDataRowValue);\n setInputValue(e.target?.value);\n }}\n onKeyDown={handleKeyDown}\n value={resolveMasterDataValue()}\n defaultValue={defaultValue}\n disabled={true}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n </Tooltip>\n\n <IconButton\n id={`btn-dynamic-data-input-rx-cross`}\n onClick={handleClear}\n className=\"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <CloseIcon className=\"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm\" />\n </IconButton>\n\n <IconButton\n id={`btn-dynamic-data-input-ai-outline-pic-center`}\n onClick={toggleMasterDataModal}\n className=\"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <TableChartRounded\n className=\"text-neutral-500 dark:text-neutral-400 w-sm h-sm\"\n />\n </IconButton>\n </label>\n\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n\n {showMasterDataModal && MasterDataModal && (\n <MasterDataModal\n isVisible={showMasterDataModal}\n onSelected={handleSetMasterData}\n onClose={toggleMasterDataModal}\n masterDataColumnName={masterDataColumnName}\n masterDataFilters={masterDataFilters}\n masterDataName={masterDataName}\n masterDataId={masterDataName}\n masterDataFormula={masterDataFormula}\n showFilters\n enableRootDrag\n />\n )}\n </div>\n\n {isHovered &&\n riskDetails &&\n isRiskAnalysisOpen &&\n RiskDetailsCard && (\n <div\n role=\"tooltip\"\n tabIndex={0}\n className=\"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl\"\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.preventDefault()}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n setIsHovered(false);\n }\n }}\n >\n <RiskDetailsCard riskDetails={riskDetails} />\n </div>\n )}\n </div>\n );\n }\n);\n\nMasterDataInputField.displayName = \"MasterDataInputField\";\n\n"],"names":["MasterDataInputField","forwardRef","id","label","labelExtra","placeholder","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","masterDataName","masterDataColumnName","masterDataFormula","masterDataFilters","tags","index","tooltip","originalCase","color","isGTN","labelClassName","gtnName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","disabled","reference","isLiveField","onBlur","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","primaryColorShades","setDisableActions","showDeprecatedFieldWarning","MasterDataModal","parseMasterDataFormula","inputEmphasis","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isHovered","setIsHovered","useState","inputValue","setInputValue","showMasterDataModal","setShowMasterDataModal","suggestion","setSuggestion","masterDataRowValue","setMasterDataRowValue","isTextOverflowing","setIsTextOverflowing","inputRef","useRef","combinedRef","useEffect","checkOverflow","input","toggleMasterDataModal","handleKeyDown","event","currentRef","handleSetMasterData","masterDataValue","masterDataRow","_value","handleClear","handleAddGTNToDocument","getClassName","baseClasses","placeholderColor","cn","resolveMasterDataValue","jsxs","jsx","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","N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AACF;AAEAnC,GAAqB,cAAc;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lax-wp/design-system",
3
3
  "private": false,
4
- "version": "0.13.39-beta.0",
4
+ "version": "0.13.39-beta.2",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",