@lax-wp/design-system 0.14.39 → 0.14.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js +149 -166
- package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/constants.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/constants.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/constants.d.ts +0 -8
- package/dist/components/data-display/infinite-table/constants.es.js +20 -24
- package/dist/components/data-display/infinite-table/constants.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/context.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/context.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/context.d.ts +1 -5
- package/dist/components/data-display/infinite-table/context.es.js +2 -5
- package/dist/components/data-display/infinite-table/context.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/head/cell/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/head/cell/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/head/cell/index.es.js +39 -39
- package/dist/components/data-display/infinite-table/head/cell/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.d.ts +1 -1
- package/dist/components/data-display/infinite-table/index.es.js +526 -547
- package/dist/components/data-display/infinite-table/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/types.d.ts +4 -75
- package/dist/components/data-display/label-value/LabelValue.cjs.js +1 -1
- package/dist/components/data-display/label-value/LabelValue.cjs.js.map +1 -1
- package/dist/components/data-display/label-value/LabelValue.es.js +1 -1
- package/dist/components/data-display/label-value/LabelValue.es.js.map +1 -1
- package/dist/components/floating-bar/FloatingBar.cjs.js +1 -1
- package/dist/components/floating-bar/FloatingBar.cjs.js.map +1 -1
- package/dist/components/floating-bar/FloatingBar.es.js +29 -32
- package/dist/components/floating-bar/FloatingBar.es.js.map +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.cjs.js +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.cjs.js.map +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.es.js +24 -24
- package/dist/components/forms/currency-input/CurrencyInputField.es.js.map +1 -1
- package/dist/components/forms/icon-picker/IconPicker.cjs.js +1 -1
- package/dist/components/forms/icon-picker/IconPicker.cjs.js.map +1 -1
- package/dist/components/forms/icon-picker/IconPicker.es.js +65 -79
- package/dist/components/forms/icon-picker/IconPicker.es.js.map +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js.map +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js +2 -2
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js.map +1 -1
- package/dist/components/forms/md-input/RichMarkdownInput.cjs.js +1 -1
- package/dist/components/forms/md-input/RichMarkdownInput.cjs.js.map +1 -1
- package/dist/components/forms/md-input/RichMarkdownInput.es.js +38 -39
- package/dist/components/forms/md-input/RichMarkdownInput.es.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/providers/design-system-provider/types.d.ts +0 -1
- package/package.json +1 -1
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.cjs.js +0 -2
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.cjs.js.map +0 -1
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.d.ts +0 -30
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.es.js +0 -248
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.es.js.map +0 -1
- package/dist/components/data-display/infinite-table/copy-text.cjs.js +0 -2
- package/dist/components/data-display/infinite-table/copy-text.cjs.js.map +0 -1
- package/dist/components/data-display/infinite-table/copy-text.d.ts +0 -13
- package/dist/components/data-display/infinite-table/copy-text.es.js +0 -56
- package/dist/components/data-display/infinite-table/copy-text.es.js.map +0 -1
|
@@ -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 disabled:!text-neutral-400 dark:disabled:!text-neutral-500\", 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:!text-neutral-400 dark:disabled:!text-neutral-500 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:!text-neutral-400 dark:disabled:!text-neutral-500 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 z-10 flex items-center pl-3 cursor-text select-all\">\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 z-1 flex items-center pl-3 text-neutral-900 dark:text-white cursor-text select-all\">\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 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={() => document.body}\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","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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CACC,UAAU,sPAEJ,SAAA,CAAAH,EAAAA,IAACqB,GAAAA,UAAA,CACC,GAAI,4BACJ,MAAOhD,EACP,SAAWO,GACTN,EAAwBM,CAAM,EAEhC,UAAU,MAAA,CAAA,EAEjBwC,CAAA,CAAA,CAAA,EAIL,SAAAjB,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,IAACsB,GAAAA,WAAA,CACC,UAAU,sBACV,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAhG,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"}
|
|
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 z-10 flex items-center pl-3 cursor-text select-all\">\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 z-1 flex items-center pl-3 text-neutral-900 dark:text-white cursor-text select-all\">\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 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={() => document.body}\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","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,EA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EtB,EAEA,SAAAsB,EAAAA,IAAC1C,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEApC,EAAmB,YAAc"}
|
|
@@ -44,7 +44,7 @@ const Ke = ye(
|
|
|
44
44
|
allowMultiCurrency: L = !1,
|
|
45
45
|
placeholder: le,
|
|
46
46
|
disabled: ne = !1,
|
|
47
|
-
currencyCode:
|
|
47
|
+
currencyCode: m = "USD",
|
|
48
48
|
inputStyle: ce,
|
|
49
49
|
labelClassName: O,
|
|
50
50
|
isLiveField: de = !1,
|
|
@@ -60,9 +60,9 @@ const Ke = ye(
|
|
|
60
60
|
inputEmphasis: _ = "default",
|
|
61
61
|
...K
|
|
62
62
|
}, J) => {
|
|
63
|
-
const { t:
|
|
64
|
-
|
|
65
|
-
), [v, I] = h(!1),
|
|
63
|
+
const { t: me } = Se(), ue = _ === "modified" && !i && !(p && c?.color), be = _ === "deleted" && !i && !(p && c?.color), fe = _ === "success" && !i && !(p && c?.color), [u, P] = h(!1), [pe, ge] = h([]), [B, R] = h(""), [o, Y] = h(
|
|
64
|
+
m || "USD"
|
|
65
|
+
), [v, I] = h(!1), xe = (e) => {
|
|
66
66
|
if (N) {
|
|
67
67
|
const r = {
|
|
68
68
|
key: ae,
|
|
@@ -70,7 +70,7 @@ const Ke = ye(
|
|
|
70
70
|
};
|
|
71
71
|
N(r);
|
|
72
72
|
}
|
|
73
|
-
},
|
|
73
|
+
}, g = (e) => {
|
|
74
74
|
if (e == null) return "";
|
|
75
75
|
const r = Number(e);
|
|
76
76
|
return isNaN(r) ? e : r?.toLocaleString("en-US", {
|
|
@@ -78,13 +78,13 @@ const Ke = ye(
|
|
|
78
78
|
maximumFractionDigits: 2
|
|
79
79
|
});
|
|
80
80
|
}, $ = (e) => {
|
|
81
|
-
const r = e.target.value,
|
|
82
|
-
z(
|
|
81
|
+
const r = e.target.value, x = r === "" || r === null || r === void 0 ? 0 : Number(r);
|
|
82
|
+
z(x, o);
|
|
83
83
|
const y = document.getElementById(d);
|
|
84
84
|
if (y && y.setAttribute(
|
|
85
85
|
"data-selected-value",
|
|
86
86
|
JSON.stringify({
|
|
87
|
-
value:
|
|
87
|
+
value: x,
|
|
88
88
|
currency_code: o
|
|
89
89
|
})
|
|
90
90
|
), y && (U || j)) {
|
|
@@ -93,7 +93,7 @@ const Ke = ye(
|
|
|
93
93
|
detail: {
|
|
94
94
|
selector: `#${d}`,
|
|
95
95
|
value: {
|
|
96
|
-
value:
|
|
96
|
+
value: x,
|
|
97
97
|
currency_code: o
|
|
98
98
|
},
|
|
99
99
|
type: "change"
|
|
@@ -109,14 +109,14 @@ const Ke = ye(
|
|
|
109
109
|
}), se?.();
|
|
110
110
|
}, he = () => {
|
|
111
111
|
const e = "pl-11 border h-8 text-sm block w-full p-2.5 font-inter font-medium focus:outline-none focus:ring-0";
|
|
112
|
-
return i ? n(e, "rounded-md border-red-300 bg-white dark:bg-black-600
|
|
112
|
+
return i ? n(e, "rounded-md border-red-300 bg-white dark:bg-black-600", s) : p && c?.color ? n(e, `rounded-md border-${c.color}-300 bg-${c.color}-50`, "text-neutral-900 dark:text-black-200 disabled:bg-neutral-50 dark:disabled:!bg-black-800", s) : be ? n(e, "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)]", s) : ue ? n(e, "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)]", s) : fe ? n(e, "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)]", s) : n(e, "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)]", s);
|
|
113
113
|
};
|
|
114
114
|
return k(() => {
|
|
115
|
-
|
|
116
|
-
}, [
|
|
115
|
+
m && Y(m);
|
|
116
|
+
}, [m]), k(() => {
|
|
117
117
|
if (o) {
|
|
118
118
|
const e = a === "" || a === null || a === void 0 ? 0 : Number(a);
|
|
119
|
-
|
|
119
|
+
m !== o && z(e, o);
|
|
120
120
|
const r = document.getElementById(d);
|
|
121
121
|
if (r && (r.setAttribute(
|
|
122
122
|
"data-selected-value",
|
|
@@ -125,7 +125,7 @@ const Ke = ye(
|
|
|
125
125
|
currency_code: o
|
|
126
126
|
})
|
|
127
127
|
), U || j)) {
|
|
128
|
-
const
|
|
128
|
+
const x = new CustomEvent("pilot-change", {
|
|
129
129
|
bubbles: !0,
|
|
130
130
|
detail: {
|
|
131
131
|
selector: `#${d}`,
|
|
@@ -136,7 +136,7 @@ const Ke = ye(
|
|
|
136
136
|
type: "change"
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
|
-
r.dispatchEvent(
|
|
139
|
+
r.dispatchEvent(x);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}, [o]), k(() => {
|
|
@@ -155,7 +155,7 @@ const Ke = ye(
|
|
|
155
155
|
),
|
|
156
156
|
key: r.value
|
|
157
157
|
}));
|
|
158
|
-
|
|
158
|
+
ge(e);
|
|
159
159
|
}, [B, o]), k(() => {
|
|
160
160
|
R("");
|
|
161
161
|
}, [o]), ee ? /* @__PURE__ */ l(
|
|
@@ -170,16 +170,16 @@ const Ke = ye(
|
|
|
170
170
|
{
|
|
171
171
|
...K,
|
|
172
172
|
ref: J,
|
|
173
|
-
type:
|
|
173
|
+
type: u ? "number" : "text",
|
|
174
174
|
required: S,
|
|
175
175
|
className: n(s, "pl-8 h-8"),
|
|
176
176
|
onChange: $,
|
|
177
177
|
min: 0,
|
|
178
178
|
onFocus: q,
|
|
179
179
|
onBlur: Q,
|
|
180
|
-
value:
|
|
180
|
+
value: u ? a : g(a),
|
|
181
181
|
...b && !a ? {
|
|
182
|
-
defaultValue:
|
|
182
|
+
defaultValue: u ? b : g(b)
|
|
183
183
|
} : {},
|
|
184
184
|
id: d || F,
|
|
185
185
|
autoFocus: W
|
|
@@ -261,9 +261,9 @@ const Ke = ye(
|
|
|
261
261
|
{
|
|
262
262
|
id: "btn-currency-input-add-to-document",
|
|
263
263
|
className: "cursor-pointer",
|
|
264
|
-
onClick: () =>
|
|
264
|
+
onClick: () => xe(g(a)),
|
|
265
265
|
type: "button",
|
|
266
|
-
children: /* @__PURE__ */ t(ke, { placement: "top", title:
|
|
266
|
+
children: /* @__PURE__ */ t(ke, { placement: "top", title: me("Add to document"), children: /* @__PURE__ */ t(
|
|
267
267
|
Be,
|
|
268
268
|
{
|
|
269
269
|
className: "text-primary-600",
|
|
@@ -286,7 +286,7 @@ const Ke = ye(
|
|
|
286
286
|
...K,
|
|
287
287
|
ref: J,
|
|
288
288
|
placeholder: le,
|
|
289
|
-
type:
|
|
289
|
+
type: u ? "number" : "text",
|
|
290
290
|
required: S,
|
|
291
291
|
disabled: ne,
|
|
292
292
|
className: he(),
|
|
@@ -294,8 +294,8 @@ const Ke = ye(
|
|
|
294
294
|
min: 0,
|
|
295
295
|
onFocus: q,
|
|
296
296
|
onBlur: Q,
|
|
297
|
-
value:
|
|
298
|
-
defaultValue:
|
|
297
|
+
value: u ? a : g(a),
|
|
298
|
+
defaultValue: u ? b : g(b),
|
|
299
299
|
id: d || F,
|
|
300
300
|
style: ce,
|
|
301
301
|
autoComplete: "off",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyInputField.es.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 disabled:!text-neutral-400 dark:disabled:!text-neutral-500\", 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:!text-neutral-400 dark:disabled:!text-neutral-500 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:!text-neutral-400 dark:disabled:!text-neutral-500 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 z-10 flex items-center pl-3 cursor-text select-all\">\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 z-1 flex items-center pl-3 text-neutral-900 dark:text-white cursor-text select-all\">\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 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={() => document.body}\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","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","menu","SearchBar","Typography"],"mappings":";;;;;;;;;;;;;;;;;;;AA6KO,MAAMA,KAAqBC;AAAA,EAIhC,CACE;AAAA,IACE,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,uBAAAC,IAAwB;AAAA,IACxB,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,SAAAC;AAAA,IACA,YAAAC,KAAa;AAAA,IACb,qBAAAC,IAAsB;AAAA,IACtB,eAAAC,KAAgB;AAAA,IAChB,iBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,mBAAAC;AAAA,IACA,YAAAC,KAAa,CAAA;AAAA,IACb,wBAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,SAAAC,KAAU;AAAA,IACV,oBAAAC,IAAqB;AAAA,IACrB,aAAAC;AAAA,IACA,UAAAC,KAAW;AAAA,IACX,cAAAC,IAAe;AAAA,IACf,YAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,aAAAC,KAAc;AAAA,IACd,QAAQC;AAAA,IACR,WAAAC,IAAY;AAAA,IACZ,aAAAC,IAAc;AAAA,IACd,WAAAC,IAAY;AAAA,IACZ,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC,IAAqB;AAAA,IACrB,iBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,GAAGC;AAAA,EAAA,GA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AA,gBACV,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,SAAQ;AAAA,gBAEP,UAAA/F;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,UACCmD,KACCrB,KACAC,KACAC,KACE,gBAAAyC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,WAAU;AAAA,cACV,SAAS,CAAC,MAAM,EAAE,gBAAA;AAAA,cAClB,aAAa,CAAC,MAAM,EAAE,eAAA;AAAA,cACtB,WAAW,CAAC,MAAM;AAChB,gBAAI,EAAE,QAAQ,YACZrB,EAAa,EAAK;AAAA,cAEtB;AAAA,cAEA,UAAA,gBAAAqB,EAACzC,KAAgB,aAAAF,EAAA,CAA0B;AAAA,YAAA;AAAA,UAAA;AAAA,QAC7C;AAAA,MAAA;AAAA,IAAA;AAAA,EAIV;AACF;AAEApC,GAAmB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"CurrencyInputField.es.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 z-10 flex items-center pl-3 cursor-text select-all\">\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 z-1 flex items-center pl-3 text-neutral-900 dark:text-white cursor-text select-all\">\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 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={() => document.body}\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","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","menu","SearchBar","Typography"],"mappings":";;;;;;;;;;;;;;;;;;;AA6KO,MAAMA,KAAqBC;AAAA,EAIhC,CACE;AAAA,IACE,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,uBAAAC,IAAwB;AAAA,IACxB,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,SAAAC;AAAA,IACA,YAAAC,KAAa;AAAA,IACb,qBAAAC,IAAsB;AAAA,IACtB,eAAAC,KAAgB;AAAA,IAChB,iBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,mBAAAC;AAAA,IACA,YAAAC,KAAa,CAAA;AAAA,IACb,wBAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,SAAAC,KAAU;AAAA,IACV,oBAAAC,IAAqB;AAAA,IACrB,aAAAC;AAAA,IACA,UAAAC,KAAW;AAAA,IACX,cAAAC,IAAe;AAAA,IACf,YAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,aAAAC,KAAc;AAAA,IACd,QAAQC;AAAA,IACR,WAAAC,IAAY;AAAA,IACZ,aAAAC,IAAc;AAAA,IAC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A;AAAA,sBAAA,EAAA,CACxC;AAAA,oBAAA;AAAA,kBAAA,IAGFA;AAAA,gBAAA;AAAA,cAAA;AAAA,YAEJ,GACF;AAAA,YACCjD,KACC,gBAAAyE;AAAA,cAACsB;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,SAAQ;AAAA,gBAEP,UAAA/F;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,UACCmD,KACCrB,KACAC,KACAC,KACE,gBAAAyC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,WAAU;AAAA,cACV,SAAS,CAAC,MAAM,EAAE,gBAAA;AAAA,cAClB,aAAa,CAAC,MAAM,EAAE,eAAA;AAAA,cACtB,WAAW,CAAC,MAAM;AAChB,gBAAI,EAAE,QAAQ,YACZrB,EAAa,EAAK;AAAA,cAEtB;AAAA,cAEA,UAAA,gBAAAqB,EAACzC,KAAgB,aAAAF,EAAA,CAA0B;AAAA,YAAA;AAAA,UAAA;AAAA,QAC7C;AAAA,MAAA;AAAA,IAAA;AAAA,EAIV;AACF;AAEApC,GAAmB,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),C=require("../../../_virtual/index.cjs.js"),d=require("react"),v=require("react-window"),I=require("@mui/icons-material"),N=require("@mui/material"),j=require("antd"),y=require("../../data-display/typography/Typography.cjs.js"),P=require("../input-field/InputField.cjs.js"),x=require("../../../types/icon-picker.cjs.js"),S=require("../../../utils/countryFlags.cjs.js"),q=require("../shared/InputLabel.cjs.js");function R(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const h=R(I),O=Object.keys(h).filter(e=>e?.endsWith("Rounded")),D=[...O||[],...(x.COUNTRY_CODES||[]).map(e=>`flag-${e}`)],T=e=>{if(e?.startsWith("flag-")){const n=e?.replace("flag-","");return x.countryNameFromCode(n||"")||n}return e.replaceAll(/([A-Z])/g," $1").trim()},L=({onChange:e,selectedIcon:n,setOpen:s})=>{const[a,p]=d.useState(""),c=(D||[]).filter(r=>{if(r?.startsWith("flag-")){const i=r?.replace("flag-","");return i?.toLowerCase()?.includes(a?.trim()?.toLowerCase()||"")||x.countryNameFromCode(i||"")?.toLowerCase()?.includes(a?.trim()?.toLowerCase()||"")}return r?.trim()?.toLowerCase()?.includes(a?.trim()?.toLowerCase()||"")}),m=(r,i)=>{if(i.stopPropagation(),n===r){e?.(null);return}e?.(r),s?.(!1)};return t.jsxs("div",{className:"flex flex-col gap-3",onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),r.stopPropagation())},children:[t.jsx(P.InputField,{id:"input-field-icon-picker",placeholder:"Search icons...",onChange:r=>p(r||""),fieldSuffix:t.jsx(h.Search,{className:"!w-4 !h-4 text-neutral-400"})}),t.jsx(v.FixedSizeGrid,{columnCount:5,rowCount:Math.ceil((c?.length||0)/5),columnWidth:40,rowHeight:40,width:220,height:240,children:({columnIndex:r,rowIndex:i,style:f})=>{const g=i*5+r,l=c?.[g];return l?t.jsx("div",{style:f,className:"p-1",children:t.jsx(j.Tooltip,{title:T(l),placement:"bottom",children:t.jsx(N.IconButton,{type:"button",className:C("flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700",{"!bg-primary-50 dark:!bg-black-800":n===l}),onClick:u=>m(l,u),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),u.stopPropagation())},children:t.jsx(b,{iconName:l,className:"!w-5 !h-5 text-neutral-900 dark:text-white"})})})}):null}})]})},b=({iconName:e,sx:n,className:s,isHovering:a})=>{if(e?.startsWith?.("flag-")){const c=e?.replace("flag-","");return S.getFlagComponent?.(c||"",a||!1)||t.jsx("div",{children:"-"})}const p=h?.[e];return p?t.jsx(p,{sx:n,className:s,isHovering:a}):t.jsx("div",{children:"-"})},F=({selectedIcon:e,onChange:n,label:s,required:a=!1,allowClear:p=!0,disabled:c=!1,errorMessage:m,dropdownPosition:r="bottom",className:i})=>{const[f,g]=d.useState(!1),l=d.useRef(!1),u=d.useRef(null),k=d.useRef(!1);d.useEffect(()=>{k.current&&!f&&u.current?.focus(),k.current=f},[f]);const w=o=>{o.stopPropagation(),n?.("")};return t.jsx(j.Popover,{arrow:!1,placement:r,trigger:"click",getPopupContainer:o=>o?.parentElement||document.body,open:f,onOpenChange:o=>{o?(l.current&&g(!0),l.current=!1):g(!1)},content:t.jsx(L,{onChange:n,selectedIcon:e,setOpen:g}),children:t.jsxs("div",{className:"flex flex-col gap-1",children:[s?t.jsx(q.InputLabel,{label:s||"",required:a||!1}):null,t.jsxs("button",{ref:u,type:"button",id:`btn-icon-picker-icon-${e?"selected":"unselected"}`,className:`lax-form-trigger min-w-[83px] h-8 py-1.5 px-3 rounded-md border ${c?"cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800":"bg-white dark:bg-black-800"} ${m?"border-red-500":"focus:border-primary-600 dark:focus:border-primary-400"} flex items-center justify-between gap-2 ${i}`,disabled:c,onClick:o=>{if(c){o.preventDefault(),o.stopPropagation();return}o.detail>0&&(l.current=!0)},onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),f||o.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click())},children:[e?t.jsx(b,{iconName:e,className:"!w-5 !h-5 text-neutral-900 dark:text-white"}):t.jsx(y.Typography,{size:"small",variant:"regular",appearance:"subtitle",children:"Select Icon"}),e&&p&&!c?t.jsx(h.CloseRounded,{className:"!w-5 !h-5 hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",onClick:w}):null]}),m&&t.jsx(y.Typography,{size:"extra-small",className:"text-red-500 font-medium",children:m})]})})},E=d.lazy(()=>Promise.resolve({default:e=>t.jsx(d.Suspense,{fallback:t.jsx("div",{className:"min-w-20 h-8 animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md"}),children:t.jsx(F,{...e})})}));exports.IconPicker=E;exports.IconRenderer=b;
|
|
2
2
|
//# sourceMappingURL=IconPicker.cjs.js.map
|