@lax-wp/design-system 0.13.33-beta.4 → 0.13.33-beta.6

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.
Files changed (51) hide show
  1. package/dist/components/forms/base-input-field/BaseInputField.cjs.js +2 -2
  2. package/dist/components/forms/base-input-field/BaseInputField.cjs.js.map +1 -1
  3. package/dist/components/forms/base-input-field/BaseInputField.es.js +20 -20
  4. package/dist/components/forms/base-input-field/BaseInputField.es.js.map +1 -1
  5. package/dist/components/forms/creatable-select/CreatableSelect.cjs.js +1 -1
  6. package/dist/components/forms/creatable-select/CreatableSelect.cjs.js.map +1 -1
  7. package/dist/components/forms/creatable-select/CreatableSelect.es.js +7 -7
  8. package/dist/components/forms/creatable-select/CreatableSelect.es.js.map +1 -1
  9. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js +1 -1
  10. package/dist/components/forms/currency-input/CurrencyInputField.cjs.js.map +1 -1
  11. package/dist/components/forms/currency-input/CurrencyInputField.es.js +12 -12
  12. package/dist/components/forms/currency-input/CurrencyInputField.es.js.map +1 -1
  13. package/dist/components/forms/date-time-field/DateTimeField.cjs.js +1 -1
  14. package/dist/components/forms/date-time-field/DateTimeField.cjs.js.map +1 -1
  15. package/dist/components/forms/date-time-field/DateTimeField.es.js +1 -1
  16. package/dist/components/forms/date-time-field/DateTimeField.es.js.map +1 -1
  17. package/dist/components/forms/dynamic-data-input/DynamicDataInput.cjs.js +1 -1
  18. package/dist/components/forms/dynamic-data-input/DynamicDataInput.cjs.js.map +1 -1
  19. package/dist/components/forms/dynamic-data-input/DynamicDataInput.es.js +7 -7
  20. package/dist/components/forms/dynamic-data-input/DynamicDataInput.es.js.map +1 -1
  21. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js +1 -1
  22. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.cjs.js.map +1 -1
  23. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js +1 -1
  24. package/dist/components/forms/dynamic-data-input/DynamicDataInputField.es.js.map +1 -1
  25. package/dist/components/forms/formula-input/FormulaInput.cjs.js +1 -1
  26. package/dist/components/forms/formula-input/FormulaInput.cjs.js.map +1 -1
  27. package/dist/components/forms/formula-input/FormulaInput.es.js +10 -10
  28. package/dist/components/forms/formula-input/FormulaInput.es.js.map +1 -1
  29. package/dist/components/forms/input-field/InputField.cjs.js.map +1 -1
  30. package/dist/components/forms/input-field/InputField.es.js.map +1 -1
  31. package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js +1 -1
  32. package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js.map +1 -1
  33. package/dist/components/forms/master-data-input/MasterDataInputField.es.js +1 -1
  34. package/dist/components/forms/master-data-input/MasterDataInputField.es.js.map +1 -1
  35. package/dist/components/forms/percentage-input/PercentageInputField.cjs.js +2 -2
  36. package/dist/components/forms/percentage-input/PercentageInputField.cjs.js.map +1 -1
  37. package/dist/components/forms/percentage-input/PercentageInputField.es.js +19 -19
  38. package/dist/components/forms/percentage-input/PercentageInputField.es.js.map +1 -1
  39. package/dist/components/forms/select-field/SelectField.cjs.js +2 -2
  40. package/dist/components/forms/select-field/SelectField.cjs.js.map +1 -1
  41. package/dist/components/forms/select-field/SelectField.es.js +1 -1
  42. package/dist/components/forms/select-field/SelectField.es.js.map +1 -1
  43. package/dist/components/forms/text-area-field/TextAreaField.cjs.js +1 -1
  44. package/dist/components/forms/text-area-field/TextAreaField.cjs.js.map +1 -1
  45. package/dist/components/forms/text-area-field/TextAreaField.es.js +14 -14
  46. package/dist/components/forms/text-area-field/TextAreaField.es.js.map +1 -1
  47. package/dist/components/forms/toggle/Toggle.cjs.js +1 -1
  48. package/dist/components/forms/toggle/Toggle.cjs.js.map +1 -1
  49. package/dist/components/forms/toggle/Toggle.es.js +62 -56
  50. package/dist/components/forms/toggle/Toggle.es.js.map +1 -1
  51. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CreatableSelect.cjs.js","sources":["../../../../src/components/forms/creatable-select/CreatableSelect.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport CreatableSelect from \"react-select/creatable\";\nimport { CancelRounded, ChevronLeftRounded } from \"@mui/icons-material\";\nimport { Tooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { useState, type ComponentProps } from \"react\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport { useIsDarkMode } from \"../../../hooks/useIsDarkMode\";\n\n/**\n * Option type for the CreatableSelect component\n */\nexport interface SelectOption {\n /** The value of the option */\n value: string | number;\n /** The label displayed for the option */\n label: string;\n /** Whether the option is disabled */\n isDisabled?: boolean;\n /** Additional data for the option */\n data?: Record<string, unknown>;\n}\n\n/**\n * Props for the CreatableSelectField component\n * Matches the lax-web-portal implementation for drop-in replacement\n */\nexport type TProps = {\n /** Unique identifier for the select */\n id: string;\n /** Label text to display above the select */\n label: string;\n /** Placeholder text for the select */\n placeholder?: string;\n /** Current value for single select */\n value?: any;\n /** Callback function called when selection changes */\n onChange(data: any): void;\n /** Error message to display below the select */\n errorMessage?: string;\n /** Array of available options */\n selectOptions: any[];\n /** Whether the select is in loading state */\n loading?: boolean;\n /** Whether multiple selections are allowed */\n multiSelect?: boolean;\n /** Current values for multi select */\n selectedValues?: any[];\n /** Custom filter function for options */\n filterOption?: any;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the select is disabled */\n disabled?: boolean;\n /** Whether the select is clearable */\n isClearable?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Additional CSS classes for the wrapper */\n className?: string;\n};\n\n// Export type alias for backward compatibility\nexport type CreatableSelectProps = TProps & ComponentProps<typeof CreatableSelect>;\n\n/**\n * A creatable select component with label, validation, and styling support.\n * Features dark mode support, accessibility enhancements, and comprehensive prop support.\n * Built on top of react-select/creatable for advanced functionality.\n *\n * This component is designed as a drop-in replacement for the lax-web-portal\n * CreatableSelectField component.\n *\n * @example\n * ```tsx\n * <CreatableSelectField\n * id=\"tags\"\n * label=\"Tags\"\n * selectOptions={tagOptions}\n * value={selectedTag}\n * onChange={(newValue) => setSelectedTag(newValue)}\n * placeholder=\"Select or create tags...\"\n * multiSelect\n * />\n * ```\n */\nexport const CreatableSelectField = ({\n id,\n label,\n errorMessage,\n selectOptions,\n loading,\n isClearable,\n multiSelect,\n selectedValues,\n disabled,\n required,\n value,\n className,\n tooltip,\n tags,\n originalCase = false,\n onChange,\n filterOption,\n placeholder,\n ...props\n}: TProps & ComponentProps<typeof CreatableSelect>) => {\n const isDarkMode = useIsDarkMode();\n const [isHovered, setIsHovered] = useState(false);\n\n const handleChange = (newValue: any, _actionMeta?: any) => {\n // Call the original onChange handler\n if (onChange) {\n onChange(newValue);\n }\n\n // Dispatch pilot-change event for recording\n const containerElement = document.getElementById(id);\n if (containerElement) {\n const pilotChangeEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: newValue,\n type: \"change\",\n },\n });\n containerElement.dispatchEvent(pilotChangeEvent);\n }\n };\n\n const styleProps = {\n control: (baseStyles: any, state: any) => ({\n ...baseStyles,\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : state.isFocused\n ? \"var(--color-primary-600)\"\n : isDarkMode ? \"#434343\" : \"#d9d9d9\",\n backgroundColor: isDarkMode\n ? \"#141414\"\n : state.isDisabled ? \"#f5f5f5\" : \"#fff\",\n borderRadius: \"6px\",\n padding: \"0 4px 0 12px\",\n opacity: state.isDisabled ? 0.6 : 1,\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n boxShadow: state.isFocused\n ? isDarkMode\n ? \"0 0 0 1.5px var(--color-primary-950)\"\n : \"0 0 0 1.5px var(--color-primary-100)\"\n : \"none\",\n \"&:hover\": {\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : \"var(--color-primary-600)\",\n },\n }),\n valueContainer: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n padding: 0,\n }),\n input: (baseStyles: any) => ({\n ...baseStyles,\n margin: \"0\",\n padding: \"0\",\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"inherit\",\n }),\n indicatorsContainer: (baseStyles: any) => ({\n ...baseStyles,\n padding: 0,\n }),\n option: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"22px\",\n padding: \"5px 12px\",\n margin: 0,\n backgroundColor: state.isSelected\n ? isDarkMode ? \"var(--color-primary-975)\" : \"var(--color-primary-50)\"\n : state.isFocused\n ? isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\"\n : isDarkMode ? \"#141414\" : \"#fff\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode\n ? state.isSelected\n ? \"var(--color-primary-600)\"\n : \"rgba(255,255,255,0.85)\"\n : \"rgba(0,0,0,0.88)\",\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n opacity: state.isDisabled ? 0.6 : 1,\n \"&:hover\": {\n backgroundColor: state.isDisabled\n ? isDarkMode ? \"#141414\" : \"#fff\"\n : isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\",\n },\n \"&:active\": {\n backgroundColor: isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-50)\",\n },\n }),\n singleValue: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"20px\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode ? \"rgba(255,255,255,0.85)\" : \"rgba(0,0,0,0.88)\",\n }),\n placeholder: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n whiteSpace: \"nowrap\" as const,\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#bfbfbf\",\n }),\n multiValue: (baseStyles: any) => ({\n ...baseStyles,\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.08)\" : \"#f0f5ff\",\n border: isDarkMode ? \"1px solid transparent\" : \"1px solid #adc6ff\",\n borderRadius: \"4px\",\n }),\n multiValueLabel: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n fontSize: \"12px\",\n }),\n multiValueRemove: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n \"&:hover\": {\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.16)\" : \"#e6f4ff\",\n color: isDarkMode ? \"#fff\" : \"var(--color-primary-600)\",\n },\n }),\n menu: (baseStyles: any) => ({\n ...baseStyles,\n zIndex: 5001,\n borderRadius: \"8px\",\n boxShadow: isDarkMode\n ? \"0 6px 16px 0 rgba(0,0,0,0.45)\"\n : \"0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05)\",\n backgroundColor: isDarkMode ? \"#141414\" : \"#fff\",\n border: isDarkMode ? \"1px solid #303030\" : \"none\",\n overflow: \"hidden\",\n }),\n menuList: (baseStyles: any) => ({\n ...baseStyles,\n padding: \"0\",\n maxHeight: \"256px\",\n }),\n };\n\n const hasSelectedValues = !!selectedValues?.length;\n const hasValue = !!value;\n const isFieldClearable = isClearable ? hasSelectedValues || hasValue : false;\n const showClearIcon = isHovered && !disabled && isFieldClearable;\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleChange(multiSelect ? [] : null);\n };\n\n const DropdownIndicator = () => (\n <div className=\"flex items-center\">\n {showClearIcon ? (\n <CancelRounded\n onClick={handleClear}\n sx={{\n fontSize: \"16px\",\n cursor: \"pointer\",\n color: isDarkMode ? \"rgba(255,255,255,0.45)\" : \"rgba(0,0,0,0.25)\",\n \"&:hover\": {\n color: isDarkMode ? \"rgba(255,255,255,0.65)\" : \"rgba(0,0,0,0.45)\",\n },\n }}\n />\n ) : (\n <ChevronLeftRounded\n className=\"-rotate-90\"\n sx={{\n fontSize: \"18px\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"rgba(0,0,0,0.25)\",\n }}\n />\n )}\n </div>\n );\n\n return (\n <div\n id={id}\n className={cn(\"w-full flex flex-col gap-1\", className)}\n onMouseDown={(e) => e.stopPropagation()}\n role=\"group\"\n aria-labelledby={label ? id + \"Label\" : undefined}\n >\n {label && (\n <label\n id={id + \"Label\"}\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 dark:text-black-300 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"}`}\n >\n <InputLabel label={label || \"\"} required={required || false} />\n <Label labels={tags} />\n {tooltip && (\n <Tooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n </label>\n )}\n\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CreatableSelect\n {...props}\n id={\"cm\" + label}\n classNamePrefix=\"lax-select\"\n required={required}\n options={selectOptions}\n isClearable={false}\n isLoading={loading}\n isDisabled={disabled}\n styles={styleProps}\n isMulti={multiSelect}\n value={multiSelect ? selectedValues : value}\n onChange={handleChange}\n filterOption={filterOption}\n placeholder={placeholder}\n classNames={{\n menuList: () => \"nowheel\",\n control: ()=> \"!min-h-8 !text-sm\"\n }}\n components={{\n DropdownIndicator,\n IndicatorSeparator: () => null,\n }}\n />\n </div>\n {errorMessage && (\n <Typography\n className=\"text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n </div>\n );\n};\n\nCreatableSelectField.displayName = \"CreatableSelectField\";\n"],"names":["CreatableSelectField","id","label","errorMessage","selectOptions","loading","isClearable","multiSelect","selectedValues","disabled","required","value","className","tooltip","tags","originalCase","onChange","filterOption","placeholder","props","isDarkMode","useIsDarkMode","isHovered","setIsHovered","useState","handleChange","newValue","_actionMeta","containerElement","pilotChangeEvent","styleProps","baseStyles","state","hasSelectedValues","showClearIcon","handleClear","DropdownIndicator","jsx","CancelRounded","ChevronLeftRounded","jsxs","cn","InputLabel","Label","Tooltip","HelpIcon","CreatableSelect","Typography"],"mappings":"8fA8FaA,EAAuB,CAAC,CACnC,GAAAC,EACA,MAAAC,EACA,aAAAC,EACA,cAAAC,EACA,QAAAC,EACA,YAAAC,EACA,YAAAC,EACA,eAAAC,EACA,SAAAC,EACA,SAAAC,EACA,MAAAC,EACA,UAAAC,EACA,QAAAC,EACA,KAAAC,EACA,aAAAC,EAAe,GACf,SAAAC,EACA,aAAAC,EACA,YAAAC,EACA,GAAGC,CACL,IAAuD,CACrD,MAAMC,EAAaC,EAAAA,cAAA,EACb,CAACC,EAAWC,CAAY,EAAIC,EAAAA,SAAS,EAAK,EAE1CC,EAAe,CAACC,EAAeC,IAAsB,CAErDX,GACFA,EAASU,CAAQ,EAInB,MAAME,EAAmB,SAAS,eAAe3B,CAAE,EACnD,GAAI2B,EAAkB,CACpB,MAAMC,EAAmB,IAAI,YAAY,eAAgB,CACvD,QAAS,GACT,OAAQ,CACN,SAAU,IAAI5B,CAAE,GAChB,MAAOyB,EACP,KAAM,QAAA,CACR,CACD,EACDE,EAAiB,cAAcC,CAAgB,CACjD,CACF,EAEMC,EAAa,CACjB,QAAS,CAACC,EAAiBC,KAAgB,CACzC,GAAGD,EACH,YACE5B,GAAgBO,EACZU,EAAa,UAAY,UACzBY,EAAM,UACJ,2BACAZ,EAAa,UAAY,UACjC,gBAAiB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vC,SAAA,CAAAC,GACCsC,EAAAA,KAAC,QAAA,CACC,GAAIvC,EAAK,QACT,QAAQ,OACR,UAAW,wFAAyFc,EAA8B,GAAf,YAAiB,GAEpI,SAAA,CAAAsB,MAACK,EAAAA,YAAW,MAAOxC,GAAS,GAAI,SAAUQ,GAAY,GAAO,EAC7D2B,EAAAA,IAACM,EAAAA,MAAA,CAAM,OAAQ7B,CAAA,CAAM,EACpBD,GACCwB,EAAAA,IAACO,EAAAA,QAAA,CAAQ,UAAU,MAAM,MAAO/B,EAC9B,SAAAwB,EAAAA,IAAC,MAAA,CAAI,UAAU,iBACb,SAAAA,EAAAA,IAACQ,WAAA,CAAA,CAAS,EACZ,CAAA,CACF,CAAA,CAAA,CAAA,EAKNR,EAAAA,IAAC,MAAA,CACC,aAAc,IAAMd,EAAa,EAAI,EACrC,aAAc,IAAMA,EAAa,EAAK,EAEtC,SAAAc,EAAAA,IAACS,EAAA,CACE,GAAG3B,EACJ,GAAI,KAAOjB,EACX,gBAAgB,aAChB,SAAAQ,EACA,QAASN,EACT,YAAa,GACb,UAAWC,EACX,WAAYI,EACZ,OAAQqB,EACR,QAASvB,EACT,MAAOA,EAAcC,EAAiBG,EACtC,SAAUc,EACV,aAAAR,EACA,YAAAC,EACA,WAAY,CACV,SAAU,IAAM,UAChB,QAAS,IAAK,mBAAA,EAEhB,WAAY,CACV,kBAAAkB,EACA,mBAAoB,IAAM,IAAA,CAC5B,CAAA,CACF,CAAA,EAEDjC,GACCkC,EAAAA,IAACU,EAAAA,WAAA,CACC,UAAU,iBACV,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAA5C,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,EAEAH,EAAqB,YAAc"}
1
+ {"version":3,"file":"CreatableSelect.cjs.js","sources":["../../../../src/components/forms/creatable-select/CreatableSelect.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport CreatableSelect from \"react-select/creatable\";\nimport { CancelRounded, ChevronLeftRounded } from \"@mui/icons-material\";\nimport { Tooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { useState, type ComponentProps } from \"react\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport { useIsDarkMode } from \"../../../hooks/useIsDarkMode\";\n\n/**\n * Option type for the CreatableSelect component\n */\nexport interface SelectOption {\n /** The value of the option */\n value: string | number;\n /** The label displayed for the option */\n label: string;\n /** Whether the option is disabled */\n isDisabled?: boolean;\n /** Additional data for the option */\n data?: Record<string, unknown>;\n}\n\n/**\n * Props for the CreatableSelectField component\n * Matches the lax-web-portal implementation for drop-in replacement\n */\nexport type TProps = {\n /** Unique identifier for the select */\n id: string;\n /** Label text to display above the select */\n label: string;\n /** Placeholder text for the select */\n placeholder?: string;\n /** Current value for single select */\n value?: any;\n /** Callback function called when selection changes */\n onChange(data: any): void;\n /** Error message to display below the select */\n errorMessage?: string;\n /** Array of available options */\n selectOptions: any[];\n /** Whether the select is in loading state */\n loading?: boolean;\n /** Whether multiple selections are allowed */\n multiSelect?: boolean;\n /** Current values for multi select */\n selectedValues?: any[];\n /** Custom filter function for options */\n filterOption?: any;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the select is disabled */\n disabled?: boolean;\n /** Whether the select is clearable */\n isClearable?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Additional CSS classes for the wrapper */\n className?: string;\n};\n\n// Export type alias for backward compatibility\nexport type CreatableSelectProps = TProps & ComponentProps<typeof CreatableSelect>;\n\n/**\n * A creatable select component with label, validation, and styling support.\n * Features dark mode support, accessibility enhancements, and comprehensive prop support.\n * Built on top of react-select/creatable for advanced functionality.\n *\n * This component is designed as a drop-in replacement for the lax-web-portal\n * CreatableSelectField component.\n *\n * @example\n * ```tsx\n * <CreatableSelectField\n * id=\"tags\"\n * label=\"Tags\"\n * selectOptions={tagOptions}\n * value={selectedTag}\n * onChange={(newValue) => setSelectedTag(newValue)}\n * placeholder=\"Select or create tags...\"\n * multiSelect\n * />\n * ```\n */\nexport const CreatableSelectField = ({\n id,\n label,\n errorMessage,\n selectOptions,\n loading,\n isClearable,\n multiSelect,\n selectedValues,\n disabled,\n required,\n value,\n className,\n tooltip,\n tags,\n originalCase = false,\n onChange,\n filterOption,\n placeholder,\n ...props\n}: TProps & ComponentProps<typeof CreatableSelect>) => {\n const isDarkMode = useIsDarkMode();\n const [isHovered, setIsHovered] = useState(false);\n\n const handleChange = (newValue: any, _actionMeta?: any) => {\n // Call the original onChange handler\n if (onChange) {\n onChange(newValue);\n }\n\n // Dispatch pilot-change event for recording\n const containerElement = document.getElementById(id);\n if (containerElement) {\n const pilotChangeEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: newValue,\n type: \"change\",\n },\n });\n containerElement.dispatchEvent(pilotChangeEvent);\n }\n };\n\n const styleProps = {\n control: (baseStyles: any, state: any) => ({\n ...baseStyles,\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : state.isFocused\n ? \"var(--color-primary-600)\"\n : isDarkMode ? \"#434343\" : \"#d9d9d9\",\n backgroundColor: isDarkMode\n ? \"#141414\"\n : state.isDisabled ? \"#f5f5f5\" : \"#fff\",\n borderRadius: \"6px\",\n padding: \"0 4px 0 12px\",\n opacity: state.isDisabled ? 0.6 : 1,\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n boxShadow: state.isFocused\n ? isDarkMode\n ? \"0 0 0 1.5px var(--color-primary-950)\"\n : \"0 0 0 1.5px var(--color-primary-100)\"\n : \"none\",\n \"&:hover\": {\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : \"var(--color-primary-600)\",\n },\n }),\n valueContainer: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n padding: 0,\n }),\n input: (baseStyles: any) => ({\n ...baseStyles,\n margin: \"0\",\n padding: \"0\",\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"inherit\",\n }),\n indicatorsContainer: (baseStyles: any) => ({\n ...baseStyles,\n padding: 0,\n }),\n option: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"22px\",\n padding: \"5px 12px\",\n margin: 0,\n backgroundColor: state.isSelected\n ? isDarkMode ? \"var(--color-primary-975)\" : \"var(--color-primary-50)\"\n : state.isFocused\n ? isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\"\n : isDarkMode ? \"#141414\" : \"#fff\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode\n ? state.isSelected\n ? \"var(--color-primary-600)\"\n : \"rgba(255,255,255,0.85)\"\n : \"rgba(0,0,0,0.88)\",\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n opacity: state.isDisabled ? 0.6 : 1,\n \"&:hover\": {\n backgroundColor: state.isDisabled\n ? isDarkMode ? \"#141414\" : \"#fff\"\n : isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\",\n },\n \"&:active\": {\n backgroundColor: isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-50)\",\n },\n }),\n singleValue: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"20px\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode ? \"rgba(255,255,255,0.85)\" : \"rgba(0,0,0,0.88)\",\n }),\n placeholder: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n whiteSpace: \"nowrap\" as const,\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#bfbfbf\",\n }),\n multiValue: (baseStyles: any) => ({\n ...baseStyles,\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.08)\" : \"#f0f5ff\",\n border: isDarkMode ? \"1px solid transparent\" : \"1px solid #adc6ff\",\n borderRadius: \"4px\",\n }),\n multiValueLabel: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n fontSize: \"12px\",\n }),\n multiValueRemove: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n \"&:hover\": {\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.16)\" : \"#e6f4ff\",\n color: isDarkMode ? \"#fff\" : \"var(--color-primary-600)\",\n },\n }),\n menu: (baseStyles: any) => ({\n ...baseStyles,\n zIndex: 5001,\n borderRadius: \"8px\",\n boxShadow: isDarkMode\n ? \"0 6px 16px 0 rgba(0,0,0,0.45)\"\n : \"0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05)\",\n backgroundColor: isDarkMode ? \"#141414\" : \"#fff\",\n border: isDarkMode ? \"1px solid #303030\" : \"none\",\n overflow: \"hidden\",\n }),\n menuList: (baseStyles: any) => ({\n ...baseStyles,\n padding: \"0\",\n maxHeight: \"256px\",\n }),\n };\n\n const hasSelectedValues = !!selectedValues?.length;\n const hasValue = !!value;\n const isFieldClearable = isClearable ? hasSelectedValues || hasValue : false;\n const showClearIcon = isHovered && !disabled && isFieldClearable;\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleChange(multiSelect ? [] : null);\n };\n\n const DropdownIndicator = () => (\n <div className=\"flex items-center\">\n {showClearIcon ? (\n <CancelRounded\n onClick={handleClear}\n sx={{\n fontSize: \"16px\",\n cursor: \"pointer\",\n color: isDarkMode ? \"rgba(255,255,255,0.45)\" : \"rgba(0,0,0,0.25)\",\n \"&:hover\": {\n color: isDarkMode ? \"rgba(255,255,255,0.65)\" : \"rgba(0,0,0,0.45)\",\n },\n }}\n />\n ) : (\n <ChevronLeftRounded\n className=\"-rotate-90\"\n sx={{\n fontSize: \"18px\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"rgba(0,0,0,0.25)\",\n }}\n />\n )}\n </div>\n );\n\n return (\n <div\n id={id}\n className={cn(\"w-full flex flex-col gap-1\", className)}\n onMouseDown={(e) => e.stopPropagation()}\n role=\"group\"\n aria-labelledby={label ? id + \"Label\" : undefined}\n >\n {label && (\n <label\n id={id + \"Label\"}\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 dark:text-black-300 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"}`}\n >\n <InputLabel label={label || \"\"} required={required || false} />\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 </label>\n )}\n\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CreatableSelect\n {...props}\n id={\"cm\" + label}\n classNamePrefix=\"lax-select\"\n required={required}\n options={selectOptions}\n isClearable={false}\n isLoading={loading}\n isDisabled={disabled}\n styles={styleProps}\n isMulti={multiSelect}\n value={multiSelect ? selectedValues : value}\n onChange={handleChange}\n filterOption={filterOption}\n placeholder={placeholder}\n classNames={{\n menuList: () => \"nowheel\",\n control: ()=> \"!min-h-8 !text-sm\"\n }}\n components={{\n DropdownIndicator,\n IndicatorSeparator: () => null,\n }}\n />\n </div>\n {errorMessage && (\n <Typography\n className=\"text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n </div>\n );\n};\n\nCreatableSelectField.displayName = \"CreatableSelectField\";\n"],"names":["CreatableSelectField","id","label","errorMessage","selectOptions","loading","isClearable","multiSelect","selectedValues","disabled","required","value","className","tooltip","tags","originalCase","onChange","filterOption","placeholder","props","isDarkMode","useIsDarkMode","isHovered","setIsHovered","useState","handleChange","newValue","_actionMeta","containerElement","pilotChangeEvent","styleProps","baseStyles","state","hasSelectedValues","showClearIcon","handleClear","DropdownIndicator","jsx","CancelRounded","ChevronLeftRounded","jsxs","cn","InputLabel","Label","Tooltip","HelpIcon","CreatableSelect","Typography"],"mappings":"8fA8FaA,EAAuB,CAAC,CACnC,GAAAC,EACA,MAAAC,EACA,aAAAC,EACA,cAAAC,EACA,QAAAC,EACA,YAAAC,EACA,YAAAC,EACA,eAAAC,EACA,SAAAC,EACA,SAAAC,EACA,MAAAC,EACA,UAAAC,EACA,QAAAC,EACA,KAAAC,EACA,aAAAC,EAAe,GACf,SAAAC,EACA,aAAAC,EACA,YAAAC,EACA,GAAGC,CACL,IAAuD,CACrD,MAAMC,EAAaC,EAAAA,cAAA,EACb,CAACC,EAAWC,CAAY,EAAIC,EAAAA,SAAS,EAAK,EAE1CC,EAAe,CAACC,EAAeC,IAAsB,CAErDX,GACFA,EAASU,CAAQ,EAInB,MAAME,EAAmB,SAAS,eAAe3B,CAAE,EACnD,GAAI2B,EAAkB,CACpB,MAAMC,EAAmB,IAAI,YAAY,eAAgB,CACvD,QAAS,GACT,OAAQ,CACN,SAAU,IAAI5B,CAAE,GAChB,MAAOyB,EACP,KAAM,QAAA,CACR,CACD,EACDE,EAAiB,cAAcC,CAAgB,CACjD,CACF,EAEMC,EAAa,CACjB,QAAS,CAACC,EAAiBC,KAAgB,CACzC,GAAGD,EACH,YACE5B,GAAgBO,EACZU,EAAa,UAAY,UACzBY,EAAM,UACJ,2BACAZ,EAAa,UAAY,UACjC,gBAAiBA,EACb,UACAY,EAAM,WAAa,UAAY,OACnC,aAAc,MACd,QAAS,eACT,QAASA,EAAM,WAAa,GAAM,EAClC,OAAQA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EAA8B,GAAf,YAAiB,GAEpI,SAAA,CAAAsB,MAACK,EAAAA,YAAW,MAAOxC,GAAS,GAAI,SAAUQ,GAAY,GAAO,EAC7D2B,EAAAA,IAACM,EAAAA,MAAA,CAAM,OAAQ7B,CAAA,CAAM,EACpBD,GACCwB,EAAAA,IAACO,EAAAA,QAAA,CAAQ,UAAU,MAAM,MAAO/B,EAC9B,SAAAwB,MAAC,MAAA,CAAI,UAAU,iBACb,SAAAA,MAACQ,EAAAA,SAAA,CAAS,UAAU,sBAAsB,EAC5C,CAAA,CACF,CAAA,CAAA,CAAA,EAKNR,EAAAA,IAAC,MAAA,CACC,aAAc,IAAMd,EAAa,EAAI,EACrC,aAAc,IAAMA,EAAa,EAAK,EAEtC,SAAAc,EAAAA,IAACS,EAAA,CACE,GAAG3B,EACJ,GAAI,KAAOjB,EACX,gBAAgB,aAChB,SAAAQ,EACA,QAASN,EACT,YAAa,GACb,UAAWC,EACX,WAAYI,EACZ,OAAQqB,EACR,QAASvB,EACT,MAAOA,EAAcC,EAAiBG,EACtC,SAAUc,EACV,aAAAR,EACA,YAAAC,EACA,WAAY,CACV,SAAU,IAAM,UAChB,QAAS,IAAK,mBAAA,EAEhB,WAAY,CACV,kBAAAkB,EACA,mBAAoB,IAAM,IAAA,CAC5B,CAAA,CACF,CAAA,EAEDjC,GACCkC,EAAAA,IAACU,EAAAA,WAAA,CACC,UAAU,iBACV,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAA5C,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,EAEAH,EAAqB,YAAc"}
@@ -17,8 +17,8 @@ const J = ({
17
17
  loading: h,
18
18
  isClearable: y,
19
19
  multiSelect: s,
20
- selectedValues: p,
21
- disabled: c,
20
+ selectedValues: c,
21
+ disabled: p,
22
22
  required: t,
23
23
  value: d,
24
24
  className: C,
@@ -137,9 +137,9 @@ const J = ({
137
137
  padding: "0",
138
138
  maxHeight: "256px"
139
139
  })
140
- }, I = !!p?.length, N = F && !c && (y ? I || !!d : !1), E = (o) => {
140
+ }, N = !!c?.length, I = F && !p && (y ? N || !!d : !1), E = (o) => {
141
141
  o.stopPropagation(), o.preventDefault(), x(s ? [] : null);
142
- }, H = () => /* @__PURE__ */ a("div", { className: "flex items-center", children: N ? /* @__PURE__ */ a(
142
+ }, H = () => /* @__PURE__ */ a("div", { className: "flex items-center", children: I ? /* @__PURE__ */ a(
143
143
  P,
144
144
  {
145
145
  onClick: E,
@@ -180,7 +180,7 @@ const J = ({
180
180
  children: [
181
181
  /* @__PURE__ */ a(A, { label: i || "", required: t || !1 }),
182
182
  /* @__PURE__ */ a(O, { labels: S }),
183
- m && /* @__PURE__ */ a(T, { placement: "top", title: m, children: /* @__PURE__ */ a("div", { className: "cursor-pointer", children: /* @__PURE__ */ a(B, {}) }) })
183
+ m && /* @__PURE__ */ a(T, { placement: "top", title: m, children: /* @__PURE__ */ a("div", { className: "cursor-pointer", children: /* @__PURE__ */ a(B, { className: "w-icon-sm h-icon-sm" }) }) })
184
184
  ]
185
185
  }
186
186
  ),
@@ -199,10 +199,10 @@ const J = ({
199
199
  options: v,
200
200
  isClearable: !1,
201
201
  isLoading: h,
202
- isDisabled: c,
202
+ isDisabled: p,
203
203
  styles: L,
204
204
  isMulti: s,
205
- value: s ? p : d,
205
+ value: s ? c : d,
206
206
  onChange: x,
207
207
  filterOption: D,
208
208
  placeholder: k,
@@ -1 +1 @@
1
- {"version":3,"file":"CreatableSelect.es.js","sources":["../../../../src/components/forms/creatable-select/CreatableSelect.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport CreatableSelect from \"react-select/creatable\";\nimport { CancelRounded, ChevronLeftRounded } from \"@mui/icons-material\";\nimport { Tooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { useState, type ComponentProps } from \"react\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport { useIsDarkMode } from \"../../../hooks/useIsDarkMode\";\n\n/**\n * Option type for the CreatableSelect component\n */\nexport interface SelectOption {\n /** The value of the option */\n value: string | number;\n /** The label displayed for the option */\n label: string;\n /** Whether the option is disabled */\n isDisabled?: boolean;\n /** Additional data for the option */\n data?: Record<string, unknown>;\n}\n\n/**\n * Props for the CreatableSelectField component\n * Matches the lax-web-portal implementation for drop-in replacement\n */\nexport type TProps = {\n /** Unique identifier for the select */\n id: string;\n /** Label text to display above the select */\n label: string;\n /** Placeholder text for the select */\n placeholder?: string;\n /** Current value for single select */\n value?: any;\n /** Callback function called when selection changes */\n onChange(data: any): void;\n /** Error message to display below the select */\n errorMessage?: string;\n /** Array of available options */\n selectOptions: any[];\n /** Whether the select is in loading state */\n loading?: boolean;\n /** Whether multiple selections are allowed */\n multiSelect?: boolean;\n /** Current values for multi select */\n selectedValues?: any[];\n /** Custom filter function for options */\n filterOption?: any;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the select is disabled */\n disabled?: boolean;\n /** Whether the select is clearable */\n isClearable?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Additional CSS classes for the wrapper */\n className?: string;\n};\n\n// Export type alias for backward compatibility\nexport type CreatableSelectProps = TProps & ComponentProps<typeof CreatableSelect>;\n\n/**\n * A creatable select component with label, validation, and styling support.\n * Features dark mode support, accessibility enhancements, and comprehensive prop support.\n * Built on top of react-select/creatable for advanced functionality.\n *\n * This component is designed as a drop-in replacement for the lax-web-portal\n * CreatableSelectField component.\n *\n * @example\n * ```tsx\n * <CreatableSelectField\n * id=\"tags\"\n * label=\"Tags\"\n * selectOptions={tagOptions}\n * value={selectedTag}\n * onChange={(newValue) => setSelectedTag(newValue)}\n * placeholder=\"Select or create tags...\"\n * multiSelect\n * />\n * ```\n */\nexport const CreatableSelectField = ({\n id,\n label,\n errorMessage,\n selectOptions,\n loading,\n isClearable,\n multiSelect,\n selectedValues,\n disabled,\n required,\n value,\n className,\n tooltip,\n tags,\n originalCase = false,\n onChange,\n filterOption,\n placeholder,\n ...props\n}: TProps & ComponentProps<typeof CreatableSelect>) => {\n const isDarkMode = useIsDarkMode();\n const [isHovered, setIsHovered] = useState(false);\n\n const handleChange = (newValue: any, _actionMeta?: any) => {\n // Call the original onChange handler\n if (onChange) {\n onChange(newValue);\n }\n\n // Dispatch pilot-change event for recording\n const containerElement = document.getElementById(id);\n if (containerElement) {\n const pilotChangeEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: newValue,\n type: \"change\",\n },\n });\n containerElement.dispatchEvent(pilotChangeEvent);\n }\n };\n\n const styleProps = {\n control: (baseStyles: any, state: any) => ({\n ...baseStyles,\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : state.isFocused\n ? \"var(--color-primary-600)\"\n : isDarkMode ? \"#434343\" : \"#d9d9d9\",\n backgroundColor: isDarkMode\n ? \"#141414\"\n : state.isDisabled ? \"#f5f5f5\" : \"#fff\",\n borderRadius: \"6px\",\n padding: \"0 4px 0 12px\",\n opacity: state.isDisabled ? 0.6 : 1,\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n boxShadow: state.isFocused\n ? isDarkMode\n ? \"0 0 0 1.5px var(--color-primary-950)\"\n : \"0 0 0 1.5px var(--color-primary-100)\"\n : \"none\",\n \"&:hover\": {\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : \"var(--color-primary-600)\",\n },\n }),\n valueContainer: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n padding: 0,\n }),\n input: (baseStyles: any) => ({\n ...baseStyles,\n margin: \"0\",\n padding: \"0\",\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"inherit\",\n }),\n indicatorsContainer: (baseStyles: any) => ({\n ...baseStyles,\n padding: 0,\n }),\n option: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"22px\",\n padding: \"5px 12px\",\n margin: 0,\n backgroundColor: state.isSelected\n ? isDarkMode ? \"var(--color-primary-975)\" : \"var(--color-primary-50)\"\n : state.isFocused\n ? isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\"\n : isDarkMode ? \"#141414\" : \"#fff\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode\n ? state.isSelected\n ? \"var(--color-primary-600)\"\n : \"rgba(255,255,255,0.85)\"\n : \"rgba(0,0,0,0.88)\",\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n opacity: state.isDisabled ? 0.6 : 1,\n \"&:hover\": {\n backgroundColor: state.isDisabled\n ? isDarkMode ? \"#141414\" : \"#fff\"\n : isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\",\n },\n \"&:active\": {\n backgroundColor: isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-50)\",\n },\n }),\n singleValue: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"20px\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode ? \"rgba(255,255,255,0.85)\" : \"rgba(0,0,0,0.88)\",\n }),\n placeholder: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n whiteSpace: \"nowrap\" as const,\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#bfbfbf\",\n }),\n multiValue: (baseStyles: any) => ({\n ...baseStyles,\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.08)\" : \"#f0f5ff\",\n border: isDarkMode ? \"1px solid transparent\" : \"1px solid #adc6ff\",\n borderRadius: \"4px\",\n }),\n multiValueLabel: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n fontSize: \"12px\",\n }),\n multiValueRemove: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n \"&:hover\": {\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.16)\" : \"#e6f4ff\",\n color: isDarkMode ? \"#fff\" : \"var(--color-primary-600)\",\n },\n }),\n menu: (baseStyles: any) => ({\n ...baseStyles,\n zIndex: 5001,\n borderRadius: \"8px\",\n boxShadow: isDarkMode\n ? \"0 6px 16px 0 rgba(0,0,0,0.45)\"\n : \"0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05)\",\n backgroundColor: isDarkMode ? \"#141414\" : \"#fff\",\n border: isDarkMode ? \"1px solid #303030\" : \"none\",\n overflow: \"hidden\",\n }),\n menuList: (baseStyles: any) => ({\n ...baseStyles,\n padding: \"0\",\n maxHeight: \"256px\",\n }),\n };\n\n const hasSelectedValues = !!selectedValues?.length;\n const hasValue = !!value;\n const isFieldClearable = isClearable ? hasSelectedValues || hasValue : false;\n const showClearIcon = isHovered && !disabled && isFieldClearable;\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleChange(multiSelect ? [] : null);\n };\n\n const DropdownIndicator = () => (\n <div className=\"flex items-center\">\n {showClearIcon ? (\n <CancelRounded\n onClick={handleClear}\n sx={{\n fontSize: \"16px\",\n cursor: \"pointer\",\n color: isDarkMode ? \"rgba(255,255,255,0.45)\" : \"rgba(0,0,0,0.25)\",\n \"&:hover\": {\n color: isDarkMode ? \"rgba(255,255,255,0.65)\" : \"rgba(0,0,0,0.45)\",\n },\n }}\n />\n ) : (\n <ChevronLeftRounded\n className=\"-rotate-90\"\n sx={{\n fontSize: \"18px\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"rgba(0,0,0,0.25)\",\n }}\n />\n )}\n </div>\n );\n\n return (\n <div\n id={id}\n className={cn(\"w-full flex flex-col gap-1\", className)}\n onMouseDown={(e) => e.stopPropagation()}\n role=\"group\"\n aria-labelledby={label ? id + \"Label\" : undefined}\n >\n {label && (\n <label\n id={id + \"Label\"}\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 dark:text-black-300 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"}`}\n >\n <InputLabel label={label || \"\"} required={required || false} />\n <Label labels={tags} />\n {tooltip && (\n <Tooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n </label>\n )}\n\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CreatableSelect\n {...props}\n id={\"cm\" + label}\n classNamePrefix=\"lax-select\"\n required={required}\n options={selectOptions}\n isClearable={false}\n isLoading={loading}\n isDisabled={disabled}\n styles={styleProps}\n isMulti={multiSelect}\n value={multiSelect ? selectedValues : value}\n onChange={handleChange}\n filterOption={filterOption}\n placeholder={placeholder}\n classNames={{\n menuList: () => \"nowheel\",\n control: ()=> \"!min-h-8 !text-sm\"\n }}\n components={{\n DropdownIndicator,\n IndicatorSeparator: () => null,\n }}\n />\n </div>\n {errorMessage && (\n <Typography\n className=\"text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n </div>\n );\n};\n\nCreatableSelectField.displayName = \"CreatableSelectField\";\n"],"names":["CreatableSelectField","id","label","errorMessage","selectOptions","loading","isClearable","multiSelect","selectedValues","disabled","required","value","className","tooltip","tags","originalCase","onChange","filterOption","placeholder","props","isDarkMode","useIsDarkMode","isHovered","setIsHovered","useState","handleChange","newValue","_actionMeta","containerElement","pilotChangeEvent","styleProps","baseStyles","state","hasSelectedValues","showClearIcon","handleClear","e","DropdownIndicator","jsx","CancelRounded","ChevronLeftRounded","jsxs","cn","InputLabel","Label","Tooltip","HelpIcon","CreatableSelect","Typography"],"mappings":";;;;;;;;;;;AA8FO,MAAMA,IAAuB,CAAC;AAAA,EACnC,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAGC;AACL,MAAuD;AACrD,QAAMC,IAAaC,EAAA,GACb,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAE1CC,IAAe,CAACC,GAAeC,MAAsB;AAEzD,IAAIX,KACFA,EAASU,CAAQ;AAInB,UAAME,IAAmB,SAAS,eAAe3B,CAAE;AACnD,QAAI2B,GAAkB;AACpB,YAAMC,IAAmB,IAAI,YAAY,gBAAgB;AAAA,QACvD,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,UAAU,IAAI5B,CAAE;AAAA,UAChB,OAAOyB;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MACR,CACD;AACD,MAAAE,EAAiB,cAAcC,CAAgB;AAAA,IACjD;AAAA,EACF,GAEMC,IAAa;AAAA,IACjB,SAAS,CAACC,GAAiBC,OAAgB;AAAA,MACzC,GAAGD;AAAA,MACH,aACE5B,KAAgBO,IACZU,IAAa,YAAY,YACzBY,EAAM,YACJ,6BACAZ,IAAa,YAAY;AAAA,MACjC,iBAAiBA,IACb,YACAY,EAAM,aAAa,YAAY;AAAA,MACnC,cAAc;AAAA,MACd,SAAS;AAAA,MACT,SAASA,EAAM,aAAa,MAAM;AAAA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C,cAAc,MAAMf,EAAa,EAAI;AAAA,YACrC,cAAc,MAAMA,EAAa,EAAK;AAAA,YAEtC,UAAA,gBAAAe;AAAA,cAACS;AAAA,cAAA;AAAA,gBACE,GAAG5B;AAAA,gBACJ,IAAI,OAAOjB;AAAA,gBACX,iBAAgB;AAAA,gBAChB,UAAAQ;AAAA,gBACA,SAASN;AAAA,gBACT,aAAa;AAAA,gBACb,WAAWC;AAAA,gBACX,YAAYI;AAAA,gBACZ,QAAQqB;AAAA,gBACR,SAASvB;AAAA,gBACT,OAAOA,IAAcC,IAAiBG;AAAA,gBACtC,UAAUc;AAAA,gBACV,cAAAR;AAAA,gBACA,aAAAC;AAAA,gBACA,YAAY;AAAA,kBACV,UAAU,MAAM;AAAA,kBAChB,SAAS,MAAK;AAAA,gBAAA;AAAA,gBAEhB,YAAY;AAAA,kBACV,mBAAAmB;AAAA,kBACA,oBAAoB,MAAM;AAAA,gBAAA;AAAA,cAC5B;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAEDlC,KACC,gBAAAmC;AAAA,UAACU;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,YAAW;AAAA,YACX,MAAK;AAAA,YACL,SAAQ;AAAA,YAEP,UAAA7C;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;AAEAH,EAAqB,cAAc;"}
1
+ {"version":3,"file":"CreatableSelect.es.js","sources":["../../../../src/components/forms/creatable-select/CreatableSelect.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport CreatableSelect from \"react-select/creatable\";\nimport { CancelRounded, ChevronLeftRounded } from \"@mui/icons-material\";\nimport { Tooltip } from \"antd\";\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { useState, type ComponentProps } from \"react\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport { useIsDarkMode } from \"../../../hooks/useIsDarkMode\";\n\n/**\n * Option type for the CreatableSelect component\n */\nexport interface SelectOption {\n /** The value of the option */\n value: string | number;\n /** The label displayed for the option */\n label: string;\n /** Whether the option is disabled */\n isDisabled?: boolean;\n /** Additional data for the option */\n data?: Record<string, unknown>;\n}\n\n/**\n * Props for the CreatableSelectField component\n * Matches the lax-web-portal implementation for drop-in replacement\n */\nexport type TProps = {\n /** Unique identifier for the select */\n id: string;\n /** Label text to display above the select */\n label: string;\n /** Placeholder text for the select */\n placeholder?: string;\n /** Current value for single select */\n value?: any;\n /** Callback function called when selection changes */\n onChange(data: any): void;\n /** Error message to display below the select */\n errorMessage?: string;\n /** Array of available options */\n selectOptions: any[];\n /** Whether the select is in loading state */\n loading?: boolean;\n /** Whether multiple selections are allowed */\n multiSelect?: boolean;\n /** Current values for multi select */\n selectedValues?: any[];\n /** Custom filter function for options */\n filterOption?: any;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Whether the select is disabled */\n disabled?: boolean;\n /** Whether the select is clearable */\n isClearable?: boolean;\n /** Whether the field is required */\n required?: boolean;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Additional CSS classes for the wrapper */\n className?: string;\n};\n\n// Export type alias for backward compatibility\nexport type CreatableSelectProps = TProps & ComponentProps<typeof CreatableSelect>;\n\n/**\n * A creatable select component with label, validation, and styling support.\n * Features dark mode support, accessibility enhancements, and comprehensive prop support.\n * Built on top of react-select/creatable for advanced functionality.\n *\n * This component is designed as a drop-in replacement for the lax-web-portal\n * CreatableSelectField component.\n *\n * @example\n * ```tsx\n * <CreatableSelectField\n * id=\"tags\"\n * label=\"Tags\"\n * selectOptions={tagOptions}\n * value={selectedTag}\n * onChange={(newValue) => setSelectedTag(newValue)}\n * placeholder=\"Select or create tags...\"\n * multiSelect\n * />\n * ```\n */\nexport const CreatableSelectField = ({\n id,\n label,\n errorMessage,\n selectOptions,\n loading,\n isClearable,\n multiSelect,\n selectedValues,\n disabled,\n required,\n value,\n className,\n tooltip,\n tags,\n originalCase = false,\n onChange,\n filterOption,\n placeholder,\n ...props\n}: TProps & ComponentProps<typeof CreatableSelect>) => {\n const isDarkMode = useIsDarkMode();\n const [isHovered, setIsHovered] = useState(false);\n\n const handleChange = (newValue: any, _actionMeta?: any) => {\n // Call the original onChange handler\n if (onChange) {\n onChange(newValue);\n }\n\n // Dispatch pilot-change event for recording\n const containerElement = document.getElementById(id);\n if (containerElement) {\n const pilotChangeEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: newValue,\n type: \"change\",\n },\n });\n containerElement.dispatchEvent(pilotChangeEvent);\n }\n };\n\n const styleProps = {\n control: (baseStyles: any, state: any) => ({\n ...baseStyles,\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : state.isFocused\n ? \"var(--color-primary-600)\"\n : isDarkMode ? \"#434343\" : \"#d9d9d9\",\n backgroundColor: isDarkMode\n ? \"#141414\"\n : state.isDisabled ? \"#f5f5f5\" : \"#fff\",\n borderRadius: \"6px\",\n padding: \"0 4px 0 12px\",\n opacity: state.isDisabled ? 0.6 : 1,\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n boxShadow: state.isFocused\n ? isDarkMode\n ? \"0 0 0 1.5px var(--color-primary-950)\"\n : \"0 0 0 1.5px var(--color-primary-100)\"\n : \"none\",\n \"&:hover\": {\n borderColor:\n errorMessage && required\n ? isDarkMode ? \"#F04438\" : \"#fda49b\"\n : \"var(--color-primary-600)\",\n },\n }),\n valueContainer: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n padding: 0,\n }),\n input: (baseStyles: any) => ({\n ...baseStyles,\n margin: \"0\",\n padding: \"0\",\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"inherit\",\n }),\n indicatorsContainer: (baseStyles: any) => ({\n ...baseStyles,\n padding: 0,\n }),\n option: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"22px\",\n padding: \"5px 12px\",\n margin: 0,\n backgroundColor: state.isSelected\n ? isDarkMode ? \"var(--color-primary-975)\" : \"var(--color-primary-50)\"\n : state.isFocused\n ? isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\"\n : isDarkMode ? \"#141414\" : \"#fff\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode\n ? state.isSelected\n ? \"var(--color-primary-600)\"\n : \"rgba(255,255,255,0.85)\"\n : \"rgba(0,0,0,0.88)\",\n cursor: state.isDisabled ? \"not-allowed\" : \"pointer\",\n opacity: state.isDisabled ? 0.6 : 1,\n \"&:hover\": {\n backgroundColor: state.isDisabled\n ? isDarkMode ? \"#141414\" : \"#fff\"\n : isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-100)\",\n },\n \"&:active\": {\n backgroundColor: isDarkMode ? \"var(--color-primary-950)\" : \"var(--color-primary-50)\",\n },\n }),\n singleValue: (baseStyles: any, state: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n lineHeight: \"20px\",\n color: state.isDisabled\n ? isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#a3a3a3\"\n : isDarkMode ? \"rgba(255,255,255,0.85)\" : \"rgba(0,0,0,0.88)\",\n }),\n placeholder: (baseStyles: any) => ({\n ...baseStyles,\n fontSize: \"14px\",\n whiteSpace: \"nowrap\" as const,\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"#bfbfbf\",\n }),\n multiValue: (baseStyles: any) => ({\n ...baseStyles,\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.08)\" : \"#f0f5ff\",\n border: isDarkMode ? \"1px solid transparent\" : \"1px solid #adc6ff\",\n borderRadius: \"4px\",\n }),\n multiValueLabel: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n fontSize: \"12px\",\n }),\n multiValueRemove: (baseStyles: any) => ({\n ...baseStyles,\n color: isDarkMode ? \"rgba(255,255,255,0.85)\" : \"var(--color-primary-600)\",\n \"&:hover\": {\n backgroundColor: isDarkMode ? \"rgba(255,255,255,0.16)\" : \"#e6f4ff\",\n color: isDarkMode ? \"#fff\" : \"var(--color-primary-600)\",\n },\n }),\n menu: (baseStyles: any) => ({\n ...baseStyles,\n zIndex: 5001,\n borderRadius: \"8px\",\n boxShadow: isDarkMode\n ? \"0 6px 16px 0 rgba(0,0,0,0.45)\"\n : \"0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05)\",\n backgroundColor: isDarkMode ? \"#141414\" : \"#fff\",\n border: isDarkMode ? \"1px solid #303030\" : \"none\",\n overflow: \"hidden\",\n }),\n menuList: (baseStyles: any) => ({\n ...baseStyles,\n padding: \"0\",\n maxHeight: \"256px\",\n }),\n };\n\n const hasSelectedValues = !!selectedValues?.length;\n const hasValue = !!value;\n const isFieldClearable = isClearable ? hasSelectedValues || hasValue : false;\n const showClearIcon = isHovered && !disabled && isFieldClearable;\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleChange(multiSelect ? [] : null);\n };\n\n const DropdownIndicator = () => (\n <div className=\"flex items-center\">\n {showClearIcon ? (\n <CancelRounded\n onClick={handleClear}\n sx={{\n fontSize: \"16px\",\n cursor: \"pointer\",\n color: isDarkMode ? \"rgba(255,255,255,0.45)\" : \"rgba(0,0,0,0.25)\",\n \"&:hover\": {\n color: isDarkMode ? \"rgba(255,255,255,0.65)\" : \"rgba(0,0,0,0.45)\",\n },\n }}\n />\n ) : (\n <ChevronLeftRounded\n className=\"-rotate-90\"\n sx={{\n fontSize: \"18px\",\n color: isDarkMode ? \"rgba(255,255,255,0.25)\" : \"rgba(0,0,0,0.25)\",\n }}\n />\n )}\n </div>\n );\n\n return (\n <div\n id={id}\n className={cn(\"w-full flex flex-col gap-1\", className)}\n onMouseDown={(e) => e.stopPropagation()}\n role=\"group\"\n aria-labelledby={label ? id + \"Label\" : undefined}\n >\n {label && (\n <label\n id={id + \"Label\"}\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 dark:text-black-300 inline-flex items-center gap-1 ${!originalCase ? \"capitalize\" : \"\"}`}\n >\n <InputLabel label={label || \"\"} required={required || false} />\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 </label>\n )}\n\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <CreatableSelect\n {...props}\n id={\"cm\" + label}\n classNamePrefix=\"lax-select\"\n required={required}\n options={selectOptions}\n isClearable={false}\n isLoading={loading}\n isDisabled={disabled}\n styles={styleProps}\n isMulti={multiSelect}\n value={multiSelect ? selectedValues : value}\n onChange={handleChange}\n filterOption={filterOption}\n placeholder={placeholder}\n classNames={{\n menuList: () => \"nowheel\",\n control: ()=> \"!min-h-8 !text-sm\"\n }}\n components={{\n DropdownIndicator,\n IndicatorSeparator: () => null,\n }}\n />\n </div>\n {errorMessage && (\n <Typography\n className=\"text-error-500\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n </div>\n );\n};\n\nCreatableSelectField.displayName = \"CreatableSelectField\";\n"],"names":["CreatableSelectField","id","label","errorMessage","selectOptions","loading","isClearable","multiSelect","selectedValues","disabled","required","value","className","tooltip","tags","originalCase","onChange","filterOption","placeholder","props","isDarkMode","useIsDarkMode","isHovered","setIsHovered","useState","handleChange","newValue","_actionMeta","containerElement","pilotChangeEvent","styleProps","baseStyles","state","hasSelectedValues","showClearIcon","handleClear","e","DropdownIndicator","jsx","CancelRounded","ChevronLeftRounded","jsxs","cn","InputLabel","Label","Tooltip","HelpIcon","CreatableSelect","Typography"],"mappings":";;;;;;;;;;;AA8FO,MAAMA,IAAuB,CAAC;AAAA,EACnC,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAGC;AACL,MAAuD;AACrD,QAAMC,IAAaC,EAAA,GACb,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAE1CC,IAAe,CAACC,GAAeC,MAAsB;AAEzD,IAAIX,KACFA,EAASU,CAAQ;AAInB,UAAME,IAAmB,SAAS,eAAe3B,CAAE;AACnD,QAAI2B,GAAkB;AACpB,YAAMC,IAAmB,IAAI,YAAY,gBAAgB;AAAA,QACvD,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,UAAU,IAAI5B,CAAE;AAAA,UAChB,OAAOyB;AAAA,UACP,MAAM;AAAA,QAAA;AAAA,MACR,CACD;AACD,MAAAE,EAAiB,cAAcC,CAAgB;AAAA,IACjD;AAAA,EACF,GAEMC,IAAa;AAAA,IACjB,SAAS,CAACC,GAAiBC,OAAgB;AAAA,MACzC,GAAGD;AAAA,MACH,aACE5B,KAAgBO,IACZU,IAAa,YAAY,YACzBY,EAAM,YACJ,6BACAZ,IAAa,YAAY;AAAA,MACjC,iBAAiBA,IACb,YACAY,EAAM,aAAa,YAAY;AAAA,MACnC,cAAc;AAAA,MACd,SAAS;AAAA,MACT,SAASA,EAAM,aAAa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;AAAA,UAAA;AAAA,YACC,cAAc,MAAMf,EAAa,EAAI;AAAA,YACrC,cAAc,MAAMA,EAAa,EAAK;AAAA,YAEtC,UAAA,gBAAAe;AAAA,cAACS;AAAA,cAAA;AAAA,gBACE,GAAG5B;AAAA,gBACJ,IAAI,OAAOjB;AAAA,gBACX,iBAAgB;AAAA,gBAChB,UAAAQ;AAAA,gBACA,SAASN;AAAA,gBACT,aAAa;AAAA,gBACb,WAAWC;AAAA,gBACX,YAAYI;AAAA,gBACZ,QAAQqB;AAAA,gBACR,SAASvB;AAAA,gBACT,OAAOA,IAAcC,IAAiBG;AAAA,gBACtC,UAAUc;AAAA,gBACV,cAAAR;AAAA,gBACA,aAAAC;AAAA,gBACA,YAAY;AAAA,kBACV,UAAU,MAAM;AAAA,kBAChB,SAAS,MAAK;AAAA,gBAAA;AAAA,gBAEhB,YAAY;AAAA,kBACV,mBAAAmB;AAAA,kBACA,oBAAoB,MAAM;AAAA,gBAAA;AAAA,cAC5B;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAEDlC,KACC,gBAAAmC;AAAA,UAACU;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,YAAW;AAAA,YACX,MAAK;AAAA,YACL,SAAQ;AAAA,YAEP,UAAA7C;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;AAEAH,EAAqB,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../../_virtual/index.cjs.js"),l=require("react"),M=require("antd"),ke=require("react-i18next"),Se=require("../../data-display/typography/Typography.cjs.js"),je=require("../../data-display/label/Label.cjs.js"),Q=require("./currency.constant.cjs.js"),X=require("@mui/icons-material"),Ee=require("../../icons/AIExtractedIndicator.cjs.js"),Ce=require("../../icons/AIStarIcon.cjs.js"),we=require("../../icons/HelpIcon.cjs.js"),Z=require("../../tooltip/Tooltip.cjs.js"),x=require("../../../utils/confidenceScoreUtils.cjs.js"),Ne=require("../search-bar/SearchBar.cjs.js"),_e=require("../../buttons/option-button/OptionButton.cjs.js"),T=require("../../../utils/countryFlags.cjs.js"),Ie=require("../shared/InputLabel.cjs.js"),Be=require("../../../utils/formatters.cjs.js"),V=l.forwardRef(({id:c,label:F,value:o,onChange:B,errorMessage:i,defaultValue:m,required:k=!1,isRequiredConditional:G=!1,tags:ee,className:re,originalCase:q=!1,tooltip:A,simpleMode:te=!1,inputFieldClassName:d="",isAiExtracted:ae=!1,confidenceScore:S,confidenceType:f="high",confidenceTooltip:j,sourceMeta:oe=[],onConfidenceScoreClick:ne,isGTN:E=!1,gtnName:le=null,allowMultiCurrency:$=!1,placeholder:se,disabled:ce=!1,currencyCode:u="USD",inputStyle:de,labelClassName:z,isLiveField:ie=!1,onBlur:ue,autoFocus:D=!1,isRecording:L=!1,isPlaying:O=!1,onAddGTNToDocument:C,riskDetails:s,isRiskAnalysisOpen:p=!1,RiskDetailsCard:U,labelExtra:be,inputEmphasis:w="default",...W},H)=>{const{t:xe}=ke.useTranslation(),me=w==="modified"&&!i&&!(p&&s?.color),fe=w==="deleted"&&!i&&!(p&&s?.color),pe=w==="success"&&!i&&!(p&&s?.color),[b,R]=l.useState(!1),[ge,he]=l.useState([]),[N,K]=l.useState(""),[a,P]=l.useState(u||"USD"),[v,_]=l.useState(!1),ve=r=>{if(C){const t={key:le,value:Be.formatCurrency(r,a)};C(t)}},g=r=>{if(r==null)return"";const t=Number(r);return isNaN(t)?r:t?.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},I=r=>{const t=r.target.value,h=t===""||t===null||t===void 0?0:Number(t);B(h,a);const y=document.getElementById(c);if(y&&y.setAttribute("data-selected-value",JSON.stringify({value:h,currency_code:a})),y&&(L||O)){const Fe=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:h,currency_code:a},type:"change"}});y.dispatchEvent(Fe)}},J=()=>{R(!0)},Y=()=>{R(!1),(o==null||o==="")&&I({target:{value:"0.00"}}),ue?.()},ye=()=>{const r="pl-11 border h-8 text-sm block w-full p-2.5 font-inter font-medium focus:outline-none focus:ring-0";return i?n(r,"rounded-md border-red-300 bg-white dark:bg-black-600",d):p&&s?.color?n(r,`rounded-md border-${s.color}-300 bg-${s.color}-50`,"text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800",d):fe?n(r,"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)]",d):me?n(r,"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)]",d):pe?n(r,"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)]",d):n(r,"rounded-lg border-gray-300 dark:border-black-600 bg-white dark:bg-black-600 text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",d)};return l.useEffect(()=>{u&&P(u)},[u]),l.useEffect(()=>{if(a){const r=o===""||o===null||o===void 0?0:Number(o);u!==a&&B(r,a);const t=document.getElementById(c);if(t&&(t.setAttribute("data-selected-value",JSON.stringify({value:r,currency_code:a})),L||O)){const h=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:r,currency_code:a},type:"change"}});t.dispatchEvent(h)}}},[a]),l.useEffect(()=>{const r=Q.CURRENCIES.filter(t=>(t.value+" - "+t.label).toLowerCase().includes(N.toLowerCase())).map(t=>({label:e.jsx(_e.OptionButton,{text:`${t.value} - ${t.label}`,icon:T.getFlagComponent(t.value),showTick:a===t.value,onClick:()=>P(t.value),className:"text-black-900 dark:text-white"}),key:t.value}));he(r)},[N,a]),l.useEffect(()=>{K("")},[a]),te?e.jsxs("label",{id:c,className:`mb-1 text-xs font-medium text-gray-600 h-full inline-flex items-center gap-1 ${q?"":"capitalize"} ${z||""}`,children:[e.jsx("span",{className:"absolute inset-y-0 left-1 top-0.5 flex items-center pl-3",children:"$"}),e.jsx("input",{...W,ref:H,type:b?"number":"text",required:k,className:n(d,"pl-8 h-8"),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?o:g(o),...m&&!o?{defaultValue:b?m:g(m)}:{},id:c||F,autoFocus:D})]}):e.jsxs("div",{className:n("flex gap-0.5 relative",v&&E?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[E&&!v?e.jsx("div",{className:"size-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:n("w-full flex flex-col",re),children:[e.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${q?"":"uppercase"} ${z||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Ie.InputLabel,{label:F||"",required:k||!1,isRequiredConditional:G||!1}),ie&&e.jsx(X.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),ae&&!x.shouldShowConfidenceScore(S)&&e.jsx(Ee.AIExtractedIndicator,{}),e.jsx(je.Label,{labels:ee}),A&&e.jsx(Z,{placement:"top",title:A,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(we.HelpIcon,{})})}),be]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[x.shouldShowConfidenceScore(S)&&f?e.jsx(Z,{placement:"top-end",title:j??"",hideTooltip:j==null,className:"cursor-pointer",children:e.jsxs("div",{className:n("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",x.getConfidenceScoreBadgeClass(f)),onClick:()=>ne?.(oe),children:[e.jsx(Ce.AIStarIcon,{size:12,fill:x.getConfidenceScoreBadgeColor(f),fillSecondary:x.getConfidenceScoreBadgeFill(f)}),e.jsxs("span",{className:n("text-xs font-medium leading-4",x.getConfidenceScoreBadgeTextColor(f)),children:[S,"%"]})]})}):null,E&&v&&C?e.jsx("button",{id:"btn-currency-input-add-to-document",className:"cursor-pointer",onClick:()=>ve(g(o)),type:"button",children:e.jsx(M.Tooltip,{placement:"top",title:xe("Add to document"),children:e.jsx(X.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),e.jsxs("label",{className:"relative block",children:[e.jsx("span",{className:"absolute inset-y-0 left-1 flex items-center pl-3 text-neutral-900 dark:text-white",children:Q.CURRENCY_SYMBOLS[a]}),e.jsx("input",{...W,ref:H,placeholder:se,type:b?"number":"text",required:k,disabled:ce,className:ye(),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?o:g(o),defaultValue:b?m:g(m),id:c||F,style:de,autoComplete:"off",autoFocus:D}),e.jsx("span",{className:`absolute inset-y-0 right-2 flex items-center z-[1000] h-full cursor-pointer dark:text-black-200 ${$?"cursor-pointer":""}`,children:$?e.jsx(M.Dropdown,{menu:{items:[...ge]},trigger:["click"],overlayClassName:"row-option-cell",placement:"bottomRight",overlayStyle:{zIndex:999},getPopupContainer:r=>r.parentElement,popupRender:r=>e.jsxs("div",{className:"[&>*:nth-child(2)]:!shadow-none [&>*:nth-child(2)>*]:!px-2 flex flex-col gap-2 p-2 bg-white dark:bg-black-700 border border-solid border-neutral-200 dark:border-black-600 max-h-[200px] w-[330px] text-ellipsis overflow-y-auto z-[999] rounded-md",children:[e.jsx(Ne.SearchBar,{id:"search-bar-currency-input",value:N,onChange:t=>K(t),className:"mb-2"}),r]}),children:e.jsxs("div",{className:"pl-4 pr-2 py-1.5 text-sm text-gray-700 dark:text-black-200 flex items-center gap-1",children:[T.getFlagComponent(a)," ",a]})}):a})]}),i&&e.jsx(Se.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:i})]}),v&&s&&p&&U&&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:r=>r.stopPropagation(),onMouseDown:r=>r.preventDefault(),onKeyDown:r=>{r.key==="Escape"&&_(!1)},children:e.jsx(U,{riskDetails:s})})]})});V.displayName="CurrencyInputField";exports.CurrencyInputField=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../../_virtual/index.cjs.js"),l=require("react"),M=require("antd"),ke=require("react-i18next"),Se=require("../../data-display/typography/Typography.cjs.js"),je=require("../../data-display/label/Label.cjs.js"),Q=require("./currency.constant.cjs.js"),X=require("@mui/icons-material"),Ee=require("../../icons/AIExtractedIndicator.cjs.js"),Ce=require("../../icons/AIStarIcon.cjs.js"),we=require("../../icons/HelpIcon.cjs.js"),Z=require("../../tooltip/Tooltip.cjs.js"),m=require("../../../utils/confidenceScoreUtils.cjs.js"),Ne=require("../search-bar/SearchBar.cjs.js"),_e=require("../../buttons/option-button/OptionButton.cjs.js"),T=require("../../../utils/countryFlags.cjs.js"),Ie=require("../shared/InputLabel.cjs.js"),Be=require("../../../utils/formatters.cjs.js"),V=l.forwardRef(({id:c,label:F,value:o,onChange:B,errorMessage:i,defaultValue:x,required:k=!1,isRequiredConditional:G=!1,tags:ee,className:re,originalCase:q=!1,tooltip:A,simpleMode:te=!1,inputFieldClassName:d="",isAiExtracted:ae=!1,confidenceScore:S,confidenceType:f="high",confidenceTooltip:j,sourceMeta:oe=[],onConfidenceScoreClick:ne,isGTN:E=!1,gtnName:le=null,allowMultiCurrency:$=!1,placeholder:se,disabled:ce=!1,currencyCode:u="USD",inputStyle:de,labelClassName:z,isLiveField:ie=!1,onBlur:ue,autoFocus:D=!1,isRecording:L=!1,isPlaying:O=!1,onAddGTNToDocument:C,riskDetails:s,isRiskAnalysisOpen:p=!1,RiskDetailsCard:U,labelExtra:be,inputEmphasis:w="default",...W},H)=>{const{t:me}=ke.useTranslation(),xe=w==="modified"&&!i&&!(p&&s?.color),fe=w==="deleted"&&!i&&!(p&&s?.color),pe=w==="success"&&!i&&!(p&&s?.color),[b,R]=l.useState(!1),[ge,he]=l.useState([]),[N,K]=l.useState(""),[a,P]=l.useState(u||"USD"),[v,_]=l.useState(!1),ve=r=>{if(C){const t={key:le,value:Be.formatCurrency(r,a)};C(t)}},g=r=>{if(r==null)return"";const t=Number(r);return isNaN(t)?r:t?.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})},I=r=>{const t=r.target.value,h=t===""||t===null||t===void 0?0:Number(t);B(h,a);const y=document.getElementById(c);if(y&&y.setAttribute("data-selected-value",JSON.stringify({value:h,currency_code:a})),y&&(L||O)){const Fe=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:h,currency_code:a},type:"change"}});y.dispatchEvent(Fe)}},J=()=>{R(!0)},Y=()=>{R(!1),(o==null||o==="")&&I({target:{value:"0.00"}}),ue?.()},ye=()=>{const r="pl-11 border h-8 text-sm block w-full p-2.5 font-inter font-medium focus:outline-none focus:ring-0";return i?n(r,"rounded-md border-red-300 bg-white dark:bg-black-600",d):p&&s?.color?n(r,`rounded-md border-${s.color}-300 bg-${s.color}-50`,"text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800",d):fe?n(r,"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)]",d):xe?n(r,"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)]",d):pe?n(r,"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)]",d):n(r,"rounded-lg border-gray-300 dark:border-black-600 bg-white dark:bg-black-600 text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]",d)};return l.useEffect(()=>{u&&P(u)},[u]),l.useEffect(()=>{if(a){const r=o===""||o===null||o===void 0?0:Number(o);u!==a&&B(r,a);const t=document.getElementById(c);if(t&&(t.setAttribute("data-selected-value",JSON.stringify({value:r,currency_code:a})),L||O)){const h=new CustomEvent("pilot-change",{bubbles:!0,detail:{selector:`#${c}`,value:{value:r,currency_code:a},type:"change"}});t.dispatchEvent(h)}}},[a]),l.useEffect(()=>{const r=Q.CURRENCIES.filter(t=>(t.value+" - "+t.label).toLowerCase().includes(N.toLowerCase())).map(t=>({label:e.jsx(_e.OptionButton,{text:`${t.value} - ${t.label}`,icon:T.getFlagComponent(t.value),showTick:a===t.value,onClick:()=>P(t.value),className:"text-black-900 dark:text-white"}),key:t.value}));he(r)},[N,a]),l.useEffect(()=>{K("")},[a]),te?e.jsxs("label",{id:c,className:`mb-1 text-xs font-medium text-gray-600 h-full inline-flex items-center gap-1 ${q?"":"capitalize"} ${z||""}`,children:[e.jsx("span",{className:"absolute inset-y-0 left-1 top-0.5 flex items-center pl-3",children:"$"}),e.jsx("input",{...W,ref:H,type:b?"number":"text",required:k,className:n(d,"pl-8 h-8"),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?o:g(o),...x&&!o?{defaultValue:b?x:g(x)}:{},id:c||F,autoFocus:D})]}):e.jsxs("div",{className:n("flex gap-0.5 relative",v&&E?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),children:[E&&!v?e.jsx("div",{className:"size-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:n("w-full flex flex-col",re),children:[e.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${q?"":"uppercase"} ${z||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Ie.InputLabel,{label:F||"",required:k||!1,isRequiredConditional:G||!1}),ie&&e.jsx(X.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),ae&&!m.shouldShowConfidenceScore(S)&&e.jsx(Ee.AIExtractedIndicator,{}),e.jsx(je.Label,{labels:ee}),A&&e.jsx(Z,{placement:"top",title:A,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(we.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),be]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[m.shouldShowConfidenceScore(S)&&f?e.jsx(Z,{placement:"top-end",title:j??"",hideTooltip:j==null,className:"cursor-pointer",children:e.jsxs("div",{className:n("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",m.getConfidenceScoreBadgeClass(f)),onClick:()=>ne?.(oe),children:[e.jsx(Ce.AIStarIcon,{size:12,fill:m.getConfidenceScoreBadgeColor(f),fillSecondary:m.getConfidenceScoreBadgeFill(f)}),e.jsxs("span",{className:n("text-xs font-medium leading-4",m.getConfidenceScoreBadgeTextColor(f)),children:[S,"%"]})]})}):null,E&&v&&C?e.jsx("button",{id:"btn-currency-input-add-to-document",className:"cursor-pointer",onClick:()=>ve(g(o)),type:"button",children:e.jsx(M.Tooltip,{placement:"top",title:me("Add to document"),children:e.jsx(X.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})]})}),e.jsxs("label",{className:"relative block",children:[e.jsx("span",{className:"absolute inset-y-0 left-1 flex items-center pl-3 text-neutral-900 dark:text-white",children:Q.CURRENCY_SYMBOLS[a]}),e.jsx("input",{...W,ref:H,placeholder:se,type:b?"number":"text",required:k,disabled:ce,className:ye(),onChange:I,min:0,onFocus:J,onBlur:Y,value:b?o:g(o),defaultValue:b?x:g(x),id:c||F,style:de,autoComplete:"off",autoFocus:D}),e.jsx("span",{className:`absolute inset-y-0 right-2 flex items-center z-[1000] h-full cursor-pointer dark:text-black-200 ${$?"cursor-pointer":""}`,children:$?e.jsx(M.Dropdown,{menu:{items:[...ge]},trigger:["click"],overlayClassName:"row-option-cell",placement:"bottomRight",overlayStyle:{zIndex:999},getPopupContainer:r=>r.parentElement,popupRender:r=>e.jsxs("div",{className:"[&>*:nth-child(2)]:!shadow-none [&>*:nth-child(2)>*]:!px-2 flex flex-col gap-2 p-2 bg-white dark:bg-black-700 border border-solid border-neutral-200 dark:border-black-600 max-h-[200px] w-[330px] text-ellipsis overflow-y-auto z-[999] rounded-md",children:[e.jsx(Ne.SearchBar,{id:"search-bar-currency-input",value:N,onChange:t=>K(t),className:"mb-2"}),r]}),children:e.jsxs("div",{className:"pl-4 pr-2 py-1.5 text-sm text-gray-700 dark:text-black-200 flex items-center gap-1",children:[T.getFlagComponent(a)," ",a]})}):a})]}),i&&e.jsx(Se.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:i})]}),v&&s&&p&&U&&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:r=>r.stopPropagation(),onMouseDown:r=>r.preventDefault(),onKeyDown:r=>{r.key==="Escape"&&_(!1)},children:e.jsx(U,{riskDetails:s})})]})});V.displayName="CurrencyInputField";exports.CurrencyInputField=V;
2
2
  //# sourceMappingURL=CurrencyInputField.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencyInputField.cjs.js","sources":["../../../../src/components/forms/currency-input/CurrencyInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport { Dropdown, Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { CURRENCIES, CURRENCY_SYMBOLS } from \"./currency.constant\";\nimport { NoteAddOutlined, BoltOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { SearchBar } from \"../search-bar/SearchBar\";\nimport { OptionButton } from \"../../buttons/option-button/OptionButton\";\nimport { getFlagComponent } from \"../../../utils/countryFlags\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport { formatCurrency as formatCurrencyUtils } from \"../../../utils/formatters\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/**\n * Props for the CurrencyInputField component\n */\nexport interface CurrencyInputFieldProps {\n /** Unique identifier for the currency input */\n id: string;\n /** Label text to display above the input */\n label?: string;\n /** Current value of the input (string for compatibility) */\n value: string;\n /** Callback function called when value changes */\n onChange: (data: any, currencyCode?: string) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Default value for the input */\n defaultValue?: string;\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 /** Additional CSS classes for the wrapper */\n className?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to use simple mode (inline label style) */\n simpleMode?: boolean;\n /** Additional CSS classes for the input field */\n inputFieldClassName?: string;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether to allow multi-currency selection with dropdown */\n allowMultiCurrency?: boolean;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Current currency code */\n currencyCode?: 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 called when input loses focus */\n onBlur?: () => void;\n /** Whether the input should auto-focus */\n autoFocus?: boolean;\n /** Whether recording is active (for pilot context) */\n isRecording?: boolean;\n /** Whether playback is active (for pilot context) */\n isPlaying?: boolean;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Input surface style: `'modified'` — Warning colors; `'deleted'` — Error colors, text #475467; `'success'` — Success colors, text #101828. */\n inputEmphasis?: \"default\" | \"modified\" | \"deleted\" | \"success\";\n}\n\n/**\n * A highly customizable currency input component with label, validation, and styling support.\n * Features currency selection, formatting, validation, GTN integration, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <CurrencyInputField\n * id=\"price\"\n * label=\"Price\"\n * value={price}\n * onChange={(value, currency) => setPrice(value)}\n * currencyCode=\"USD\"\n * allowMultiCurrency\n * required\n * />\n * ```\n */\nexport const CurrencyInputField = forwardRef<\n HTMLInputElement,\n CurrencyInputFieldProps\n>(\n (\n {\n id,\n label,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n tags,\n className,\n originalCase = false,\n tooltip,\n simpleMode = false,\n inputFieldClassName = \"\",\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n isGTN = false,\n gtnName = null,\n allowMultiCurrency = false,\n placeholder,\n disabled = false,\n currencyCode = \"USD\",\n inputStyle,\n labelClassName,\n isLiveField = false,\n onBlur: onBlurProp,\n autoFocus = false,\n isRecording = false,\n isPlaying = false,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n labelExtra,\n inputEmphasis = \"default\",\n ...props\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\" && !errorMessage && !(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisDeletedSkin = inputEmphasis === \"deleted\" && !errorMessage && !(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisSuccessSkin = inputEmphasis === \"success\" && !errorMessage && !(isRiskAnalysisOpen && riskDetails?.color);\n const [isFocused, setIsFocused] = useState(false);\n const [filteredCurrencyOptions, setFilteredCurrencyOptions] = useState<\n { label: React.ReactNode; key: string }[]\n >([]);\n const [searchKeyForCurrency, setSearchKeyForCurrency] = useState(\"\");\n const [selectedCurrency, setSelectedCurrency] = useState<string>(\n currencyCode ? currencyCode : \"USD\"\n );\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: gtnName,\n value: formatCurrencyUtils(_value, selectedCurrency),\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const formatCurrency = (targetValue: any): string => {\n if (targetValue === null || targetValue === undefined) return \"\";\n\n const number = Number(targetValue);\n if (isNaN(number)) return targetValue;\n\n return number?.toLocaleString(\"en-US\", {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n });\n };\n\n const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const _value = e.target.value;\n const numericValue =\n _value === \"\" || _value === null || _value === undefined\n ? 0\n : Number(_value);\n onChange(numericValue, selectedCurrency);\n const element = document.getElementById(id);\n if (element) {\n element.setAttribute(\n \"data-selected-value\",\n JSON.stringify({\n value: numericValue,\n currency_code: selectedCurrency,\n })\n );\n }\n if (element && (isRecording || isPlaying)) {\n const pilotEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: {\n value: numericValue,\n currency_code: selectedCurrency,\n },\n type: \"change\",\n },\n });\n element.dispatchEvent(pilotEvent);\n }\n };\n\n const onFocus = () => {\n setIsFocused(true);\n };\n\n const onBlur = () => {\n setIsFocused(false);\n if (value === null || value === undefined || value === \"\") {\n handleOnChange({\n target: { value: \"0.00\" },\n } as React.ChangeEvent<HTMLInputElement>);\n }\n onBlurProp?.();\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"pl-11 border h-8 text-sm block w-full p-2.5 font-inter font-medium focus:outline-none focus:ring-0\";\n\n if (errorMessage) {\n return cn(baseClasses, \"rounded-md border-red-300 bg-white dark:bg-black-600\", inputFieldClassName);\n }\n if (isRiskAnalysisOpen && riskDetails?.color) {\n return cn(baseClasses, `rounded-md border-${riskDetails.color}-300 bg-${riskDetails.color}-50`, \"text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800\", inputFieldClassName);\n }\n if (emphasisDeletedSkin) {\n return cn(baseClasses, \"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)]\", inputFieldClassName);\n }\n if (emphasisModifiedSkin) {\n return cn(baseClasses, \"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)]\", inputFieldClassName);\n }\n if (emphasisSuccessSkin) {\n return cn(baseClasses, \"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)]\", inputFieldClassName);\n }\n return cn(baseClasses, \"rounded-lg border-gray-300 dark:border-black-600 bg-white dark:bg-black-600 text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]\", inputFieldClassName);\n };\n\n useEffect(() => {\n if (currencyCode) {\n setSelectedCurrency(currencyCode);\n }\n }, [currencyCode]);\n\n useEffect(() => {\n if (selectedCurrency) {\n const numericValue =\n value === \"\" || value === null || value === undefined\n ? 0\n : Number(value);\n if (currencyCode !== selectedCurrency) {\n onChange(numericValue, selectedCurrency);\n }\n const element = document.getElementById(id);\n if (element) {\n element.setAttribute(\n \"data-selected-value\",\n JSON.stringify({\n value: numericValue,\n currency_code: selectedCurrency,\n })\n );\n if (isRecording || isPlaying) {\n const pilotEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: {\n value: numericValue,\n currency_code: selectedCurrency,\n },\n type: \"change\",\n },\n });\n element.dispatchEvent(pilotEvent);\n }\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedCurrency]);\n\n useEffect(() => {\n const currencyOptions = CURRENCIES.filter((item) =>\n (item.value + \" - \" + item.label)\n .toLowerCase()\n .includes(searchKeyForCurrency.toLowerCase())\n ).map((item) => ({\n label: (\n <OptionButton\n text={`${item.value} - ${item.label}`}\n icon={getFlagComponent(item.value)}\n showTick={selectedCurrency === item.value}\n onClick={() => setSelectedCurrency(item.value)}\n className=\"text-black-900 dark:text-white\"\n />\n ),\n key: item.value,\n }));\n\n setFilteredCurrencyOptions(currencyOptions);\n }, [searchKeyForCurrency, selectedCurrency]);\n\n useEffect(() => {\n setSearchKeyForCurrency(\"\");\n }, [selectedCurrency]);\n\n // Simple mode rendering\n if (simpleMode) {\n return (\n <label\n id={id}\n className={`mb-1 text-xs font-medium text-gray-600 h-full inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <span className=\"absolute inset-y-0 left-1 top-0.5 flex items-center pl-3\">\n {\"$\"}\n </span>\n <input\n {...props}\n ref={ref}\n type={isFocused ? \"number\" : \"text\"}\n required={required}\n className={cn(inputFieldClassName, \"pl-8 h-8\")}\n onChange={handleOnChange}\n min={0}\n onFocus={onFocus}\n onBlur={onBlur}\n value={!isFocused ? formatCurrency(value) : value}\n {...(defaultValue && !value\n ? {\n defaultValue: !isFocused\n ? formatCurrency(defaultValue)\n : defaultValue,\n }\n : {})}\n id={id || label}\n autoFocus={autoFocus}\n />\n </label>\n );\n }\n\n // Full mode rendering\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\"\n : \"\"\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"size-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n <div className={cn(\"w-full flex flex-col\", className)}>\n <label\n htmlFor=\"text\"\n className={`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"uppercase\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip placement=\"top\" title={tooltip}>\n <div className=\"cursor-pointer\">\n <HelpIcon />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </div>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-currency-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(formatCurrency(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 <label className=\"relative block\">\n <span className=\"absolute inset-y-0 left-1 flex items-center pl-3 text-neutral-900 dark:text-white\">\n {CURRENCY_SYMBOLS[selectedCurrency]}\n </span>\n\n <input\n {...props}\n ref={ref}\n placeholder={placeholder}\n type={isFocused ? \"number\" : \"text\"}\n required={required}\n disabled={disabled}\n className={getClassName()}\n onChange={handleOnChange}\n min={0}\n onFocus={onFocus}\n onBlur={onBlur}\n value={!isFocused ? formatCurrency(value) : value}\n defaultValue={\n !isFocused ? formatCurrency(defaultValue) : defaultValue\n }\n id={id || label}\n style={inputStyle}\n autoComplete=\"off\"\n autoFocus={autoFocus}\n />\n <span\n className={`absolute inset-y-0 right-2 flex items-center z-[1000] h-full cursor-pointer dark:text-black-200 ${\n allowMultiCurrency ? \"cursor-pointer\" : \"\"\n }`}\n >\n {allowMultiCurrency ? (\n <Dropdown\n menu={{\n items: [\n ...filteredCurrencyOptions,\n ],\n }}\n trigger={[\"click\"]}\n overlayClassName=\"row-option-cell\"\n placement=\"bottomRight\"\n overlayStyle={{ zIndex: 999 }}\n getPopupContainer={(trigger) =>\n trigger.parentElement as HTMLElement\n }\n popupRender={(menu) => (\n <div\n className=\"[&>*:nth-child(2)]:!shadow-none [&>*:nth-child(2)>*]:!px-2 flex flex-col gap-2 p-2 bg-white dark:bg-black-700 border border-solid border-neutral-200 dark:border-black-600 max-h-[200px] w-[330px] text-ellipsis overflow-y-auto z-[999] rounded-md\"\n >\n <SearchBar\n id={`search-bar-currency-input`}\n value={searchKeyForCurrency}\n onChange={(_value) =>\n setSearchKeyForCurrency(_value)\n }\n className=\"mb-2\"\n />\n {menu}\n </div>\n )}\n >\n <div className=\"pl-4 pr-2 py-1.5 text-sm text-gray-700 dark:text-black-200 flex items-center gap-1\">\n {getFlagComponent(selectedCurrency)} {selectedCurrency}\n </div>\n </Dropdown>\n ) : (\n selectedCurrency\n )}\n </span>\n </label>\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n </div>\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\nCurrencyInputField.displayName = \"CurrencyInputField\";\n"],"names":["CurrencyInputField","forwardRef","id","label","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","tags","className","originalCase","tooltip","simpleMode","inputFieldClassName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","isGTN","gtnName","allowMultiCurrency","placeholder","disabled","currencyCode","inputStyle","labelClassName","isLiveField","onBlurProp","autoFocus","isRecording","isPlaying","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","labelExtra","inputEmphasis","props","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isFocused","setIsFocused","useState","filteredCurrencyOptions","setFilteredCurrencyOptions","searchKeyForCurrency","setSearchKeyForCurrency","selectedCurrency","setSelectedCurrency","isHovered","setIsHovered","handleAddGTNToDocument","_value","keyValuePair","formatCurrencyUtils","formatCurrency","targetValue","number","handleOnChange","e","numericValue","element","pilotEvent","onFocus","onBlur","getClassName","baseClasses","cn","useEffect","currencyOptions","CURRENCIES","item","jsx","OptionButton","getFlagComponent","jsxs","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","CURRENCY_SYMBOLS","Dropdown","trigger","menu","SearchBar","Typography"],"mappings":"+3BA6KaA,EAAqBC,EAAAA,WAIhC,CACE,CACE,GAAAC,EACA,MAAAC,EACA,MAAAC,EACA,SAAAC,EACA,aAAAC,EACA,aAAAC,EACA,SAAAC,EAAW,GACX,sBAAAC,EAAwB,GACxB,KAAAC,GACA,UAAAC,GACA,aAAAC,EAAe,GACf,QAAAC,EACA,WAAAC,GAAa,GACb,oBAAAC,EAAsB,GACtB,cAAAC,GAAgB,GAChB,gBAAAC,EACA,eAAAC,EAAiB,OACjB,kBAAAC,EACA,WAAAC,GAAa,CAAA,EACb,uBAAAC,GACA,MAAAC,EAAQ,GACR,QAAAC,GAAU,KACV,mBAAAC,EAAqB,GACrB,YAAAC,GACA,SAAAC,GAAW,GACX,aAAAC,E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B,YAAcA,GAAMA,EAAE,eAAA,EACtB,UAAYA,GAAM,CACZA,EAAE,MAAQ,UACZT,EAAa,EAAK,CAEtB,EAEA,SAAAsB,EAAAA,IAAC1C,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEApC,EAAmB,YAAc"}
1
+ {"version":3,"file":"CurrencyInputField.cjs.js","sources":["../../../../src/components/forms/currency-input/CurrencyInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport { Dropdown, Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport { CURRENCIES, CURRENCY_SYMBOLS } from \"./currency.constant\";\nimport { NoteAddOutlined, BoltOutlined } from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { SearchBar } from \"../search-bar/SearchBar\";\nimport { OptionButton } from \"../../buttons/option-button/OptionButton\";\nimport { getFlagComponent } from \"../../../utils/countryFlags\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport { formatCurrency as formatCurrencyUtils } from \"../../../utils/formatters\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/**\n * Props for the CurrencyInputField component\n */\nexport interface CurrencyInputFieldProps {\n /** Unique identifier for the currency input */\n id: string;\n /** Label text to display above the input */\n label?: string;\n /** Current value of the input (string for compatibility) */\n value: string;\n /** Callback function called when value changes */\n onChange: (data: any, currencyCode?: string) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Default value for the input */\n defaultValue?: string;\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 /** Additional CSS classes for the wrapper */\n className?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to use simple mode (inline label style) */\n simpleMode?: boolean;\n /** Additional CSS classes for the input field */\n inputFieldClassName?: string;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether to allow multi-currency selection with dropdown */\n allowMultiCurrency?: boolean;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Current currency code */\n currencyCode?: 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 called when input loses focus */\n onBlur?: () => void;\n /** Whether the input should auto-focus */\n autoFocus?: boolean;\n /** Whether recording is active (for pilot context) */\n isRecording?: boolean;\n /** Whether playback is active (for pilot context) */\n isPlaying?: boolean;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Input surface style: `'modified'` — Warning colors; `'deleted'` — Error colors, text #475467; `'success'` — Success colors, text #101828. */\n inputEmphasis?: \"default\" | \"modified\" | \"deleted\" | \"success\";\n}\n\n/**\n * A highly customizable currency input component with label, validation, and styling support.\n * Features currency selection, formatting, validation, GTN integration, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <CurrencyInputField\n * id=\"price\"\n * label=\"Price\"\n * value={price}\n * onChange={(value, currency) => setPrice(value)}\n * currencyCode=\"USD\"\n * allowMultiCurrency\n * required\n * />\n * ```\n */\nexport const CurrencyInputField = forwardRef<\n HTMLInputElement,\n CurrencyInputFieldProps\n>(\n (\n {\n id,\n label,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n tags,\n className,\n originalCase = false,\n tooltip,\n simpleMode = false,\n inputFieldClassName = \"\",\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n isGTN = false,\n gtnName = null,\n allowMultiCurrency = false,\n placeholder,\n disabled = false,\n currencyCode = \"USD\",\n inputStyle,\n labelClassName,\n isLiveField = false,\n onBlur: onBlurProp,\n autoFocus = false,\n isRecording = false,\n isPlaying = false,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n labelExtra,\n inputEmphasis = \"default\",\n ...props\n },\n ref\n ) => {\n const { t } = useTranslation();\n const emphasisModifiedSkin = inputEmphasis === \"modified\" && !errorMessage && !(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisDeletedSkin = inputEmphasis === \"deleted\" && !errorMessage && !(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisSuccessSkin = inputEmphasis === \"success\" && !errorMessage && !(isRiskAnalysisOpen && riskDetails?.color);\n const [isFocused, setIsFocused] = useState(false);\n const [filteredCurrencyOptions, setFilteredCurrencyOptions] = useState<\n { label: React.ReactNode; key: string }[]\n >([]);\n const [searchKeyForCurrency, setSearchKeyForCurrency] = useState(\"\");\n const [selectedCurrency, setSelectedCurrency] = useState<string>(\n currencyCode ? currencyCode : \"USD\"\n );\n const [isHovered, setIsHovered] = useState(false);\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument) {\n const keyValuePair = {\n key: gtnName,\n value: formatCurrencyUtils(_value, selectedCurrency),\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const formatCurrency = (targetValue: any): string => {\n if (targetValue === null || targetValue === undefined) return \"\";\n\n const number = Number(targetValue);\n if (isNaN(number)) return targetValue;\n\n return number?.toLocaleString(\"en-US\", {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n });\n };\n\n const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const _value = e.target.value;\n const numericValue =\n _value === \"\" || _value === null || _value === undefined\n ? 0\n : Number(_value);\n onChange(numericValue, selectedCurrency);\n const element = document.getElementById(id);\n if (element) {\n element.setAttribute(\n \"data-selected-value\",\n JSON.stringify({\n value: numericValue,\n currency_code: selectedCurrency,\n })\n );\n }\n if (element && (isRecording || isPlaying)) {\n const pilotEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: {\n value: numericValue,\n currency_code: selectedCurrency,\n },\n type: \"change\",\n },\n });\n element.dispatchEvent(pilotEvent);\n }\n };\n\n const onFocus = () => {\n setIsFocused(true);\n };\n\n const onBlur = () => {\n setIsFocused(false);\n if (value === null || value === undefined || value === \"\") {\n handleOnChange({\n target: { value: \"0.00\" },\n } as React.ChangeEvent<HTMLInputElement>);\n }\n onBlurProp?.();\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"pl-11 border h-8 text-sm block w-full p-2.5 font-inter font-medium focus:outline-none focus:ring-0\";\n\n if (errorMessage) {\n return cn(baseClasses, \"rounded-md border-red-300 bg-white dark:bg-black-600\", inputFieldClassName);\n }\n if (isRiskAnalysisOpen && riskDetails?.color) {\n return cn(baseClasses, `rounded-md border-${riskDetails.color}-300 bg-${riskDetails.color}-50`, \"text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800\", inputFieldClassName);\n }\n if (emphasisDeletedSkin) {\n return cn(baseClasses, \"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)]\", inputFieldClassName);\n }\n if (emphasisModifiedSkin) {\n return cn(baseClasses, \"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)]\", inputFieldClassName);\n }\n if (emphasisSuccessSkin) {\n return cn(baseClasses, \"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)]\", inputFieldClassName);\n }\n return cn(baseClasses, \"rounded-lg border-gray-300 dark:border-black-600 bg-white dark:bg-black-600 text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400 focus:border-[var(--color-primary-600)] dark:focus:border-[var(--color-primary-400)] focus:shadow-[0_0_0_1.5px_var(--color-primary-100)] dark:focus:shadow-[0_0_0_1.5px_var(--color-primary-950)]\", inputFieldClassName);\n };\n\n useEffect(() => {\n if (currencyCode) {\n setSelectedCurrency(currencyCode);\n }\n }, [currencyCode]);\n\n useEffect(() => {\n if (selectedCurrency) {\n const numericValue =\n value === \"\" || value === null || value === undefined\n ? 0\n : Number(value);\n if (currencyCode !== selectedCurrency) {\n onChange(numericValue, selectedCurrency);\n }\n const element = document.getElementById(id);\n if (element) {\n element.setAttribute(\n \"data-selected-value\",\n JSON.stringify({\n value: numericValue,\n currency_code: selectedCurrency,\n })\n );\n if (isRecording || isPlaying) {\n const pilotEvent = new CustomEvent(\"pilot-change\", {\n bubbles: true,\n detail: {\n selector: `#${id}`,\n value: {\n value: numericValue,\n currency_code: selectedCurrency,\n },\n type: \"change\",\n },\n });\n element.dispatchEvent(pilotEvent);\n }\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedCurrency]);\n\n useEffect(() => {\n const currencyOptions = CURRENCIES.filter((item) =>\n (item.value + \" - \" + item.label)\n .toLowerCase()\n .includes(searchKeyForCurrency.toLowerCase())\n ).map((item) => ({\n label: (\n <OptionButton\n text={`${item.value} - ${item.label}`}\n icon={getFlagComponent(item.value)}\n showTick={selectedCurrency === item.value}\n onClick={() => setSelectedCurrency(item.value)}\n className=\"text-black-900 dark:text-white\"\n />\n ),\n key: item.value,\n }));\n\n setFilteredCurrencyOptions(currencyOptions);\n }, [searchKeyForCurrency, selectedCurrency]);\n\n useEffect(() => {\n setSearchKeyForCurrency(\"\");\n }, [selectedCurrency]);\n\n // Simple mode rendering\n if (simpleMode) {\n return (\n <label\n id={id}\n className={`mb-1 text-xs font-medium text-gray-600 h-full inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <span className=\"absolute inset-y-0 left-1 top-0.5 flex items-center pl-3\">\n {\"$\"}\n </span>\n <input\n {...props}\n ref={ref}\n type={isFocused ? \"number\" : \"text\"}\n required={required}\n className={cn(inputFieldClassName, \"pl-8 h-8\")}\n onChange={handleOnChange}\n min={0}\n onFocus={onFocus}\n onBlur={onBlur}\n value={!isFocused ? formatCurrency(value) : value}\n {...(defaultValue && !value\n ? {\n defaultValue: !isFocused\n ? formatCurrency(defaultValue)\n : defaultValue,\n }\n : {})}\n id={id || label}\n autoFocus={autoFocus}\n />\n </label>\n );\n }\n\n // Full mode rendering\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\"\n : \"\"\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"size-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n <div className={cn(\"w-full flex flex-col\", className)}>\n <label\n htmlFor=\"text\"\n className={`mb-1 text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"uppercase\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip 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 </div>\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-currency-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(formatCurrency(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 <label className=\"relative block\">\n <span className=\"absolute inset-y-0 left-1 flex items-center pl-3 text-neutral-900 dark:text-white\">\n {CURRENCY_SYMBOLS[selectedCurrency]}\n </span>\n\n <input\n {...props}\n ref={ref}\n placeholder={placeholder}\n type={isFocused ? \"number\" : \"text\"}\n required={required}\n disabled={disabled}\n className={getClassName()}\n onChange={handleOnChange}\n min={0}\n onFocus={onFocus}\n onBlur={onBlur}\n value={!isFocused ? formatCurrency(value) : value}\n defaultValue={\n !isFocused ? formatCurrency(defaultValue) : defaultValue\n }\n id={id || label}\n style={inputStyle}\n autoComplete=\"off\"\n autoFocus={autoFocus}\n />\n <span\n className={`absolute inset-y-0 right-2 flex items-center z-[1000] h-full cursor-pointer dark:text-black-200 ${\n allowMultiCurrency ? \"cursor-pointer\" : \"\"\n }`}\n >\n {allowMultiCurrency ? (\n <Dropdown\n menu={{\n items: [\n ...filteredCurrencyOptions,\n ],\n }}\n trigger={[\"click\"]}\n overlayClassName=\"row-option-cell\"\n placement=\"bottomRight\"\n overlayStyle={{ zIndex: 999 }}\n getPopupContainer={(trigger) =>\n trigger.parentElement as HTMLElement\n }\n popupRender={(menu) => (\n <div\n className=\"[&>*:nth-child(2)]:!shadow-none [&>*:nth-child(2)>*]:!px-2 flex flex-col gap-2 p-2 bg-white dark:bg-black-700 border border-solid border-neutral-200 dark:border-black-600 max-h-[200px] w-[330px] text-ellipsis overflow-y-auto z-[999] rounded-md\"\n >\n <SearchBar\n id={`search-bar-currency-input`}\n value={searchKeyForCurrency}\n onChange={(_value) =>\n setSearchKeyForCurrency(_value)\n }\n className=\"mb-2\"\n />\n {menu}\n </div>\n )}\n >\n <div className=\"pl-4 pr-2 py-1.5 text-sm text-gray-700 dark:text-black-200 flex items-center gap-1\">\n {getFlagComponent(selectedCurrency)} {selectedCurrency}\n </div>\n </Dropdown>\n ) : (\n selectedCurrency\n )}\n </span>\n </label>\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n </div>\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\nCurrencyInputField.displayName = \"CurrencyInputField\";\n"],"names":["CurrencyInputField","forwardRef","id","label","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","tags","className","originalCase","tooltip","simpleMode","inputFieldClassName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","isGTN","gtnName","allowMultiCurrency","placeholder","disabled","currencyCode","inputStyle","labelClassName","isLiveField","onBlurProp","autoFocus","isRecording","isPlaying","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","labelExtra","inputEmphasis","props","ref","t","useTranslation","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isFocused","setIsFocused","useState","filteredCurrencyOptions","setFilteredCurrencyOptions","searchKeyForCurrency","setSearchKeyForCurrency","selectedCurrency","setSelectedCurrency","isHovered","setIsHovered","handleAddGTNToDocument","_value","keyValuePair","formatCurrencyUtils","formatCurrency","targetValue","number","handleOnChange","e","numericValue","element","pilotEvent","onFocus","onBlur","getClassName","baseClasses","cn","useEffect","currencyOptions","CURRENCIES","item","jsx","OptionButton","getFlagComponent","jsxs","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","CURRENCY_SYMBOLS","Dropdown","trigger","menu","SearchBar","Typography"],"mappings":"+3BA6KaA,EAAqBC,EAAAA,WAIhC,CACE,CACE,GAAAC,EACA,MAAAC,EACA,MAAAC,EACA,SAAAC,EACA,aAAAC,EACA,aAAAC,EACA,SAAAC,EAAW,GACX,sBAAAC,EAAwB,GACxB,KAAAC,GACA,UAAAC,GACA,aAAAC,EAAe,GACf,QAAAC,EACA,WAAAC,GAAa,GACb,oBAAAC,EAAsB,GACtB,cAAAC,GAAgB,GAChB,gBAAAC,EACA,eAAAC,EAAiB,OACjB,kBAAAC,EACA,WAAAC,GAAa,CAAA,EACb,uBAAAC,GACA,MAAAC,EAAQ,GACR,QAAAC,GAAU,KACV,mBAAAC,EAAqB,GACrB,YAAAC,GACA,SAAAC,GAAW,GACX,aAAAC,EAAe,MACf,WAAAC,GACA,eAAAC,EACA,YAAAC,GAAc,GACd,OAAQC,GACR,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,UAAAC,EAAY,GACZ,mBAAAC,EACA,YAAAC,EACA,mBAAAC,EAAqB,GACrB,gBAAAC,EACA,WAAAC,GACA,cAAAC,EAAgB,UAChB,GAAGC,CAAA,EAELC,IACG,CACH,KAAM,CAAE,EAAAC,EAAA,EAAMC,kBAAA,EACRC,GAAuBL,IAAkB,YAAc,CAAClC,GAAgB,EAAE+B,GAAsBD,GAAa,OAC7GU,GAAsBN,IAAkB,WAAa,CAAClC,GAAgB,EAAE+B,GAAsBD,GAAa,OAC3GW,GAAsBP,IAAkB,WAAa,CAAClC,GAAgB,EAAE+B,GAAsBD,GAAa,OAC3G,CAACY,EAAWC,CAAY,EAAIC,EAAAA,SAAS,EAAK,EAC1C,CAACC,GAAyBC,EAA0B,EAAIF,EAAAA,SAE5D,CAAA,CAAE,EACE,CAACG,EAAsBC,CAAuB,EAAIJ,EAAAA,SAAS,EAAE,EAC7D,CAACK,EAAkBC,CAAmB,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CAAAH,EAAAA,IAACsB,GAAAA,UAAA,CACC,GAAI,4BACJ,MAAOjD,EACP,SAAWO,GACTN,EAAwBM,CAAM,EAEhC,UAAU,MAAA,CAAA,EAEjByC,CAAA,CAAA,CAAA,EAIL,SAAAlB,EAAAA,KAAC,MAAA,CAAI,UAAU,qFACZ,SAAA,CAAAD,EAAAA,iBAAiB3B,CAAgB,EAAE,IAAEA,CAAA,CAAA,CACxC,CAAA,CAAA,EAGFA,CAAA,CAAA,CAEJ,EACF,EACCjD,GACC0E,EAAAA,IAACuB,GAAAA,WAAA,CACC,UAAU,sBACV,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAjG,CAAA,CAAA,CACH,EAEJ,EACCmD,GACCrB,GACAC,GACAC,GACE0C,EAAAA,IAAC,MAAA,CACC,KAAK,UACL,SAAU,EACV,UAAU,oFACV,QAAUb,GAAMA,EAAE,gBAAA,EAClB,YAAcA,GAAMA,EAAE,eAAA,EACtB,UAAYA,GAAM,CACZA,EAAE,MAAQ,UACZT,EAAa,EAAK,CAEtB,EAEA,SAAAsB,EAAAA,IAAC1C,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEApC,EAAmB,YAAc"}
@@ -4,8 +4,8 @@ import { forwardRef as ye, useState as h, useEffect as k } from "react";
4
4
  import { Tooltip as ke, Dropdown as Fe } from "antd";
5
5
  import { useTranslation as Ee } from "react-i18next";
6
6
  import { Typography as Se } from "../../data-display/typography/Typography.es.js";
7
- import { Label as Ce } from "../../data-display/label/Label.es.js";
8
- import { CURRENCIES as we, CURRENCY_SYMBOLS as Ne } from "./currency.constant.es.js";
7
+ import { Label as we } from "../../data-display/label/Label.es.js";
8
+ import { CURRENCIES as Ce, CURRENCY_SYMBOLS as Ne } from "./currency.constant.es.js";
9
9
  import { BoltOutlined as _e, NoteAddOutlined as Be } from "@mui/icons-material";
10
10
  import { AIExtractedIndicator as Ie } from "../../icons/AIExtractedIndicator.es.js";
11
11
  import { AIStarIcon as $e } from "../../icons/AIStarIcon.es.js";
@@ -36,10 +36,10 @@ const Ke = ye(
36
36
  isAiExtracted: re = !1,
37
37
  confidenceScore: S,
38
38
  confidenceType: f = "high",
39
- confidenceTooltip: C,
39
+ confidenceTooltip: w,
40
40
  sourceMeta: te = [],
41
41
  onConfidenceScoreClick: oe,
42
- isGTN: w = !1,
42
+ isGTN: C = !1,
43
43
  gtnName: ae = null,
44
44
  allowMultiCurrency: L = !1,
45
45
  placeholder: le,
@@ -140,7 +140,7 @@ const Ke = ye(
140
140
  }
141
141
  }
142
142
  }, [o]), k(() => {
143
- const e = we.filter(
143
+ const e = Ce.filter(
144
144
  (r) => (r.value + " - " + r.label).toLowerCase().includes(B.toLowerCase())
145
145
  ).map((r) => ({
146
146
  label: /* @__PURE__ */ t(
@@ -192,12 +192,12 @@ const Ke = ye(
192
192
  {
193
193
  className: n(
194
194
  "flex gap-0.5 relative",
195
- v && w ? "border rounded-lg border-primary-100 bg-primary-50 p-1" : ""
195
+ v && C ? "border rounded-lg border-primary-100 bg-primary-50 p-1" : ""
196
196
  ),
197
197
  onMouseEnter: () => I(!0),
198
198
  onMouseLeave: () => I(!1),
199
199
  children: [
200
- w && !v ? /* @__PURE__ */ t("div", { className: "size-1 bg-primary-600 rounded-full animate-blink mt-1.5" }) : null,
200
+ C && !v ? /* @__PURE__ */ t("div", { className: "size-1 bg-primary-600 rounded-full animate-blink mt-1.5" }) : null,
201
201
  /* @__PURE__ */ l("div", { className: n("w-full flex flex-col", G), children: [
202
202
  /* @__PURE__ */ t(
203
203
  "label",
@@ -218,8 +218,8 @@ const Ke = ye(
218
218
  }
219
219
  ),
220
220
  re && !Z(S) && /* @__PURE__ */ t(Ie, {}),
221
- /* @__PURE__ */ t(Ce, { labels: V }),
222
- D && /* @__PURE__ */ t(X, { placement: "top", title: D, children: /* @__PURE__ */ t("div", { className: "cursor-pointer", children: /* @__PURE__ */ t(ze, {}) }) }),
221
+ /* @__PURE__ */ t(we, { labels: V }),
222
+ D && /* @__PURE__ */ t(X, { placement: "top", title: D, children: /* @__PURE__ */ t("div", { className: "cursor-pointer", children: /* @__PURE__ */ t(ze, { className: "w-icon-sm h-icon-sm" }) }) }),
223
223
  ie
224
224
  ] }),
225
225
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1 justify-self-end", children: [
@@ -227,8 +227,8 @@ const Ke = ye(
227
227
  X,
228
228
  {
229
229
  placement: "top-end",
230
- title: C ?? "",
231
- hideTooltip: C == null,
230
+ title: w ?? "",
231
+ hideTooltip: w == null,
232
232
  className: "cursor-pointer",
233
233
  children: /* @__PURE__ */ l(
234
234
  "div",
@@ -256,7 +256,7 @@ const Ke = ye(
256
256
  )
257
257
  }
258
258
  ) : null,
259
- w && v && N ? /* @__PURE__ */ t(
259
+ C && v && N ? /* @__PURE__ */ t(
260
260
  "button",
261
261
  {
262
262
  id: "btn-currency-input-add-to-document",