se-design 1.0.83-dev.4 → 1.0.83-r-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/dist/assets/icons/tag.svg +2 -2
  2. package/dist/assets/style.css +1 -1
  3. package/dist/components/AccessibleDiv/index.d.ts +1 -23
  4. package/dist/components/Dropdown/index.d.ts +0 -2
  5. package/dist/components/DropdownWithInputTags/index.d.ts +0 -3
  6. package/dist/components/Link/index.d.ts +2 -6
  7. package/dist/components/NLSearch/ClearAiFiltersBar.d.ts +21 -0
  8. package/dist/components/NLSearch/NLDynamicChip.d.ts +26 -0
  9. package/dist/components/NLSearch/NLSearchInput.d.ts +46 -0
  10. package/dist/components/NLSearch/index.d.ts +6 -0
  11. package/dist/components/index.d.ts +2 -0
  12. package/dist/index.js +139 -140
  13. package/dist/index.js.map +1 -1
  14. package/dist/index100.js.map +1 -1
  15. package/dist/index101.js.map +1 -1
  16. package/dist/index102.js.map +1 -1
  17. package/dist/index103.js.map +1 -1
  18. package/dist/index104.js.map +1 -1
  19. package/dist/index105.js.map +1 -1
  20. package/dist/index106.js.map +1 -1
  21. package/dist/index107.js.map +1 -1
  22. package/dist/index108.js.map +1 -1
  23. package/dist/index109.js.map +1 -1
  24. package/dist/index11.js +1 -1
  25. package/dist/index110.js.map +1 -1
  26. package/dist/index111.js.map +1 -1
  27. package/dist/index112.js.map +1 -1
  28. package/dist/index113.js.map +1 -1
  29. package/dist/index114.js.map +1 -1
  30. package/dist/index115.js.map +1 -1
  31. package/dist/index116.js.map +1 -1
  32. package/dist/index117.js.map +1 -1
  33. package/dist/index118.js.map +1 -1
  34. package/dist/index119.js.map +1 -1
  35. package/dist/index12.js +1 -1
  36. package/dist/index120.js.map +1 -1
  37. package/dist/index121.js.map +1 -1
  38. package/dist/index122.js.map +1 -1
  39. package/dist/index123.js.map +1 -1
  40. package/dist/index124.js.map +1 -1
  41. package/dist/index125.js.map +1 -1
  42. package/dist/index126.js.map +1 -1
  43. package/dist/index127.js.map +1 -1
  44. package/dist/index128.js.map +1 -1
  45. package/dist/index129.js.map +1 -1
  46. package/dist/index13.js +1 -1
  47. package/dist/index130.js.map +1 -1
  48. package/dist/index131.js.map +1 -1
  49. package/dist/index132.js.map +1 -1
  50. package/dist/index133.js.map +1 -1
  51. package/dist/index134.js.map +1 -1
  52. package/dist/index135.js.map +1 -1
  53. package/dist/index136.js.map +1 -1
  54. package/dist/index137.js.map +1 -1
  55. package/dist/index138.js.map +1 -1
  56. package/dist/index139.js.map +1 -1
  57. package/dist/index140.js.map +1 -1
  58. package/dist/index141.js.map +1 -1
  59. package/dist/index142.js.map +1 -1
  60. package/dist/index143.js.map +1 -1
  61. package/dist/index144.js.map +1 -1
  62. package/dist/index145.js.map +1 -1
  63. package/dist/index146.js.map +1 -1
  64. package/dist/index147.js.map +1 -1
  65. package/dist/index148.js.map +1 -1
  66. package/dist/index149.js.map +1 -1
  67. package/dist/index150.js.map +1 -1
  68. package/dist/index151.js.map +1 -1
  69. package/dist/index152.js.map +1 -1
  70. package/dist/index153.js.map +1 -1
  71. package/dist/index154.js.map +1 -1
  72. package/dist/index155.js.map +1 -1
  73. package/dist/index156.js.map +1 -1
  74. package/dist/index157.js.map +1 -1
  75. package/dist/index158.js.map +1 -1
  76. package/dist/index159.js.map +1 -1
  77. package/dist/index16.js +23 -25
  78. package/dist/index16.js.map +1 -1
  79. package/dist/index160.js.map +1 -1
  80. package/dist/index161.js.map +1 -1
  81. package/dist/index162.js.map +1 -1
  82. package/dist/index163.js.map +1 -1
  83. package/dist/index164.js.map +1 -1
  84. package/dist/index165.js.map +1 -1
  85. package/dist/index166.js.map +1 -1
  86. package/dist/index167.js.map +1 -1
  87. package/dist/index168.js.map +1 -1
  88. package/dist/index169.js.map +1 -1
  89. package/dist/index17.js +29 -29
  90. package/dist/index17.js.map +1 -1
  91. package/dist/index170.js.map +1 -1
  92. package/dist/index171.js.map +1 -1
  93. package/dist/index172.js.map +1 -1
  94. package/dist/index173.js.map +1 -1
  95. package/dist/index174.js.map +1 -1
  96. package/dist/index175.js.map +1 -1
  97. package/dist/index176.js.map +1 -1
  98. package/dist/index177.js.map +1 -1
  99. package/dist/index178.js.map +1 -1
  100. package/dist/index179.js.map +1 -1
  101. package/dist/index18.js +63 -85
  102. package/dist/index18.js.map +1 -1
  103. package/dist/index180.js.map +1 -1
  104. package/dist/index181.js.map +1 -1
  105. package/dist/index182.js.map +1 -1
  106. package/dist/index183.js.map +1 -1
  107. package/dist/index184.js.map +1 -1
  108. package/dist/index185.js.map +1 -1
  109. package/dist/index186.js.map +1 -1
  110. package/dist/index187.js.map +1 -1
  111. package/dist/index188.js.map +1 -1
  112. package/dist/index189.js.map +1 -1
  113. package/dist/index19.js +167 -182
  114. package/dist/index19.js.map +1 -1
  115. package/dist/index190.js.map +1 -1
  116. package/dist/index191.js.map +1 -1
  117. package/dist/index192.js.map +1 -1
  118. package/dist/index193.js +1 -1
  119. package/dist/index193.js.map +1 -1
  120. package/dist/index194.js.map +1 -1
  121. package/dist/index195.js.map +1 -1
  122. package/dist/index196.js.map +1 -1
  123. package/dist/index197.js.map +1 -1
  124. package/dist/index198.js.map +1 -1
  125. package/dist/index199.js.map +1 -1
  126. package/dist/index200.js.map +1 -1
  127. package/dist/index201.js.map +1 -1
  128. package/dist/index202.js.map +1 -1
  129. package/dist/index203.js.map +1 -1
  130. package/dist/index207.js +2 -2
  131. package/dist/index208.js +3 -3
  132. package/dist/index208.js.map +1 -1
  133. package/dist/index216.js +9 -13
  134. package/dist/index216.js.map +1 -1
  135. package/dist/index23.js +2 -2
  136. package/dist/index244.js +1 -1
  137. package/dist/index25.js +160 -174
  138. package/dist/index25.js.map +1 -1
  139. package/dist/index27.js +1 -1
  140. package/dist/index28.js +4 -4
  141. package/dist/index28.js.map +1 -1
  142. package/dist/index29.js +30 -34
  143. package/dist/index29.js.map +1 -1
  144. package/dist/index3.js +50 -60
  145. package/dist/index3.js.map +1 -1
  146. package/dist/index30.js +3 -3
  147. package/dist/index32.js +10 -11
  148. package/dist/index35.js +3 -3
  149. package/dist/index36.js +4 -4
  150. package/dist/index38.js +195 -210
  151. package/dist/index38.js.map +1 -1
  152. package/dist/index39.js +2 -2
  153. package/dist/index4.js +3 -3
  154. package/dist/index42.js +7 -8
  155. package/dist/index43.js +13 -14
  156. package/dist/index43.js.map +1 -1
  157. package/dist/index45.js +60 -61
  158. package/dist/index45.js.map +1 -1
  159. package/dist/index46.js +198 -194
  160. package/dist/index46.js.map +1 -1
  161. package/dist/index47.js +40 -38
  162. package/dist/index47.js.map +1 -1
  163. package/dist/index48.js +36 -33
  164. package/dist/index48.js.map +1 -1
  165. package/dist/index50.js +189 -78
  166. package/dist/index50.js.map +1 -1
  167. package/dist/index51.js +36 -459
  168. package/dist/index51.js.map +1 -1
  169. package/dist/index52.js +33 -98
  170. package/dist/index52.js.map +1 -1
  171. package/dist/index53.js +151 -36
  172. package/dist/index53.js.map +1 -1
  173. package/dist/index54.js +84 -36
  174. package/dist/index54.js.map +1 -1
  175. package/dist/index55.js +456 -88
  176. package/dist/index55.js.map +1 -1
  177. package/dist/index56.js +96 -161
  178. package/dist/index56.js.map +1 -1
  179. package/dist/index57.js +35 -146
  180. package/dist/index57.js.map +1 -1
  181. package/dist/index58.js +38 -33
  182. package/dist/index58.js.map +1 -1
  183. package/dist/index59.js +89 -83
  184. package/dist/index59.js.map +1 -1
  185. package/dist/index6.js +237 -239
  186. package/dist/index6.js.map +1 -1
  187. package/dist/index60.js +157 -113
  188. package/dist/index60.js.map +1 -1
  189. package/dist/index61.js +143 -62
  190. package/dist/index61.js.map +1 -1
  191. package/dist/index62.js +33 -152
  192. package/dist/index62.js.map +1 -1
  193. package/dist/index63.js +80 -312
  194. package/dist/index63.js.map +1 -1
  195. package/dist/index64.js +118 -46
  196. package/dist/index64.js.map +1 -1
  197. package/dist/index65.js +62 -140
  198. package/dist/index65.js.map +1 -1
  199. package/dist/index66.js +152 -12
  200. package/dist/index66.js.map +1 -1
  201. package/dist/index67.js +316 -44
  202. package/dist/index67.js.map +1 -1
  203. package/dist/index68.js +44 -104
  204. package/dist/index68.js.map +1 -1
  205. package/dist/index69.js +143 -18
  206. package/dist/index69.js.map +1 -1
  207. package/dist/index7.js +8 -9
  208. package/dist/index70.js +9 -63
  209. package/dist/index70.js.map +1 -1
  210. package/dist/index71.js +45 -26
  211. package/dist/index71.js.map +1 -1
  212. package/dist/index72.js +78 -102
  213. package/dist/index72.js.map +1 -1
  214. package/dist/index73.js +18 -61
  215. package/dist/index73.js.map +1 -1
  216. package/dist/index74.js +63 -18
  217. package/dist/index74.js.map +1 -1
  218. package/dist/index75.js +24 -105
  219. package/dist/index75.js.map +1 -1
  220. package/dist/index76.js +108 -18
  221. package/dist/index76.js.map +1 -1
  222. package/dist/index77.js +61 -10
  223. package/dist/index77.js.map +1 -1
  224. package/dist/index78.js +21 -5
  225. package/dist/index78.js.map +1 -1
  226. package/dist/index79.js +5 -56
  227. package/dist/index79.js.map +1 -1
  228. package/dist/index80.js +50 -23
  229. package/dist/index80.js.map +1 -1
  230. package/dist/index81.js +22 -7
  231. package/dist/index81.js.map +1 -1
  232. package/dist/index82.js +12 -0
  233. package/dist/index82.js.map +1 -0
  234. package/dist/index84.js +2 -2
  235. package/dist/index84.js.map +1 -1
  236. package/dist/index85.js +2 -2
  237. package/dist/index85.js.map +1 -1
  238. package/dist/index86.js +2 -2
  239. package/dist/index86.js.map +1 -1
  240. package/dist/index87.js +2 -2
  241. package/dist/index87.js.map +1 -1
  242. package/dist/index88.js +1 -1
  243. package/dist/index88.js.map +1 -1
  244. package/dist/index89.js +1 -1
  245. package/dist/index89.js.map +1 -1
  246. package/dist/index9.js +3 -3
  247. package/dist/index90.js +1 -1
  248. package/dist/index90.js.map +1 -1
  249. package/dist/index91.js +1 -1
  250. package/dist/index91.js.map +1 -1
  251. package/dist/index92.js +1 -1
  252. package/dist/index92.js.map +1 -1
  253. package/dist/index93.js +1 -1
  254. package/dist/index93.js.map +1 -1
  255. package/dist/index94.js +1 -1
  256. package/dist/index94.js.map +1 -1
  257. package/dist/index95.js +1 -1
  258. package/dist/index95.js.map +1 -1
  259. package/dist/index96.js +1 -1
  260. package/dist/index96.js.map +1 -1
  261. package/dist/index97.js.map +1 -1
  262. package/dist/index98.js.map +1 -1
  263. package/dist/index99.js.map +1 -1
  264. package/package.json +1 -1
  265. package/dist/assets/icons/chat.svg +0 -4
  266. package/dist/index49.js +0 -152
  267. package/dist/index49.js.map +0 -1
  268. package/dist/index83.js +0 -5
  269. package/dist/index83.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index45.js","sources":["../src/components/AutoCompleteInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useCallback, useState } from 'react';\nimport './style.scss';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes, useCombobox } from '../../utils/a11y';\n\nexport interface AutoCompleteInputProps {\n value: string;\n disabled?: boolean;\n maxLength?: number;\n /** Called when the user types in the input. Not called on suggestion selection. */\n onChange: (value: string) => void;\n tag?: string;\n error?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n /**\n * Suggestion items. Default rendering expects { label, value } shape.\n * When renderOption is provided, any shape is accepted.\n */\n suggestions?: any[];\n /**\n * Called when a suggestion is selected (click or Enter key).\n * Receives the full item object from the suggestions array.\n */\n onSelect?: (item: any) => void;\n /**\n * Render custom content for each suggestion option. The component handles the option wrapper\n * (ARIA props, highlight, click, keyboard navigation). You only provide the inner content.\n */\n renderOption?: (suggestion: any, context: { isHighlighted: boolean; index: number }) => React.ReactNode;\n /**\n * Custom CSS class for option elements. Replaces the default 'suggestion-item' class.\n * Useful with renderOption to apply custom styling to option wrappers.\n */\n optionClassName?: string;\n automationId?: string;\n /**\n * Accessible label for the input. Used when no visible label is provided.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this input. Takes precedence over ariaLabel.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) providing additional description.\n */\n ariaDescribedBy?: string;\n}\n\nexport const AutoCompleteInput: React.FC<AutoCompleteInputProps> = React.memo(\n ({\n value,\n onChange,\n disabled = false,\n maxLength,\n tag = 'input',\n error = false,\n errorMessage,\n label,\n placeholder,\n suggestions = [],\n onSelect,\n renderOption,\n optionClassName,\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ...props\n }) => {\n const [filteredSuggestions, setFilteredSuggestions] = useState<any[]>([...suggestions]);\n const [isSuggestionBoxVisible, setSuggestionBoxVisible] = useState<boolean>(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Generate stable unique IDs per instance so label, input, listbox, and error never share IDs (HTML/ARIA require unique ids).\n const instanceId = useStableId(undefined, 'autocomplete');\n const inputId = `${instanceId}-input`;\n const listboxId = `${instanceId}-listbox`;\n const labelId = `${instanceId}-label`;\n const errorId = `${instanceId}-error`;\n\n const handleSelectSuggestion = useCallback(\n (item: any) => {\n setSuggestionBoxVisible(false);\n onSelect?.(item);\n },\n [onSelect]\n );\n\n // Use the comprehensive useCombobox hook\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex,\n isKeyboardFocused\n } = useCombobox<any>({\n items: filteredSuggestions,\n isOpen: isSuggestionBoxVisible,\n onOpenChange: setSuggestionBoxVisible,\n onSelect: handleSelectSuggestion,\n listboxId\n });\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n setHighlightedIndex(-1); // Reset highlight on input change\n onChange(inputValue);\n\n // Internal filtering for default rendering (when no renderOption, component manages filtering)\n if (!renderOption) {\n if (inputValue === '') {\n setFilteredSuggestions([...suggestions]);\n } else {\n const filtered = suggestions?.filter(\n (suggestion) =>\n typeof suggestion === 'object' &&\n suggestion?.label?.toLowerCase().includes(inputValue?.toLowerCase() ?? '')\n );\n setFilteredSuggestions([...filtered]);\n }\n }\n },\n [onChange, suggestions, renderOption, setHighlightedIndex]\n );\n\n useEffect(() => {\n setFilteredSuggestions([...suggestions]);\n }, [suggestions]);\n\n const handleInputClick = () => {\n setSuggestionBoxVisible(true);\n };\n\n const handleInputFocus = () => {\n if (filteredSuggestions.length > 0) {\n setSuggestionBoxVisible(true);\n }\n };\n\n const handleClearInput = () => {\n onChange('');\n setHighlightedIndex(-1);\n inputRef.current?.focus();\n };\n\n // Build ARIA name attributes: when ariaLabel is provided use it (e.g. \"Signer 1 name\"); otherwise use visible label or ariaLabelledBy\n const a11yNameProps = getA11yNameAttributes({\n ariaLabelledBy: label && !ariaLabel ? labelId : ariaLabelledBy,\n ariaLabel,\n ariaDescribedBy: error ? errorId : ariaDescribedBy\n });\n\n return (\n <div \n className=\"main-container-autocomplete-se-design\" \n ref={containerRef} \n data-automation-id={automationId}\n {...containerProps}\n >\n {label && (\n <span\n id={labelId}\n className={`label-container ${disabled ? 'label-container-disabled' : ''}`}\n >\n {label}\n </span>\n )}\n <div className=\"input-container-wrapper\">\n <div className=\"input-wrapper\" style={{ pointerEvents: disabled ? 'none' : 'auto' }}>\n {React.createElement(tag, {\n ref: inputRef,\n id: inputId,\n value: value,\n onChange: handleInputChange,\n onClick: handleInputClick,\n onFocus: handleInputFocus,\n ...comboboxInputProps,\n disabled,\n className: `${error ? 'input-container-error' : 'input-container-default'} ${disabled ? 'input-container-disabled' : ''} ${filteredSuggestions.length > 0 || value ? 'with-icon' : ''} ${filteredSuggestions.length > 0 && value ? 'with-icons' : ''}`,\n maxLength,\n placeholder,\n 'aria-invalid': error || undefined,\n ...a11yNameProps,\n ...props\n })}\n {value && (\n <Icon\n name=\"close\"\n className=\"input-icon-close\"\n size={15}\n onClick={handleClearInput}\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n ariaLabel=\"Clear input\"\n />\n )}\n {filteredSuggestions.length > 0 && (\n <Icon\n name=\"chevron\"\n rotation={isSuggestionBoxVisible ? '180' : '0'}\n className=\"input-icon-chevron\"\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n aria-hidden=\"true\"\n />\n )}\n </div>\n {isSuggestionBoxVisible && filteredSuggestions.length > 0 && (\n <div\n {...listboxProps}\n aria-label={label || ariaLabel || 'Suggestions'}\n className=\"suggestions-list\"\n data-automation-id=\"autocomplete-suggestions-list\"\n >\n {filteredSuggestions.map((suggestion, index) => {\n const optionProps = getOptionProps(index, false);\n const isHighlighted = highlightedIndex === index;\n return (\n <div\n key={index}\n {...optionProps}\n className={`${optionClassName || 'suggestion-item'} ${isHighlighted ? `suggestion-item-highlighted${isKeyboardFocused ? ' suggestion-item-keyboard-highlight' : ''}` : ''}`}\n onClick={() => handleSelectSuggestion(suggestion)}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`autocomplete-suggestion-item-${index}`}\n >\n {renderOption\n ? renderOption(suggestion, { isHighlighted, index })\n : suggestion.label}\n </div>\n );\n })}\n </div>\n )}\n </div>\n {(error || maxLength) && (\n <div className={`${error ? 'error-and-max-word' : 'max-word-container'} ${disabled ? 'disabled' : ''}`}>\n {error && (\n <div id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n {maxLength && (\n <div className=\"max-word\">\n {value.length}/{maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n"],"names":["AutoCompleteInput","React","memo","value","onChange","disabled","maxLength","tag","error","errorMessage","label","placeholder","suggestions","onSelect","renderOption","optionClassName","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","props","filteredSuggestions","setFilteredSuggestions","useState","isSuggestionBoxVisible","setSuggestionBoxVisible","containerRef","useRef","inputRef","instanceId","useStableId","undefined","inputId","listboxId","labelId","errorId","handleSelectSuggestion","useCallback","item","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","isKeyboardFocused","useCombobox","items","isOpen","onOpenChange","handleInputChange","e","inputValue","target","filtered","filter","suggestion","toLowerCase","includes","useEffect","handleInputClick","handleInputFocus","length","handleClearInput","current","focus","a11yNameProps","getA11yNameAttributes","createElement","_extends","className","ref","id","style","pointerEvents","onClick","onFocus","Icon","name","size","stroke","rotation","map","index","optionProps","isHighlighted","key","onMouseEnter","role"],"mappings":";;;;;;;;;;;;;;;;AAoDO,MAAMA,KAAsDC,gBAAAA,EAAMC,KACvE,CAAC;AAAA,EACCC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,WAAAA;AAAAA,EACAC,KAAAA,IAAM;AAAA,EACNC,OAAAA,IAAQ;AAAA,EACRC,cAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,aAAAA,IAAc,CAAA;AAAA,EACdC,UAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAM,CAACC,GAAqBC,CAAsB,IAAIC,EAAgB,CAAC,GAAGX,CAAW,CAAC,GAChF,CAACY,GAAwBC,CAAuB,IAAIF,EAAkB,EAAK,GAC3EG,IAAeC,EAAuB,IAAI,GAC1CC,IAAWD,EAAyB,IAAI,GAGxCE,IAAaC,EAAYC,QAAW,cAAc,GAClDC,IAAU,GAAGH,CAAU,UACvBI,IAAY,GAAGJ,CAAU,YACzBK,IAAU,GAAGL,CAAU,UACvBM,IAAU,GAAGN,CAAU,UAEvBO,IAAyBC,EAC7B,CAACC,MAAc;AACbb,IAAAA,EAAwB,EAAK,GAC7BZ,IAAWyB,CAAI;AAAA,EACjB,GACA,CAACzB,CAAQ,CACX,GAGM;AAAA,IACJ0B,gBAAAA;AAAAA,IACAC,YAAYC;AAAAA,IACZC,cAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,kBAAAA;AAAAA,IACAC,qB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AA,EAAAoE,cAAA,OAAA;AAAA,IAAKE,WAAU;AAAA,EAAA,GACZpE,EAAM4D,QAAO,KAAEzD,CACb,CAEJ,CAEJ;AAET,CACF;"}
1
+ {"version":3,"file":"index45.js","sources":["../src/components/AutoCompleteInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useCallback, useState } from 'react';\nimport './style.scss';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes, useCombobox } from '../../utils/a11y';\n\nexport interface AutoCompleteInputProps {\n value: string;\n disabled?: boolean;\n maxLength?: number;\n /** Called when the user types in the input. Not called on suggestion selection. */\n onChange: (value: string) => void;\n tag?: string;\n error?: boolean;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n /**\n * Suggestion items. Default rendering expects { label, value } shape.\n * When renderOption is provided, any shape is accepted.\n */\n suggestions?: any[];\n /**\n * Called when a suggestion is selected (click or Enter key).\n * Receives the full item object from the suggestions array.\n */\n onSelect?: (item: any) => void;\n /**\n * Render custom content for each suggestion option. The component handles the option wrapper\n * (ARIA props, highlight, click, keyboard navigation). You only provide the inner content.\n */\n renderOption?: (suggestion: any, context: { isHighlighted: boolean; index: number }) => React.ReactNode;\n /**\n * Custom CSS class for option elements. Replaces the default 'suggestion-item' class.\n * Useful with renderOption to apply custom styling to option wrappers.\n */\n optionClassName?: string;\n automationId?: string;\n /**\n * Accessible label for the input. Used when no visible label is provided.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this input. Takes precedence over ariaLabel.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) providing additional description.\n */\n ariaDescribedBy?: string;\n}\n\nexport const AutoCompleteInput: React.FC<AutoCompleteInputProps> = React.memo(\n ({\n value,\n onChange,\n disabled = false,\n maxLength,\n tag = 'input',\n error = false,\n errorMessage,\n label,\n placeholder,\n suggestions = [],\n onSelect,\n renderOption,\n optionClassName,\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ...props\n }) => {\n const [filteredSuggestions, setFilteredSuggestions] = useState<any[]>([...suggestions]);\n const [isSuggestionBoxVisible, setSuggestionBoxVisible] = useState<boolean>(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Generate stable unique IDs per instance so label, input, listbox, and error never share IDs (HTML/ARIA require unique ids).\n const instanceId = useStableId(undefined, 'autocomplete');\n const inputId = `${instanceId}-input`;\n const listboxId = `${instanceId}-listbox`;\n const labelId = `${instanceId}-label`;\n const errorId = `${instanceId}-error`;\n\n const handleSelectSuggestion = useCallback(\n (item: any) => {\n setSuggestionBoxVisible(false);\n onSelect?.(item);\n },\n [onSelect]\n );\n\n // Use the comprehensive useCombobox hook\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex\n } = useCombobox<any>({\n items: filteredSuggestions,\n isOpen: isSuggestionBoxVisible,\n onOpenChange: setSuggestionBoxVisible,\n onSelect: handleSelectSuggestion,\n listboxId\n });\n\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n setHighlightedIndex(-1); // Reset highlight on input change\n onChange(inputValue);\n\n // Internal filtering for default rendering (when no renderOption, component manages filtering)\n if (!renderOption) {\n if (inputValue === '') {\n setFilteredSuggestions([...suggestions]);\n } else {\n const filtered = suggestions?.filter(\n (suggestion) =>\n typeof suggestion === 'object' &&\n suggestion?.label?.toLowerCase().includes(inputValue?.toLowerCase() ?? '')\n );\n setFilteredSuggestions([...filtered]);\n }\n }\n },\n [onChange, suggestions, renderOption, setHighlightedIndex]\n );\n\n useEffect(() => {\n setFilteredSuggestions([...suggestions]);\n }, [suggestions]);\n\n const handleInputClick = () => {\n setSuggestionBoxVisible(true);\n };\n\n const handleInputFocus = () => {\n if (filteredSuggestions.length > 0) {\n setSuggestionBoxVisible(true);\n }\n };\n\n const handleClearInput = () => {\n onChange('');\n setHighlightedIndex(-1);\n inputRef.current?.focus();\n };\n\n // Build ARIA name attributes: when ariaLabel is provided use it (e.g. \"Signer 1 name\"); otherwise use visible label or ariaLabelledBy\n const a11yNameProps = getA11yNameAttributes({\n ariaLabelledBy: label && !ariaLabel ? labelId : ariaLabelledBy,\n ariaLabel,\n ariaDescribedBy: error ? errorId : ariaDescribedBy\n });\n\n return (\n <div \n className=\"main-container-autocomplete-se-design\" \n ref={containerRef} \n data-automation-id={automationId}\n {...containerProps}\n >\n {label && (\n <span\n id={labelId}\n className={`label-container ${disabled ? 'label-container-disabled' : ''}`}\n >\n {label}\n </span>\n )}\n <div className=\"input-container-wrapper\">\n <div className=\"input-wrapper\" style={{ pointerEvents: disabled ? 'none' : 'auto' }}>\n {React.createElement(tag, {\n ref: inputRef,\n id: inputId,\n value: value,\n onChange: handleInputChange,\n onClick: handleInputClick,\n onFocus: handleInputFocus,\n ...comboboxInputProps,\n disabled,\n className: `${error ? 'input-container-error' : 'input-container-default'} ${disabled ? 'input-container-disabled' : ''} ${filteredSuggestions.length > 0 || value ? 'with-icon' : ''} ${filteredSuggestions.length > 0 && value ? 'with-icons' : ''}`,\n maxLength,\n placeholder,\n 'aria-invalid': error || undefined,\n ...a11yNameProps,\n ...props\n })}\n {value && (\n <Icon\n name=\"close\"\n className=\"input-icon-close\"\n size={15}\n onClick={handleClearInput}\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n ariaLabel=\"Clear input\"\n />\n )}\n {filteredSuggestions.length > 0 && (\n <Icon\n name=\"chevron\"\n rotation={isSuggestionBoxVisible ? '180' : '0'}\n className=\"input-icon-chevron\"\n stroke={disabled ? 'var(--color-gray-600)' : ''}\n aria-hidden=\"true\"\n />\n )}\n </div>\n {isSuggestionBoxVisible && filteredSuggestions.length > 0 && (\n <div\n {...listboxProps}\n aria-label={label || ariaLabel || 'Suggestions'}\n className=\"suggestions-list\"\n data-automation-id=\"autocomplete-suggestions-list\"\n >\n {filteredSuggestions.map((suggestion, index) => {\n const optionProps = getOptionProps(index, false);\n const isHighlighted = highlightedIndex === index;\n return (\n <div\n key={index}\n {...optionProps}\n className={`${optionClassName || 'suggestion-item'} ${isHighlighted ? 'suggestion-item-highlighted' : ''}`}\n onClick={() => handleSelectSuggestion(suggestion)}\n onMouseEnter={() => setHighlightedIndex(index)}\n data-automation-id={`autocomplete-suggestion-item-${index}`}\n >\n {renderOption\n ? renderOption(suggestion, { isHighlighted, index })\n : suggestion.label}\n </div>\n );\n })}\n </div>\n )}\n </div>\n {(error || maxLength) && (\n <div className={`${error ? 'error-and-max-word' : 'max-word-container'} ${disabled ? 'disabled' : ''}`}>\n {error && (\n <div id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n {maxLength && (\n <div className=\"max-word\">\n {value.length}/{maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n"],"names":["AutoCompleteInput","React","memo","value","onChange","disabled","maxLength","tag","error","errorMessage","label","placeholder","suggestions","onSelect","renderOption","optionClassName","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","props","filteredSuggestions","setFilteredSuggestions","useState","isSuggestionBoxVisible","setSuggestionBoxVisible","containerRef","useRef","inputRef","instanceId","useStableId","undefined","inputId","listboxId","labelId","errorId","handleSelectSuggestion","useCallback","item","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","useCombobox","items","isOpen","onOpenChange","handleInputChange","e","inputValue","target","filtered","filter","suggestion","toLowerCase","includes","useEffect","handleInputClick","handleInputFocus","length","handleClearInput","current","focus","a11yNameProps","getA11yNameAttributes","createElement","_extends","className","ref","id","style","pointerEvents","onClick","onFocus","Icon","name","size","stroke","rotation","map","index","optionProps","isHighlighted","key","onMouseEnter","role"],"mappings":";;;;;;;;;;;;;;;;AAoDO,MAAMA,KAAsDC,gBAAAA,EAAMC,KACvE,CAAC;AAAA,EACCC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EAC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EAAoB6D,IAAI,CAAC1B,GAAY2B,MAAU;AAC9C,UAAMC,IAAczC,EAAewC,GAAO,EAAK,GACzCE,IAAgBzC,MAAqBuC;AAC3C,WACElF,gBAAAA,EAAAmE,cAAA,OAAAC,EAAA;AAAA,MACEiB,KAAKH;AAAAA,IAAAA,GACDC,GAAW;AAAA,MACfd,WAAW,GAAGvD,KAAmB,iBAAiB,IAAIsE,IAAgB,gCAAgC,EAAE;AAAA,MACxGV,SAASA,MAAMvC,EAAuBoB,CAAU;AAAA,MAChD+B,cAAcA,MAAM1C,EAAoBsC,CAAK;AAAA,MAC7C,sBAAoB,gCAAgCA,CAAK;AAAA,IAAA,CAAG,GAE3DrE,IACGA,EAAa0C,GAAY;AAAA,MAAE6B,eAAAA;AAAAA,MAAeF,OAAAA;AAAAA,IAAAA,CAAO,IACjD3B,EAAW9C,KACZ;AAAA,EAET,CAAC,CACE,CAEJ,IACHF,KAASF,MACTL,gBAAAA,EAAAmE,cAAA,OAAA;AAAA,IAAKE,WAAW,GAAG9D,IAAQ,uBAAuB,oBAAoB,IAAIH,IAAW,aAAa,EAAE;AAAA,EAAA,GACjGG,KACCP,gBAAAA,EAAAmE,cAAA,OAAA;AAAA,IAAKI,IAAIrC;AAAAA,IAASmC,WAAU;AAAA,IAAgBkB,MAAK;AAAA,EAAA,GAC9C/E,CACE,GAENH,KACCL,gBAAAA,EAAAmE,cAAA,OAAA;AAAA,IAAKE,WAAU;AAAA,EAAA,GACZnE,EAAM2D,QAAO,KAAExD,CACb,CAEJ,CAEJ;AAET,CACF;"}
package/dist/index46.js CHANGED
@@ -1,200 +1,204 @@
1
- import t, { useState as h, useRef as f, useCallback as g, useEffect as _ } from "react";
2
- /* empty css */
3
- import C from "./index232.js";
4
- import { Icon as M } from "./index6.js";
5
- import { useStableId as v } from "./index205.js";
6
- import { getA11yNameAttributes as T } from "./index81.js";
7
- import "./index72.js";
8
- import { useCombobox as le } from "./index68.js";
9
- function c() {
10
- return c = Object.assign ? Object.assign.bind() : function(i) {
11
- for (var l = 1; l < arguments.length; l++) {
12
- var r = arguments[l];
13
- for (var u in r) ({}).hasOwnProperty.call(r, u) && (i[u] = r[u]);
14
- }
15
- return i;
16
- }, c.apply(null, arguments);
17
- }
18
- const ve = ({
19
- onCountrycodeChange: i,
20
- onNumberChange: l,
21
- error: r,
22
- errorMessage: u,
23
- value: d,
24
- label: s,
25
- automationId: p = "",
26
- ariaLabel: P,
27
- ariaLabelledBy: x,
28
- ariaDescribedBy: z,
29
- phoneNumberAriaLabel: $,
30
- countryCodeAriaLabel: G,
31
- disabled: a = !1
1
+ import e, { useRef as R, useState as g, useCallback as C, useEffect as b } from "react";
2
+ const A = ({
3
+ size: n = 14,
4
+ className: s
5
+ }) => /* @__PURE__ */ e.createElement("svg", {
6
+ width: n,
7
+ height: n,
8
+ viewBox: "0 0 18 18",
9
+ fill: "currentColor",
10
+ className: s,
11
+ "aria-hidden": "true"
12
+ }, /* @__PURE__ */ e.createElement("path", {
13
+ d: "M3.025,5.623c.068,.204,.26,.342,.475,.342s.406-.138,.475-.342l.421-1.263,1.263-.421c.204-.068,.342-.259,.342-.474s-.138-.406-.342-.474l-1.263-.421-.421-1.263c-.137-.408-.812-.408-.949,0l-.421,1.263-1.263,.421c-.204,.068-.342,.259-.342,.474s.138,.406,.342,.474l1.263,.421,.421,1.263Z"
14
+ }), /* @__PURE__ */ e.createElement("path", {
15
+ d: "M16.525,8.803l-4.535-1.793-1.793-4.535c-.227-.572-1.168-.572-1.395,0l-1.793,4.535-4.535,1.793c-.286,.113-.475,.39-.475,.697s.188,.584,.475,.697l4.535,1.793,1.793,4.535c.113,.286,.39,.474,.697,.474s.584-.188,.697-.474l1.793-4.535,4.535-1.793c.286-.113,.475-.39,.475-.697s-.188-.584-.475-.697Z"
16
+ })), U = ({
17
+ size: n = 14
18
+ }) => /* @__PURE__ */ e.createElement("svg", {
19
+ width: n,
20
+ height: n,
21
+ viewBox: "0 0 24 24",
22
+ fill: "none",
23
+ stroke: "currentColor",
24
+ strokeWidth: "2",
25
+ strokeLinecap: "round",
26
+ strokeLinejoin: "round",
27
+ "aria-hidden": "true"
28
+ }, /* @__PURE__ */ e.createElement("circle", {
29
+ cx: "12",
30
+ cy: "12",
31
+ r: "10"
32
+ }), /* @__PURE__ */ e.createElement("path", {
33
+ d: "M12 6v6l4 2"
34
+ })), q = ({
35
+ size: n = 14
36
+ }) => /* @__PURE__ */ e.createElement("svg", {
37
+ width: n,
38
+ height: n,
39
+ viewBox: "0 0 24 24",
40
+ fill: "none",
41
+ stroke: "currentColor",
42
+ strokeWidth: "2.2",
43
+ strokeLinecap: "round",
44
+ "aria-hidden": "true"
45
+ }, /* @__PURE__ */ e.createElement("path", {
46
+ d: "M18 6 6 18M6 6l12 12"
47
+ })), H = /[.*+?^${}()|[\]\\]/g, J = (n, s, m) => {
48
+ const o = (m && m.length ? m : [s]).map((r) => (r || "").trim()).filter(Boolean);
49
+ if (!o.length) return n;
50
+ o.sort((r, i) => i.length - r.length);
51
+ const k = new Set(o.map((r) => r.toLowerCase())), l = o.map((r) => r.replace(H, "\\$&")).join("|");
52
+ return n.split(new RegExp(`(${l})`, "ig")).map((r, i) => k.has(r.toLowerCase()) ? /* @__PURE__ */ e.createElement("mark", {
53
+ key: i
54
+ }, r) : /* @__PURE__ */ e.createElement(e.Fragment, {
55
+ key: i
56
+ }, r));
57
+ }, P = /* @__PURE__ */ e.memo(({
58
+ value: n,
59
+ onChange: s,
60
+ onSelect: m,
61
+ onSubmit: o,
62
+ onClear: k,
63
+ suggestions: l = [],
64
+ isLoading: v = !1,
65
+ helperText: r,
66
+ helperVariant: i = "info",
67
+ placeholder: S = "Get any of your contracts",
68
+ placeholderPrefix: d,
69
+ examples: u,
70
+ collapsed: c = !1,
71
+ onExpand: I,
72
+ automationId: B = "nl-search-input",
73
+ ariaLabel: F = "Natural language search"
32
74
  }) => {
33
- const [E, k] = h(d?.countryCode || C[0].dial_code), [n, y] = h(!1), [w, B] = h(C), [Q, R] = h(""), [U, F] = h(""), W = f(null), O = f(null), K = f(null), m = f(!1), N = v(p, "phone-label"), V = v(p, "phone-listbox"), X = v(p, "phone-input"), j = v(p, "phone-error"), b = C.find((e) => e.dial_code === E), q = g(() => {
34
- y(!1), R(""), B(C);
35
- }, []), I = g((e) => {
36
- e && (k(e), i(e)), q();
37
- }, [i, q]), Y = g((e) => {
38
- m.current = !0, I(e.dial_code);
39
- }, [I]), {
40
- containerProps: H,
41
- inputProps: Z,
42
- listboxProps: ee,
43
- getOptionProps: te,
44
- highlightedIndex: ne,
45
- setHighlightedIndex: J
46
- } = le({
47
- items: w,
48
- isOpen: n,
49
- onOpenChange: y,
50
- onSelect: Y,
51
- listboxId: V
52
- }), oe = (e) => {
53
- const o = e.target.value;
54
- R(o), J(-1);
55
- const S = C.filter((A) => A.name.toLowerCase().includes(o.toLowerCase()) || A.dial_code.toLowerCase().includes(o.toLowerCase()) || A.code.toLowerCase().includes(o.toLowerCase()));
56
- B(S);
57
- }, D = f(n);
58
- _(() => {
59
- let e = null;
60
- return D.current && !n && m.current && (e = requestAnimationFrame(() => {
61
- O.current?.focus();
62
- })), D.current && !n && (m.current = !1), D.current = n, () => {
63
- e !== null && cancelAnimationFrame(e);
64
- };
65
- }, [n]), _(() => {
66
- d && (k(d.countryCode), F(d.number));
67
- }, [d]), _(() => {
68
- let e = null;
69
- return n && (e = requestAnimationFrame(() => {
70
- K.current?.focus();
71
- })), () => {
72
- e !== null && cancelAnimationFrame(e);
73
- };
74
- }, [n]);
75
- const re = (e) => {
76
- const o = e.replace(/\D/g, "");
77
- F(o), l(o);
78
- }, L = g(() => {
79
- a || y((e) => !e);
80
- }, [a]), ae = g((e) => {
81
- if (!a)
82
- switch (e.key) {
83
- case "Enter":
84
- case " ":
85
- e.preventDefault(), L();
86
- break;
87
- case "ArrowDown":
88
- e.preventDefault(), n || y(!0);
89
- break;
75
+ const D = R(null), K = R(null), [w, E] = g(!1), [h, N] = g(-1), j = C(() => {
76
+ c && I?.();
77
+ }, [c, I]), p = !!u && u.length > 0 && !n && !w, [L, W] = g(0), [f, _] = g(""), [y, $] = g("typing");
78
+ b(() => {
79
+ if (!p) return;
80
+ const t = u[L % u.length] || "";
81
+ let a = 60;
82
+ if (y === "typing")
83
+ if (f.length < t.length)
84
+ a = 55 + Math.random() * 35;
85
+ else {
86
+ const x = setTimeout(() => $("erasing"), 1800);
87
+ return () => clearTimeout(x);
90
88
  }
91
- }, [a, n, L]), ce = T({
92
- ariaLabelledBy: x || (!P && s ? N : void 0),
93
- ariaLabel: x ? void 0 : P || (s ? void 0 : "Phone number")
94
- }), se = T({
95
- ariaLabelledBy: !$ && s ? N : void 0,
96
- ariaLabel: $ || (s ? void 0 : "Phone number"),
97
- ariaDescribedBy: r ? j : z
98
- }), ie = G || `Select country code. Current: ${b?.name} ${b?.dial_code}`;
99
- return /* @__PURE__ */ t.createElement("div", c({
100
- className: "phone-input-container-se-design-main-container",
101
- "data-automation-id": p
102
- }, H, {
103
- onKeyDownCapture: (e) => {
104
- e.key === "Escape" && n && (m.current = !0), H.onKeyDownCapture(e);
105
- }
106
- }), s && /* @__PURE__ */ t.createElement("div", {
107
- id: N,
108
- className: "label-container"
109
- }, s), /* @__PURE__ */ t.createElement("div", c({
110
- role: "group"
111
- }, ce, {
112
- className: `phone-input-container-se-design-main ${r ? "error" : ""}`,
113
- ref: W
114
- }), /* @__PURE__ */ t.createElement("div", {
115
- className: "phone-input-container-se-design"
116
- }, /* @__PURE__ */ t.createElement("button", {
117
- ref: O,
118
- type: "button",
119
- className: `phone-input-container-se-design-country-code focus-outline rounded ${a ? "cursor-not-allowed opacity-60" : ""}`,
120
- onClick: L,
121
- onKeyDown: ae,
122
- "aria-haspopup": "listbox",
123
- "aria-expanded": n,
124
- "aria-controls": n ? V : void 0,
125
- "aria-label": ie,
126
- disabled: a,
127
- "data-automation-id": "country-code-selector"
128
- }, /* @__PURE__ */ t.createElement("img", {
129
- src: `https://flagcdn.com/${b?.code.toLowerCase()}.svg`,
130
- alt: "",
131
- "aria-hidden": "true",
132
- width: "16"
133
- }), /* @__PURE__ */ t.createElement("span", null, b?.dial_code), /* @__PURE__ */ t.createElement(M, {
134
- name: "chevron",
135
- className: n ? "rotate-180" : "",
136
- "aria-hidden": "true"
137
- })), /* @__PURE__ */ t.createElement("span", {
138
- className: "divider",
139
- "aria-hidden": "true"
140
- }), /* @__PURE__ */ t.createElement("input", c({
141
- id: X,
142
- type: "tel",
143
- placeholder: "Enter phone number",
144
- className: `phone-input-container-se-design-phone-number-input ${a ? "disabled" : ""}`,
145
- onChange: (e) => re(e.target.value),
146
- value: U,
147
- pattern: "[0-9]*",
148
- disabled: a,
149
- "aria-invalid": r || void 0
150
- }, se, {
151
- "data-automation-id": "phone-number-input-field"
152
- }))), n && /* @__PURE__ */ t.createElement("div", c({}, ee, {
153
- className: "phone-input-container-se-design-country-code-list",
154
- "aria-label": "Select country",
155
- "data-automation-id": "country-code-list"
156
- }), /* @__PURE__ */ t.createElement("div", {
157
- className: "search-input-wrapper"
158
- }, /* @__PURE__ */ t.createElement(M, {
159
- name: "search",
160
- className: "search-icon",
161
- "aria-hidden": "true"
162
- }), /* @__PURE__ */ t.createElement("input", c({
163
- ref: K
164
- }, Z, {
89
+ else if (y === "erasing")
90
+ if (f.length > 0)
91
+ a = 28;
92
+ else {
93
+ const x = setTimeout(() => {
94
+ W((O) => (O + 1) % u.length), $("typing");
95
+ }, 260);
96
+ return () => clearTimeout(x);
97
+ }
98
+ const M = setTimeout(() => {
99
+ y === "typing" ? _(t.slice(0, f.length + 1)) : y === "erasing" && _(t.slice(0, f.length - 1));
100
+ }, a);
101
+ return () => clearTimeout(M);
102
+ }, [p, L, f, y, u]), b(() => {
103
+ p || (_(""), $("typing"));
104
+ }, [p]), b(() => {
105
+ N(-1);
106
+ }, [l]), b(() => {
107
+ if (!w) return;
108
+ const t = (a) => {
109
+ D.current && !D.current.contains(a.target) && E(!1);
110
+ };
111
+ return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
112
+ }, [w]);
113
+ const Z = w && l.length > 0, T = C((t) => {
114
+ m?.(t), E(!1);
115
+ }, [m]), z = C((t) => {
116
+ t.key === "ArrowDown" && l.length ? (t.preventDefault(), N((a) => (a + 1) % l.length)) : t.key === "ArrowUp" && l.length ? (t.preventDefault(), N((a) => a <= 0 ? l.length - 1 : a - 1)) : t.key === "Enter" ? h >= 0 && l[h] ? (t.preventDefault(), T(l[h])) : n.trim() && (t.preventDefault(), o?.(n.trim()), E(!1)) : t.key === "Escape" && E(!1);
117
+ }, [l, h, n, T, o]), G = C(() => {
118
+ s(""), k?.();
119
+ }, [s, k]);
120
+ return /* @__PURE__ */ e.createElement("div", {
121
+ className: `nl-wrap${c ? " is-collapsed" : ""}`,
122
+ ref: D,
123
+ "data-automation-id": B
124
+ }, /* @__PURE__ */ e.createElement("div", {
125
+ className: `nl-input-row${w ? " is-active" : ""}${v ? " is-loading" : ""}${c ? " is-collapsed" : ""}`
126
+ }, /* @__PURE__ */ e.createElement("div", {
127
+ className: "nl-mark",
128
+ "aria-hidden": !c,
129
+ role: c ? "button" : void 0,
130
+ "aria-label": c ? "Open AI search" : void 0,
131
+ tabIndex: c ? 0 : -1,
132
+ onClick: j,
133
+ onKeyDown: c ? (t) => {
134
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), I?.());
135
+ } : void 0
136
+ }, /* @__PURE__ */ e.createElement(A, {
137
+ size: 14
138
+ })), /* @__PURE__ */ e.createElement("input", {
139
+ ref: K,
165
140
  type: "text",
166
- placeholder: "Search countries",
167
- className: "phone-input-container-se-design-country-code-list-item-input",
168
- onChange: oe,
169
- value: Q,
170
- "aria-label": "Search countries",
171
- "data-automation-id": "country-code-search-input"
172
- }))), w.length > 0 ? w.map((e, o) => {
173
- const S = te(o, e.dial_code === E);
174
- return /* @__PURE__ */ t.createElement("div", c({
175
- key: e.code
176
- }, S, {
177
- className: `phone-input-container-se-design-country-code-list-item ${ne === o ? "highlighted" : ""} ${e.dial_code === E ? "selected" : ""}`,
178
- onClick: () => {
179
- m.current = !0, I(e.dial_code);
180
- },
181
- onMouseEnter: () => J(o)
182
- }), /* @__PURE__ */ t.createElement("img", {
183
- src: `https://flagcdn.com/${e.code.toLowerCase()}.svg`,
184
- alt: "",
185
- "aria-hidden": "true",
186
- width: "16"
187
- }), /* @__PURE__ */ t.createElement("span", null, e.name), /* @__PURE__ */ t.createElement("span", null, "(", e.dial_code, ")"));
188
- }) : /* @__PURE__ */ t.createElement("div", {
189
- className: "phone-input-container-se-design-country-code-list-item-no-results",
190
- role: "status"
191
- }, "No results found"))), r && /* @__PURE__ */ t.createElement("div", {
192
- id: j,
193
- className: "error-message",
194
- role: "alert"
195
- }, u));
196
- };
141
+ className: "nl-input",
142
+ value: n,
143
+ placeholder: p ? "" : S,
144
+ autoComplete: "off",
145
+ "aria-label": F,
146
+ tabIndex: c ? -1 : 0,
147
+ disabled: c,
148
+ onChange: (t) => s(t.target.value),
149
+ onFocus: () => E(!0),
150
+ onKeyDown: z
151
+ }), p && /* @__PURE__ */ e.createElement("div", {
152
+ className: "nl-typewriter",
153
+ "aria-hidden": "true"
154
+ }, d && /* @__PURE__ */ e.createElement("span", {
155
+ className: "nl-typewriter__prefix"
156
+ }, d), /* @__PURE__ */ e.createElement("span", {
157
+ className: "nl-typewriter__example"
158
+ }, f), /* @__PURE__ */ e.createElement("span", {
159
+ className: "nl-typewriter__caret"
160
+ }), d && /['"`]\s*$/.test(d) && /* @__PURE__ */ e.createElement("span", {
161
+ className: "nl-typewriter__prefix"
162
+ }, d.trim().slice(-1))), v && /* @__PURE__ */ e.createElement("span", {
163
+ className: "nl-spinner show",
164
+ role: "status",
165
+ "aria-label": "Resolving"
166
+ }), !v && n && /* @__PURE__ */ e.createElement("button", {
167
+ type: "button",
168
+ className: "nl-clear show",
169
+ title: "Clear search",
170
+ onClick: G
171
+ }, /* @__PURE__ */ e.createElement(q, {
172
+ size: 14
173
+ }))), Z && /* @__PURE__ */ e.createElement("div", {
174
+ className: "nl-suggestions show",
175
+ role: "listbox"
176
+ }, l.map((t, a) => /* @__PURE__ */ e.createElement("button", {
177
+ key: `${t.source}-${t.text}`,
178
+ type: "button",
179
+ role: "option",
180
+ "aria-selected": a === h,
181
+ className: `nl-sug${a === h ? " kb-active" : ""}`,
182
+ onMouseEnter: () => N(a),
183
+ onMouseDown: (M) => {
184
+ M.preventDefault(), T(t);
185
+ }
186
+ }, t.source === "recent" ? /* @__PURE__ */ e.createElement(U, {
187
+ size: 16
188
+ }) : /* @__PURE__ */ e.createElement(A, {
189
+ size: 16,
190
+ className: "sparkle"
191
+ }), /* @__PURE__ */ e.createElement("span", {
192
+ className: "sug-text"
193
+ }, J(t.text, n.trim(), t.highlight_terms)), t.source === "recent" && /* @__PURE__ */ e.createElement("span", {
194
+ className: "sug-meta"
195
+ }, "Recent")))), r && /* @__PURE__ */ e.createElement("div", {
196
+ className: `nl-helper nl-helper--${i}`,
197
+ role: i === "error" ? "alert" : "status"
198
+ }, r));
199
+ });
200
+ P.displayName = "NLSearchInput";
197
201
  export {
198
- ve as PhoneInput
202
+ P as NLSearchInput
199
203
  };
200
204
  //# sourceMappingURL=index46.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index46.js","sources":["../src/components/PhoneInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState, useCallback } from 'react';\nimport './style.scss';\nimport countriesInfoJson from './countriesInfo.json';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes, useCombobox } from '../../utils/a11y';\n\nexport interface PhoneInputProps {\n onCountrycodeChange: (countryCode: string) => void;\n onNumberChange: (number: string) => void;\n error?: boolean;\n errorMessage?: string;\n value?: {\n countryCode: string;\n number: string;\n };\n label?: string;\n automationId?: string;\n /**\n * Accessible label for the entire phone input group (role=\"group\").\n * Provides context for screen readers (e.g., \"Two-step verification phone number for signer 1\").\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label the group (highest precedence over ariaLabel).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) providing additional description for the phone number input.\n */\n ariaDescribedBy?: string;\n /**\n * Override aria-label for the phone number input specifically.\n * Defaults to the visible label text or 'Phone number'.\n */\n phoneNumberAriaLabel?: string;\n /**\n * Override aria-label for the country code combobox button.\n * Defaults to \"Select country code. Current: {name} {dial_code}\".\n */\n countryCodeAriaLabel?: string;\n /**\n * Whether the input is disabled\n */\n disabled?: boolean;\n}\n\nexport const PhoneInput: React.FC<PhoneInputProps> = ({\n onCountrycodeChange,\n onNumberChange,\n error,\n errorMessage,\n value,\n label,\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n phoneNumberAriaLabel,\n countryCodeAriaLabel,\n disabled = false\n}) => {\n const [countryCode, setCountryCode] = useState(value?.countryCode || countriesInfoJson[0].dial_code);\n const [displaySelectCountryCode, setDisplaySelectCountryCode] = useState(false);\n const [countriesInfo, setCountriesInfo] = useState(countriesInfoJson);\n const [searchValue, setSearchValue] = useState('');\n const [enteredNumber, setEnteredNumber] = useState('');\n const containerRef = useRef<HTMLDivElement>(null);\n const countryButtonRef = useRef<HTMLButtonElement>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const restoreFocusToButtonRef = useRef(false);\n\n // Generate stable IDs for ARIA relationships\n const labelId = useStableId(automationId, 'phone-label');\n const listboxId = useStableId(automationId, 'phone-listbox');\n const phoneInputId = useStableId(automationId, 'phone-input');\n const errorId = useStableId(automationId, 'phone-error');\n\n const countryInfo = countriesInfoJson.find((country) => country.dial_code === countryCode);\n\n // Close dropdown and reset state\n const closeDropdown = useCallback(() => {\n setDisplaySelectCountryCode(false);\n setSearchValue('');\n setCountriesInfo(countriesInfoJson);\n }, []);\n\n const handleCountryCodeSelect = useCallback(\n (country: string) => {\n if (country) {\n setCountryCode(country);\n onCountrycodeChange(country);\n }\n closeDropdown();\n // Focus return is handled by useEffect that watches displaySelectCountryCode\n },\n [onCountrycodeChange, closeDropdown]\n );\n\n const handleSelectFromDropdown = useCallback(\n (country: typeof countriesInfoJson[0]) => {\n restoreFocusToButtonRef.current = true;\n handleCountryCodeSelect(country.dial_code);\n },\n [handleCountryCodeSelect]\n );\n\n // Use comprehensive useCombobox hook for country search\n const {\n containerProps,\n inputProps: comboboxInputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex,\n setHighlightedIndex\n } = useCombobox({\n items: countriesInfo,\n isOpen: displaySelectCountryCode,\n onOpenChange: setDisplaySelectCountryCode,\n onSelect: handleSelectFromDropdown,\n listboxId\n });\n\n const handleCountryCodeSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n const searchVal = event.target.value;\n setSearchValue(searchVal);\n setHighlightedIndex(-1);\n const filteredCountries = countriesInfoJson.filter(\n (country) =>\n country.name.toLowerCase().includes(searchVal.toLowerCase()) ||\n country.dial_code.toLowerCase().includes(searchVal.toLowerCase()) ||\n country.code.toLowerCase().includes(searchVal.toLowerCase())\n );\n setCountriesInfo(filteredCountries);\n };\n\n // Return focus to button when dropdown closes\n const prevDisplaySelectCountryCodeRef = useRef(displaySelectCountryCode);\n useEffect(() => {\n let rafId: number | null = null;\n // If dropdown was open and is now closed, return focus to button\n // ONLY when the close was triggered from within the component (Escape/selection),\n // not when the user moved focus outside (focus-out dismissal).\n if (prevDisplaySelectCountryCodeRef.current && !displaySelectCountryCode && restoreFocusToButtonRef.current) {\n rafId = requestAnimationFrame(() => {\n countryButtonRef.current?.focus();\n });\n }\n if (prevDisplaySelectCountryCodeRef.current && !displaySelectCountryCode) {\n restoreFocusToButtonRef.current = false;\n }\n prevDisplaySelectCountryCodeRef.current = displaySelectCountryCode;\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n };\n }, [displaySelectCountryCode]);\n\n useEffect(() => {\n if (value) {\n setCountryCode(value.countryCode);\n setEnteredNumber(value.number);\n }\n }, [value]);\n\n // Focus search input when dropdown opens\n useEffect(() => {\n let rafId: number | null = null;\n if (displaySelectCountryCode) {\n rafId = requestAnimationFrame(() => {\n searchInputRef.current?.focus();\n });\n }\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n };\n }, [displaySelectCountryCode]);\n\n const handleEnteredNumberChange = (val: string) => {\n const numericValue = val.replace(/\\D/g, ''); // Remove non-numeric characters\n setEnteredNumber(numericValue);\n onNumberChange(numericValue);\n };\n\n const toggleDropdown = useCallback(() => {\n if (disabled) return;\n setDisplaySelectCountryCode((prev) => !prev);\n }, [disabled]);\n\n const handleCountryButtonKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ':\n e.preventDefault();\n toggleDropdown();\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (!displaySelectCountryCode) {\n setDisplaySelectCountryCode(true);\n }\n break;\n // Escape is handled by useDismissOnEscape hook\n }\n },\n [disabled, displaySelectCountryCode, toggleDropdown]\n );\n\n // Group label (role=\"group\"): ariaLabelledBy > ariaLabel > visible label > fallback\n const groupAriaLabelledBy = ariaLabelledBy || (!ariaLabel && label ? labelId : undefined);\n const groupAriaLabel = !ariaLabelledBy ? (ariaLabel || (!label ? 'Phone number' : undefined)) : undefined;\n const groupA11yProps = getA11yNameAttributes({ ariaLabelledBy: groupAriaLabelledBy, ariaLabel: groupAriaLabel });\n\n // Phone number input: caller override > visible label > fallback 'Phone number'\n const phoneInputA11yProps = getA11yNameAttributes({\n ariaLabelledBy: !phoneNumberAriaLabel && label ? labelId : undefined,\n ariaLabel: phoneNumberAriaLabel || (!label ? 'Phone number' : undefined),\n ariaDescribedBy: error ? errorId : ariaDescribedBy\n });\n\n // Country code button label: caller override > default dynamic label\n const computedCountryCodeAriaLabel = countryCodeAriaLabel ||\n `Select country code. Current: ${countryInfo?.name} ${countryInfo?.dial_code}`;\n\n return (\n <div \n className=\"phone-input-container-se-design-main-container\" \n data-automation-id={automationId}\n {...containerProps}\n onKeyDownCapture={(e) => {\n if (e.key === 'Escape' && displaySelectCountryCode) {\n restoreFocusToButtonRef.current = true;\n }\n containerProps.onKeyDownCapture(e);\n }}\n >\n {label && (\n <div id={labelId} className=\"label-container\">\n {label}\n </div>\n )}\n <div\n role=\"group\"\n {...groupA11yProps}\n className={`phone-input-container-se-design-main ${error ? 'error' : ''}`}\n ref={containerRef}\n >\n <div className=\"phone-input-container-se-design\">\n <button\n ref={countryButtonRef}\n type=\"button\"\n className={`phone-input-container-se-design-country-code focus-outline rounded ${disabled ? 'cursor-not-allowed opacity-60' : ''}`}\n onClick={toggleDropdown}\n onKeyDown={handleCountryButtonKeyDown}\n aria-haspopup=\"listbox\"\n aria-expanded={displaySelectCountryCode}\n aria-controls={displaySelectCountryCode ? listboxId : undefined}\n aria-label={computedCountryCodeAriaLabel}\n disabled={disabled}\n data-automation-id=\"country-code-selector\"\n >\n <img\n src={`https://flagcdn.com/${countryInfo?.code.toLowerCase()}.svg`}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"16\"\n />\n <span>{countryInfo?.dial_code}</span>\n <Icon\n name=\"chevron\"\n className={!displaySelectCountryCode ? '' : 'rotate-180'}\n aria-hidden=\"true\"\n />\n </button>\n <span className=\"divider\" aria-hidden=\"true\" />\n <input\n id={phoneInputId}\n type=\"tel\"\n placeholder=\"Enter phone number\"\n className={`phone-input-container-se-design-phone-number-input ${disabled ? 'disabled' : ''}`}\n onChange={(event) => handleEnteredNumberChange(event.target.value)}\n value={enteredNumber}\n pattern=\"[0-9]*\"\n disabled={disabled}\n aria-invalid={error || undefined}\n {...phoneInputA11yProps}\n data-automation-id=\"phone-number-input-field\"\n />\n </div>\n\n {displaySelectCountryCode && (\n <div\n {...listboxProps}\n className=\"phone-input-container-se-design-country-code-list\"\n aria-label=\"Select country\"\n data-automation-id=\"country-code-list\"\n >\n <div className=\"search-input-wrapper\">\n <Icon name=\"search\" className=\"search-icon\" aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n {...comboboxInputProps}\n type=\"text\"\n placeholder=\"Search countries\"\n className=\"phone-input-container-se-design-country-code-list-item-input\"\n onChange={handleCountryCodeSearch}\n value={searchValue}\n aria-label=\"Search countries\"\n data-automation-id=\"country-code-search-input\"\n />\n </div>\n {countriesInfo.length > 0 ? (\n countriesInfo.map((country, index) => {\n const optionProps = getOptionProps(index, country.dial_code === countryCode);\n return (\n <div\n key={country.code}\n {...optionProps}\n className={`phone-input-container-se-design-country-code-list-item ${\n highlightedIndex === index ? 'highlighted' : ''\n } ${country.dial_code === countryCode ? 'selected' : ''}`}\n onClick={() => {\n restoreFocusToButtonRef.current = true;\n handleCountryCodeSelect(country.dial_code);\n }}\n onMouseEnter={() => setHighlightedIndex(index)}\n >\n <img\n src={`https://flagcdn.com/${country.code.toLowerCase()}.svg`}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"16\"\n />\n <span>{country.name}</span>\n <span>({country.dial_code})</span>\n </div>\n );\n })\n ) : (\n <div className=\"phone-input-container-se-design-country-code-list-item-no-results\" role=\"status\">\n No results found\n </div>\n )}\n </div>\n )}\n </div>\n {error && (\n <div id={errorId} className=\"error-message\" role=\"alert\">\n {errorMessage}\n </div>\n )}\n </div>\n );\n};\n"],"names":["PhoneInput","onCountrycodeChange","onNumberChange","error","errorMessage","value","label","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","phoneNumberAriaLabel","countryCodeAriaLabel","disabled","countryCode","setCountryCode","useState","countriesInfoJson","dial_code","displaySelectCountryCode","setDisplaySelectCountryCode","countriesInfo","setCountriesInfo","searchValue","setSearchValue","enteredNumber","setEnteredNumber","containerRef","useRef","countryButtonRef","searchInputRef","restoreFocusToButtonRef","labelId","useStableId","listboxId","phoneInputId","errorId","countryInfo","find","country","closeDropdown","useCallback","handleCountryCodeSelect","handleSelectFromDropdown","current","containerProps","inputProps","comboboxInputProps","listboxProps","getOptionProps","highlightedIndex","setHighlightedIndex","useCombobox","items","isOpen","onOpenChange","onSelect","handleCountryCodeSearch","event","searchVal","target","filteredCountries","filter","name","toLowerCase","includes","code","prevDisplaySelectCountryCodeRef","useEffect","rafId","requestAnimationFrame","focus","cancelAnimationFrame","number","handleEnteredNumberChange","val","numericValue","replace","toggleDropdown","prev","handleCountryButtonKeyDown","e","key","preventDefault","groupA11yProps","getA11yNameAttributes","undefined","groupAriaLabel","phoneInputA11yProps","computedCountryCodeAriaLabel","React","createElement","_extends","className","onKeyDownCapture","id","role","ref","type","onClick","onKeyDown","src","alt","width","Icon","placeholder","onChange","pattern","length","map","index","optionProps","onMouseEnter"],"mappings":";;;;;;;;;;;;;;;;;AA+CO,MAAMA,KAAwCA,CAAC;AAAA,EACpDC,qBAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,sBAAAA;AAAAA,EACAC,sBAAAA;AAAAA,EACAC,UAAAA,IAAW;AACb,MAAM;AACJ,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAASX,GAAOS,eAAeG,EAAkB,CAAC,EAAEC,SAAS,GAC7F,CAACC,GAA0BC,CAA2B,IAAIJ,EAAS,EAAK,GACxE,CAACK,GAAeC,CAAgB,IAAIN,EAASC,CAAiB,GAC9D,CAACM,GAAaC,CAAc,IAAIR,EAAS,EAAE,GAC3C,CAACS,GAAeC,CAAgB,IAAIV,EAAS,EAAE,GAC/CW,IAAeC,EAAuB,IAAI,GAC1CC,IAAmBD,EAA0B,IAAI,GACjDE,IAAiBF,EAAyB,IAAI,GAC9CG,IAA0BH,EAAO,EAAK,GAGtCI,IAAUC,EAAY1B,GAAc,aAAa,GACjD2B,IAAYD,EAAY1B,GAAc,eAAe,GACrD4B,IAAeF,EAAY1B,GAAc,aAAa,GACtD6B,IAAUH,EAAY1B,GAAc,aAAa,GAEjD8B,IAAcpB,EAAkBqB,KAAMC,CAAAA,MAAYA,EAAQrB,cAAcJ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MAAK;AAAA,EAAA,GAAS,kBAE5F,CAEJ,CAEJ,GACJ7F,KACCuF,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKI,IAAI3D;AAAAA,IAASyD,WAAU;AAAA,IAAgBG,MAAK;AAAA,EAAA,GAC9C5F,CACE,CAEJ;AAET;"}
1
+ {"version":3,"file":"index46.js","sources":["../src/components/NLSearch/NLSearchInput.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\n\nexport type NLSuggestionSource = 'recent' | 'global';\n\nexport interface NLSuggestion {\n text: string;\n source: NLSuggestionSource;\n /**\n * Words inside `text` the backend wants <mark>-highlighted. Set when\n * the user's typed prefix matched via a synonym (typed \"documents\",\n * suggestion says \"contracts\" — backend returns `[\"contracts\"]` so the\n * canonical word still lights up). Empty/undefined falls back to\n * highlighting the literal typed query.\n */\n highlight_terms?: string[];\n}\n\nexport interface NLSearchInputProps {\n value: string;\n onChange: (value: string) => void;\n onSelect?: (suggestion: NLSuggestion) => void;\n onSubmit?: (text: string) => void;\n onClear?: () => void;\n suggestions?: NLSuggestion[];\n isLoading?: boolean;\n helperText?: string;\n helperVariant?: 'info' | 'warning' | 'error';\n placeholder?: string;\n /**\n * When provided alongside `examples`, the input renders a typewriter\n * placeholder overlay: `<placeholderPrefix><typed-example>` cycling\n * through the list every ~5s. The native `placeholder` prop is\n * suppressed while the overlay is active so the two don't collide.\n */\n placeholderPrefix?: string;\n examples?: string[];\n /**\n * When true, the bar collapses to just the sparkle disc — the input,\n * placeholder overlay, clear button, and helper line all hide via\n * width + opacity transitions. Clicking the disc fires `onExpand`\n * (the parent toggles `collapsed` back to false). Auto-focuses the\n * input after the expand animation finishes.\n */\n collapsed?: boolean;\n onExpand?: () => void;\n automationId?: string;\n ariaLabel?: string;\n}\n\nconst SparkleIcon = ({ size = 14, className }: { size?: number; className?: string }) => (\n <svg width={size} height={size} viewBox=\"0 0 18 18\" fill=\"currentColor\" className={className} aria-hidden=\"true\">\n <path d=\"M3.025,5.623c.068,.204,.26,.342,.475,.342s.406-.138,.475-.342l.421-1.263,1.263-.421c.204-.068,.342-.259,.342-.474s-.138-.406-.342-.474l-1.263-.421-.421-1.263c-.137-.408-.812-.408-.949,0l-.421,1.263-1.263,.421c-.204,.068-.342,.259-.342,.474s.138,.406,.342,.474l1.263,.421,.421,1.263Z\" />\n <path d=\"M16.525,8.803l-4.535-1.793-1.793-4.535c-.227-.572-1.168-.572-1.395,0l-1.793,4.535-4.535,1.793c-.286,.113-.475,.39-.475,.697s.188,.584,.475,.697l4.535,1.793,1.793,4.535c.113,.286,.39,.474,.697,.474s.584-.188,.697-.474l1.793-4.535,4.535-1.793c.286-.113,.475-.39,.475-.697s-.188-.584-.475-.697Z\" />\n </svg>\n);\n\nconst ClockIcon = ({ size = 14 }: { size?: number }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 6v6l4 2\" />\n </svg>\n);\n\nconst CloseIcon = ({ size = 14 }: { size?: number }) => (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n);\n\nconst RE_SPECIAL = /[.*+?^${}()|[\\]\\\\]/g;\n\n/**\n * Wrap each case-insensitive occurrence of `terms` (any of them) inside\n * `text` in a <mark>. Long terms first so \"contracts\" wins over a\n * shorter prefix that overlaps. Falls back to splitting on the literal\n * `query` if no `terms` were provided by the backend.\n */\nconst highlightMatch = (\n text: string,\n query: string,\n terms?: string[],\n): React.ReactNode => {\n const needles = (terms && terms.length ? terms : [query])\n .map((t) => (t || '').trim())\n .filter(Boolean);\n if (!needles.length) return text;\n // Longest first so substrings don't pre-empt the longer canonical\n // match (e.g. \"contracts\" should win over \"con\").\n needles.sort((a, b) => b.length - a.length);\n const needleSet = new Set(needles.map((n) => n.toLowerCase()));\n const pattern = needles.map((n) => n.replace(RE_SPECIAL, '\\\\$&')).join('|');\n const parts = text.split(new RegExp(`(${pattern})`, 'ig'));\n return parts.map((part, idx) =>\n needleSet.has(part.toLowerCase())\n ? <mark key={idx}>{part}</mark>\n : <React.Fragment key={idx}>{part}</React.Fragment>,\n );\n};\n\nexport const NLSearchInput: React.FC<NLSearchInputProps> = React.memo(\n ({\n value,\n onChange,\n onSelect,\n onSubmit,\n onClear,\n suggestions = [],\n isLoading = false,\n helperText,\n helperVariant = 'info',\n placeholder = 'Get any of your contracts',\n placeholderPrefix,\n examples,\n collapsed = false,\n onExpand,\n automationId = 'nl-search-input',\n ariaLabel = 'Natural language search'\n }) => {\n const wrapRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const [focused, setFocused] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n\n const handleMarkClick = useCallback(() => {\n if (collapsed) onExpand?.();\n }, [collapsed, onExpand]);\n\n // Typewriter overlay state. Only animates when:\n // • caller passed a non-empty `examples` list,\n // • the input is empty (no user-typed value),\n // • the input isn't focused.\n // On any of those conditions flipping false the overlay hides\n // instantly and the native input takes over.\n const showTypewriter =\n !!examples && examples.length > 0 && !value && !focused;\n const [twIdx, setTwIdx] = useState(0);\n const [twText, setTwText] = useState('');\n const [twPhase, setTwPhase] = useState<'typing' | 'holding' | 'erasing'>('typing');\n\n useEffect(() => {\n if (!showTypewriter) return undefined;\n const target = examples![twIdx % examples!.length] || '';\n let delay = 60;\n if (twPhase === 'typing') {\n if (twText.length < target.length) {\n delay = 55 + Math.random() * 35; // slight jitter for organic feel\n } else {\n // Finished typing — hold the full sentence before erasing.\n const t = setTimeout(() => setTwPhase('erasing'), 1800);\n return () => clearTimeout(t);\n }\n } else if (twPhase === 'erasing') {\n if (twText.length > 0) {\n delay = 28;\n } else {\n // Erased — short pause then cycle to next example.\n const t = setTimeout(() => {\n setTwIdx((i) => (i + 1) % examples!.length);\n setTwPhase('typing');\n }, 260);\n return () => clearTimeout(t);\n }\n }\n const tick = setTimeout(() => {\n if (twPhase === 'typing') setTwText(target.slice(0, twText.length + 1));\n else if (twPhase === 'erasing') setTwText(target.slice(0, twText.length - 1));\n }, delay);\n return () => clearTimeout(tick);\n }, [showTypewriter, twIdx, twText, twPhase, examples]);\n\n // Reset typewriter when overlay re-engages so it starts cleanly.\n useEffect(() => {\n if (!showTypewriter) {\n setTwText('');\n setTwPhase('typing');\n }\n }, [showTypewriter]);\n\n useEffect(() => {\n setActiveIndex(-1);\n }, [suggestions]);\n\n useEffect(() => {\n if (!focused) return undefined;\n const onDocClick = (e: MouseEvent) => {\n if (wrapRef.current && !wrapRef.current.contains(e.target as Node)) {\n setFocused(false);\n }\n };\n document.addEventListener('mousedown', onDocClick);\n return () => document.removeEventListener('mousedown', onDocClick);\n }, [focused]);\n\n const showPopover = focused && suggestions.length > 0;\n\n const pick = useCallback(\n (s: NLSuggestion) => {\n onSelect?.(s);\n setFocused(false);\n },\n [onSelect]\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'ArrowDown' && suggestions.length) {\n e.preventDefault();\n setActiveIndex((i) => (i + 1) % suggestions.length);\n } else if (e.key === 'ArrowUp' && suggestions.length) {\n e.preventDefault();\n setActiveIndex((i) => (i <= 0 ? suggestions.length - 1 : i - 1));\n } else if (e.key === 'Enter') {\n if (activeIndex >= 0 && suggestions[activeIndex]) {\n e.preventDefault();\n pick(suggestions[activeIndex]);\n } else if (value.trim()) {\n e.preventDefault();\n onSubmit?.(value.trim());\n setFocused(false);\n }\n } else if (e.key === 'Escape') {\n setFocused(false);\n }\n },\n [suggestions, activeIndex, value, pick, onSubmit]\n );\n\n const handleClear = useCallback(() => {\n onChange('');\n onClear?.();\n }, [onChange, onClear]);\n\n return (\n <div\n className={`nl-wrap${collapsed ? ' is-collapsed' : ''}`}\n ref={wrapRef}\n data-automation-id={automationId}\n >\n <div className={`nl-input-row${focused ? ' is-active' : ''}${isLoading ? ' is-loading' : ''}${collapsed ? ' is-collapsed' : ''}`}>\n <div\n className=\"nl-mark\"\n aria-hidden={!collapsed}\n role={collapsed ? 'button' : undefined}\n aria-label={collapsed ? 'Open AI search' : undefined}\n tabIndex={collapsed ? 0 : -1}\n onClick={handleMarkClick}\n onKeyDown={collapsed ? (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onExpand?.();\n }\n } : undefined}\n >\n <SparkleIcon size={14} />\n </div>\n <input\n ref={inputRef}\n type=\"text\"\n className=\"nl-input\"\n value={value}\n placeholder={showTypewriter ? '' : placeholder}\n autoComplete=\"off\"\n aria-label={ariaLabel}\n // Skip the bar in tab order while collapsed; restored on\n // expand. Prevents users from \"clicking\" the hidden input\n // via keyboard.\n tabIndex={collapsed ? -1 : 0}\n disabled={collapsed}\n onChange={(e) => onChange(e.target.value)}\n onFocus={() => setFocused(true)}\n onKeyDown={handleKeyDown}\n />\n {showTypewriter && (\n <div className=\"nl-typewriter\" aria-hidden=\"true\">\n {placeholderPrefix && (\n <span className=\"nl-typewriter__prefix\">{placeholderPrefix}</span>\n )}\n <span className=\"nl-typewriter__example\">{twText}</span>\n <span className=\"nl-typewriter__caret\" />\n {/* Closing quote — paired with the opening quote the\n caller passes in via placeholderPrefix. Hidden when\n the prefix doesn't end with an opening quote so the\n component degrades cleanly for callers that pass a\n prefix without quotes. */}\n {placeholderPrefix && /['\"`]\\s*$/.test(placeholderPrefix) && (\n <span className=\"nl-typewriter__prefix\">\n {placeholderPrefix.trim().slice(-1)}\n </span>\n )}\n </div>\n )}\n {isLoading && <span className=\"nl-spinner show\" role=\"status\" aria-label=\"Resolving\" />}\n {!isLoading && value && (\n <button type=\"button\" className=\"nl-clear show\" title=\"Clear search\" onClick={handleClear}>\n <CloseIcon size={14} />\n </button>\n )}\n </div>\n\n {showPopover && (\n <div className=\"nl-suggestions show\" role=\"listbox\">\n {suggestions.map((s, i) => (\n <button\n key={`${s.source}-${s.text}`}\n type=\"button\"\n role=\"option\"\n aria-selected={i === activeIndex}\n className={`nl-sug${i === activeIndex ? ' kb-active' : ''}`}\n onMouseEnter={() => setActiveIndex(i)}\n onMouseDown={(e) => {\n e.preventDefault();\n pick(s);\n }}\n >\n {s.source === 'recent' ? (\n <ClockIcon size={16} />\n ) : (\n <SparkleIcon size={16} className=\"sparkle\" />\n )}\n <span className=\"sug-text\">{highlightMatch(s.text, value.trim(), s.highlight_terms)}</span>\n {s.source === 'recent' && <span className=\"sug-meta\">Recent</span>}\n </button>\n ))}\n </div>\n )}\n\n {helperText && (\n <div\n className={`nl-helper nl-helper--${helperVariant}`}\n role={helperVariant === 'error' ? 'alert' : 'status'}\n >\n {helperText}\n </div>\n )}\n </div>\n );\n }\n);\n\nNLSearchInput.displayName = 'NLSearchInput';\n"],"names":["SparkleIcon","size","className","React","createElement","width","height","viewBox","fill","d","ClockIcon","stroke","strokeWidth","strokeLinecap","strokeLinejoin","cx","cy","r","CloseIcon","RE_SPECIAL","highlightMatch","text","query","terms","needles","length","map","t","trim","filter","Boolean","sort","a","b","needleSet","Set","n","toLowerCase","pattern","replace","join","split","RegExp","part","idx","has","key","Fragment","NLSearchInput","memo","value","onChange","onSelect","onSubmit","onClear","suggestions","isLoading","helperText","helperVariant","placeholder","placeholderPrefix","examples","collapsed","onExpand","automationId","ariaLabel","wrapRef","useRef","inputRef","focused","setFocused","useState","activeIndex","setActiveIndex","handleMarkClick","useCallback","showTypewriter","twIdx","setTwIdx","twText","setTwText","twPhase","setTwPhase","useEffect","target","delay","Math","random","setTimeout","clearTimeout","i","tick","slice","onDocClick","e","current","contains","document","addEventListener","removeEventListener","showPopover","pick","s","handleKeyDown","preventDefault","handleClear","ref","role","undefined","tabIndex","onClick","onKeyDown","type","autoComplete","disabled","onFocus","test","title","source","onMouseEnter","onMouseDown","highlight_terms","displayName"],"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