@lax-wp/design-system 0.13.35 → 0.13.37-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data-display/infinite-table/head/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/head/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/head/index.d.ts +3 -1
- package/dist/components/data-display/infinite-table/head/index.es.js +50 -48
- package/dist/components/data-display/infinite-table/head/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.d.ts +1 -1
- package/dist/components/data-display/infinite-table/index.es.js +190 -188
- package/dist/components/data-display/infinite-table/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/types.d.ts +2 -0
- package/dist/components/forms/date-time-field/DateTimeField.cjs.js +1 -1
- package/dist/components/forms/date-time-field/DateTimeField.cjs.js.map +1 -1
- package/dist/components/forms/date-time-field/DateTimeField.es.js +97 -92
- package/dist/components/forms/date-time-field/DateTimeField.es.js.map +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js.map +1 -1
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.d.ts +6 -0
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js +172 -142
- package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js.map +1 -1
- package/dist/components/forms/link-input/LinkInputField.cjs.js +2 -0
- package/dist/components/forms/link-input/LinkInputField.cjs.js.map +1 -0
- package/dist/components/forms/link-input/LinkInputField.d.ts +26 -0
- package/dist/components/forms/link-input/LinkInputField.es.js +113 -0
- package/dist/components/forms/link-input/LinkInputField.es.js.map +1 -0
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js.map +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.d.ts +6 -0
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js +199 -169
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js.map +1 -1
- package/dist/components/forms/percentage-input/PercentageInputField.cjs.js +1 -5
- package/dist/components/forms/percentage-input/PercentageInputField.cjs.js.map +1 -1
- package/dist/components/forms/percentage-input/PercentageInputField.d.ts +6 -0
- package/dist/components/forms/percentage-input/PercentageInputField.es.js +141 -134
- package/dist/components/forms/percentage-input/PercentageInputField.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.es.js +407 -405
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import c from "../../../_virtual/index.es.js";
|
|
3
|
+
import { useTranslation as z } from "react-i18next";
|
|
4
|
+
import { BaseInputField as N } from "../base-input-field/BaseInputField.es.js";
|
|
5
|
+
import { KeychainIcon as E, MentionIcon as w } from "../../icon/icons.generated.es.js";
|
|
6
|
+
const y = "[&_input]:!border-0 [&_input]:!shadow-none [&_input]:!rounded-none [&_input]:!bg-transparent [&_input]:!h-8 [&_input]:!pl-1", H = ({
|
|
7
|
+
urlId: A,
|
|
8
|
+
urlValue: a,
|
|
9
|
+
onUrlChange: S,
|
|
10
|
+
urlPlaceholder: l,
|
|
11
|
+
urlError: i,
|
|
12
|
+
urlClassName: C,
|
|
13
|
+
onUrlBlur: D,
|
|
14
|
+
aliasId: _,
|
|
15
|
+
aliasValue: t,
|
|
16
|
+
onAliasChange: I,
|
|
17
|
+
aliasPlaceholder: m,
|
|
18
|
+
aliasError: d,
|
|
19
|
+
aliasClassName: W,
|
|
20
|
+
aliasFixedWidth: B,
|
|
21
|
+
disabled: h = !1,
|
|
22
|
+
label: p,
|
|
23
|
+
labelExtra: b,
|
|
24
|
+
withBorder: n = !1,
|
|
25
|
+
readOnly: R = !1,
|
|
26
|
+
inputEmphasis: j = "default"
|
|
27
|
+
}) => {
|
|
28
|
+
const { t: k } = z(), L = l === void 0 ? k("Enter URL") : l, M = m === void 0 ? k("Enter Alias") : m, o = !!i || !!d, s = o ? "default" : j, g = s === "modified", u = s === "deleted", v = s === "success", F = g || u || v, x = (p || b) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
29
|
+
p,
|
|
30
|
+
b
|
|
31
|
+
] });
|
|
32
|
+
if (R)
|
|
33
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
34
|
+
x,
|
|
35
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 min-h-9", children: [
|
|
36
|
+
/* @__PURE__ */ e(E, { className: "text-black-300 shrink-0 w-icon h-icon" }),
|
|
37
|
+
a ? /* @__PURE__ */ r(f, { children: [
|
|
38
|
+
/* @__PURE__ */ e(
|
|
39
|
+
"a",
|
|
40
|
+
{
|
|
41
|
+
href: a,
|
|
42
|
+
target: "_blank",
|
|
43
|
+
rel: "noopener noreferrer",
|
|
44
|
+
className: "text-primary-600 dark:text-primary-400 hover:underline text-sm truncate",
|
|
45
|
+
children: t || a
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
t && /* @__PURE__ */ r(f, { children: [
|
|
49
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-px bg-neutral-300 dark:bg-grey-800 shrink-0" }),
|
|
50
|
+
/* @__PURE__ */ e(w, { className: "text-black-300 shrink-0 w-icon h-icon" }),
|
|
51
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-500 dark:text-neutral-400 text-sm shrink-0", children: t })
|
|
52
|
+
] })
|
|
53
|
+
] }) : /* @__PURE__ */ e("span", { className: "text-neutral-400 dark:text-neutral-600 text-sm", children: "—" })
|
|
54
|
+
] })
|
|
55
|
+
] });
|
|
56
|
+
const U = /* @__PURE__ */ r(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: c("flex items-center h-9 overflow-hidden", {
|
|
60
|
+
"border rounded-lg bg-white dark:bg-black-700": n && !F,
|
|
61
|
+
"border-error-500": n && o,
|
|
62
|
+
"border-gray-300 dark:border-black-500": n && !o && !F,
|
|
63
|
+
"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]": n && g,
|
|
64
|
+
"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)]": n && u,
|
|
65
|
+
"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)]": n && v
|
|
66
|
+
}),
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ e(E, { className: "ml-2 text-black-300 shrink-0 w-icon h-icon" }),
|
|
69
|
+
/* @__PURE__ */ e("div", { className: c("min-w-0 flex-1", y), children: /* @__PURE__ */ e(
|
|
70
|
+
N,
|
|
71
|
+
{
|
|
72
|
+
id: A,
|
|
73
|
+
originalCase: !0,
|
|
74
|
+
type: "url",
|
|
75
|
+
value: a,
|
|
76
|
+
onChange: S,
|
|
77
|
+
placeholder: L,
|
|
78
|
+
disabled: h,
|
|
79
|
+
onBlur: D,
|
|
80
|
+
className: C,
|
|
81
|
+
inputEmphasis: s
|
|
82
|
+
}
|
|
83
|
+
) }),
|
|
84
|
+
/* @__PURE__ */ e("div", { className: "h-full w-px bg-neutral-300 dark:bg-grey-800 shrink-0" }),
|
|
85
|
+
/* @__PURE__ */ e(w, { className: "ml-2 text-black-300 shrink-0 w-icon h-icon", size: 18 }),
|
|
86
|
+
/* @__PURE__ */ e("div", { className: c("shrink-0", y, B), children: /* @__PURE__ */ e(
|
|
87
|
+
N,
|
|
88
|
+
{
|
|
89
|
+
id: _,
|
|
90
|
+
originalCase: !0,
|
|
91
|
+
type: "text",
|
|
92
|
+
value: t,
|
|
93
|
+
onChange: I,
|
|
94
|
+
placeholder: M,
|
|
95
|
+
disabled: h,
|
|
96
|
+
className: W,
|
|
97
|
+
inputEmphasis: s
|
|
98
|
+
}
|
|
99
|
+
) })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
104
|
+
x,
|
|
105
|
+
U,
|
|
106
|
+
i && /* @__PURE__ */ e("p", { className: "text-error-500 text-xs mt-1", children: i }),
|
|
107
|
+
d && /* @__PURE__ */ e("p", { className: "text-error-500 text-xs mt-1", children: d })
|
|
108
|
+
] });
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
H as LinkInputField
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=LinkInputField.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkInputField.es.js","sources":["../../../../src/components/forms/link-input/LinkInputField.tsx"],"sourcesContent":["import cn from 'classnames';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { BaseInputField, type BaseInputFieldEmphasis } from '../base-input-field/BaseInputField';\nimport { KeychainIcon, MentionIcon } from '../../icon';\n\ninterface ILinkInputFieldProps {\n // URL input\n urlId?: string;\n urlValue: string;\n onUrlChange: (value: string) => void;\n urlPlaceholder?: string | null;\n urlError?: string;\n urlClassName?: string;\n onUrlBlur?: () => void;\n\n // Alias input\n aliasId?: string;\n aliasValue: string;\n onAliasChange: (value: string) => void;\n aliasPlaceholder?: string | null;\n aliasError?: string;\n aliasClassName?: string;\n // Pass e.g. 'w-[140px]' for a fixed-width alias column; omit for natural width\n aliasFixedWidth?: string;\n\n disabled?: boolean;\n // Optional label rendered above the input row\n label?: ReactNode;\n // Optional extra content rendered next to the label (e.g. actions, badges)\n labelExtra?: ReactNode;\n // Wrap the edit row in a bordered container (for standalone field usage)\n withBorder?: boolean;\n // Render a read-only link view instead of inputs (when the field is disabled and anchors are preferred)\n readOnly?: boolean;\n // Input surface style, mirrors BaseInputField's inputEmphasis\n inputEmphasis?: BaseInputFieldEmphasis;\n}\n\nconst inputOverrides =\n '[&_input]:!border-0 [&_input]:!shadow-none [&_input]:!rounded-none [&_input]:!bg-transparent [&_input]:!h-8 [&_input]:!pl-1';\n\nexport const LinkInputField = ({\n urlId,\n urlValue,\n onUrlChange,\n urlPlaceholder,\n urlError,\n urlClassName,\n onUrlBlur,\n aliasId,\n aliasValue,\n onAliasChange,\n aliasPlaceholder,\n aliasError,\n aliasClassName,\n aliasFixedWidth,\n disabled = false,\n label,\n labelExtra,\n withBorder = false,\n readOnly = false,\n inputEmphasis = 'default',\n}: ILinkInputFieldProps) => {\n const { t } = useTranslation();\n\n const resolvedUrlPlaceholder = urlPlaceholder === undefined ? t('Enter URL') : urlPlaceholder;\n const resolvedAliasPlaceholder = aliasPlaceholder === undefined ? t('Enter Alias') : aliasPlaceholder;\n const hasAnyError = !!urlError || !!aliasError;\n const resolvedEmphasis = hasAnyError ? 'default' : inputEmphasis;\n const emphasisModifiedSkin = resolvedEmphasis === 'modified';\n const emphasisDeletedSkin = resolvedEmphasis === 'deleted';\n const emphasisSuccessSkin = resolvedEmphasis === 'success';\n const hasEmphasisSkin = emphasisModifiedSkin || emphasisDeletedSkin || emphasisSuccessSkin;\n\n const labelRow = (label || labelExtra) && (\n <div className='flex items-center gap-1'>\n {label}\n {labelExtra}\n </div>\n );\n\n if (readOnly) {\n return (\n <div className='w-full'>\n {labelRow}\n <div className='flex items-center gap-2 min-h-9'>\n <KeychainIcon className='text-black-300 shrink-0 w-icon h-icon' />\n {urlValue ? (\n <>\n <a\n href={urlValue}\n target='_blank'\n rel='noopener noreferrer'\n className='text-primary-600 dark:text-primary-400 hover:underline text-sm truncate'\n >\n {aliasValue || urlValue}\n </a>\n {aliasValue && (\n <>\n <div className='h-4 w-px bg-neutral-300 dark:bg-grey-800 shrink-0' />\n <MentionIcon className='text-black-300 shrink-0 w-icon h-icon' />\n <span className='text-neutral-500 dark:text-neutral-400 text-sm shrink-0'>{aliasValue}</span>\n </>\n )}\n </>\n ) : (\n <span className='text-neutral-400 dark:text-neutral-600 text-sm'>—</span>\n )}\n </div>\n </div>\n );\n }\n\n const editRow = (\n <div\n className={cn('flex items-center h-9 overflow-hidden', {\n 'border rounded-lg bg-white dark:bg-black-700': withBorder && !hasEmphasisSkin,\n 'border-error-500': withBorder && hasAnyError,\n 'border-gray-300 dark:border-black-500': withBorder && !hasAnyError && !hasEmphasisSkin,\n 'rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]':\n withBorder && emphasisModifiedSkin,\n 'rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)]':\n withBorder && emphasisDeletedSkin,\n 'rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)]':\n withBorder && emphasisSuccessSkin,\n })}\n >\n <KeychainIcon className='ml-2 text-black-300 shrink-0 w-icon h-icon' />\n <div className={cn('min-w-0 flex-1', inputOverrides)}>\n <BaseInputField\n id={urlId}\n originalCase\n type='url'\n value={urlValue}\n onChange={onUrlChange}\n placeholder={resolvedUrlPlaceholder}\n disabled={disabled}\n onBlur={onUrlBlur}\n className={urlClassName}\n inputEmphasis={resolvedEmphasis}\n />\n </div>\n <div className='h-full w-px bg-neutral-300 dark:bg-grey-800 shrink-0' />\n <MentionIcon className='ml-2 text-black-300 shrink-0 w-icon h-icon' size={18} />\n <div className={cn('shrink-0', inputOverrides, aliasFixedWidth)}>\n <BaseInputField\n id={aliasId}\n originalCase\n type='text'\n value={aliasValue}\n onChange={onAliasChange}\n placeholder={resolvedAliasPlaceholder}\n disabled={disabled}\n className={aliasClassName}\n inputEmphasis={resolvedEmphasis}\n />\n </div>\n </div>\n );\n\n return (\n <div className='w-full'>\n {labelRow}\n {editRow}\n {urlError && <p className='text-error-500 text-xs mt-1'>{urlError}</p>}\n {aliasError && <p className='text-error-500 text-xs mt-1'>{aliasError}</p>}\n </div>\n );\n};\n"],"names":["inputOverrides","LinkInputField","urlId","urlValue","onUrlChange","urlPlaceholder","urlError","urlClassName","onUrlBlur","aliasId","aliasValue","onAliasChange","aliasPlaceholder","aliasError","aliasClassName","aliasFixedWidth","disabled","label","labelExtra","withBorder","readOnly","inputEmphasis","t","useTranslation","resolvedUrlPlaceholder","resolvedAliasPlaceholder","hasAnyError","resolvedEmphasis","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","hasEmphasisSkin","labelRow","jsxs","jsx","KeychainIcon","Fragment","MentionIcon","editRow","cn","BaseInputField"],"mappings":";;;;;AAuCA,MAAMA,IACJ,+HAEWC,IAAiB,CAAC;AAAA,EAC7B,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,eAAAC,IAAgB;AAClB,MAA4B;AAC1B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GAERC,IAAyBnB,MAAmB,SAAYiB,EAAE,WAAW,IAAIjB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UAAA5B,GAAS;AAAA,IACjEO,KAAc,gBAAAqB,EAAC,KAAA,EAAE,WAAU,+BAA+B,UAAArB,EAAA,CAAW;AAAA,EAAA,GACxE;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
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:o,onChange:B,errorMessage:s,defaultValue:Y,required:A=!1,isRequiredConditional:Z=!1,masterDataName:g,masterDataColumnName:G,masterDataFormula:i,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:m,inputEmphasis:w="default"},xe)=>{const{t:fe}=Fe.useTranslation(),p=!!(L&&d?.color),be=w==="modified"&&!s&&!p,ge=w==="deleted"&&!s&&!p,me=w==="success"&&!s&&!p,[h,y]=n.useState(!1),[a,b]=n.useState(null),[u,H]=n.useState(!1),[pe,he]=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)},[a,o]),n.useEffect(()=>{b(o)},[re,o]),n.useEffect(()=>{a!==null&&a!==o&&B(a,C)},[a,C]);const E=()=>{M?.(!u),H(!u)},je=t=>{if(t.keyCode===9||t.key==="Enter"){const r=F.current||I.current;r&&(b(pe),r.blur())}},Se=(t,r)=>{let _=t;i&&m&&(_=m(i,r)),he(""),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"):p&&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)]"):me?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=()=>a!==null?a:i&&m?m(i,ie):o;return n.useEffect(()=>{u&&!g&&(O?.(),H(!1))},[u,g,O]),e.jsxs("div",{className:l("flex gap-0.5 w-full relative",h&&k?"border rounded-lg border-primary-100 p-1":"",{"error-field":!!s}),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:[k&&!h?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}${i?` | ${i}`:""}`,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&&h&&S?e.jsx("button",{id:"btn-master-data-input-add-to-document",className:"cursor-pointer",onClick:()=>ye(o?.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,showFilters:!0})]}),h&&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;
|
|
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/**\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 showFilters?: 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 /** 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}\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 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 },\n ref\n ) => {\n const { t } = useTranslation();\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 borderColor = errorMessage\n ? \"border-red-300\"\n : isRiskAnalysisOpen && riskDetails?.color\n ? `border-${riskDetails?.color}-300`\n : \"border-gray-300 dark:border-black-600\";\n const placeholderColor = `placeholder:text-neutral-900 dark:placeholder:text-black-400`;\n const backgroundColor = `${\n isRiskAnalysisOpen && riskDetails?.color\n ? `bg-${riskDetails?.color}-50`\n : \"dark:bg-black-600 \"\n } ${color ? color : \"text-neutral-900 dark:text-black-200\"}`;\n\n return `${baseClasses} ${borderColor} ${backgroundColor} ${placeholderColor}`;\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 </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 showFilters\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","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","ref","t","useTranslation","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","borderColor","placeholderColor","backgroundColor","resolveMasterDataValue","jsxs","cn","jsx","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","e","IconButton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Aa,EAAK,CAEtB,EAEA,SAAAoC,EAAAA,IAAC9C,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEAlC,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 showFilters?: 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 showFilters\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":"0uBAgNaA,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,EACA,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,GAAY,CAAA,EACZ,YAAAC,GAAc,GACd,OAAAC,GACA,mBAAAC,EACA,YAAAC,EACA,mBAAAC,EAAqB,GACrB,gBAAAC,EACA,mBAAAC,GACA,kBAAAC,EACA,2BAAAC,EACA,gBAAAC,EACA,uBAAAC,EACA,cAAAC,EAAgB,SAAA,EAElBC,KACG,CACH,KAAM,CAAE,EAAAC,EAAA,EAAMC,kBAAA,EACRC,EAAe,GAAQX,GAAsBD,GAAa,OAC1Da,GACJL,IAAkB,YAAc,CAACnC,GAAgB,CAACuC,EAC9CE,GACJN,IAAkB,WAAa,CAACnC,GAAgB,CAACuC,EAC7CG,GACJP,IAAkB,WAAa,CAACnC,GAAgB,CAACuC,EAC7C,CAACI,EAAWC,CAAY,EAAIC,EAAAA,SAAS,EAAK,EAC1C,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAwB,IAAI,EAC1D,CAACG,EAAqBC,CAAsB,EAAIJ,EAAA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AAA,WAAA,CACC,UAAU,sBACV,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAjG,CAAA,CAAA,EAIJgD,GAAuBf,GACtB6C,EAAAA,IAAC7C,EAAA,CACC,UAAWe,EACX,WAAYkB,GACZ,QAASJ,EACT,qBAAAzD,EACA,kBAAAE,GACA,eAAAH,EACA,aAAcA,EACd,YAAW,EAAA,CAAA,CACb,EAEJ,EAECuC,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"}
|
|
@@ -38,6 +38,8 @@ export interface RiskDetailsCardProps<T = any> {
|
|
|
38
38
|
maxWidth?: string;
|
|
39
39
|
showAllRisksSuggestions?: boolean;
|
|
40
40
|
}
|
|
41
|
+
/** Visual emphasis for the input surface (background + border) */
|
|
42
|
+
export type MasterDataInputFieldEmphasis = "default" | "modified" | "deleted" | "success";
|
|
41
43
|
/**
|
|
42
44
|
* Props for the MasterDataModal component
|
|
43
45
|
*/
|
|
@@ -59,6 +61,8 @@ export interface MasterDataInputFieldProps {
|
|
|
59
61
|
id: string;
|
|
60
62
|
/** Label text to display above the input */
|
|
61
63
|
label: string;
|
|
64
|
+
/** Optional extra content in the label row (e.g. actions, badges) */
|
|
65
|
+
labelExtra?: React.ReactNode;
|
|
62
66
|
/** Placeholder text for the input */
|
|
63
67
|
placeholder?: string;
|
|
64
68
|
/** Current value of the input */
|
|
@@ -142,6 +146,8 @@ export interface MasterDataInputFieldProps {
|
|
|
142
146
|
MasterDataModal?: React.ComponentType<MasterDataModalProps>;
|
|
143
147
|
/** Function to parse master data formula */
|
|
144
148
|
parseMasterDataFormula?: (formula: string, row: any) => string;
|
|
149
|
+
/** Input surface style: `'modified'` — `--Warning-50` / `--Warning-200`; `'deleted'` — `--Error-50` / `--Error-200`, text `#475467`; `'success'` — `--Success-50` / `--Success-200`, text `#101828`. */
|
|
150
|
+
inputEmphasis?: MasterDataInputFieldEmphasis;
|
|
145
151
|
}
|
|
146
152
|
/**
|
|
147
153
|
* A highly customizable master data input component with label, validation, and styling support.
|