@lax-wp/design-system 0.14.16 → 0.14.17
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/forms/base-input-field/BaseInputField.cjs.js +2 -2
- package/dist/components/forms/base-input-field/BaseInputField.cjs.js.map +1 -1
- package/dist/components/forms/base-input-field/BaseInputField.es.js +14 -14
- package/dist/components/forms/base-input-field/BaseInputField.es.js.map +1 -1
- package/dist/components/forms/toggle/Toggle.cjs.js +1 -1
- package/dist/components/forms/toggle/Toggle.cjs.js.map +1 -1
- package/dist/components/forms/toggle/Toggle.es.js +34 -34
- package/dist/components/forms/toggle/Toggle.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),p=require("react"),a=require("../../../_virtual/index.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),p=require("react"),a=require("../../../_virtual/index.cjs.js"),h=require("framer-motion"),ne=require("react-i18next"),_=require("antd"),P=require("../../data-display/typography/Typography.cjs.js"),le=require("../../data-display/label/Label.cjs.js"),D=require("@mui/icons-material"),de=require("../../icons/AIExtractedIndicator.cjs.js"),ce=require("../../icons/AIStarIcon.cjs.js"),ue=require("../shared/InputLabel.cjs.js"),be=require("../../tooltip/Tooltip.cjs.js"),l=require("../../../utils/confidenceScoreUtils.cjs.js"),xe=require("../../icons/HelpIcon.cjs.js"),pe=({className:o,size:r=16})=>e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),he=({className:o,size:r=16})=>e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}),me=({className:o,size:r=16})=>e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),fe=({className:o,size:r=16})=>e.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:o,children:[e.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),e.jsx("path",{d:"M3 3v5h5"})]}),F=p.forwardRef(({id:o,label:r,labelExtra:S,onChange:m,errorMessage:i,successMessage:s,required:f,isRequiredConditional:N=!1,bg:C,tags:$,color:E,className:H,isPasswordField:z,setIsPasswordVisible:O,inputRef:R,tooltip:I,suffixIcon:B,revertBackValue:c,originalCase:M=!1,textSize:A,isAiExtracted:T=!1,isGTN:k=!1,confidenceScore:g,confidenceType:d="high",confidenceTooltip:K,gtnName:U=null,inputClassName:q="",inputStyle:J={},labelClassName:Q,onBlur:X,isLiveField:Y=!1,isClearable:Z=!1,riskDetails:n,isRiskAnalysisOpen:L=!1,RiskDetailsCard:W,onAddGTNToDocument:v,sourceMeta:V=[],inputEmphasis:y="default",onConfidenceScoreClick:G,...u},ee)=>{const{t:re}=ne.useTranslation(),b=!!(L&&n?.color),oe=y==="modified"&&!i&&!s&&!b,te=y==="deleted"&&!i&&!s&&!b,ae=y==="success"&&!i&&!s&&!b,[j,ie]=p.useState(!1),[x,w]=p.useState(!1),se=t=>{v&&v({key:U,value:t})};return e.jsxs("div",{className:a("flex gap-0.5 relative",x&&k?"border rounded-lg border-primary-100 bg-primary-50 p-1 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-neutral-50 dark:focus:border-neutral-50":""),onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:[k&&!x?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:a("flex flex-col w-full",H),children:[e.jsx("style",{children:`
|
|
2
2
|
.dark input:-webkit-autofill,
|
|
3
3
|
.dark input:-webkit-autofill:hover,
|
|
4
4
|
.dark input:-webkit-autofill:focus {
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
-webkit-box-shadow: 0 0 0px 1000px white inset !important;
|
|
15
15
|
transition: background-color 5000s ease-in-out 0s;
|
|
16
16
|
}
|
|
17
|
-
`}),(r||S)&&e.jsx("label",{id:o,htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${M?"":"capitalize"} ${Q||"!uppercse"}`,children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between w-full",children:[e.jsxs("div",{className:"inline-flex flex-wrap items-center gap-1",children:[(r||f||N)&&e.jsx(ue.InputLabel,{label:r??"",required:f||!1,isRequiredConditional:N||!1}),c?.length>0&&c!==u.value&&e.jsx(_.Tooltip,{placement:"top",title:c,children:e.jsx("button",{className:"cursor-pointer",onClick:()=>
|
|
17
|
+
`}),(r||S)&&e.jsx("label",{id:o,htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${M?"":"capitalize"} ${Q||"!uppercse"}`,children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between w-full",children:[e.jsxs("div",{className:"inline-flex flex-wrap items-center gap-1",children:[(r||f||N)&&e.jsx(ue.InputLabel,{label:r??"",required:f||!1,isRequiredConditional:N||!1}),c?.length>0&&c!==u.value&&e.jsx(_.Tooltip,{placement:"top",title:c,children:e.jsx("button",{className:"cursor-pointer",onClick:()=>m(c),type:"button",children:e.jsx(fe,{className:"cursor-pointer pb-0.5 text-primary-600 w-4 h-4"})})}),Y&&e.jsx(D.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),T&&!l.shouldShowConfidenceScore(g)&&e.jsx(de.AIExtractedIndicator,{}),e.jsx(le.Label,{labels:$}),I&&e.jsx(_.Tooltip,{placement:"top",title:I,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(xe.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),S]}),e.jsxs("div",{className:"flex items-center gap-1",children:[l.shouldShowConfidenceScore(g)&&d?e.jsx(be,{placement:"top-end",title:K||"",className:"cursor-pointer",children:e.jsxs("div",{className:a("inline-flex min-w-12 items-center gap-1 rounded-md px-1 py-0.5",l.getConfidenceScoreBadgeClass(d)),onClick:()=>G?.(V),children:[e.jsx(ce.AIStarIcon,{size:12,fill:l.getConfidenceScoreBadgeColor(d),fillSecondary:l.getConfidenceScoreBadgeFill(d)}),e.jsxs("span",{className:a("text-xs font-medium leading-4",l.getConfidenceScoreBadgeTextColor(d)),children:[g,"%"]})]})}):null,k&&x&&v?e.jsx("button",{id:`btn-base-input-field-add-to-document-${o}`,className:"cursor-pointer",onClick:()=>se(u?.value),type:"button",children:e.jsx(_.Tooltip,{placement:"top",title:re("Add to document"),children:e.jsx(D.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),e.jsx("label",{className:"relative block",children:e.jsxs("div",{className:"relative",children:[p.createElement("input",{...u,ref:R||ee,id:o||r,key:o,required:f,style:{"--input-bg-color":"var(--tw-bg-opacity, 1) rgb(var(--bg-color))",...J},className:a("border border-solid h-8 text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium placeholder:font-light placeholder:text-neutral-300 disabled:opacity-70 focus:outline-none focus:ring-0 dark:disabled:placeholder:!text-black-400",A||"text-sm",E||"text-neutral-900 dark:text-black-100",C&&C,q||"",i?a("rounded-md border-red-300 dark:border-red-500 bg-white hover:border-red-400 dark:bg-black-600 dark:hover:border-red-400 focus:border-red-600 focus:shadow-[0_0_0_1.5px_rgba(239,68,68,0.22)] dark:focus:border-red-500 dark:focus:shadow-[0_0_0_1.5px_rgba(248,113,113,0.25)]"):s?a("rounded-md border-green-300 bg-white hover:border-green-400 dark:border-green-600 dark:bg-black-600 dark:hover:border-green-500 focus:border-green-600 focus:shadow-[0_0_0_1.5px_rgba(34,197,94,0.22)] dark:focus:border-green-500"):b&&n?.color?a("rounded-md hover:border-primary-500 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",`bg-${n.color}-50 border-${n.color}-300`):te?"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254_202_202_/_0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)] dark:disabled:!bg-[var(--Error-50,#FEF2F2)]":oe?"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254_223_137_/_0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)] dark:disabled:!bg-[var(--Warning-50,#FFFAEB)]":ae?"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187_247_208_/_0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)] dark:disabled:!bg-[var(--Success-50,#F0FDF4)] disabled:!text-[#101828] dark:disabled:!text-[#101828]":"rounded-md border-neutral-200 bg-white hover:border-primary-500 dark:border-black-600 dark:bg-black-600 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)] disabled:!bg-neutral-50 dark:disabled:!bg-black-800"),onChange:t=>{m(t.target.value)},onClick:t=>t.stopPropagation(),autoComplete:"off",onBlur:X}),z?e.jsx("button",{className:"absolute inset-y-0 flex items-center cursor-pointer right-2",onClick:()=>{ie(!j),O?.(!j)},type:"button",children:j?e.jsx(pe,{className:"text-gray-400 w-4 h-4"}):e.jsx(he,{className:"text-gray-400 w-4 h-4"})}):Z&&u.value?e.jsx("button",{id:`btn-input-field-clear-${o}`,className:"absolute inset-y-0 flex items-center cursor-pointer right-2 focus:outline-none",onClick:t=>{t.stopPropagation(),m("")},type:"button",children:e.jsx(me,{className:"text-neutral-200 dark:text-black-500 w-4 h-4"})}):B?e.jsx("div",{className:"absolute inset-y-0 flex items-center right-2",children:B}):null]})}),e.jsx(h.AnimatePresence,{children:i&&e.jsx(h.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:e.jsx(P.Typography,{className:"mt-1 text-error-500",appearance:"custom",size:"extra-small",variant:"medium",children:i})})}),e.jsx(h.AnimatePresence,{children:s&&e.jsx(h.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:e.jsx(P.Typography,{className:"mt-1 text-success-500 dark:text-success-300",appearance:"custom",size:"extra-small",variant:"medium",children:s})})})]}),x&&n&&L&&W&&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"&&w(!1)},children:e.jsx(W,{riskDetails:n})})]})});F.displayName="BaseInputField";exports.BaseInputField=F;exports.default=F;
|
|
18
18
|
//# sourceMappingURL=BaseInputField.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputField.cjs.js","sources":["../../../../src/components/forms/base-input-field/BaseInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useState } from \"react\";\nimport { useTranslation } from 'react-i18next';\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { NoteAddOutlined, BoltOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\n/**\n * Bounding boxes interface\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\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\n */\nexport interface RiskDetailsCardProps {\n riskDetails: RiskDetails;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/**\n * Eye icon for password visibility toggle\n */\nconst EyeIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n);\n\n/**\n * Eye off icon for password visibility toggle\n */\nconst EyeOffIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24\" />\n <line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\" />\n </svg>\n);\n\n/**\n * Close icon for clearable input\n */\nconst CloseIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n);\n\n/**\n * Revert icon for revert back value\n */\nconst RevertIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n);\n\n/** Visual emphasis for the input surface (background + border) */\nexport type BaseInputFieldEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Props for the BaseInputField component\n */\nexport type TBaseInputFieldProps = any & {\n /** Current value of the input */\n value: string;\n /** Callback function called when the input value changes */\n onChange(data: any): void;\n /** Callback function for key down events */\n onKeyDown?: void;\n /** Error message to display */\n errorMessage: string;\n /** Default value for the input */\n defaultValue?: string;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional */\n isRequiredConditional?: boolean;\n /** Background color class */\n bg?: string;\n /** Tags to display with the label */\n tags?: (string | LabelType)[];\n /** Text color class */\n color?: string;\n /** Unique identifier for the input */\n id: string;\n /** Label text for the input */\n label?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Value to revert back to */\n revertBackValue?: any;\n /** Placeholder text */\n placeholder?: string;\n /** Whether this is a password field with visibility toggle */\n isPasswordField?: boolean;\n /** Callback to set password visibility */\n setIsPasswordVisible?: any;\n /** Tooltip text */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Icon or element to display at the end of the input */\n suffixIcon?: React.ReactNode;\n /** Text size class */\n textSize?: string;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Whether this is a GTN field */\n isGTN?: boolean;\n /** Confidence score shown as a compact badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence score badge */\n confidenceTooltip?: React.ReactNode;\n /** GTN name for document integration */\n gtnName?: any;\n /** Success message to display */\n successMessage?: string;\n /** Additional CSS classes for the input element */\n inputClassName?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function for blur events */\n onBlur?: () => void;\n /** Whether the input is clearable */\n isClearable?: boolean;\n /** Additional CSS classes for the wrapper */\n className?: string;\n /** Ref for the input element */\n inputRef?: React.RefObject<HTMLInputElement>;\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>;\n /** Bounding box for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Callback function for confidence score click */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\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?: BaseInputFieldEmphasis;\n};\n\n/**\n * A feature-rich input field component with label, validation, GTN integration,\n * risk analysis support, and comprehensive styling options.\n *\n * @example\n * ```tsx\n * <BaseInputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const BaseInputField = forwardRef<HTMLInputElement, TBaseInputFieldProps>(\n (\n {\n id,\n label,\n labelExtra,\n onChange,\n errorMessage,\n successMessage,\n required,\n isRequiredConditional = false,\n bg,\n tags,\n color,\n className,\n isPasswordField,\n setIsPasswordVisible,\n inputRef,\n tooltip,\n suffixIcon,\n revertBackValue,\n originalCase = false,\n textSize,\n isAiExtracted = false,\n isGTN = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n gtnName = null,\n inputClassName = \"\",\n inputStyle = {},\n labelClassName,\n onBlur,\n isLiveField = false,\n isClearable = false,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n onAddGTNToDocument,\n sourceMeta = [],\n inputEmphasis = \"default\",\n onConfidenceScoreClick,\n ...props\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const [showPassword, setShowPassword] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const handleAddGTNToDocument = (value: string) => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: gtnName,\n value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n return (\n <div\n className={cn(\n \"flex gap-0.5 relative\",\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 bg-primary-50 p-1 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-neutral-50 dark:focus:border-neutral-50\"\n : \"\"\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 <div className={cn(\"flex flex-col w-full\", className)}>\n <style>\n {`\n .dark input:-webkit-autofill,\n .dark input:-webkit-autofill:hover,\n .dark input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n input:-webkit-autofill,\n input:-webkit-autofill:hover,\n input:-webkit-autofill:focus {\n -webkit-text-fill-color: #111827 !important;\n -webkit-box-shadow: 0 0 0px 1000px white inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n `}\n </style>\n {(label || labelExtra) && (\n <label\n id={id}\n htmlFor=\"text\"\n className={`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"!uppercse\"}`}\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n {(label || required || isRequiredConditional) && (\n <InputLabel label={label ?? \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n )}\n {revertBackValue?.length > 0 &&\n revertBackValue !== props.value && (\n <AntTooltip placement=\"top\" title={revertBackValue}>\n <button\n className=\"cursor-pointer\"\n onClick={() => onChange(revertBackValue)}\n type=\"button\"\n >\n <RevertIcon\n className=\"cursor-pointer pb-0.5 text-primary-600 w-4 h-4\"\n />\n </button>\n </AntTooltip>\n )}\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 <AntTooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </AntTooltip>\n )}\n {labelExtra}\n </div>\n <div className=\"flex items-center gap-1\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip || \"\"}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-12 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\n className={cn(\n \"text-xs font-medium leading-4\",\n getConfidenceScoreBadgeTextColor(confidenceType)\n )}\n >\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id={`btn-base-input-field-add-to-document-${id}`}\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(props?.value)}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n className=\"text-primary-600\"\n sx={{\n fontSize: 16,\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n )}\n <label className=\"relative block\">\n <div className=\"relative\">\n <input\n {...props}\n ref={inputRef || ref}\n id={id || label}\n key={id}\n required={required}\n style={\n {\n \"--input-bg-color\":\n \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n ...inputStyle,\n } as React.CSSProperties\n }\n className={cn(\n \"border border-solid h-8 text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium disabled:opacity-70 focus:outline-none focus:ring-0 dark:disabled:placeholder:!text-black-400\",\n textSize ? textSize : \"text-sm\",\n color ? color : \"text-neutral-900 dark:text-black-100\",\n bg && bg,\n inputClassName ? inputClassName : \"\",\n errorMessage\n ? cn(\n \"rounded-md border-red-300 dark:border-red-500 bg-white hover:border-red-400 dark:bg-black-600 dark:hover:border-red-400 focus:border-red-600 focus:shadow-[0_0_0_1.5px_rgba(239,68,68,0.22)] dark:focus:border-red-500 dark:focus:shadow-[0_0_0_1.5px_rgba(248,113,113,0.25)]\",\n )\n : successMessage\n ? cn(\n \"rounded-md border-green-300 bg-white hover:border-green-400 dark:border-green-600 dark:bg-black-600 dark:hover:border-green-500 focus:border-green-600 focus:shadow-[0_0_0_1.5px_rgba(34,197,94,0.22)] dark:focus:border-green-500\",\n )\n : showRiskSkin && riskDetails?.color\n ? cn(\n \"rounded-md hover:border-primary-500 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]\",\n `bg-${riskDetails.color}-50 border-${riskDetails.color}-300`,\n )\n : emphasisDeletedSkin\n ? \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254_202_202_/_0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)] dark:disabled:!bg-[var(--Error-50,#FEF2F2)]\"\n : emphasisModifiedSkin\n ? \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254_223_137_/_0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)] dark:disabled:!bg-[var(--Warning-50,#FFFAEB)]\"\n : emphasisSuccessSkin\n ? \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187_247_208_/_0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)] dark:disabled:!bg-[var(--Success-50,#F0FDF4)] disabled:!text-[#101828] dark:disabled:!text-[#101828]\"\n : \"rounded-md border-neutral-200 bg-white hover:border-primary-500 dark:border-black-600 dark:bg-black-600 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)] disabled:!bg-neutral-50 dark:disabled:!bg-black-800\"\n )}\n onChange={(e) => {\n onChange(e.target.value);\n }}\n onClick={(e) => e.stopPropagation()}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n {isPasswordField ? (\n <button\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2\"\n onClick={() => {\n setShowPassword(!showPassword);\n setIsPasswordVisible?.(!showPassword);\n }}\n type=\"button\"\n >\n {showPassword ? (\n <EyeIcon className=\"text-gray-400 w-4 h-4\" />\n ) : (\n <EyeOffIcon className=\"text-gray-400 w-4 h-4\" />\n )}\n </button>\n ) : isClearable && props.value ? (\n <button\n id={`btn-input-field-clear-${id}`}\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2 focus:outline-none\"\n onClick={(e) => {\n e.stopPropagation();\n onChange(\"\");\n }}\n type=\"button\"\n >\n <CloseIcon\n className=\"text-neutral-200 dark:text-black-500 w-4 h-4\"\n />\n </button>\n ) : suffixIcon ? (\n <div className=\"absolute inset-y-0 flex items-center right-2\">\n {suffixIcon}\n </div>\n ) : null}\n </div>\n </label>\n <AnimatePresence>\n {errorMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n <AnimatePresence>\n {successMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-success-500 dark:text-success-300\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {successMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\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\nBaseInputField.displayName = \"BaseInputField\";\n\nexport default BaseInputField;\n\n"],"names":["EyeIcon","className","size","jsxs","jsx","EyeOffIcon","CloseIcon","RevertIcon","BaseInputField","forwardRef","id","label","labelExtra","onChange","errorMessage","successMessage","required","isRequiredConditional","bg","tags","color","isPasswordField","setIsPasswordVisible","inputRef","tooltip","suffixIcon","revertBackValue","originalCase","textSize","isAiExtracted","isGTN","confidenceScore","confidenceType","confidenceTooltip","gtnName","inputClassName","inputStyle","labelClassName","onBlur","isLiveField","isClearable","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","onAddGTNToDocument","sourceMeta","inputEmphasis","onConfidenceScoreClick","props","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","showPassword","setShowPassword","useState","isHovered","setIsHovered","handleAddGTNToDocument","value","cn","InputLabel","AntTooltip","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","HelpIcon","Tooltip","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","NoteAddOutlined","createElement","e","AnimatePresence","motion","Typography"],"mappings":"osBAyEMA,GAAU,CAAC,CAAE,UAAAC,EAAW,KAAAC,EAAO,MACnCC,EAAAA,KAAC,MAAA,CACC,MAAOD,EACP,OAAQA,EACR,QAAQ,YACR,KAAK,OACL,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,QACf,UAAAD,EAEA,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,EAAE,8CAAA,CAA+C,QACtD,SAAA,CAAO,GAAG,KAAK,GAAG,KAAK,EAAE,GAAA,CAAI,CAAA,CAAA,CAChC,EAMIC,GAAa,CAAC,CAAE,UAAAJ,EAAW,KAAAC,EAAO,MACtCC,EAAAA,KAAC,MAAA,CACC,MAAOD,EACP,OAAQA,EACR,QAAQ,YACR,KAAK,OACL,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,QACf,UAAAD,EAEA,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,EAAE,sLAAA,CAAuL,EAC/LA,EAAAA,IAAC,QAAK,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAA,CAAK,CAAA,CAAA,CACtC,EAMIE,GAAY,CAAC,CAAE,UAAAL,EAAW,KAAAC,EAAO,MACrCC,EAAAA,KAAC,MAAA,CACC,MAAOD,EACP,OAAQA,EACR,QAAQ,YACR,KAAK,OACL,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,QACf,UAAAD,EAEA,SAAA,CAAAG,EAAAA,IAAC,O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ACtB,UAAYA,GAAM,CACZA,EAAE,MAAQ,UACZnB,EAAa,EAAK,CAEtB,EAEA,SAAAxD,EAAAA,IAACuC,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEAjC,EAAe,YAAc"}
|
|
1
|
+
{"version":3,"file":"BaseInputField.cjs.js","sources":["../../../../src/components/forms/base-input-field/BaseInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useState } from \"react\";\nimport { useTranslation } from 'react-i18next';\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { NoteAddOutlined, BoltOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\n/**\n * Bounding boxes interface\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\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\n */\nexport interface RiskDetailsCardProps {\n riskDetails: RiskDetails;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/**\n * Eye icon for password visibility toggle\n */\nconst EyeIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n);\n\n/**\n * Eye off icon for password visibility toggle\n */\nconst EyeOffIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24\" />\n <line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\" />\n </svg>\n);\n\n/**\n * Close icon for clearable input\n */\nconst CloseIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n);\n\n/**\n * Revert icon for revert back value\n */\nconst RevertIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n);\n\n/** Visual emphasis for the input surface (background + border) */\nexport type BaseInputFieldEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Props for the BaseInputField component\n */\nexport type TBaseInputFieldProps = any & {\n /** Current value of the input */\n value: string;\n /** Callback function called when the input value changes */\n onChange(data: any): void;\n /** Callback function for key down events */\n onKeyDown?: void;\n /** Error message to display */\n errorMessage: string;\n /** Default value for the input */\n defaultValue?: string;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional */\n isRequiredConditional?: boolean;\n /** Background color class */\n bg?: string;\n /** Tags to display with the label */\n tags?: (string | LabelType)[];\n /** Text color class */\n color?: string;\n /** Unique identifier for the input */\n id: string;\n /** Label text for the input */\n label?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Value to revert back to */\n revertBackValue?: any;\n /** Placeholder text */\n placeholder?: string;\n /** Whether this is a password field with visibility toggle */\n isPasswordField?: boolean;\n /** Callback to set password visibility */\n setIsPasswordVisible?: any;\n /** Tooltip text */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Icon or element to display at the end of the input */\n suffixIcon?: React.ReactNode;\n /** Text size class */\n textSize?: string;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Whether this is a GTN field */\n isGTN?: boolean;\n /** Confidence score shown as a compact badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence score badge */\n confidenceTooltip?: React.ReactNode;\n /** GTN name for document integration */\n gtnName?: any;\n /** Success message to display */\n successMessage?: string;\n /** Additional CSS classes for the input element */\n inputClassName?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function for blur events */\n onBlur?: () => void;\n /** Whether the input is clearable */\n isClearable?: boolean;\n /** Additional CSS classes for the wrapper */\n className?: string;\n /** Ref for the input element */\n inputRef?: React.RefObject<HTMLInputElement>;\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>;\n /** Bounding box for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Callback function for confidence score click */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\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?: BaseInputFieldEmphasis;\n};\n\n/**\n * A feature-rich input field component with label, validation, GTN integration,\n * risk analysis support, and comprehensive styling options.\n *\n * @example\n * ```tsx\n * <BaseInputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const BaseInputField = forwardRef<HTMLInputElement, TBaseInputFieldProps>(\n (\n {\n id,\n label,\n labelExtra,\n onChange,\n errorMessage,\n successMessage,\n required,\n isRequiredConditional = false,\n bg,\n tags,\n color,\n className,\n isPasswordField,\n setIsPasswordVisible,\n inputRef,\n tooltip,\n suffixIcon,\n revertBackValue,\n originalCase = false,\n textSize,\n isAiExtracted = false,\n isGTN = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n gtnName = null,\n inputClassName = \"\",\n inputStyle = {},\n labelClassName,\n onBlur,\n isLiveField = false,\n isClearable = false,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n onAddGTNToDocument,\n sourceMeta = [],\n inputEmphasis = \"default\",\n onConfidenceScoreClick,\n ...props\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const [showPassword, setShowPassword] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const handleAddGTNToDocument = (value: string) => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: gtnName,\n value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n return (\n <div\n className={cn(\n \"flex gap-0.5 relative\",\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 bg-primary-50 p-1 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-neutral-50 dark:focus:border-neutral-50\"\n : \"\"\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 <div className={cn(\"flex flex-col w-full\", className)}>\n <style>\n {`\n .dark input:-webkit-autofill,\n .dark input:-webkit-autofill:hover,\n .dark input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n input:-webkit-autofill,\n input:-webkit-autofill:hover,\n input:-webkit-autofill:focus {\n -webkit-text-fill-color: #111827 !important;\n -webkit-box-shadow: 0 0 0px 1000px white inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n `}\n </style>\n {(label || labelExtra) && (\n <label\n id={id}\n htmlFor=\"text\"\n className={`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"!uppercse\"}`}\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n {(label || required || isRequiredConditional) && (\n <InputLabel label={label ?? \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n )}\n {revertBackValue?.length > 0 &&\n revertBackValue !== props.value && (\n <AntTooltip placement=\"top\" title={revertBackValue}>\n <button\n className=\"cursor-pointer\"\n onClick={() => onChange(revertBackValue)}\n type=\"button\"\n >\n <RevertIcon\n className=\"cursor-pointer pb-0.5 text-primary-600 w-4 h-4\"\n />\n </button>\n </AntTooltip>\n )}\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 <AntTooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </AntTooltip>\n )}\n {labelExtra}\n </div>\n <div className=\"flex items-center gap-1\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip || \"\"}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-12 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\n className={cn(\n \"text-xs font-medium leading-4\",\n getConfidenceScoreBadgeTextColor(confidenceType)\n )}\n >\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id={`btn-base-input-field-add-to-document-${id}`}\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(props?.value)}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n className=\"text-primary-600\"\n sx={{\n fontSize: 16,\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n )}\n <label className=\"relative block\">\n <div className=\"relative\">\n <input\n {...props}\n ref={inputRef || ref}\n id={id || label}\n key={id}\n required={required}\n style={\n {\n \"--input-bg-color\":\n \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n ...inputStyle,\n } as React.CSSProperties\n }\n className={cn(\n \"border border-solid h-8 text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium placeholder:font-light placeholder:text-neutral-300 disabled:opacity-70 focus:outline-none focus:ring-0 dark:disabled:placeholder:!text-black-400\",\n textSize ? textSize : \"text-sm\",\n color ? color : \"text-neutral-900 dark:text-black-100\",\n bg && bg,\n inputClassName ? inputClassName : \"\",\n errorMessage\n ? cn(\n \"rounded-md border-red-300 dark:border-red-500 bg-white hover:border-red-400 dark:bg-black-600 dark:hover:border-red-400 focus:border-red-600 focus:shadow-[0_0_0_1.5px_rgba(239,68,68,0.22)] dark:focus:border-red-500 dark:focus:shadow-[0_0_0_1.5px_rgba(248,113,113,0.25)]\",\n )\n : successMessage\n ? cn(\n \"rounded-md border-green-300 bg-white hover:border-green-400 dark:border-green-600 dark:bg-black-600 dark:hover:border-green-500 focus:border-green-600 focus:shadow-[0_0_0_1.5px_rgba(34,197,94,0.22)] dark:focus:border-green-500\",\n )\n : showRiskSkin && riskDetails?.color\n ? cn(\n \"rounded-md hover:border-primary-500 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]\",\n `bg-${riskDetails.color}-50 border-${riskDetails.color}-300`,\n )\n : emphasisDeletedSkin\n ? \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254_202_202_/_0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)] dark:disabled:!bg-[var(--Error-50,#FEF2F2)]\"\n : emphasisModifiedSkin\n ? \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254_223_137_/_0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)] dark:disabled:!bg-[var(--Warning-50,#FFFAEB)]\"\n : emphasisSuccessSkin\n ? \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187_247_208_/_0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)] dark:disabled:!bg-[var(--Success-50,#F0FDF4)] disabled:!text-[#101828] dark:disabled:!text-[#101828]\"\n : \"rounded-md border-neutral-200 bg-white hover:border-primary-500 dark:border-black-600 dark:bg-black-600 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)] disabled:!bg-neutral-50 dark:disabled:!bg-black-800\"\n )}\n onChange={(e) => {\n onChange(e.target.value);\n }}\n onClick={(e) => e.stopPropagation()}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n {isPasswordField ? (\n <button\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2\"\n onClick={() => {\n setShowPassword(!showPassword);\n setIsPasswordVisible?.(!showPassword);\n }}\n type=\"button\"\n >\n {showPassword ? (\n <EyeIcon className=\"text-gray-400 w-4 h-4\" />\n ) : (\n <EyeOffIcon className=\"text-gray-400 w-4 h-4\" />\n )}\n </button>\n ) : isClearable && props.value ? (\n <button\n id={`btn-input-field-clear-${id}`}\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2 focus:outline-none\"\n onClick={(e) => {\n e.stopPropagation();\n onChange(\"\");\n }}\n type=\"button\"\n >\n <CloseIcon\n className=\"text-neutral-200 dark:text-black-500 w-4 h-4\"\n />\n </button>\n ) : suffixIcon ? (\n <div className=\"absolute inset-y-0 flex items-center right-2\">\n {suffixIcon}\n </div>\n ) : null}\n </div>\n </label>\n <AnimatePresence>\n {errorMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n <AnimatePresence>\n {successMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-success-500 dark:text-success-300\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {successMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\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\nBaseInputField.displayName = \"BaseInputField\";\n\nexport default BaseInputField;\n\n"],"names":["EyeIcon","className","size","jsxs","jsx","EyeOffIcon","CloseIcon","RevertIcon","BaseInputField","forwardRef","id","label","labelExtra","onChange","errorMessage","successMessage","required","isRequiredConditional","bg","tags","color","isPasswordField","setIsPasswordVisible","inputRef","tooltip","suffixIcon","revertBackValue","originalCase","textSize","isAiExtracted","isGTN","confidenceScore","confidenceType","confidenceTooltip","gtnName","inputClassName","inputStyle","labelClassName","onBlur","isLiveField","isClearable","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","onAddGTNToDocument","sourceMeta","inputEmphasis","onConfidenceScoreClick","props","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","showPassword","setShowPassword","useState","isHovered","setIsHovered","handleAddGTNToDocument","value","cn","InputLabel","AntTooltip","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","HelpIcon","Tooltip","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","NoteAddOutlined","createElement","e","AnimatePresence","motion","Typography"],"mappings":"osBAyEMA,GAAU,CAAC,CAAE,UAAAC,EAAW,KAAAC,EAAO,MACnCC,EAAAA,KAAC,MAAA,CACC,MAAOD,EACP,OAAQA,EACR,QAAQ,YACR,KAAK,OACL,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,QACf,UAAAD,EAEA,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,EAAE,8CAAA,CAA+C,QACtD,SAAA,CAAO,GAAG,KAAK,GAAG,KAAK,EAAE,GAAA,CAAI,CAAA,CAAA,CAChC,EAMIC,GAAa,CAAC,CAAE,UAAAJ,EAAW,KAAAC,EAAO,MACtCC,EAAAA,KAAC,MAAA,CACC,MAAOD,EACP,OAAQA,EACR,QAAQ,YACR,KAAK,OACL,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,QACf,UAAAD,EAEA,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,EAAE,sLAAA,CAAuL,EAC/LA,EAAAA,IAAC,QAAK,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAA,CAAK,CAAA,CAAA,CACtC,EAMIE,GAAY,CAAC,CAAE,UAAAL,EAAW,KAAAC,EAAO,MACrCC,EAAAA,KAAC,MAAA,CACC,MAAOD,EACP,OAAQA,EACR,QAAQ,YACR,KAAK,OACL,OAAO,eACP,YAAY,IACZ,cAAc,QACd,eAAe,QACf,UAAAD,EAEA,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAA,CAAK,EACpCA,EAAAA,IAAC,QAAK,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAA,CAAK,CAAA,CAAA,CACtC,EAMIG,GAAa,CAAC,CAAE,UAAAN,EAAW,KAAAC,EAAO,MACtCC,EAAAA,KAAC,MAAA,CACC,MAAOD,EACP,O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forwardRef as lr, useState as W, createElement as nr } from "react";
|
|
3
3
|
import i from "../../../_virtual/index.es.js";
|
|
4
4
|
import { AnimatePresence as P, motion as j } from "framer-motion";
|
|
5
|
-
import { useTranslation as
|
|
5
|
+
import { useTranslation as cr } from "react-i18next";
|
|
6
6
|
import { Tooltip as w } from "antd";
|
|
7
7
|
import { Typography as D } from "../../data-display/typography/Typography.es.js";
|
|
8
|
-
import { Label as
|
|
8
|
+
import { Label as sr } from "../../data-display/label/Label.es.js";
|
|
9
9
|
import { BoltOutlined as ur, NoteAddOutlined as br } from "@mui/icons-material";
|
|
10
10
|
import { AIExtractedIndicator as mr } from "../../icons/AIExtractedIndicator.es.js";
|
|
11
11
|
import { AIStarIcon as pr } from "../../icons/AIStarIcon.es.js";
|
|
@@ -100,13 +100,13 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
100
100
|
inputRef: R,
|
|
101
101
|
tooltip: E,
|
|
102
102
|
suffixIcon: S,
|
|
103
|
-
revertBackValue:
|
|
103
|
+
revertBackValue: s,
|
|
104
104
|
originalCase: J = !1,
|
|
105
105
|
textSize: B,
|
|
106
106
|
isAiExtracted: Q = !1,
|
|
107
107
|
isGTN: h = !1,
|
|
108
108
|
confidenceScore: k,
|
|
109
|
-
confidenceType:
|
|
109
|
+
confidenceType: c = "high",
|
|
110
110
|
confidenceTooltip: U,
|
|
111
111
|
gtnName: X = null,
|
|
112
112
|
inputClassName: A = "",
|
|
@@ -124,7 +124,7 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
124
124
|
onConfidenceScoreClick: T,
|
|
125
125
|
...u
|
|
126
126
|
}, rr) => {
|
|
127
|
-
const { t: er } =
|
|
127
|
+
const { t: er } = cr(), b = !!(I && n?.color), or = x === "modified" && !d && !l && !b, tr = x === "deleted" && !d && !l && !b, ar = x === "success" && !d && !l && !b, [v, ir] = W(!1), [m, y] = W(!1), dr = (t) => {
|
|
128
128
|
g && g({
|
|
129
129
|
key: X,
|
|
130
130
|
value: t
|
|
@@ -168,11 +168,11 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
168
168
|
children: /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center justify-between w-full", children: [
|
|
169
169
|
/* @__PURE__ */ a("div", { className: "inline-flex flex-wrap items-center gap-1", children: [
|
|
170
170
|
(e || f || _) && /* @__PURE__ */ r(fr, { label: e ?? "", required: f || !1, isRequiredConditional: _ || !1 }),
|
|
171
|
-
|
|
171
|
+
s?.length > 0 && s !== u.value && /* @__PURE__ */ r(w, { placement: "top", title: s, children: /* @__PURE__ */ r(
|
|
172
172
|
"button",
|
|
173
173
|
{
|
|
174
174
|
className: "cursor-pointer",
|
|
175
|
-
onClick: () => p(
|
|
175
|
+
onClick: () => p(s),
|
|
176
176
|
type: "button",
|
|
177
177
|
children: /* @__PURE__ */ r(
|
|
178
178
|
Nr,
|
|
@@ -193,12 +193,12 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
193
193
|
}
|
|
194
194
|
),
|
|
195
195
|
Q && !$(k) && /* @__PURE__ */ r(mr, {}),
|
|
196
|
-
/* @__PURE__ */ r(
|
|
196
|
+
/* @__PURE__ */ r(sr, { labels: z }),
|
|
197
197
|
E && /* @__PURE__ */ r(w, { placement: "top", title: E, children: /* @__PURE__ */ r("div", { className: "cursor-pointer", children: /* @__PURE__ */ r(yr, { className: "w-icon-sm h-icon-sm" }) }) }),
|
|
198
198
|
F
|
|
199
199
|
] }),
|
|
200
200
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
|
|
201
|
-
$(k) &&
|
|
201
|
+
$(k) && c ? /* @__PURE__ */ r(
|
|
202
202
|
hr,
|
|
203
203
|
{
|
|
204
204
|
placement: "top-end",
|
|
@@ -209,7 +209,7 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
209
209
|
{
|
|
210
210
|
className: i(
|
|
211
211
|
"inline-flex min-w-12 items-center gap-1 rounded-md px-1 py-0.5",
|
|
212
|
-
vr(
|
|
212
|
+
vr(c)
|
|
213
213
|
),
|
|
214
214
|
onClick: () => T?.(G),
|
|
215
215
|
children: [
|
|
@@ -217,8 +217,8 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
217
217
|
pr,
|
|
218
218
|
{
|
|
219
219
|
size: 12,
|
|
220
|
-
fill: gr(
|
|
221
|
-
fillSecondary: kr(
|
|
220
|
+
fill: gr(c),
|
|
221
|
+
fillSecondary: kr(c)
|
|
222
222
|
}
|
|
223
223
|
),
|
|
224
224
|
/* @__PURE__ */ a(
|
|
@@ -226,7 +226,7 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
226
226
|
{
|
|
227
227
|
className: i(
|
|
228
228
|
"text-xs font-medium leading-4",
|
|
229
|
-
xr(
|
|
229
|
+
xr(c)
|
|
230
230
|
),
|
|
231
231
|
children: [
|
|
232
232
|
k,
|
|
@@ -275,7 +275,7 @@ const wr = ({ className: o, size: e = 16 }) => /* @__PURE__ */ a(
|
|
|
275
275
|
...Y
|
|
276
276
|
},
|
|
277
277
|
className: i(
|
|
278
|
-
"border border-solid h-8 text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium disabled:opacity-70 focus:outline-none focus:ring-0 dark:disabled:placeholder:!text-black-400",
|
|
278
|
+
"border border-solid h-8 text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium placeholder:font-light placeholder:text-neutral-300 disabled:opacity-70 focus:outline-none focus:ring-0 dark:disabled:placeholder:!text-black-400",
|
|
279
279
|
B || "text-sm",
|
|
280
280
|
C || "text-neutral-900 dark:text-black-100",
|
|
281
281
|
N && N,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputField.es.js","sources":["../../../../src/components/forms/base-input-field/BaseInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useState } from \"react\";\nimport { useTranslation } from 'react-i18next';\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { NoteAddOutlined, BoltOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\n/**\n * Bounding boxes interface\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\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\n */\nexport interface RiskDetailsCardProps {\n riskDetails: RiskDetails;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/**\n * Eye icon for password visibility toggle\n */\nconst EyeIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n);\n\n/**\n * Eye off icon for password visibility toggle\n */\nconst EyeOffIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24\" />\n <line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\" />\n </svg>\n);\n\n/**\n * Close icon for clearable input\n */\nconst CloseIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n);\n\n/**\n * Revert icon for revert back value\n */\nconst RevertIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n);\n\n/** Visual emphasis for the input surface (background + border) */\nexport type BaseInputFieldEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Props for the BaseInputField component\n */\nexport type TBaseInputFieldProps = any & {\n /** Current value of the input */\n value: string;\n /** Callback function called when the input value changes */\n onChange(data: any): void;\n /** Callback function for key down events */\n onKeyDown?: void;\n /** Error message to display */\n errorMessage: string;\n /** Default value for the input */\n defaultValue?: string;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional */\n isRequiredConditional?: boolean;\n /** Background color class */\n bg?: string;\n /** Tags to display with the label */\n tags?: (string | LabelType)[];\n /** Text color class */\n color?: string;\n /** Unique identifier for the input */\n id: string;\n /** Label text for the input */\n label?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Value to revert back to */\n revertBackValue?: any;\n /** Placeholder text */\n placeholder?: string;\n /** Whether this is a password field with visibility toggle */\n isPasswordField?: boolean;\n /** Callback to set password visibility */\n setIsPasswordVisible?: any;\n /** Tooltip text */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Icon or element to display at the end of the input */\n suffixIcon?: React.ReactNode;\n /** Text size class */\n textSize?: string;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Whether this is a GTN field */\n isGTN?: boolean;\n /** Confidence score shown as a compact badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence score badge */\n confidenceTooltip?: React.ReactNode;\n /** GTN name for document integration */\n gtnName?: any;\n /** Success message to display */\n successMessage?: string;\n /** Additional CSS classes for the input element */\n inputClassName?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function for blur events */\n onBlur?: () => void;\n /** Whether the input is clearable */\n isClearable?: boolean;\n /** Additional CSS classes for the wrapper */\n className?: string;\n /** Ref for the input element */\n inputRef?: React.RefObject<HTMLInputElement>;\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>;\n /** Bounding box for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Callback function for confidence score click */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\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?: BaseInputFieldEmphasis;\n};\n\n/**\n * A feature-rich input field component with label, validation, GTN integration,\n * risk analysis support, and comprehensive styling options.\n *\n * @example\n * ```tsx\n * <BaseInputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const BaseInputField = forwardRef<HTMLInputElement, TBaseInputFieldProps>(\n (\n {\n id,\n label,\n labelExtra,\n onChange,\n errorMessage,\n successMessage,\n required,\n isRequiredConditional = false,\n bg,\n tags,\n color,\n className,\n isPasswordField,\n setIsPasswordVisible,\n inputRef,\n tooltip,\n suffixIcon,\n revertBackValue,\n originalCase = false,\n textSize,\n isAiExtracted = false,\n isGTN = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n gtnName = null,\n inputClassName = \"\",\n inputStyle = {},\n labelClassName,\n onBlur,\n isLiveField = false,\n isClearable = false,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n onAddGTNToDocument,\n sourceMeta = [],\n inputEmphasis = \"default\",\n onConfidenceScoreClick,\n ...props\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const [showPassword, setShowPassword] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const handleAddGTNToDocument = (value: string) => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: gtnName,\n value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n return (\n <div\n className={cn(\n \"flex gap-0.5 relative\",\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 bg-primary-50 p-1 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-neutral-50 dark:focus:border-neutral-50\"\n : \"\"\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 <div className={cn(\"flex flex-col w-full\", className)}>\n <style>\n {`\n .dark input:-webkit-autofill,\n .dark input:-webkit-autofill:hover,\n .dark input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n input:-webkit-autofill,\n input:-webkit-autofill:hover,\n input:-webkit-autofill:focus {\n -webkit-text-fill-color: #111827 !important;\n -webkit-box-shadow: 0 0 0px 1000px white inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n `}\n </style>\n {(label || labelExtra) && (\n <label\n id={id}\n htmlFor=\"text\"\n className={`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"!uppercse\"}`}\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n {(label || required || isRequiredConditional) && (\n <InputLabel label={label ?? \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n )}\n {revertBackValue?.length > 0 &&\n revertBackValue !== props.value && (\n <AntTooltip placement=\"top\" title={revertBackValue}>\n <button\n className=\"cursor-pointer\"\n onClick={() => onChange(revertBackValue)}\n type=\"button\"\n >\n <RevertIcon\n className=\"cursor-pointer pb-0.5 text-primary-600 w-4 h-4\"\n />\n </button>\n </AntTooltip>\n )}\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 <AntTooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </AntTooltip>\n )}\n {labelExtra}\n </div>\n <div className=\"flex items-center gap-1\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip || \"\"}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-12 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\n className={cn(\n \"text-xs font-medium leading-4\",\n getConfidenceScoreBadgeTextColor(confidenceType)\n )}\n >\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id={`btn-base-input-field-add-to-document-${id}`}\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(props?.value)}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n className=\"text-primary-600\"\n sx={{\n fontSize: 16,\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n )}\n <label className=\"relative block\">\n <div className=\"relative\">\n <input\n {...props}\n ref={inputRef || ref}\n id={id || label}\n key={id}\n required={required}\n style={\n {\n \"--input-bg-color\":\n \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n ...inputStyle,\n } as React.CSSProperties\n }\n className={cn(\n \"border border-solid h-8 text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium disabled:opacity-70 focus:outline-none focus:ring-0 dark:disabled:placeholder:!text-black-400\",\n textSize ? textSize : \"text-sm\",\n color ? color : \"text-neutral-900 dark:text-black-100\",\n bg && bg,\n inputClassName ? inputClassName : \"\",\n errorMessage\n ? cn(\n \"rounded-md border-red-300 dark:border-red-500 bg-white hover:border-red-400 dark:bg-black-600 dark:hover:border-red-400 focus:border-red-600 focus:shadow-[0_0_0_1.5px_rgba(239,68,68,0.22)] dark:focus:border-red-500 dark:focus:shadow-[0_0_0_1.5px_rgba(248,113,113,0.25)]\",\n )\n : successMessage\n ? cn(\n \"rounded-md border-green-300 bg-white hover:border-green-400 dark:border-green-600 dark:bg-black-600 dark:hover:border-green-500 focus:border-green-600 focus:shadow-[0_0_0_1.5px_rgba(34,197,94,0.22)] dark:focus:border-green-500\",\n )\n : showRiskSkin && riskDetails?.color\n ? cn(\n \"rounded-md hover:border-primary-500 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]\",\n `bg-${riskDetails.color}-50 border-${riskDetails.color}-300`,\n )\n : emphasisDeletedSkin\n ? \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254_202_202_/_0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)] dark:disabled:!bg-[var(--Error-50,#FEF2F2)]\"\n : emphasisModifiedSkin\n ? \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254_223_137_/_0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)] dark:disabled:!bg-[var(--Warning-50,#FFFAEB)]\"\n : emphasisSuccessSkin\n ? \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187_247_208_/_0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)] dark:disabled:!bg-[var(--Success-50,#F0FDF4)] disabled:!text-[#101828] dark:disabled:!text-[#101828]\"\n : \"rounded-md border-neutral-200 bg-white hover:border-primary-500 dark:border-black-600 dark:bg-black-600 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)] disabled:!bg-neutral-50 dark:disabled:!bg-black-800\"\n )}\n onChange={(e) => {\n onChange(e.target.value);\n }}\n onClick={(e) => e.stopPropagation()}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n {isPasswordField ? (\n <button\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2\"\n onClick={() => {\n setShowPassword(!showPassword);\n setIsPasswordVisible?.(!showPassword);\n }}\n type=\"button\"\n >\n {showPassword ? (\n <EyeIcon className=\"text-gray-400 w-4 h-4\" />\n ) : (\n <EyeOffIcon className=\"text-gray-400 w-4 h-4\" />\n )}\n </button>\n ) : isClearable && props.value ? (\n <button\n id={`btn-input-field-clear-${id}`}\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2 focus:outline-none\"\n onClick={(e) => {\n e.stopPropagation();\n onChange(\"\");\n }}\n type=\"button\"\n >\n <CloseIcon\n className=\"text-neutral-200 dark:text-black-500 w-4 h-4\"\n />\n </button>\n ) : suffixIcon ? (\n <div className=\"absolute inset-y-0 flex items-center right-2\">\n {suffixIcon}\n </div>\n ) : null}\n </div>\n </label>\n <AnimatePresence>\n {errorMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n <AnimatePresence>\n {successMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-success-500 dark:text-success-300\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {successMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\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\nBaseInputField.displayName = \"BaseInputField\";\n\nexport default BaseInputField;\n\n"],"names":["EyeIcon","className","size","jsxs","jsx","EyeOffIcon","CloseIcon","RevertIcon","BaseInputField","forwardRef","id","label","labelExtra","onChange","errorMessage","successMessage","required","isRequiredConditional","bg","tags","color","isPasswordField","setIsPasswordVisible","inputRef","tooltip","suffixIcon","revertBackValue","originalCase","textSize","isAiExtracted","isGTN","confidenceScore","confidenceType","confidenceTooltip","gtnName","inputClassName","inputStyle","labelClassName","onBlur","isLiveField","isClearable","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","onAddGTNToDocument","sourceMeta","inputEmphasis","onConfidenceScoreClick","props","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","showPassword","setShowPassword","useState","isHovered","setIsHovered","handleAddGTNToDocument","value","cn","InputLabel","AntTooltip","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","HelpIcon","Tooltip","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","NoteAddOutlined","createElement","e","AnimatePresence","motion","Typography"],"mappings":";;;;;;;;;;;;;;;AAyEA,MAAMA,KAAU,CAAC,EAAE,WAAAC,GAAW,MAAAC,IAAO,SACnC,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAOD;AAAA,IACP,QAAQA;AAAA,IACR,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe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EP,UAAAnE;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA,EACF,CAEJ;AAAA,UAAA,GACF;AAAA,UAEC4C,KACClB,KACAC,KACAC,KACE,gBAAAvC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,WAAU;AAAA,cACV,SAAS,CAAC2E,MAAMA,EAAE,gBAAA;AAAA,cAClB,aAAa,CAACA,MAAMA,EAAE,eAAA;AAAA,cACtB,WAAW,CAACA,MAAM;AAChB,gBAAIA,EAAE,QAAQ,YACZnB,EAAa,EAAK;AAAA,cAEtB;AAAA,cAEA,UAAA,gBAAAxD,EAACuC,KAAgB,aAAAF,EAAA,CAA0B;AAAA,YAAA;AAAA,UAAA;AAAA,QAC7C;AAAA,MAAA;AAAA,IAAA;AAAA,EAIV;AACF;AAEAjC,GAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"BaseInputField.es.js","sources":["../../../../src/components/forms/base-input-field/BaseInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React, { forwardRef, useState } from \"react\";\nimport { useTranslation } from 'react-i18next';\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { NoteAddOutlined, BoltOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\n/**\n * Bounding boxes interface\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\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\n */\nexport interface RiskDetailsCardProps {\n riskDetails: RiskDetails;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/**\n * Eye icon for password visibility toggle\n */\nconst EyeIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n);\n\n/**\n * Eye off icon for password visibility toggle\n */\nconst EyeOffIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24\" />\n <line x1=\"1\" y1=\"1\" x2=\"23\" y2=\"23\" />\n </svg>\n);\n\n/**\n * Close icon for clearable input\n */\nconst CloseIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n);\n\n/**\n * Revert icon for revert back value\n */\nconst RevertIcon = ({ className, size = 16 }: { className?: string; size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n);\n\n/** Visual emphasis for the input surface (background + border) */\nexport type BaseInputFieldEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\n\n/**\n * Props for the BaseInputField component\n */\nexport type TBaseInputFieldProps = any & {\n /** Current value of the input */\n value: string;\n /** Callback function called when the input value changes */\n onChange(data: any): void;\n /** Callback function for key down events */\n onKeyDown?: void;\n /** Error message to display */\n errorMessage: string;\n /** Default value for the input */\n defaultValue?: string;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Maximum value for number inputs */\n max?: number;\n /** Minimum value for number inputs */\n min?: number;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional */\n isRequiredConditional?: boolean;\n /** Background color class */\n bg?: string;\n /** Tags to display with the label */\n tags?: (string | LabelType)[];\n /** Text color class */\n color?: string;\n /** Unique identifier for the input */\n id: string;\n /** Label text for the input */\n label?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Input type (text, email, password, number, etc.) */\n type?: string;\n /** Value to revert back to */\n revertBackValue?: any;\n /** Placeholder text */\n placeholder?: string;\n /** Whether this is a password field with visibility toggle */\n isPasswordField?: boolean;\n /** Callback to set password visibility */\n setIsPasswordVisible?: any;\n /** Tooltip text */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Icon or element to display at the end of the input */\n suffixIcon?: React.ReactNode;\n /** Text size class */\n textSize?: string;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Whether this is a GTN field */\n isGTN?: boolean;\n /** Confidence score shown as a compact badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence score badge */\n confidenceTooltip?: React.ReactNode;\n /** GTN name for document integration */\n gtnName?: any;\n /** Success message to display */\n successMessage?: string;\n /** Additional CSS classes for the input element */\n inputClassName?: string;\n /** Inline styles for the input element */\n inputStyle?: React.CSSProperties;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function for blur events */\n onBlur?: () => void;\n /** Whether the input is clearable */\n isClearable?: boolean;\n /** Additional CSS classes for the wrapper */\n className?: string;\n /** Ref for the input element */\n inputRef?: React.RefObject<HTMLInputElement>;\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>;\n /** Bounding box for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Callback function for confidence score click */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\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?: BaseInputFieldEmphasis;\n};\n\n/**\n * A feature-rich input field component with label, validation, GTN integration,\n * risk analysis support, and comprehensive styling options.\n *\n * @example\n * ```tsx\n * <BaseInputField\n * id=\"email\"\n * label=\"Email Address\"\n * type=\"email\"\n * value={email}\n * onChange={setEmail}\n * placeholder=\"Enter your email\"\n * required\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const BaseInputField = forwardRef<HTMLInputElement, TBaseInputFieldProps>(\n (\n {\n id,\n label,\n labelExtra,\n onChange,\n errorMessage,\n successMessage,\n required,\n isRequiredConditional = false,\n bg,\n tags,\n color,\n className,\n isPasswordField,\n setIsPasswordVisible,\n inputRef,\n tooltip,\n suffixIcon,\n revertBackValue,\n originalCase = false,\n textSize,\n isAiExtracted = false,\n isGTN = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n gtnName = null,\n inputClassName = \"\",\n inputStyle = {},\n labelClassName,\n onBlur,\n isLiveField = false,\n isClearable = false,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n onAddGTNToDocument,\n sourceMeta = [],\n inputEmphasis = \"default\",\n onConfidenceScoreClick,\n ...props\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" &&\n !errorMessage &&\n !successMessage &&\n !showRiskSkin;\n const [showPassword, setShowPassword] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const handleAddGTNToDocument = (value: string) => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: gtnName,\n value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n return (\n <div\n className={cn(\n \"flex gap-0.5 relative\",\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 bg-primary-50 p-1 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-neutral-50 dark:focus:border-neutral-50\"\n : \"\"\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 <div className={cn(\"flex flex-col w-full\", className)}>\n <style>\n {`\n .dark input:-webkit-autofill,\n .dark input:-webkit-autofill:hover,\n .dark input:-webkit-autofill:focus {\n -webkit-text-fill-color: white !important;\n -webkit-box-shadow: 0 0 0px 1000px var(--input-bg-color) inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n \n input:-webkit-autofill,\n input:-webkit-autofill:hover,\n input:-webkit-autofill:focus {\n -webkit-text-fill-color: #111827 !important;\n -webkit-box-shadow: 0 0 0px 1000px white inset !important;\n transition: background-color 5000s ease-in-out 0s;\n }\n `}\n </style>\n {(label || labelExtra) && (\n <label\n id={id}\n htmlFor=\"text\"\n className={`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"!uppercse\"}`}\n >\n <div className=\"flex flex-wrap items-center justify-between w-full\">\n <div className=\"inline-flex flex-wrap items-center gap-1\">\n {(label || required || isRequiredConditional) && (\n <InputLabel label={label ?? \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n )}\n {revertBackValue?.length > 0 &&\n revertBackValue !== props.value && (\n <AntTooltip placement=\"top\" title={revertBackValue}>\n <button\n className=\"cursor-pointer\"\n onClick={() => onChange(revertBackValue)}\n type=\"button\"\n >\n <RevertIcon\n className=\"cursor-pointer pb-0.5 text-primary-600 w-4 h-4\"\n />\n </button>\n </AntTooltip>\n )}\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 <AntTooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </AntTooltip>\n )}\n {labelExtra}\n </div>\n <div className=\"flex items-center gap-1\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip || \"\"}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-12 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\n className={cn(\n \"text-xs font-medium leading-4\",\n getConfidenceScoreBadgeTextColor(confidenceType)\n )}\n >\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id={`btn-base-input-field-add-to-document-${id}`}\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(props?.value)}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n className=\"text-primary-600\"\n sx={{\n fontSize: 16,\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n )}\n <label className=\"relative block\">\n <div className=\"relative\">\n <input\n {...props}\n ref={inputRef || ref}\n id={id || label}\n key={id}\n required={required}\n style={\n {\n \"--input-bg-color\":\n \"var(--tw-bg-opacity, 1) rgb(var(--bg-color))\",\n ...inputStyle,\n } as React.CSSProperties\n }\n className={cn(\n \"border border-solid h-8 text-neutral-900 dark:text-black-100 block w-full px-3 py-1.5 font-medium placeholder:font-light placeholder:text-neutral-300 disabled:opacity-70 focus:outline-none focus:ring-0 dark:disabled:placeholder:!text-black-400\",\n textSize ? textSize : \"text-sm\",\n color ? color : \"text-neutral-900 dark:text-black-100\",\n bg && bg,\n inputClassName ? inputClassName : \"\",\n errorMessage\n ? cn(\n \"rounded-md border-red-300 dark:border-red-500 bg-white hover:border-red-400 dark:bg-black-600 dark:hover:border-red-400 focus:border-red-600 focus:shadow-[0_0_0_1.5px_rgba(239,68,68,0.22)] dark:focus:border-red-500 dark:focus:shadow-[0_0_0_1.5px_rgba(248,113,113,0.25)]\",\n )\n : successMessage\n ? cn(\n \"rounded-md border-green-300 bg-white hover:border-green-400 dark:border-green-600 dark:bg-black-600 dark:hover:border-green-500 focus:border-green-600 focus:shadow-[0_0_0_1.5px_rgba(34,197,94,0.22)] dark:focus:border-green-500\",\n )\n : showRiskSkin && riskDetails?.color\n ? cn(\n \"rounded-md hover:border-primary-500 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]\",\n `bg-${riskDetails.color}-50 border-${riskDetails.color}-300`,\n )\n : emphasisDeletedSkin\n ? \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] focus:border-[var(--Error-200,#FECACA)] focus:shadow-[0_0_0_2px_rgba(254_202_202_/_0.45)] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467] disabled:!opacity-100 disabled:!bg-[var(--Error-50,#FEF2F2)] dark:disabled:!bg-[var(--Error-50,#FEF2F2)]\"\n : emphasisModifiedSkin\n ? \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 focus:border-[var(--Warning-200,#FEDF89)] focus:shadow-[0_0_0_2px_rgba(254_223_137_/_0.45)] dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)] disabled:!opacity-100 disabled:!bg-[var(--Warning-50,#FFFAEB)] dark:disabled:!bg-[var(--Warning-50,#FFFAEB)]\"\n : emphasisSuccessSkin\n ? \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] focus:border-[var(--Success-200,#BBF7D0)] focus:shadow-[0_0_0_2px_rgba(187_247_208_/_0.45)] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828] disabled:!opacity-100 disabled:!bg-[var(--Success-50,#F0FDF4)] dark:disabled:!bg-[var(--Success-50,#F0FDF4)] disabled:!text-[#101828] dark:disabled:!text-[#101828]\"\n : \"rounded-md border-neutral-200 bg-white hover:border-primary-500 dark:border-black-600 dark:bg-black-600 dark:hover:border-primary-400 focus:border-primary-600 dark:focus:border-primary-400 focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)] disabled:!bg-neutral-50 dark:disabled:!bg-black-800\"\n )}\n onChange={(e) => {\n onChange(e.target.value);\n }}\n onClick={(e) => e.stopPropagation()}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n {isPasswordField ? (\n <button\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2\"\n onClick={() => {\n setShowPassword(!showPassword);\n setIsPasswordVisible?.(!showPassword);\n }}\n type=\"button\"\n >\n {showPassword ? (\n <EyeIcon className=\"text-gray-400 w-4 h-4\" />\n ) : (\n <EyeOffIcon className=\"text-gray-400 w-4 h-4\" />\n )}\n </button>\n ) : isClearable && props.value ? (\n <button\n id={`btn-input-field-clear-${id}`}\n className=\"absolute inset-y-0 flex items-center cursor-pointer right-2 focus:outline-none\"\n onClick={(e) => {\n e.stopPropagation();\n onChange(\"\");\n }}\n type=\"button\"\n >\n <CloseIcon\n className=\"text-neutral-200 dark:text-black-500 w-4 h-4\"\n />\n </button>\n ) : suffixIcon ? (\n <div className=\"absolute inset-y-0 flex items-center right-2\">\n {suffixIcon}\n </div>\n ) : null}\n </div>\n </label>\n <AnimatePresence>\n {errorMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n <AnimatePresence>\n {successMessage && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n >\n <Typography\n className=\"mt-1 text-success-500 dark:text-success-300\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {successMessage}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\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\nBaseInputField.displayName = \"BaseInputField\";\n\nexport default BaseInputField;\n\n"],"names":["EyeIcon","className","size","jsxs","jsx","EyeOffIcon","CloseIcon","RevertIcon","BaseInputField","forwardRef","id","label","labelExtra","onChange","errorMessage","successMessage","required","isRequiredConditional","bg","tags","color","isPasswordField","setIsPasswordVisible","inputRef","tooltip","suffixIcon","revertBackValue","originalCase","textSize","isAiExtracted","isGTN","confidenceScore","confidenceType","confidenceTooltip","gtnName","inputClassName","inputStyle","labelClassName","onBlur","isLiveField","isClearable","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","onAddGTNToDocument","sourceMeta","inputEmphasis","onConfidenceScoreClick","props","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","showPassword","setShowPassword","useState","isHovered","setIsHovered","handleAddGTNToDocument","value","cn","InputLabel","AntTooltip","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","HelpIcon","Tooltip","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","NoteAddOutlined","createElement","e","AnimatePresence","motion","Typography"],"mappings":";;;;;;;;;;;;;;;AAyEA,MAAMA,KAAU,CAAC,EAAE,WAAAC,GAAW,MAAAC,IAAO,SACnC,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAOD;AAAA,IACP,QAAQA;AAAA,IACR,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,WAAAD;AAAA,IAEA,UAAA;AAAA,MAAA,gBAAAG,EAAC,QAAA,EAAK,GAAE,+CAAA,CAA+C;AAAA,wBACtD,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,IAAA,CAAI;AAAA,IAAA;AAAA,EAAA;AAChC,GAMIC,KAAa,CAAC,EAAE,WAAAJ,GAAW,MAAAC,IAAO,SACtC,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAOD;AAAA,IACP,QAAQA;AAAA,IACR,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,WAAAD;AAAA,IAEA,UAAA;AAAA,MAAA,gBAAAG,EAAC,QAAA,EAAK,GAAE,uLAAA,CAAuL;AAAA,M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ACF;AAEAjC,GAAe,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../_virtual/index.cjs.js"),O=require("react"),T=require("framer-motion"),ne=require("antd"),ce=require("react-i18next"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../../_virtual/index.cjs.js"),O=require("react"),T=require("framer-motion"),ne=require("antd"),ce=require("react-i18next"),f=require("../../data-display/typography/Typography.cjs.js"),b=require("../../../constants/toggle.cjs.js"),R=require("@mui/icons-material"),de=require("../../icons/AIExtractedIndicator.cjs.js"),ue=require("../../icons/AIStarIcon.cjs.js"),me=require("../../data-display/label/Label.cjs.js"),C=require("../../tooltip/Tooltip.cjs.js"),fe=require("../../icons/HelpIcon.cjs.js"),pe=require("../shared/InputLabel.cjs.js"),n=require("../../../utils/confidenceScoreUtils.cjs.js"),xe=(t,a,l,p="medium")=>{const i={small:"w-7 h-4 after:h-3 after:w-3 after:top-1 after:left-0.5",medium:"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5",large:"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5"},x={small:"peer-checked:after:translate-x-3",medium:"peer-checked:after:translate-x-full",large:"peer-checked:after:translate-x-5"};return r("rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]",i[p],x[p],{"peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-white":t,"after:bg-white dark:after:bg-white":!t,"text-white dark:text-black-900":a,"cursor-not-allowed opacity-70":l})},ge=({size:t=18,fill:a="#016DCF"})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",fill:a})}),he=({size:t=18,fill:a="#101828"})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z",fill:a})}),M=O.forwardRef(({isGTN:t=!1,isChecked:a,id:l,onChange:p,label:i,required:x,isRequiredConditional:P=!1,hideStatus:G=!1,labelDirection:v=b.TOGGLE_LABEL_DIRECTION.TOP,statusText:y,withIcon:S=!1,tags:z,isAiExtracted:H=!1,confidenceScore:j,confidenceType:c="high",confidenceTooltip:k,sourceMeta:$=[],onConfidenceScoreClick:V,tooltip:E="",className:W="",disabled:Y,isDisabled:U=!1,icon:g,stopClickPropagation:J=!0,gtnName:K,variant:be="primary",labelClassName:w,isLiveField:Q=!1,message:d,messageType:u="default",wrapperClassName:X,helpText:m,labelExtra:Z,size:s="medium",renderGTNAddButton:q,onAddGTNToDocument:_,inputEmphasis:N="default"},ee)=>{const{t:re}=ce.useTranslation(),te=N==="modified",ae=N==="deleted",se=N==="success",I=Y??U,h=!!I,F=typeof I=="string"?I:void 0,le=v===b.TOGGLE_LABEL_DIRECTION.TOP,ie=v===b.TOGGLE_LABEL_DIRECTION.LEFT,A=v===b.TOGGLE_LABEL_DIRECTION.RIGHT,[L,B]=O.useState(!1),D=()=>{_&&_({key:K,value:a?"Yes":"No"})},oe=()=>u==="error"?"text-red-500 dark:text-red-400":u==="success"?"text-green-500 dark:text-green-400":u==="info"?"text-primary-500 dark:text-primary-400":"text-neutral-500 dark:text-neutral-400";return e.jsxs("div",{className:r("flex gap-0.5",L&&t?"border rounded-lg border-primary-100 bg-primary-50 p-1":"",X),onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),onClick:o=>{J&&o.stopPropagation()},children:[t&&!L?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5"}):null,e.jsxs("div",{className:r("w-full flex flex-col",te&&"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5",ae&&"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5",se&&"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5"),children:[le&&i&&e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("h1",{className:r("mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap",w),children:[e.jsx(pe.InputLabel,{label:i||"",required:x||!1,isRequiredConditional:P||!1}),Q&&e.jsx(R.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),H&&!n.shouldShowConfidenceScore(j)&&e.jsx(de.AIExtractedIndicator,{}),e.jsx(me.Label,{labels:z||[]}),E&&e.jsx(C,{placement:"top",title:E,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(fe.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),Z]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[n.shouldShowConfidenceScore(j)&&c?e.jsx(C,{placement:"top-end",title:k??"",hideTooltip:k==null,className:"cursor-pointer",children:e.jsxs("div",{className:r("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",n.getConfidenceScoreBadgeClass(c)),onClick:()=>V?.($),children:[e.jsx(ue.AIStarIcon,{size:12,fill:n.getConfidenceScoreBadgeColor(c),fillSecondary:n.getConfidenceScoreBadgeFill(c)}),e.jsxs("span",{className:r("text-xs font-medium leading-4",n.getConfidenceScoreBadgeTextColor(c)),children:[j,"%"]})]})}):null,t&&L?q?q(D):e.jsx("button",{id:"btn-toggle-add-to-document",className:"cursor-pointer",onClick:D,type:"button",children:e.jsx(ne.Tooltip,{placement:"top",title:re("Add to document"),children:e.jsx(R.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]}),m&&e.jsx(f.Typography,{className:"mb-2 text-neutral-600 dark:text-neutral-400",appearance:"custom",size:"extra-small",variant:"regular",children:m}),e.jsxs("div",{className:"flex",children:[ie&&e.jsx(f.Typography,{size:"small",variant:"medium",className:r("mr-2 text-neutral-700 dark:text-black-200",w),appearance:"custom",children:i}),e.jsxs("label",{className:r("relative inline-flex items-center",A||y?"":"w-min",h?"cursor-not-allowed opacity-50":"cursor-pointer"),onClick:o=>o.stopPropagation(),children:[e.jsx("input",{ref:ee,type:"checkbox",id:l,onChange:o=>!h&&p(o.target.checked),value:"",disabled:h,checked:a,className:r("sr-only peer w-full",W),"aria-required":x,"aria-invalid":d&&u==="error"?"true":"false","aria-describedby":d||m?`${l}-description`:void 0}),e.jsx("div",{className:xe(a,S,h,s),children:S?e.jsx("div",{className:r("pointer-events-none absolute top-0.5 left-0.5 z-10 flex items-center justify-center transition-transform",s==="small"&&"h-3 w-3",s==="medium"&&"h-[1.125rem] w-[1.125rem]",s==="large"&&"h-5 w-5",a&&"translate-x-full"),children:a?g?.checkedIcon?g.checkedIcon:e.jsx(ge,{size:18,fill:"#016DCF"}):g?.uncheckedIcon?g.uncheckedIcon:e.jsx(he,{size:18,fill:"#101828"})}):null}),F&&e.jsx(C,{placement:"top",title:F,className:"-ml-2",children:e.jsx("span",{className:r("absolute inset-y-0 left-0",s==="small"&&"w-7",s==="medium"&&"w-9",s==="large"&&"w-11")})}),A&&e.jsx(f.Typography,{size:"small",variant:"medium",className:r("ml-2 text-neutral-700 dark:text-black-300",w),appearance:"custom",children:i}),G?null:e.jsx(f.Typography,{size:"small",variant:"medium",className:"ml-2 text-neutral-900 dark:text-black-100",appearance:"custom",children:y||(a?"Yes":"No")})]})]}),e.jsx(T.AnimatePresence,{children:d&&e.jsx(T.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},id:`${l}-description`,role:u==="error"?"alert":void 0,children:e.jsx(f.Typography,{className:r("mt-1",oe()),appearance:"custom",size:"extra-small",variant:"medium",children:d})})}),m&&!d&&e.jsx("div",{id:`${l}-description`,className:"sr-only",children:m})]})]})});M.displayName="Toggle";exports.Toggle=M;
|
|
2
2
|
//# sourceMappingURL=Toggle.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.cjs.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\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 * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\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 /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\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?: 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 /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\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 ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n // Overlay the icon on the sliding knob using the knob's exact\n // geometry (same top/left, same size, same full-width slide) so\n // it stays perfectly centered in the circle for every size/state.\n <div\n className={cn(\n \"pointer-events-none absolute top-0.5 left-0.5 z-10 flex items-center justify-center transition-transform\",\n size === \"small\" && \"h-3 w-3\",\n size === \"medium\" && \"h-[1.125rem] w-[1.125rem]\",\n size === \"large\" && \"h-5 w-5\",\n isChecked && \"translate-x-full\"\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],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AAAxB,CAAA,CAAA,CACH,CAAA,EAGN,EAGCG,GAAY,CAACH,GACZ9B,EAAAA,IAAC,MAAA,CAAI,GAAI,GAAGK,CAAE,eAAgB,UAAU,UACrC,SAAA4B,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,CAGN,CACF,EAEA/B,EAAO,YAAc"}
|
|
1
|
+
{"version":3,"file":"Toggle.cjs.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\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 * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\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 /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\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?: 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 /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-1 after:left-0.5\",\n medium: \"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-white':\n isChecked,\n 'after:bg-white dark:after:bg-white': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\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 ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n // Overlay the icon on the sliding knob using the knob's exact\n // geometry (same top/left, same size, same full-width slide) so\n // it stays perfectly centered in the circle for every size/state.\n <div\n className={cn(\n \"pointer-events-none absolute top-0.5 left-0.5 z-10 flex items-center justify-center transition-transform\",\n size === \"small\" && \"h-3 w-3\",\n size === \"medium\" && \"h-[1.125rem] w-[1.125rem]\",\n size === \"large\" && \"h-5 w-5\",\n isChecked && \"translate-x-full\"\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":"stBA+IMA,GAAsB,CAC1BC,EACAC,EACAC,EACAC,EAAqC,WAC1B,CACX,MAAMC,EAAc,CAClB,MAAO,yDACP,OAAQ,uFACR,MAAO,2DAAA,EAGHC,EAAmB,CACvB,MAAO,mCACP,OAAQ,sCACR,MAAO,kCAAA,EAGT,OAAOC,EACL,0fACAF,EAAYD,CAAI,EAChBE,EAAiBF,CAAI,EACrB,CACE,sIACEH,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x } from "../../../constants/toggle.es.js";
|
|
|
9
9
|
import { BoltOutlined as me, NoteAddOutlined as fe } from "@mui/icons-material";
|
|
10
10
|
import { AIExtractedIndicator as pe } from "../../icons/AIExtractedIndicator.es.js";
|
|
11
11
|
import { AIStarIcon as ue } from "../../icons/AIStarIcon.es.js";
|
|
12
|
-
import { Label as
|
|
12
|
+
import { Label as he } from "../../data-display/label/Label.es.js";
|
|
13
13
|
import L from "../../tooltip/Tooltip.es.js";
|
|
14
|
-
import { HelpIcon as
|
|
14
|
+
import { HelpIcon as ge } from "../../icons/HelpIcon.es.js";
|
|
15
15
|
import { InputLabel as be } from "../shared/InputLabel.es.js";
|
|
16
16
|
import { shouldShowConfidenceScore as O, getConfidenceScoreBadgeFill as xe, getConfidenceScoreBadgeColor as ve, getConfidenceScoreBadgeTextColor as ke, getConfidenceScoreBadgeClass as ye } from "../../../utils/confidenceScoreUtils.es.js";
|
|
17
|
-
const we = (
|
|
17
|
+
const we = (t, a, o, u = "medium") => {
|
|
18
18
|
const n = {
|
|
19
|
-
small: "w-7 h-4 after:h-3 after:w-3 after:top-
|
|
19
|
+
small: "w-7 h-4 after:h-3 after:w-3 after:top-1 after:left-0.5",
|
|
20
20
|
medium: "w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5",
|
|
21
21
|
large: "w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5"
|
|
22
|
-
},
|
|
22
|
+
}, h = {
|
|
23
23
|
small: "peer-checked:after:translate-x-3",
|
|
24
24
|
medium: "peer-checked:after:translate-x-full",
|
|
25
25
|
large: "peer-checked:after:translate-x-5"
|
|
26
26
|
};
|
|
27
27
|
return r(
|
|
28
|
-
"
|
|
28
|
+
"rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]",
|
|
29
29
|
n[u],
|
|
30
|
-
|
|
30
|
+
h[u],
|
|
31
31
|
{
|
|
32
|
-
"peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-
|
|
33
|
-
"after:bg-white dark:after:bg-
|
|
34
|
-
"text-white dark:text-black-900":
|
|
32
|
+
"peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-white": t,
|
|
33
|
+
"after:bg-white dark:after:bg-white": !t,
|
|
34
|
+
"text-white dark:text-black-900": a,
|
|
35
35
|
"cursor-not-allowed opacity-70": o
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
|
-
}, Ne = ({ size:
|
|
38
|
+
}, Ne = ({ size: t = 18, fill: a = "#016DCF" }) => /* @__PURE__ */ e("svg", { width: t, height: t, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ e(
|
|
39
39
|
"path",
|
|
40
40
|
{
|
|
41
41
|
d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",
|
|
42
|
-
fill:
|
|
42
|
+
fill: a
|
|
43
43
|
}
|
|
44
|
-
) }), Ce = ({ size:
|
|
44
|
+
) }), Ce = ({ size: t = 18, fill: a = "#101828" }) => /* @__PURE__ */ e("svg", { width: t, height: t, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ e(
|
|
45
45
|
"path",
|
|
46
46
|
{
|
|
47
47
|
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z",
|
|
48
|
-
fill:
|
|
48
|
+
fill: a
|
|
49
49
|
}
|
|
50
50
|
) }), Fe = ie(
|
|
51
51
|
({
|
|
52
|
-
isGTN:
|
|
53
|
-
isChecked:
|
|
52
|
+
isGTN: t = !1,
|
|
53
|
+
isChecked: a,
|
|
54
54
|
id: o,
|
|
55
55
|
onChange: u,
|
|
56
56
|
label: n,
|
|
57
|
-
required:
|
|
57
|
+
required: h,
|
|
58
58
|
isRequiredConditional: z = !1,
|
|
59
59
|
hideStatus: R = !1,
|
|
60
60
|
labelDirection: v = x.TOP,
|
|
@@ -71,7 +71,7 @@ const we = (a, t, o, u = "medium") => {
|
|
|
71
71
|
className: V = "",
|
|
72
72
|
disabled: W,
|
|
73
73
|
isDisabled: Y = !1,
|
|
74
|
-
icon:
|
|
74
|
+
icon: g,
|
|
75
75
|
stopClickPropagation: G = !0,
|
|
76
76
|
gtnName: J,
|
|
77
77
|
variant: Ie = "primary",
|
|
@@ -87,10 +87,10 @@ const we = (a, t, o, u = "medium") => {
|
|
|
87
87
|
onAddGTNToDocument: D,
|
|
88
88
|
inputEmphasis: C = "default"
|
|
89
89
|
}, U) => {
|
|
90
|
-
const { t: X } = de(), Z = C === "modified", ee = C === "deleted", re = C === "success", F = W ?? Y, b = !!F, E = typeof F == "string" ? F : void 0,
|
|
90
|
+
const { t: X } = de(), Z = C === "modified", ee = C === "deleted", re = C === "success", F = W ?? Y, b = !!F, E = typeof F == "string" ? F : void 0, te = v === x.TOP, ae = v === x.LEFT, A = v === x.RIGHT, [I, P] = oe(!1), M = () => {
|
|
91
91
|
D && D({
|
|
92
92
|
key: J,
|
|
93
|
-
value:
|
|
93
|
+
value: a ? "Yes" : "No"
|
|
94
94
|
});
|
|
95
95
|
}, le = () => m === "error" ? "text-red-500 dark:text-red-400" : m === "success" ? "text-green-500 dark:text-green-400" : m === "info" ? "text-primary-500 dark:text-primary-400" : "text-neutral-500 dark:text-neutral-400";
|
|
96
96
|
return /* @__PURE__ */ l(
|
|
@@ -98,7 +98,7 @@ const we = (a, t, o, u = "medium") => {
|
|
|
98
98
|
{
|
|
99
99
|
className: r(
|
|
100
100
|
"flex gap-0.5",
|
|
101
|
-
I &&
|
|
101
|
+
I && t ? "border rounded-lg border-primary-100 bg-primary-50 p-1" : "",
|
|
102
102
|
Q
|
|
103
103
|
),
|
|
104
104
|
onMouseEnter: () => P(!0),
|
|
@@ -107,14 +107,14 @@ const we = (a, t, o, u = "medium") => {
|
|
|
107
107
|
G && s.stopPropagation();
|
|
108
108
|
},
|
|
109
109
|
children: [
|
|
110
|
-
|
|
110
|
+
t && !I ? /* @__PURE__ */ e("div", { className: "w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5" }) : null,
|
|
111
111
|
/* @__PURE__ */ l("div", { className: r(
|
|
112
112
|
"w-full flex flex-col",
|
|
113
113
|
Z && "rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5",
|
|
114
114
|
ee && "rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5",
|
|
115
115
|
re && "rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5"
|
|
116
116
|
), children: [
|
|
117
|
-
|
|
117
|
+
te && n && /* @__PURE__ */ l("div", { className: "grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1", children: [
|
|
118
118
|
/* @__PURE__ */ l(
|
|
119
119
|
"h1",
|
|
120
120
|
{
|
|
@@ -123,11 +123,11 @@ const we = (a, t, o, u = "medium") => {
|
|
|
123
123
|
N
|
|
124
124
|
),
|
|
125
125
|
children: [
|
|
126
|
-
/* @__PURE__ */ e(be, { label: n || "", required:
|
|
126
|
+
/* @__PURE__ */ e(be, { label: n || "", required: h || !1, isRequiredConditional: z || !1 }),
|
|
127
127
|
K && /* @__PURE__ */ e(me, { sx: { fontSize: 16, color: "var(--color-primary-600)", rotate: "15deg" } }),
|
|
128
128
|
H && !O(y) && /* @__PURE__ */ e(pe, {}),
|
|
129
|
-
/* @__PURE__ */ e(
|
|
130
|
-
_ && /* @__PURE__ */ e(L, { placement: "top", title: _, children: /* @__PURE__ */ e("div", { className: "cursor-pointer", children: /* @__PURE__ */ e(
|
|
129
|
+
/* @__PURE__ */ e(he, { labels: j || [] }),
|
|
130
|
+
_ && /* @__PURE__ */ e(L, { placement: "top", title: _, children: /* @__PURE__ */ e("div", { className: "cursor-pointer", children: /* @__PURE__ */ e(ge, { className: "w-icon-sm h-icon-sm" }) }) }),
|
|
131
131
|
T
|
|
132
132
|
]
|
|
133
133
|
}
|
|
@@ -166,7 +166,7 @@ const we = (a, t, o, u = "medium") => {
|
|
|
166
166
|
)
|
|
167
167
|
}
|
|
168
168
|
) : null,
|
|
169
|
-
|
|
169
|
+
t && I ? B ? B(M) : /* @__PURE__ */ e(
|
|
170
170
|
"button",
|
|
171
171
|
{
|
|
172
172
|
id: "btn-toggle-add-to-document",
|
|
@@ -189,7 +189,7 @@ const we = (a, t, o, u = "medium") => {
|
|
|
189
189
|
}
|
|
190
190
|
),
|
|
191
191
|
/* @__PURE__ */ l("div", { className: "flex", children: [
|
|
192
|
-
|
|
192
|
+
ae && /* @__PURE__ */ e(
|
|
193
193
|
p,
|
|
194
194
|
{
|
|
195
195
|
size: "small",
|
|
@@ -218,14 +218,14 @@ const we = (a, t, o, u = "medium") => {
|
|
|
218
218
|
onChange: (s) => !b && u(s.target.checked),
|
|
219
219
|
value: "",
|
|
220
220
|
disabled: b,
|
|
221
|
-
checked:
|
|
221
|
+
checked: a,
|
|
222
222
|
className: r("sr-only peer w-full", V),
|
|
223
|
-
"aria-required":
|
|
223
|
+
"aria-required": h,
|
|
224
224
|
"aria-invalid": d && m === "error" ? "true" : "false",
|
|
225
225
|
"aria-describedby": d || f ? `${o}-description` : void 0
|
|
226
226
|
}
|
|
227
227
|
),
|
|
228
|
-
/* @__PURE__ */ e("div", { className: we(
|
|
228
|
+
/* @__PURE__ */ e("div", { className: we(a, S, b, i), children: S ? (
|
|
229
229
|
// Overlay the icon on the sliding knob using the knob's exact
|
|
230
230
|
// geometry (same top/left, same size, same full-width slide) so
|
|
231
231
|
// it stays perfectly centered in the circle for every size/state.
|
|
@@ -237,9 +237,9 @@ const we = (a, t, o, u = "medium") => {
|
|
|
237
237
|
i === "small" && "h-3 w-3",
|
|
238
238
|
i === "medium" && "h-[1.125rem] w-[1.125rem]",
|
|
239
239
|
i === "large" && "h-5 w-5",
|
|
240
|
-
|
|
240
|
+
a && "translate-x-full"
|
|
241
241
|
),
|
|
242
|
-
children:
|
|
242
|
+
children: a ? g?.checkedIcon ? g.checkedIcon : /* @__PURE__ */ e(Ne, { size: 18, fill: "#016DCF" }) : g?.uncheckedIcon ? g.uncheckedIcon : /* @__PURE__ */ e(Ce, { size: 18, fill: "#101828" })
|
|
243
243
|
}
|
|
244
244
|
)
|
|
245
245
|
) : null }),
|
|
@@ -266,7 +266,7 @@ const we = (a, t, o, u = "medium") => {
|
|
|
266
266
|
variant: "medium",
|
|
267
267
|
className: "ml-2 text-neutral-900 dark:text-black-100",
|
|
268
268
|
appearance: "custom",
|
|
269
|
-
children: k || (
|
|
269
|
+
children: k || (a ? "Yes" : "No")
|
|
270
270
|
}
|
|
271
271
|
)
|
|
272
272
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.es.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\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 * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\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 /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\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?: 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 /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-0.5 after:left-0.5\",\n medium: \"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"p-0.5 rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-primary-500':\n isChecked,\n 'after:bg-white dark:after:bg-black-500': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\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 ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n // Overlay the icon on the sliding knob using the knob's exact\n // geometry (same top/left, same size, same full-width slide) so\n // it stays perfectly centered in the circle for every size/state.\n <div\n className={cn(\n \"pointer-events-none absolute top-0.5 left-0.5 z-10 flex items-center justify-center transition-transform\",\n size === \"small\" && \"h-3 w-3\",\n size === \"medium\" && \"h-[1.125rem] w-[1.125rem]\",\n size === \"large\" && \"h-5 w-5\",\n isChecked && \"translate-x-full\"\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":";;;;;;;;;;;;;;;;AA+IA,MAAMA,KAAsB,CAC1BC,GACAC,GACAC,GACAC,IAAqC,aAC1B;AACX,QAAMC,IAAc;AAAA,IAClB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA,GAGHC,IAAmB;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA;AAGT,SAAOC;AAAA,IACL;AAAA,IACAF,EAAYD,CAAI;AAAA,IAChBE,EAAiBF,CAAI;AAAA,IACrB;AAAA,MACE,6IACEH;AAAA,MACF,0CAA0C,CAACA;AAAA,MAC3C,kCAAkCC;AAAA,MAClC,iCAAiCC;AAAA,IAAA;AAAA,EACnC;AAEJ,GAKMK,KAAY,CAAC,EAAE,MAAAJ,IAAO,IAAI,MAAAK,IAAO,UAAA,MACrC,gBAAAC,EAAC,OAAA,EAAI,OAAON,GAAM,QAAQA,GAAM,SAAQ,aAAY,MAAK,QACvD,UAAA,gBAAAM;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,GAAE;AAAA,IACF,MAAAD;AAAA,EAAA;AACF,GACF,GAMIE,KAAY,CAAC,EAAE,MAAAP,IAAO,IAAI,MAAAK,IAAO,UAAA,MACrC,gBAAAC,EAAC,OAAA,EAAI,OAAON,GAAM,QAAQA,GAAM,SAAQ,aAAY,MAAK,QACvD,UAAA,gBAAAM;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,GAAE;AAAA,IACF,MAAAD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;AAAA,sBAACuE;AAAA,sBAAA;AAAA,wBACC,MAAK;AAAA,wBACL,SAAQ;AAAA,wBACR,WAAU;AAAA,wBACV,YAAW;AAAA,wBAEV,UAAA1D,MAA0BtB,IAAY,QAAQ;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACjD;AAAA,gBAAA;AAAA,cAAA;AAAA,YAEJ,GACF;AAAA,YAGA,gBAAAS,EAACwE,MACE,UAAA1C,KACC,gBAAA9B;AAAA,cAACyE,GAAO;AAAA,cAAP;AAAA,gBACC,SAAS,EAAE,SAAS,GAAG,GAAG,IAAA;AAAA,gBAC1B,SAAS,EAAE,SAAS,GAAG,GAAG,EAAA;AAAA,gBAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,IAAA;AAAA,gBACvB,YAAY,EAAE,UAAU,IAAA;AAAA,gBACxB,IAAI,GAAGpE,CAAE;AAAA,gBACT,MAAM0B,MAAgB,UAAU,UAAU;AAAA,gBAE1C,UAAA,gBAAA/B;AAAA,kBAACuE;AAAA,kBAAA;AAAA,oBACC,WAAW1E,EAAG,QAAQyD,IAA2B;AAAA,oBACjD,YAAW;AAAA,oBACX,MAAK;AAAA,oBACL,SAAQ;AAAA,oBAEP,UAAAxB;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACH;AAAA,YAAA,GAGN;AAAA,YAGCG,KAAY,CAACH,KACZ,gBAAA9B,EAAC,OAAA,EAAI,IAAI,GAAGK,CAAE,gBAAgB,WAAU,WACrC,UAAA4B,EAAA,CACH;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA/B,GAAO,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Toggle.es.js","sources":["../../../../src/components/forms/toggle/Toggle.tsx"],"sourcesContent":["import cn from \"classnames\";\nimport { forwardRef, type ReactNode, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { TOGGLE_LABEL_DIRECTION } from \"../../../constants/toggle\";\nimport type { TToggleDirection } from \"../../../constants/toggle\";\nimport { BoltOutlined, NoteAddOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { Label, type LabelType } from \"../../data-display/label/Label\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\n\n// Re-export LabelType from Label component for external use\nexport type { LabelType };\n\n/** Visual emphasis for the toggle container (background + border) */\nexport type ToggleEmphasis = \"default\" | \"modified\" | \"deleted\" | \"success\";\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 * Props for the Toggle component\n */\nexport interface ToggleProps {\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** Unique identifier for the toggle */\n id?: string;\n /** Whether the toggle is checked */\n isChecked: boolean;\n /** Callback function called when toggle state changes */\n onChange: (val: boolean) => void;\n /** Label text or element to display */\n label?: ReactNode;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\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 /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Whether to hide the status text (Yes/No) */\n hideStatus?: boolean;\n /** Label direction relative to toggle */\n labelDirection?: TToggleDirection;\n /** Custom status text instead of Yes/No */\n statusText?: string;\n /** Whether to show icons in the toggle */\n withIcon?: boolean;\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?: 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 /** Tooltip text to display */\n tooltip?: string;\n /** Additional CSS classes for the toggle input */\n className?: string;\n /** Whether the toggle is disabled. Pass a string to disable with a tooltip message. */\n disabled?: boolean | string;\n /**\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean | string;\n /** Custom icons for checked/unchecked states */\n icon?: {\n checkedIcon: ReactNode;\n uncheckedIcon: ReactNode;\n };\n /** Whether to stop click propagation */\n stopClickPropagation?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Visual variant for the toggle */\n variant?: 'primary' | 'secondary';\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Message to display below the toggle */\n message?: string;\n /** Type of message to display */\n messageType?: \"success\" | \"error\" | \"info\" | \"default\";\n /** Additional CSS classes for the wrapper container */\n wrapperClassName?: string;\n /** Help text to display below the label */\n helpText?: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Size variant for the toggle */\n size?: \"small\" | \"medium\" | \"large\";\n /** Custom render function for GTN add to document button */\n renderGTNAddButton?: (onClick: () => void) => ReactNode;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Container surface style: `'modified'` — Warning-50/Warning-200; `'deleted'` — Error-50/Error-200; `'success'` — Success-50/Success-200 */\n inputEmphasis?: ToggleEmphasis;\n}\n\n/**\n * Get toggle class names based on state and options\n */\nconst getToggleClassNames = (\n isChecked: boolean,\n withIcon: boolean,\n isDisabled: boolean,\n size: \"small\" | \"medium\" | \"large\" = \"medium\"\n): string => {\n const sizeClasses = {\n small: \"w-7 h-4 after:h-3 after:w-3 after:top-1 after:left-0.5\",\n medium: \"w-10 h-[1.375rem] after:h-[1.125rem] after:w-[1.125rem] after:top-0.5 after:left-0.5\",\n large: \"w-11 h-6 after:h-5 after:w-5 after:top-0.5 after:left-0.5\",\n };\n\n const translateClasses = {\n small: \"peer-checked:after:translate-x-3\",\n medium: \"peer-checked:after:translate-x-full\",\n large: \"peer-checked:after:translate-x-5\",\n };\n\n return cn(\n \"rounded-full peer after:content-[''] after:absolute after:rounded-full after:transition-all bg-gray-200 dark:bg-black-400 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-primary-400 dark:peer-focus-visible:ring-offset-black-900 peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-100)] dark:peer-focus-visible:shadow-[0_0_0_3px_var(--color-primary-950)]\",\n sizeClasses[size],\n translateClasses[size],\n {\n 'peer-checked:bg-primary-600 dark:peer-checked:bg-primary-700 peer-checked:after:translate-x-full after:bg-white dark:after:bg-white':\n isChecked,\n 'after:bg-white dark:after:bg-white': !isChecked,\n 'text-white dark:text-black-900': withIcon,\n 'cursor-not-allowed opacity-70': isDisabled,\n }\n );\n};\n\n/**\n * Default Check icon component\n */\nconst CheckIcon = ({ size = 18, fill = '#016DCF' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * Default Close icon component\n */\nconst CloseIcon = ({ size = 18, fill = '#101828' }: { size?: number; fill?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n fill={fill}\n />\n </svg>\n);\n\n/**\n * A highly customizable toggle component with label, validation, and styling support.\n * Features multiple sizes, variants, icon support, GTN integration, and comprehensive prop support.\n *\n * @example\n * ```tsx\n * <Toggle\n * id=\"notifications\"\n * label=\"Enable Notifications\"\n * isChecked={notificationsEnabled}\n * onChange={(checked) => setNotificationsEnabled(checked)}\n * required\n * />\n * ```\n */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n (\n {\n isGTN = false,\n isChecked,\n id,\n onChange,\n label,\n required,\n isRequiredConditional = false,\n hideStatus = false,\n labelDirection = TOGGLE_LABEL_DIRECTION.TOP,\n statusText,\n withIcon = false,\n tags,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n tooltip = '',\n className = '',\n disabled,\n isDisabled = false,\n icon,\n stopClickPropagation = true,\n gtnName: _gtnName,\n variant: _variant = 'primary',\n labelClassName,\n isLiveField = false,\n message,\n messageType = \"default\",\n wrapperClassName,\n helpText,\n labelExtra,\n size = \"medium\",\n renderGTNAddButton,\n onAddGTNToDocument,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\";\n const emphasisDeletedSkin = inputEmphasis === \"deleted\";\n const emphasisSuccessSkin = inputEmphasis === \"success\";\n const resolvedDisabled = disabled ?? isDisabled;\n const isDisabledBool = !!resolvedDisabled;\n const disabledTooltip = typeof resolvedDisabled === 'string' ? resolvedDisabled : undefined;\n const isLabelDirectionTop = labelDirection === TOGGLE_LABEL_DIRECTION.TOP;\n const isLabelDirectionLeft = labelDirection === TOGGLE_LABEL_DIRECTION.LEFT;\n const isLabelDirectionRight = labelDirection === TOGGLE_LABEL_DIRECTION.RIGHT;\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = () => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: _gtnName,\n value: isChecked ? 'Yes' : 'No',\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getMessageTypographyClass = (): string => {\n if (messageType === \"error\") return \"text-red-500 dark:text-red-400\";\n if (messageType === \"success\")\n return \"text-green-500 dark:text-green-400\";\n if (messageType === \"info\") return \"text-primary-500 dark:text-primary-400\";\n return \"text-neutral-500 dark:text-neutral-400\";\n };\n\n const _defaultRenderLabels = (labels?: (string | LabelType)[]) => {\n if (!labels || labels.length === 0) return null;\n return (\n <span className=\"inline-flex gap-1 ml-1\">\n {labels.map((tag, index) => {\n const label = typeof tag === 'string' ? tag : tag.label;\n const color = typeof tag === 'string' ? undefined : tag.color;\n return (\n <span\n key={index}\n className=\"px-1.5 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300\"\n style={color ? { backgroundColor: color } : undefined}\n >\n {label}\n </span>\n );\n })}\n </span>\n );\n };\n\n return (\n <div\n className={cn(\n 'flex gap-0.5',\n isHovered && isGTN ? 'border rounded-lg border-primary-100 bg-primary-50 p-1' : '',\n wrapperClassName\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={(e) => {\n if (stopClickPropagation) e.stopPropagation();\n }}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-pulse mt-1.5\" />\n ) : null}\n <div className={cn(\n \"w-full flex flex-col\",\n emphasisModifiedSkin && \"rounded-lg border border-solid border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] px-2 py-1.5\",\n emphasisDeletedSkin && \"rounded-lg border border-solid border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] px-2 py-1.5\",\n emphasisSuccessSkin && \"rounded-lg border border-solid border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] px-2 py-1.5\",\n )}>\n {isLabelDirectionTop && label && (\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <h1\n className={cn(\n 'mb-1 min-w-0 font-inter text-neutral-600 font-medium text-xs flex items-center gap-0.5 flex-wrap',\n labelClassName\n )}\n >\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && <BoltOutlined sx={{ fontSize: 16, color: 'var(--color-primary-600)', rotate: '15deg' }} />}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags || []} />\n {tooltip && (\n <Tooltip placement='top' title={tooltip}>\n <div className='cursor-pointer'>\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </h1>\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 ? (\n renderGTNAddButton ? (\n renderGTNAddButton(handleAddGTNToDocument)\n ) : (\n <button\n id=\"btn-toggle-add-to-document\"\n className=\"cursor-pointer\"\n onClick={handleAddGTNToDocument}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined className=\"text-primary-600\" sx={{ fontSize: 16 }} />\n </AntTooltip>\n </button>\n )\n ) : null}\n </div>\n </div>\n )}\n\n {/* Help text */}\n {helpText && (\n <Typography\n className=\"mb-2 text-neutral-600 dark:text-neutral-400\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"regular\"\n >\n {helpText}\n </Typography>\n )}\n\n <div className=\"flex\">\n {isLabelDirectionLeft && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('mr-2 text-neutral-700 dark:text-black-200', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n <label\n className={cn(\n 'relative inline-flex items-center',\n isLabelDirectionRight || statusText ? '' : 'w-min',\n !isDisabledBool ? 'cursor-pointer' : 'cursor-not-allowed opacity-50'\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <input\n ref={ref}\n type=\"checkbox\"\n id={id}\n onChange={(e) => !isDisabledBool && onChange(e.target.checked)}\n value=\"\"\n disabled={isDisabledBool}\n checked={isChecked}\n className={cn('sr-only peer w-full', className)}\n aria-required={required}\n aria-invalid={\n message && messageType === \"error\" ? \"true\" : \"false\"\n }\n aria-describedby={\n message || helpText ? `${id}-description` : undefined\n }\n />\n <div className={getToggleClassNames(isChecked, withIcon, isDisabledBool, size)}>\n {withIcon ? (\n // Overlay the icon on the sliding knob using the knob's exact\n // geometry (same top/left, same size, same full-width slide) so\n // it stays perfectly centered in the circle for every size/state.\n <div\n className={cn(\n \"pointer-events-none absolute top-0.5 left-0.5 z-10 flex items-center justify-center transition-transform\",\n size === \"small\" && \"h-3 w-3\",\n size === \"medium\" && \"h-[1.125rem] w-[1.125rem]\",\n size === \"large\" && \"h-5 w-5\",\n isChecked && \"translate-x-full\"\n )}\n >\n {isChecked ? (\n icon?.checkedIcon ? (\n icon.checkedIcon\n ) : (\n <CheckIcon size={18} fill=\"#016DCF\" />\n )\n ) : icon?.uncheckedIcon ? (\n icon.uncheckedIcon\n ) : (\n <CloseIcon size={18} fill=\"#101828\" />\n )}\n </div>\n ) : null}\n </div>\n {disabledTooltip && (\n <Tooltip placement=\"top\" title={disabledTooltip} className=\"-ml-2\">\n <span className={cn(\n 'absolute inset-y-0 left-0',\n size === 'small' && 'w-7',\n size === 'medium' && 'w-9',\n size === 'large' && 'w-11',\n )} />\n </Tooltip>\n )}\n\n {isLabelDirectionRight && (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className={cn('ml-2 text-neutral-700 dark:text-black-300', labelClassName)}\n appearance=\"custom\"\n >\n {label}\n </Typography>\n )}\n\n {hideStatus ? null : (\n <Typography\n size=\"small\"\n variant=\"medium\"\n className=\"ml-2 text-neutral-900 dark:text-black-100\"\n appearance=\"custom\"\n >\n {statusText ? statusText : isChecked ? 'Yes' : 'No'}\n </Typography>\n )}\n </label>\n </div>\n\n {/* Message */}\n <AnimatePresence>\n {message && (\n <motion.div\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.2 }}\n id={`${id}-description`}\n role={messageType === \"error\" ? \"alert\" : undefined}\n >\n <Typography\n className={cn(\"mt-1\", getMessageTypographyClass())}\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {message}\n </Typography>\n </motion.div>\n )}\n </AnimatePresence>\n\n {/* Help text description for accessibility */}\n {helpText && !message && (\n <div id={`${id}-description`} className=\"sr-only\">\n {helpText}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nToggle.displayName = \"Toggle\";\n"],"names":["getToggleClassNames","isChecked","withIcon","isDisabled","size","sizeClasses","translateClasses","cn","CheckIcon","fill","jsx","CloseIcon","Toggle","forwardRef","isGTN","id","onChange","label","required","isRequiredConditional","hideStatus","labelDirection","TOGGLE_LABEL_DIRECTION","statusText","tags","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","tooltip","className","disabled","icon","stopClickPropagation","_gtnName","_variant","labelClassName","isLiveField","message","messageType","wrapperClassName","helpText","labelExtra","renderGTNAddButton","onAddGTNToDocument","inputEmphasis","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","resolvedDisabled","isDisabledBool","disabledTooltip","isLabelDirectionTop","isLabelDirectionLeft","isLabelDirectionRight","isHovered","setIsHovered","useState","handleAddGTNToDocument","getMessageTypographyClass","jsxs","e","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","Typography","AnimatePresence","motion"],"mappings":";;;;;;;;;;;;;;;;AA+IA,MAAMA,KAAsB,CAC1BC,GACAC,GACAC,GACAC,IAAqC,aAC1B;AACX,QAAMC,IAAc;AAAA,IAClB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA,GAGHC,IAAmB;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA;AAGT,SAAOC;AAAA,IACL;AAAA,IACAF,EAAYD,CAAI;AAAA,IAChBE,EAAiBF,CAAI;AAAA,IACrB;AAAA,MACE,uIACEH;AAAA,MACF,sCAAsC,CAACA;AAAA,MACvC,kCAAkCC;AAAA,MAClC,iCAAiCC;AAAA,IAAA;AAAA,EACnC;AAEJ,GAKMK,KAAY,CAAC,EAAE,MAAAJ,IAAO,IAAI,MAAAK,IAAO,UAAA,MACrC,gBAAAC,EAAC,OAAA,EAAI,OAAON,GAAM,QAAQA,GAAM,SAAQ,aAAY,MAAK,QACvD,UAAA,gBAAAM;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,GAAE;AAAA,IACF,MAAAD;AAAA,EA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