@cube-dev/ui-kit 0.182.0 → 0.183.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1124) hide show
  1. package/dist/CHANGELOG.md +10 -0
  2. package/dist/_internal/hooks/use-debounced-value.js +48 -31
  3. package/dist/_internal/hooks/use-debounced-value.js.map +1 -1
  4. package/dist/_internal/hooks/use-deprecation-warning.js +22 -7
  5. package/dist/_internal/hooks/use-deprecation-warning.js.map +1 -1
  6. package/dist/_internal/hooks/use-event.js +1 -1
  7. package/dist/_internal/hooks/use-event.js.map +1 -1
  8. package/dist/_internal/hooks/use-is-first-render.js +1 -1
  9. package/dist/_internal/hooks/use-is-first-render.js.map +1 -1
  10. package/dist/_internal/hooks/use-sync-ref.js +12 -4
  11. package/dist/_internal/hooks/use-sync-ref.js.map +1 -1
  12. package/dist/_internal/hooks/use-timer/timer.js +1 -1
  13. package/dist/_internal/hooks/use-timer/timer.js.map +1 -1
  14. package/dist/_internal/hooks/use-timer/use-timer.js +90 -20
  15. package/dist/_internal/hooks/use-timer/use-timer.js.map +1 -1
  16. package/dist/_internal/hooks/use-warn.js +4 -4
  17. package/dist/_internal/hooks/use-warn.js.map +1 -1
  18. package/dist/components/Block.js +29 -7
  19. package/dist/components/Block.js.map +1 -1
  20. package/dist/components/CollectionItem.js +1 -1
  21. package/dist/components/CollectionItem.js.map +1 -1
  22. package/dist/components/GlobalStyles.js +33 -9
  23. package/dist/components/GlobalStyles.js.map +1 -1
  24. package/dist/components/GridProvider.js +4 -4
  25. package/dist/components/GridProvider.js.map +1 -1
  26. package/dist/components/HiddenInput.js +1 -1
  27. package/dist/components/HiddenInput.js.map +1 -1
  28. package/dist/components/Root.js +137 -42
  29. package/dist/components/Root.js.map +1 -1
  30. package/dist/components/actions/Action/Action.js +20 -8
  31. package/dist/components/actions/Action/Action.js.map +1 -1
  32. package/dist/components/actions/Banner/Banner.js +91 -22
  33. package/dist/components/actions/Banner/Banner.js.map +1 -1
  34. package/dist/components/actions/Button/Button.js +5 -5
  35. package/dist/components/actions/Button/Button.js.map +1 -1
  36. package/dist/components/actions/ButtonGroup/ButtonGroup.js +15 -5
  37. package/dist/components/actions/ButtonGroup/ButtonGroup.js.map +1 -1
  38. package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
  39. package/dist/components/actions/ButtonSplit/ButtonSplit.js.map +1 -1
  40. package/dist/components/actions/ButtonSplit/context.js +1 -1
  41. package/dist/components/actions/ButtonSplit/context.js.map +1 -1
  42. package/dist/components/actions/CommandMenu/CommandMenu.js +76 -76
  43. package/dist/components/actions/CommandMenu/CommandMenu.js.map +1 -1
  44. package/dist/components/actions/CommandMenu/styled.js +1 -1
  45. package/dist/components/actions/CommandMenu/styled.js.map +1 -1
  46. package/dist/components/actions/ItemAction/ItemAction.js +205 -68
  47. package/dist/components/actions/ItemAction/ItemAction.js.map +1 -1
  48. package/dist/components/actions/ItemActionContext.js +26 -7
  49. package/dist/components/actions/ItemActionContext.js.map +1 -1
  50. package/dist/components/actions/ItemActionsWrapper.js +215 -84
  51. package/dist/components/actions/ItemActionsWrapper.js.map +1 -1
  52. package/dist/components/actions/ItemButton/ItemButton.js +2 -2
  53. package/dist/components/actions/ItemButton/ItemButton.js.map +1 -1
  54. package/dist/components/actions/Link/Link.js +16 -7
  55. package/dist/components/actions/Link/Link.js.map +1 -1
  56. package/dist/components/actions/Menu/Menu.js +127 -72
  57. package/dist/components/actions/Menu/Menu.js.map +1 -1
  58. package/dist/components/actions/Menu/MenuItem.js +116 -43
  59. package/dist/components/actions/Menu/MenuItem.js.map +1 -1
  60. package/dist/components/actions/Menu/MenuSection.js +85 -30
  61. package/dist/components/actions/Menu/MenuSection.js.map +1 -1
  62. package/dist/components/actions/Menu/MenuTrigger.js +316 -112
  63. package/dist/components/actions/Menu/MenuTrigger.js.map +1 -1
  64. package/dist/components/actions/Menu/SubMenuTrigger.js +6 -6
  65. package/dist/components/actions/Menu/SubMenuTrigger.js.map +1 -1
  66. package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
  67. package/dist/components/actions/Menu/SubmenuTriggerContext.js.map +1 -1
  68. package/dist/components/actions/Menu/context.js +1 -1
  69. package/dist/components/actions/Menu/context.js.map +1 -1
  70. package/dist/components/actions/Menu/styled.js +1 -1
  71. package/dist/components/actions/Menu/styled.js.map +1 -1
  72. package/dist/components/actions/actions-run.js +1 -1
  73. package/dist/components/actions/actions-run.js.map +1 -1
  74. package/dist/components/actions/index.js +1 -1
  75. package/dist/components/actions/index.js.map +1 -1
  76. package/dist/components/actions/use-action.js +3 -3
  77. package/dist/components/actions/use-action.js.map +1 -1
  78. package/dist/components/actions/use-anchored-menu.js +6 -6
  79. package/dist/components/actions/use-anchored-menu.js.map +1 -1
  80. package/dist/components/actions/use-context-menu.js +12 -12
  81. package/dist/components/actions/use-context-menu.js.map +1 -1
  82. package/dist/components/content/ActiveZone/ActiveZone.js +84 -18
  83. package/dist/components/content/ActiveZone/ActiveZone.js.map +1 -1
  84. package/dist/components/content/Alert/Alert.js +18 -7
  85. package/dist/components/content/Alert/Alert.js.map +1 -1
  86. package/dist/components/content/Alert/use-alert.js +53 -15
  87. package/dist/components/content/Alert/use-alert.js.map +1 -1
  88. package/dist/components/content/Avatar/Avatar.js +51 -13
  89. package/dist/components/content/Avatar/Avatar.js.map +1 -1
  90. package/dist/components/content/Badge/Badge.js +43 -10
  91. package/dist/components/content/Badge/Badge.js.map +1 -1
  92. package/dist/components/content/Card/Card.js +29 -7
  93. package/dist/components/content/Card/Card.js.map +1 -1
  94. package/dist/components/content/Content.js +29 -7
  95. package/dist/components/content/Content.js.map +1 -1
  96. package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +2 -2
  97. package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js.map +1 -1
  98. package/dist/components/content/CopySnippet/CopySnippet.js +220 -60
  99. package/dist/components/content/CopySnippet/CopySnippet.js.map +1 -1
  100. package/dist/components/content/Disclosure/Disclosure.js +453 -194
  101. package/dist/components/content/Disclosure/Disclosure.js.map +1 -1
  102. package/dist/components/content/Divider.js +52 -14
  103. package/dist/components/content/Divider.js.map +1 -1
  104. package/dist/components/content/Footer.js +29 -7
  105. package/dist/components/content/Footer.js.map +1 -1
  106. package/dist/components/content/Header.js +29 -7
  107. package/dist/components/content/Header.js.map +1 -1
  108. package/dist/components/content/HotKeys/HotKeys.js +55 -27
  109. package/dist/components/content/HotKeys/HotKeys.js.map +1 -1
  110. package/dist/components/content/InfoBadge/InfoBadge.js +8 -8
  111. package/dist/components/content/InfoBadge/InfoBadge.js.map +1 -1
  112. package/dist/components/content/InlineInput/InlineInput.js +429 -188
  113. package/dist/components/content/InlineInput/InlineInput.js.map +1 -1
  114. package/dist/components/content/Item/Item.js +408 -151
  115. package/dist/components/content/Item/Item.js.map +1 -1
  116. package/dist/components/content/ItemBadge/ItemBadge.js +173 -59
  117. package/dist/components/content/ItemBadge/ItemBadge.js.map +1 -1
  118. package/dist/components/content/ItemCard/ItemCard.js +34 -9
  119. package/dist/components/content/ItemCard/ItemCard.js.map +1 -1
  120. package/dist/components/content/Layout/GridLayout.js +38 -10
  121. package/dist/components/content/Layout/GridLayout.js.map +1 -1
  122. package/dist/components/content/Layout/Layout.js +30 -13
  123. package/dist/components/content/Layout/Layout.js.map +1 -1
  124. package/dist/components/content/Layout/LayoutBlock.js +33 -8
  125. package/dist/components/content/Layout/LayoutBlock.js.map +1 -1
  126. package/dist/components/content/Layout/LayoutCenter.js +48 -11
  127. package/dist/components/content/Layout/LayoutCenter.js.map +1 -1
  128. package/dist/components/content/Layout/LayoutContainer.js +1 -1
  129. package/dist/components/content/Layout/LayoutContainer.js.map +1 -1
  130. package/dist/components/content/Layout/LayoutContent.js +1 -1
  131. package/dist/components/content/Layout/LayoutContent.js.map +1 -1
  132. package/dist/components/content/Layout/LayoutContext.js +30 -21
  133. package/dist/components/content/Layout/LayoutContext.js.map +1 -1
  134. package/dist/components/content/Layout/LayoutFlex.js +33 -8
  135. package/dist/components/content/Layout/LayoutFlex.js.map +1 -1
  136. package/dist/components/content/Layout/LayoutFooter.js +53 -14
  137. package/dist/components/content/Layout/LayoutFooter.js.map +1 -1
  138. package/dist/components/content/Layout/LayoutGrid.js +48 -11
  139. package/dist/components/content/Layout/LayoutGrid.js.map +1 -1
  140. package/dist/components/content/Layout/LayoutHeader.js +211 -57
  141. package/dist/components/content/Layout/LayoutHeader.js.map +1 -1
  142. package/dist/components/content/Layout/LayoutPane.js +60 -14
  143. package/dist/components/content/Layout/LayoutPane.js.map +1 -1
  144. package/dist/components/content/Layout/LayoutPanel.js +59 -17
  145. package/dist/components/content/Layout/LayoutPanel.js.map +1 -1
  146. package/dist/components/content/Layout/LayoutPanelHeader.js +89 -27
  147. package/dist/components/content/Layout/LayoutPanelHeader.js.map +1 -1
  148. package/dist/components/content/Layout/LayoutToolbar.js +33 -8
  149. package/dist/components/content/Layout/LayoutToolbar.js.map +1 -1
  150. package/dist/components/content/Layout/hooks/useTinyScrollbar.js +206 -119
  151. package/dist/components/content/Layout/hooks/useTinyScrollbar.js.map +1 -1
  152. package/dist/components/content/Layout/index.js +1 -1
  153. package/dist/components/content/Layout/index.js.map +1 -1
  154. package/dist/components/content/Layout/utils.js +1 -1
  155. package/dist/components/content/Layout/utils.js.map +1 -1
  156. package/dist/components/content/Paragraph.js +25 -9
  157. package/dist/components/content/Paragraph.js.map +1 -1
  158. package/dist/components/content/Placeholder/Placeholder.js +52 -14
  159. package/dist/components/content/Placeholder/Placeholder.js.map +1 -1
  160. package/dist/components/content/PrismCode/PrismCode.js +1 -1
  161. package/dist/components/content/PrismCode/PrismCode.js.map +1 -1
  162. package/dist/components/content/PrismCode/prismSetup.js +1 -1
  163. package/dist/components/content/PrismCode/prismSetup.js.map +1 -1
  164. package/dist/components/content/PrismDiffCode/PrismDiffCode.js +52 -17
  165. package/dist/components/content/PrismDiffCode/PrismDiffCode.js.map +1 -1
  166. package/dist/components/content/Result/Result.js +117 -38
  167. package/dist/components/content/Result/Result.js.map +1 -1
  168. package/dist/components/content/Skeleton/Skeleton.js +26 -17
  169. package/dist/components/content/Skeleton/Skeleton.js.map +1 -1
  170. package/dist/components/content/Tag/Tag.js +68 -13
  171. package/dist/components/content/Tag/Tag.js.map +1 -1
  172. package/dist/components/content/Text.d.ts +14 -14
  173. package/dist/components/content/Text.js +61 -14
  174. package/dist/components/content/Text.js.map +1 -1
  175. package/dist/components/content/TextItem/TextItem.js +37 -16
  176. package/dist/components/content/TextItem/TextItem.js.map +1 -1
  177. package/dist/components/content/Title.js +98 -23
  178. package/dist/components/content/Title.js.map +1 -1
  179. package/dist/components/content/Tree/Tree.js +32 -32
  180. package/dist/components/content/Tree/Tree.js.map +1 -1
  181. package/dist/components/content/Tree/TreeNode.js +10 -10
  182. package/dist/components/content/Tree/TreeNode.js.map +1 -1
  183. package/dist/components/content/Tree/styled.js +1 -1
  184. package/dist/components/content/Tree/styled.js.map +1 -1
  185. package/dist/components/content/Tree/tree-index.js +1 -1
  186. package/dist/components/content/Tree/tree-index.js.map +1 -1
  187. package/dist/components/content/Tree/use-checkbox-tree.js +123 -89
  188. package/dist/components/content/Tree/use-checkbox-tree.js.map +1 -1
  189. package/dist/components/content/Tree/use-load-data.js +52 -21
  190. package/dist/components/content/Tree/use-load-data.js.map +1 -1
  191. package/dist/components/content/highlightText.js +1 -1
  192. package/dist/components/content/highlightText.js.map +1 -1
  193. package/dist/components/content/use-auto-tooltip.js +1 -1
  194. package/dist/components/content/use-auto-tooltip.js.map +1 -1
  195. package/dist/components/data/DataTable/DataTable.js +31 -31
  196. package/dist/components/data/DataTable/DataTable.js.map +1 -1
  197. package/dist/components/data/ItemTable/ItemTable.js +41 -41
  198. package/dist/components/data/ItemTable/ItemTable.js.map +1 -1
  199. package/dist/components/data/ItemTable/ItemTableBulkBar.js +11 -11
  200. package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +1 -1
  201. package/dist/components/data/ItemTable/ItemTableDragPreview.js +41 -4
  202. package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +1 -1
  203. package/dist/components/data/ItemTable/ItemTableFooter.js +67 -30
  204. package/dist/components/data/ItemTable/ItemTableFooter.js.map +1 -1
  205. package/dist/components/data/ItemTable/ItemTableToolbar.js +95 -28
  206. package/dist/components/data/ItemTable/ItemTableToolbar.js.map +1 -1
  207. package/dist/components/data/TableBase/ColumnResizer.js +90 -41
  208. package/dist/components/data/TableBase/ColumnResizer.js.map +1 -1
  209. package/dist/components/data/TableBase/RowCollection.js +1 -1
  210. package/dist/components/data/TableBase/RowCollection.js.map +1 -1
  211. package/dist/components/data/TableBase/TableHeaderCell.js +154 -64
  212. package/dist/components/data/TableBase/TableHeaderCell.js.map +1 -1
  213. package/dist/components/data/TableBase/TableRow.js +211 -69
  214. package/dist/components/data/TableBase/TableRow.js.map +1 -1
  215. package/dist/components/data/TableBase/TableView.js +119 -80
  216. package/dist/components/data/TableBase/TableView.js.map +1 -1
  217. package/dist/components/data/TableBase/column-menu.js +1 -1
  218. package/dist/components/data/TableBase/column-menu.js.map +1 -1
  219. package/dist/components/data/TableBase/column-tint.js +1 -1
  220. package/dist/components/data/TableBase/column-tint.js.map +1 -1
  221. package/dist/components/data/TableBase/row-menu.js +1 -1
  222. package/dist/components/data/TableBase/row-menu.js.map +1 -1
  223. package/dist/components/data/TableBase/styled.js +1 -1
  224. package/dist/components/data/TableBase/styled.js.map +1 -1
  225. package/dist/components/data/TableBase/table-tree.js +1 -1
  226. package/dist/components/data/TableBase/table-tree.js.map +1 -1
  227. package/dist/components/data/TableBase/types.js +1 -1
  228. package/dist/components/data/TableBase/types.js.map +1 -1
  229. package/dist/components/data/TableBase/use-cell-selection.js +0 -0
  230. package/dist/components/data/TableBase/use-cell-selection.js.map +1 -1
  231. package/dist/components/data/TableBase/use-column-order.js +56 -12
  232. package/dist/components/data/TableBase/use-column-order.js.map +1 -1
  233. package/dist/components/data/TableBase/use-container-width.js +24 -10
  234. package/dist/components/data/TableBase/use-container-width.js.map +1 -1
  235. package/dist/components/data/TableBase/use-row-move-animation.js +68 -49
  236. package/dist/components/data/TableBase/use-row-move-animation.js.map +1 -1
  237. package/dist/components/data/TableBase/use-scrollability.js +32 -18
  238. package/dist/components/data/TableBase/use-scrollability.js.map +1 -1
  239. package/dist/components/data/TableBase/use-table-columns.js +130 -60
  240. package/dist/components/data/TableBase/use-table-columns.js.map +1 -1
  241. package/dist/components/data/TableBase/use-table-search.js +1 -1
  242. package/dist/components/data/TableBase/use-table-search.js.map +1 -1
  243. package/dist/components/data/TableBase/use-table-selection.js +39 -39
  244. package/dist/components/data/TableBase/use-table-selection.js.map +1 -1
  245. package/dist/components/data/TableBase/use-table-sort.js +132 -68
  246. package/dist/components/data/TableBase/use-table-sort.js.map +1 -1
  247. package/dist/components/data/TableBase/use-table-sorts.js +168 -101
  248. package/dist/components/data/TableBase/use-table-sorts.js.map +1 -1
  249. package/dist/components/data/TableBase/use-table-storage.js +2 -2
  250. package/dist/components/data/TableBase/use-table-storage.js.map +1 -1
  251. package/dist/components/data/TableBase/use-table-tree-state.js +181 -86
  252. package/dist/components/data/TableBase/use-table-tree-state.js.map +1 -1
  253. package/dist/components/fields/Checkbox/Checkbox.js +2 -2
  254. package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
  255. package/dist/components/fields/Checkbox/CheckboxGroup.js +101 -33
  256. package/dist/components/fields/Checkbox/CheckboxGroup.js.map +1 -1
  257. package/dist/components/fields/Checkbox/context.js +1 -1
  258. package/dist/components/fields/Checkbox/context.js.map +1 -1
  259. package/dist/components/fields/ColorInput/ColorInput.js +329 -150
  260. package/dist/components/fields/ColorInput/ColorInput.js.map +1 -1
  261. package/dist/components/fields/ColorPicker/ColorPicker.js +16 -16
  262. package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
  263. package/dist/components/fields/ColorSwatch/ColorSwatch.js +52 -13
  264. package/dist/components/fields/ColorSwatch/ColorSwatch.js.map +1 -1
  265. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +90 -28
  266. package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -1
  267. package/dist/components/fields/ComboBox/ComboBox.js +216 -134
  268. package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
  269. package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
  270. package/dist/components/fields/CommandTextArea/CommandTextArea.js.map +1 -1
  271. package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
  272. package/dist/components/fields/CommandTextArea/caretPosition.js.map +1 -1
  273. package/dist/components/fields/CommandTextArea/useCaretAnchor.js +88 -49
  274. package/dist/components/fields/CommandTextArea/useCaretAnchor.js.map +1 -1
  275. package/dist/components/fields/DatePicker/DateInput.js +1 -1
  276. package/dist/components/fields/DatePicker/DateInput.js.map +1 -1
  277. package/dist/components/fields/DatePicker/DateInputBase.js +129 -34
  278. package/dist/components/fields/DatePicker/DateInputBase.js.map +1 -1
  279. package/dist/components/fields/DatePicker/DatePicker.js +194 -69
  280. package/dist/components/fields/DatePicker/DatePicker.js.map +1 -1
  281. package/dist/components/fields/DatePicker/DatePickerButton.js +39 -8
  282. package/dist/components/fields/DatePicker/DatePickerButton.js.map +1 -1
  283. package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
  284. package/dist/components/fields/DatePicker/DatePickerElement.js.map +1 -1
  285. package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
  286. package/dist/components/fields/DatePicker/DatePickerInput.js.map +1 -1
  287. package/dist/components/fields/DatePicker/DatePickerSegment.js +109 -29
  288. package/dist/components/fields/DatePicker/DatePickerSegment.js.map +1 -1
  289. package/dist/components/fields/DatePicker/DateRangePicker.js +224 -88
  290. package/dist/components/fields/DatePicker/DateRangePicker.js.map +1 -1
  291. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +473 -180
  292. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js.map +1 -1
  293. package/dist/components/fields/DatePicker/MonthPicker.js +15 -6
  294. package/dist/components/fields/DatePicker/MonthPicker.js.map +1 -1
  295. package/dist/components/fields/DatePicker/PeriodPicker.js +288 -91
  296. package/dist/components/fields/DatePicker/PeriodPicker.js.map +1 -1
  297. package/dist/components/fields/DatePicker/QuarterPicker.js +15 -6
  298. package/dist/components/fields/DatePicker/QuarterPicker.js.map +1 -1
  299. package/dist/components/fields/DatePicker/TimeInput.js +15 -7
  300. package/dist/components/fields/DatePicker/TimeInput.js.map +1 -1
  301. package/dist/components/fields/DatePicker/WeekPicker.js +15 -6
  302. package/dist/components/fields/DatePicker/WeekPicker.js.map +1 -1
  303. package/dist/components/fields/DatePicker/YearPicker.js +15 -6
  304. package/dist/components/fields/DatePicker/YearPicker.js.map +1 -1
  305. package/dist/components/fields/DatePicker/parseDate.js +1 -1
  306. package/dist/components/fields/DatePicker/parseDate.js.map +1 -1
  307. package/dist/components/fields/DatePicker/period.js +1 -1
  308. package/dist/components/fields/DatePicker/period.js.map +1 -1
  309. package/dist/components/fields/DatePicker/props.js +1 -1
  310. package/dist/components/fields/DatePicker/props.js.map +1 -1
  311. package/dist/components/fields/DatePicker/utils.js +15 -8
  312. package/dist/components/fields/DatePicker/utils.js.map +1 -1
  313. package/dist/components/fields/FileInput/FileInput.js +3 -3
  314. package/dist/components/fields/FileInput/FileInput.js.map +1 -1
  315. package/dist/components/fields/FilterListBox/FilterListBox.js +87 -87
  316. package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
  317. package/dist/components/fields/FilterPicker/FilterPicker.js +22 -22
  318. package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
  319. package/dist/components/fields/Input/Input.js +1 -1
  320. package/dist/components/fields/Input/Input.js.map +1 -1
  321. package/dist/components/fields/ListBox/DraggableListBox.js +23 -10
  322. package/dist/components/fields/ListBox/DraggableListBox.js.map +1 -1
  323. package/dist/components/fields/ListBox/ListBox.js +138 -53
  324. package/dist/components/fields/ListBox/ListBox.js.map +1 -1
  325. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +156 -37
  326. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js.map +1 -1
  327. package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
  328. package/dist/components/fields/ListBoxPopover/listNavigation.js.map +1 -1
  329. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +61 -33
  330. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js.map +1 -1
  331. package/dist/components/fields/NumberInput/NumberInput.js +123 -33
  332. package/dist/components/fields/NumberInput/NumberInput.js.map +1 -1
  333. package/dist/components/fields/NumberInput/StepButton.js +53 -15
  334. package/dist/components/fields/NumberInput/StepButton.js.map +1 -1
  335. package/dist/components/fields/PasswordInput/PasswordInput.js +149 -45
  336. package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
  337. package/dist/components/fields/Picker/Picker.js +8 -8
  338. package/dist/components/fields/Picker/Picker.js.map +1 -1
  339. package/dist/components/fields/RadioGroup/Radio.js +273 -104
  340. package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
  341. package/dist/components/fields/RadioGroup/RadioGroup.js +149 -48
  342. package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
  343. package/dist/components/fields/RadioGroup/context.js +1 -1
  344. package/dist/components/fields/RadioGroup/context.js.map +1 -1
  345. package/dist/components/fields/SearchComboBox/SearchComboBox.js +80 -65
  346. package/dist/components/fields/SearchComboBox/SearchComboBox.js.map +1 -1
  347. package/dist/components/fields/SearchInput/SearchInput.js +91 -28
  348. package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
  349. package/dist/components/fields/Select/Select.js +369 -117
  350. package/dist/components/fields/Select/Select.js.map +1 -1
  351. package/dist/components/fields/Slider/Gradation.js +45 -10
  352. package/dist/components/fields/Slider/Gradation.js.map +1 -1
  353. package/dist/components/fields/Slider/HueSlider.js +121 -32
  354. package/dist/components/fields/Slider/HueSlider.js.map +1 -1
  355. package/dist/components/fields/Slider/RangeSlider.js +46 -10
  356. package/dist/components/fields/Slider/RangeSlider.js.map +1 -1
  357. package/dist/components/fields/Slider/Slider.js +108 -23
  358. package/dist/components/fields/Slider/Slider.js.map +1 -1
  359. package/dist/components/fields/Slider/SliderBase.js +2 -2
  360. package/dist/components/fields/Slider/SliderBase.js.map +1 -1
  361. package/dist/components/fields/Slider/SliderThumb.js +96 -37
  362. package/dist/components/fields/Slider/SliderThumb.js.map +1 -1
  363. package/dist/components/fields/Slider/SliderTrack.js +64 -23
  364. package/dist/components/fields/Slider/SliderTrack.js.map +1 -1
  365. package/dist/components/fields/Slider/elements.js +1 -1
  366. package/dist/components/fields/Slider/elements.js.map +1 -1
  367. package/dist/components/fields/Slider/index.js +1 -1
  368. package/dist/components/fields/Switch/Switch.js +190 -66
  369. package/dist/components/fields/Switch/Switch.js.map +1 -1
  370. package/dist/components/fields/TextArea/TextArea.js +137 -47
  371. package/dist/components/fields/TextArea/TextArea.js.map +1 -1
  372. package/dist/components/fields/TextInput/TextInput.js +80 -27
  373. package/dist/components/fields/TextInput/TextInput.js.map +1 -1
  374. package/dist/components/fields/TextInput/TextInputBase.js +1 -1
  375. package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
  376. package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
  377. package/dist/components/fields/TextInput/useAutoSizeTextArea.js.map +1 -1
  378. package/dist/components/fields/TextInputMapper/TextInputMapper.js +156 -83
  379. package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
  380. package/dist/components/fields/TriggerActions.js +11 -2
  381. package/dist/components/fields/TriggerActions.js.map +1 -1
  382. package/dist/components/fields/color/ColorPanel.js +237 -59
  383. package/dist/components/fields/color/ColorPanel.js.map +1 -1
  384. package/dist/components/fields/color/channels.js +1 -1
  385. package/dist/components/fields/color/channels.js.map +1 -1
  386. package/dist/components/fields/color/color.js +1 -1
  387. package/dist/components/fields/color/color.js.map +1 -1
  388. package/dist/components/fields/color/context.js +1 -1
  389. package/dist/components/fields/color/context.js.map +1 -1
  390. package/dist/components/form/FieldWrapper/FieldWrapper.js +195 -72
  391. package/dist/components/form/FieldWrapper/FieldWrapper.js.map +1 -1
  392. package/dist/components/form/Form/Field.js +23 -9
  393. package/dist/components/form/Form/Field.js.map +1 -1
  394. package/dist/components/form/Form/Form.js +76 -30
  395. package/dist/components/form/Form/Form.js.map +1 -1
  396. package/dist/components/form/Form/ModernFormRoot.js +294 -81
  397. package/dist/components/form/Form/ModernFormRoot.js.map +1 -1
  398. package/dist/components/form/Form/ResetButton/ResetButton.js +32 -10
  399. package/dist/components/form/Form/ResetButton/ResetButton.js.map +1 -1
  400. package/dist/components/form/Form/SubmitButton/SubmitButton.js +32 -10
  401. package/dist/components/form/Form/SubmitButton/SubmitButton.js.map +1 -1
  402. package/dist/components/form/Form/SubmitError.js +130 -32
  403. package/dist/components/form/Form/SubmitError.js.map +1 -1
  404. package/dist/components/form/Form/backend.js +1 -1
  405. package/dist/components/form/Form/backend.js.map +1 -1
  406. package/dist/components/form/Form/index.js +1 -1
  407. package/dist/components/form/Form/index.js.map +1 -1
  408. package/dist/components/form/Form/modern/actions.js +140 -45
  409. package/dist/components/form/Form/modern/actions.js.map +1 -1
  410. package/dist/components/form/Form/modern/context.js +1 -1
  411. package/dist/components/form/Form/modern/context.js.map +1 -1
  412. package/dist/components/form/Form/modern/controller.js +1 -1
  413. package/dist/components/form/Form/modern/controller.js.map +1 -1
  414. package/dist/components/form/Form/modern/field-binding.js +1 -1
  415. package/dist/components/form/Form/modern/field-binding.js.map +1 -1
  416. package/dist/components/form/Form/modern/field.js +1 -1
  417. package/dist/components/form/Form/modern/field.js.map +1 -1
  418. package/dist/components/form/Form/modern/react.js +102 -19
  419. package/dist/components/form/Form/modern/react.js.map +1 -1
  420. package/dist/components/form/Form/modern/store.js +13 -3
  421. package/dist/components/form/Form/modern/store.js.map +1 -1
  422. package/dist/components/form/Form/modern/types.d.ts +3 -1
  423. package/dist/components/form/Form/modern/validation.js +1 -1
  424. package/dist/components/form/Form/modern/validation.js.map +1 -1
  425. package/dist/components/form/Form/modern/values.js +1 -1
  426. package/dist/components/form/Form/modern/values.js.map +1 -1
  427. package/dist/components/form/Form/use-field/use-field-binding.js +236 -63
  428. package/dist/components/form/Form/use-field/use-field-binding.js.map +1 -1
  429. package/dist/components/form/Form/use-field/use-field-props.js +106 -61
  430. package/dist/components/form/Form/use-field/use-field-props.js.map +1 -1
  431. package/dist/components/form/Form/use-field/use-field.js +5 -4
  432. package/dist/components/form/Form/use-field/use-field.js.map +1 -1
  433. package/dist/components/form/Form/use-form.js +2 -1
  434. package/dist/components/form/Form/use-form.js.map +1 -1
  435. package/dist/components/form/Form/validation.js +1 -1
  436. package/dist/components/form/Form/validation.js.map +1 -1
  437. package/dist/components/form/Label.js +127 -37
  438. package/dist/components/form/Label.js.map +1 -1
  439. package/dist/components/form/validation/ValidationIndicator.js +20 -5
  440. package/dist/components/form/validation/ValidationIndicator.js.map +1 -1
  441. package/dist/components/form/validation/resolve-validation-props.js +1 -1
  442. package/dist/components/form/validation/resolve-validation-props.js.map +1 -1
  443. package/dist/components/form/validation/use-validation-props.js +36 -10
  444. package/dist/components/form/validation/use-validation-props.js.map +1 -1
  445. package/dist/components/form/wrapper.js +1 -1
  446. package/dist/components/form/wrapper.js.map +1 -1
  447. package/dist/components/helpers/DisplayTransition/DisplayTransition.js +49 -29
  448. package/dist/components/helpers/DisplayTransition/DisplayTransition.js.map +1 -1
  449. package/dist/components/helpers/IconSwitch/IconSwitch.js +8 -8
  450. package/dist/components/helpers/IconSwitch/IconSwitch.js.map +1 -1
  451. package/dist/components/layout/Board/Board.js +27 -9
  452. package/dist/components/layout/Board/Board.js.map +1 -1
  453. package/dist/components/layout/Board/BoardProvider.js +1 -1
  454. package/dist/components/layout/Board/BoardProvider.js.map +1 -1
  455. package/dist/components/layout/Board/BoardResponsive.js +1 -1
  456. package/dist/components/layout/Board/BoardResponsive.js.map +1 -1
  457. package/dist/components/layout/Board/Widget.js +1 -1
  458. package/dist/components/layout/Board/Widget.js.map +1 -1
  459. package/dist/components/layout/Board/WidgetHost.js +159 -121
  460. package/dist/components/layout/Board/WidgetHost.js.map +1 -1
  461. package/dist/components/layout/Board/board-context.js +14 -5
  462. package/dist/components/layout/Board/board-context.js.map +1 -1
  463. package/dist/components/layout/Board/board-store.js +1 -1
  464. package/dist/components/layout/Board/board-store.js.map +1 -1
  465. package/dist/components/layout/Board/grid-core/calculate.js +1 -1
  466. package/dist/components/layout/Board/grid-core/calculate.js.map +1 -1
  467. package/dist/components/layout/Board/grid-core/collision-modes.js +1 -1
  468. package/dist/components/layout/Board/grid-core/collision-modes.js.map +1 -1
  469. package/dist/components/layout/Board/grid-core/collision.js +1 -1
  470. package/dist/components/layout/Board/grid-core/collision.js.map +1 -1
  471. package/dist/components/layout/Board/grid-core/compactors.js +1 -1
  472. package/dist/components/layout/Board/grid-core/compactors.js.map +1 -1
  473. package/dist/components/layout/Board/grid-core/constraints.js +1 -1
  474. package/dist/components/layout/Board/grid-core/constraints.js.map +1 -1
  475. package/dist/components/layout/Board/grid-core/group-move.js +1 -1
  476. package/dist/components/layout/Board/grid-core/group-move.js.map +1 -1
  477. package/dist/components/layout/Board/grid-core/layout.js +1 -1
  478. package/dist/components/layout/Board/grid-core/layout.js.map +1 -1
  479. package/dist/components/layout/Board/grid-core/placement.js +1 -1
  480. package/dist/components/layout/Board/grid-core/placement.js.map +1 -1
  481. package/dist/components/layout/Board/grid-core/sort.js +1 -1
  482. package/dist/components/layout/Board/grid-core/sort.js.map +1 -1
  483. package/dist/components/layout/Board/index.js +1 -1
  484. package/dist/components/layout/Board/index.js.map +1 -1
  485. package/dist/components/layout/Board/responsive-utils.js +1 -1
  486. package/dist/components/layout/Board/responsive-utils.js.map +1 -1
  487. package/dist/components/layout/Board/use-board-layout.js +8 -8
  488. package/dist/components/layout/Board/use-board-layout.js.map +1 -1
  489. package/dist/components/layout/Board/use-board-registry.js +257 -257
  490. package/dist/components/layout/Board/use-board-registry.js.map +1 -1
  491. package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
  492. package/dist/components/layout/Board/use-board-select-modifier-key.js.map +1 -1
  493. package/dist/components/layout/Board/use-board-selection.js +16 -16
  494. package/dist/components/layout/Board/use-board-selection.js.map +1 -1
  495. package/dist/components/layout/Flex.js +29 -7
  496. package/dist/components/layout/Flex.js.map +1 -1
  497. package/dist/components/layout/Flow.js +29 -7
  498. package/dist/components/layout/Flow.js.map +1 -1
  499. package/dist/components/layout/Grid.js +30 -7
  500. package/dist/components/layout/Grid.js.map +1 -1
  501. package/dist/components/layout/Panel.js +9 -9
  502. package/dist/components/layout/Panel.js.map +1 -1
  503. package/dist/components/layout/Prefix.js +59 -16
  504. package/dist/components/layout/Prefix.js.map +1 -1
  505. package/dist/components/layout/ResizablePanel.js +62 -32
  506. package/dist/components/layout/ResizablePanel.js.map +1 -1
  507. package/dist/components/layout/Space.js +55 -11
  508. package/dist/components/layout/Space.js.map +1 -1
  509. package/dist/components/layout/Suffix.js +59 -16
  510. package/dist/components/layout/Suffix.js.map +1 -1
  511. package/dist/components/navigation/Pagination/Pagination.js +394 -164
  512. package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
  513. package/dist/components/navigation/Pagination/use-pagination.js +69 -26
  514. package/dist/components/navigation/Pagination/use-pagination.js.map +1 -1
  515. package/dist/components/navigation/Tabs/DraggableTabList.js +25 -10
  516. package/dist/components/navigation/Tabs/DraggableTabList.js.map +1 -1
  517. package/dist/components/navigation/Tabs/TabButton.js +604 -235
  518. package/dist/components/navigation/Tabs/TabButton.js.map +1 -1
  519. package/dist/components/navigation/Tabs/TabDropIndicator.js +65 -23
  520. package/dist/components/navigation/Tabs/TabDropIndicator.js.map +1 -1
  521. package/dist/components/navigation/Tabs/TabPanel.js +47 -19
  522. package/dist/components/navigation/Tabs/TabPanel.js.map +1 -1
  523. package/dist/components/navigation/Tabs/TabPicker.js +105 -33
  524. package/dist/components/navigation/Tabs/TabPicker.js.map +1 -1
  525. package/dist/components/navigation/Tabs/Tabs.js +45 -45
  526. package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
  527. package/dist/components/navigation/Tabs/TabsAction.js +53 -19
  528. package/dist/components/navigation/Tabs/TabsAction.js.map +1 -1
  529. package/dist/components/navigation/Tabs/TabsContext.js +16 -6
  530. package/dist/components/navigation/Tabs/TabsContext.js.map +1 -1
  531. package/dist/components/navigation/Tabs/popover-placement.js +1 -1
  532. package/dist/components/navigation/Tabs/popover-placement.js.map +1 -1
  533. package/dist/components/navigation/Tabs/styled.js +1 -1
  534. package/dist/components/navigation/Tabs/styled.js.map +1 -1
  535. package/dist/components/navigation/Tabs/types.js +1 -1
  536. package/dist/components/navigation/Tabs/types.js.map +1 -1
  537. package/dist/components/navigation/Tabs/use-tab-editing.js +50 -13
  538. package/dist/components/navigation/Tabs/use-tab-editing.js.map +1 -1
  539. package/dist/components/navigation/Tabs/use-tab-indicator.js +111 -63
  540. package/dist/components/navigation/Tabs/use-tab-indicator.js.map +1 -1
  541. package/dist/components/organisms/StatsCard/StatsCard.js +54 -14
  542. package/dist/components/organisms/StatsCard/StatsCard.js.map +1 -1
  543. package/dist/components/other/Calendar/Calendar.js +79 -31
  544. package/dist/components/other/Calendar/Calendar.js.map +1 -1
  545. package/dist/components/other/Calendar/CalendarCell.js +66 -20
  546. package/dist/components/other/Calendar/CalendarCell.js.map +1 -1
  547. package/dist/components/other/Calendar/CalendarGrid.js +90 -40
  548. package/dist/components/other/Calendar/CalendarGrid.js.map +1 -1
  549. package/dist/components/other/Calendar/CalendarHeader.js +80 -17
  550. package/dist/components/other/Calendar/CalendarHeader.js.map +1 -1
  551. package/dist/components/other/Calendar/CalendarPanel.js +568 -144
  552. package/dist/components/other/Calendar/CalendarPanel.js.map +1 -1
  553. package/dist/components/other/Calendar/PeriodCalendar.js +425 -134
  554. package/dist/components/other/Calendar/PeriodCalendar.js.map +1 -1
  555. package/dist/components/other/Calendar/PeriodGrid.js +6 -6
  556. package/dist/components/other/Calendar/PeriodGrid.js.map +1 -1
  557. package/dist/components/other/Calendar/RangeCalendar.js +50 -24
  558. package/dist/components/other/Calendar/RangeCalendar.js.map +1 -1
  559. package/dist/components/other/Calendar/styled.js +1 -1
  560. package/dist/components/other/Calendar/styled.js.map +1 -1
  561. package/dist/components/other/CubeLogo/CubeLogo.js +95 -34
  562. package/dist/components/other/CubeLogo/CubeLogo.js.map +1 -1
  563. package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
  564. package/dist/components/other/NoDataIcon/NoDataIcon.js.map +1 -1
  565. package/dist/components/overlays/AlertDialog/AlertDialog.js +153 -42
  566. package/dist/components/overlays/AlertDialog/AlertDialog.js.map +1 -1
  567. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +76 -54
  568. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js.map +1 -1
  569. package/dist/components/overlays/AlertDialog/AlertDialogZone.js +146 -39
  570. package/dist/components/overlays/AlertDialog/AlertDialogZone.js.map +1 -1
  571. package/dist/components/overlays/Dialog/Dialog.js +26 -10
  572. package/dist/components/overlays/Dialog/Dialog.js.map +1 -1
  573. package/dist/components/overlays/Dialog/DialogContainer.js +13 -13
  574. package/dist/components/overlays/Dialog/DialogContainer.js.map +1 -1
  575. package/dist/components/overlays/Dialog/DialogForm.d.ts +12 -7
  576. package/dist/components/overlays/Dialog/DialogForm.js +18 -7
  577. package/dist/components/overlays/Dialog/DialogForm.js.map +1 -1
  578. package/dist/components/overlays/Dialog/DialogTrigger.d.ts +1 -1
  579. package/dist/components/overlays/Dialog/DialogTrigger.js +214 -59
  580. package/dist/components/overlays/Dialog/DialogTrigger.js.map +1 -1
  581. package/dist/components/overlays/Dialog/ModernDialogForm.js +350 -0
  582. package/dist/components/overlays/Dialog/ModernDialogForm.js.map +1 -0
  583. package/dist/components/overlays/Dialog/context.js +1 -1
  584. package/dist/components/overlays/Dialog/context.js.map +1 -1
  585. package/dist/components/overlays/Dialog/index.d.ts +1 -1
  586. package/dist/components/overlays/Dialog/use-dialog-container.js +6 -6
  587. package/dist/components/overlays/Dialog/use-dialog-container.js.map +1 -1
  588. package/dist/components/overlays/Modal/Modal.js +140 -27
  589. package/dist/components/overlays/Modal/Modal.js.map +1 -1
  590. package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
  591. package/dist/components/overlays/Modal/OpenTransitionContext.js.map +1 -1
  592. package/dist/components/overlays/Modal/Overlay.js +4 -4
  593. package/dist/components/overlays/Modal/Overlay.js.map +1 -1
  594. package/dist/components/overlays/Modal/Popover.js +131 -29
  595. package/dist/components/overlays/Modal/Popover.js.map +1 -1
  596. package/dist/components/overlays/Modal/Tray.js +142 -30
  597. package/dist/components/overlays/Modal/Tray.js.map +1 -1
  598. package/dist/components/overlays/Modal/Underlay.js +36 -7
  599. package/dist/components/overlays/Modal/Underlay.js.map +1 -1
  600. package/dist/components/overlays/Notifications/Notification.js +69 -32
  601. package/dist/components/overlays/Notifications/Notification.js.map +1 -1
  602. package/dist/components/overlays/Notifications/NotificationAction.js +79 -26
  603. package/dist/components/overlays/Notifications/NotificationAction.js.map +1 -1
  604. package/dist/components/overlays/Notifications/NotificationCard.js +138 -33
  605. package/dist/components/overlays/Notifications/NotificationCard.js.map +1 -1
  606. package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
  607. package/dist/components/overlays/Notifications/NotificationContext.js.map +1 -1
  608. package/dist/components/overlays/Notifications/NotificationItem.js +63 -16
  609. package/dist/components/overlays/Notifications/NotificationItem.js.map +1 -1
  610. package/dist/components/overlays/Notifications/OverlayContainer.js +312 -151
  611. package/dist/components/overlays/Notifications/OverlayContainer.js.map +1 -1
  612. package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
  613. package/dist/components/overlays/Notifications/OverlayProvider.js.map +1 -1
  614. package/dist/components/overlays/Notifications/PersistentNotificationsList.js +210 -58
  615. package/dist/components/overlays/Notifications/PersistentNotificationsList.js.map +1 -1
  616. package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
  617. package/dist/components/overlays/Notifications/dismissed-storage.js.map +1 -1
  618. package/dist/components/overlays/Notifications/format-relative-time.d.ts +1 -1
  619. package/dist/components/overlays/Notifications/format-relative-time.js +3 -3
  620. package/dist/components/overlays/Notifications/format-relative-time.js.map +1 -1
  621. package/dist/components/overlays/Notifications/index.js +1 -1
  622. package/dist/components/overlays/Notifications/index.js.map +1 -1
  623. package/dist/components/overlays/Notifications/use-notification-state.js +51 -51
  624. package/dist/components/overlays/Notifications/use-notification-state.js.map +1 -1
  625. package/dist/components/overlays/Notifications/use-notifications.js +12 -12
  626. package/dist/components/overlays/Notifications/use-notifications.js.map +1 -1
  627. package/dist/components/overlays/Notifications/use-overlay-timers.js +10 -10
  628. package/dist/components/overlays/Notifications/use-overlay-timers.js.map +1 -1
  629. package/dist/components/overlays/Notifications/use-persistent-notifications.js +24 -5
  630. package/dist/components/overlays/Notifications/use-persistent-notifications.js.map +1 -1
  631. package/dist/components/overlays/Notifications/use-persistent-state.js +145 -43
  632. package/dist/components/overlays/Notifications/use-persistent-state.js.map +1 -1
  633. package/dist/components/overlays/Notifications/use-toast-state.js +25 -25
  634. package/dist/components/overlays/Notifications/use-toast-state.js.map +1 -1
  635. package/dist/components/overlays/Toast/ToastItem.js +68 -15
  636. package/dist/components/overlays/Toast/ToastItem.js.map +1 -1
  637. package/dist/components/overlays/Toast/index.js +100 -34
  638. package/dist/components/overlays/Toast/index.js.map +1 -1
  639. package/dist/components/overlays/Toast/useProgressToast.js +1 -1
  640. package/dist/components/overlays/Toast/useProgressToast.js.map +1 -1
  641. package/dist/components/overlays/Toast/useToast.js +9 -9
  642. package/dist/components/overlays/Toast/useToast.js.map +1 -1
  643. package/dist/components/overlays/Tooltip/Tooltip.js +88 -31
  644. package/dist/components/overlays/Tooltip/Tooltip.js.map +1 -1
  645. package/dist/components/overlays/Tooltip/TooltipProvider.js +75 -10
  646. package/dist/components/overlays/Tooltip/TooltipProvider.js.map +1 -1
  647. package/dist/components/overlays/Tooltip/TooltipTrigger.js +186 -77
  648. package/dist/components/overlays/Tooltip/TooltipTrigger.js.map +1 -1
  649. package/dist/components/overlays/Tooltip/context.js +1 -1
  650. package/dist/components/overlays/Tooltip/context.js.map +1 -1
  651. package/dist/components/portal/Portal.js +18 -3
  652. package/dist/components/portal/Portal.js.map +1 -1
  653. package/dist/components/portal/PortalProvider.js +11 -2
  654. package/dist/components/portal/PortalProvider.js.map +1 -1
  655. package/dist/components/portal/usePortal.js +1 -1
  656. package/dist/components/portal/usePortal.js.map +1 -1
  657. package/dist/components/shared/DraggableCollection.js +23 -23
  658. package/dist/components/shared/DraggableCollection.js.map +1 -1
  659. package/dist/components/shared/InvalidIcon.js +1 -1
  660. package/dist/components/shared/InvalidIcon.js.map +1 -1
  661. package/dist/components/shared/ValidIcon.js +1 -1
  662. package/dist/components/shared/ValidIcon.js.map +1 -1
  663. package/dist/components/status/LoadingAnimation/LoadingAnimation.js +156 -48
  664. package/dist/components/status/LoadingAnimation/LoadingAnimation.js.map +1 -1
  665. package/dist/components/status/Spin/Cube.js +12 -3
  666. package/dist/components/status/Spin/Cube.js.map +1 -1
  667. package/dist/components/status/Spin/InternalSpinner.js +21 -6
  668. package/dist/components/status/Spin/InternalSpinner.js.map +1 -1
  669. package/dist/components/status/Spin/Spin.js +31 -7
  670. package/dist/components/status/Spin/Spin.js.map +1 -1
  671. package/dist/components/status/Spin/SpinsContainer.js +23 -6
  672. package/dist/components/status/Spin/SpinsContainer.js.map +1 -1
  673. package/dist/data/item-themes.js +1 -1
  674. package/dist/data/item-themes.js.map +1 -1
  675. package/dist/data/themes.js +1 -1
  676. package/dist/data/themes.js.map +1 -1
  677. package/dist/eslint-plugin/defaults.generated.js +15 -5
  678. package/dist/eslint-plugin/defaults.generated.js.map +1 -1
  679. package/dist/eslint-plugin/index.js +1 -1
  680. package/dist/eslint-plugin/index.js.map +1 -1
  681. package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
  682. package/dist/eslint-plugin/rules/no-redundant-default-prop.js.map +1 -1
  683. package/dist/i18n/I18nProvider.js +54 -13
  684. package/dist/i18n/I18nProvider.js.map +1 -1
  685. package/dist/i18n/createFormatter.js +1 -1
  686. package/dist/i18n/createFormatter.js.map +1 -1
  687. package/dist/i18n/index.js +1 -1
  688. package/dist/i18n/index.js.map +1 -1
  689. package/dist/i18n/instance.js +1 -1
  690. package/dist/i18n/instance.js.map +1 -1
  691. package/dist/i18n/locales/de-DE/uikit.js +1 -1
  692. package/dist/i18n/locales/en-US/uikit.js +1 -1
  693. package/dist/i18n/locales/es-ES/uikit.js +1 -1
  694. package/dist/i18n/locales/es-MX/uikit.js +1 -1
  695. package/dist/i18n/locales/fr-FR/uikit.js +1 -1
  696. package/dist/i18n/locales/it-IT/uikit.js +1 -1
  697. package/dist/i18n/locales/ja-JP/uikit.js +1 -1
  698. package/dist/i18n/locales/nb-NO/uikit.js +1 -1
  699. package/dist/i18n/locales/pt-BR/uikit.js +1 -1
  700. package/dist/i18n/locales/pt-PT/uikit.js +1 -1
  701. package/dist/i18n/locales/sv-SE/uikit.js +1 -1
  702. package/dist/i18n/locales/vi-VN/uikit.js +1 -1
  703. package/dist/i18n/locales.js +1 -1
  704. package/dist/i18n/locales.js.map +1 -1
  705. package/dist/i18n/useFormatter.js +10 -3
  706. package/dist/i18n/useFormatter.js.map +1 -1
  707. package/dist/i18n/useI18n.js +1 -1
  708. package/dist/i18n/useI18n.js.map +1 -1
  709. package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
  710. package/dist/icons/AdjustmentsHorizontalIcon.js.map +1 -1
  711. package/dist/icons/AdjustmentsIcon.js +1 -1
  712. package/dist/icons/AdjustmentsIcon.js.map +1 -1
  713. package/dist/icons/AiIcon.js +1 -1
  714. package/dist/icons/AiIcon.js.map +1 -1
  715. package/dist/icons/AreaChartIcon.js +1 -1
  716. package/dist/icons/AreaChartIcon.js.map +1 -1
  717. package/dist/icons/ArrowNarrowDownIcon.js +1 -1
  718. package/dist/icons/ArrowNarrowDownIcon.js.map +1 -1
  719. package/dist/icons/ArrowNarrowUpIcon.js +1 -1
  720. package/dist/icons/ArrowNarrowUpIcon.js.map +1 -1
  721. package/dist/icons/BackwardIcon.js +1 -1
  722. package/dist/icons/BackwardIcon.js.map +1 -1
  723. package/dist/icons/BarChartIcon.js +1 -1
  724. package/dist/icons/BarChartIcon.js.map +1 -1
  725. package/dist/icons/BellFilledIcon.js +1 -1
  726. package/dist/icons/BellFilledIcon.js.map +1 -1
  727. package/dist/icons/BellIcon.js +1 -1
  728. package/dist/icons/BellIcon.js.map +1 -1
  729. package/dist/icons/BooleanIcon.js +1 -1
  730. package/dist/icons/BooleanIcon.js.map +1 -1
  731. package/dist/icons/CalendarEditIcon.js +1 -1
  732. package/dist/icons/CalendarEditIcon.js.map +1 -1
  733. package/dist/icons/CalendarIcon.js +1 -1
  734. package/dist/icons/CalendarIcon.js.map +1 -1
  735. package/dist/icons/CaretDownIcon.js +1 -1
  736. package/dist/icons/CaretDownIcon.js.map +1 -1
  737. package/dist/icons/CaretUpIcon.js +1 -1
  738. package/dist/icons/CaretUpIcon.js.map +1 -1
  739. package/dist/icons/ChartAreaStackedIcon.js +1 -1
  740. package/dist/icons/ChartAreaStackedIcon.js.map +1 -1
  741. package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
  742. package/dist/icons/ChartAreaStackedPercentageIcon.js.map +1 -1
  743. package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
  744. package/dist/icons/ChartBarGroupedHorizontalIcon.js.map +1 -1
  745. package/dist/icons/ChartBarGroupedIcon.js +1 -1
  746. package/dist/icons/ChartBarGroupedIcon.js.map +1 -1
  747. package/dist/icons/ChartBarHorizontalIcon.js +1 -1
  748. package/dist/icons/ChartBarHorizontalIcon.js.map +1 -1
  749. package/dist/icons/ChartBarLineIcon.js +1 -1
  750. package/dist/icons/ChartBarLineIcon.js.map +1 -1
  751. package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
  752. package/dist/icons/ChartBarStackedHorizontalIcon.js.map +1 -1
  753. package/dist/icons/ChartBarStackedIcon.js +1 -1
  754. package/dist/icons/ChartBarStackedIcon.js.map +1 -1
  755. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
  756. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js.map +1 -1
  757. package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
  758. package/dist/icons/ChartBarStackedPercentageIcon.js.map +1 -1
  759. package/dist/icons/ChartBoxPlot2Icon.js +1 -1
  760. package/dist/icons/ChartBoxPlot2Icon.js.map +1 -1
  761. package/dist/icons/ChartBoxPlotIcon.js +1 -1
  762. package/dist/icons/ChartBoxPlotIcon.js.map +1 -1
  763. package/dist/icons/ChartBubbleIcon.js +1 -1
  764. package/dist/icons/ChartBubbleIcon.js.map +1 -1
  765. package/dist/icons/ChartDonut2Icon.js +1 -1
  766. package/dist/icons/ChartDonut2Icon.js.map +1 -1
  767. package/dist/icons/ChartFunnelIcon.js +1 -1
  768. package/dist/icons/ChartFunnelIcon.js.map +1 -1
  769. package/dist/icons/ChartHeatmapIcon.js +1 -1
  770. package/dist/icons/ChartHeatmapIcon.js.map +1 -1
  771. package/dist/icons/ChartKPIIcon.js +1 -1
  772. package/dist/icons/ChartKPIIcon.js.map +1 -1
  773. package/dist/icons/ChartPie2Icon.js +1 -1
  774. package/dist/icons/ChartPie2Icon.js.map +1 -1
  775. package/dist/icons/ChartScatterIcon.js +1 -1
  776. package/dist/icons/ChartScatterIcon.js.map +1 -1
  777. package/dist/icons/CheckCircleFilledIcon.js +1 -1
  778. package/dist/icons/CheckCircleFilledIcon.js.map +1 -1
  779. package/dist/icons/CheckCircleIcon.js +1 -1
  780. package/dist/icons/CheckCircleIcon.js.map +1 -1
  781. package/dist/icons/CheckIcon.js +1 -1
  782. package/dist/icons/CheckIcon.js.map +1 -1
  783. package/dist/icons/CircleFilledIcon.js +1 -1
  784. package/dist/icons/CircleFilledIcon.js.map +1 -1
  785. package/dist/icons/ClearIcon.js +1 -1
  786. package/dist/icons/ClearIcon.js.map +1 -1
  787. package/dist/icons/CloseCircleFilledIcon.js +1 -1
  788. package/dist/icons/CloseCircleFilledIcon.js.map +1 -1
  789. package/dist/icons/CloseCircleIcon.js +1 -1
  790. package/dist/icons/CloseCircleIcon.js.map +1 -1
  791. package/dist/icons/CloseIcon.js +1 -1
  792. package/dist/icons/CloseIcon.js.map +1 -1
  793. package/dist/icons/CodeIcon.js +1 -1
  794. package/dist/icons/CodeIcon.js.map +1 -1
  795. package/dist/icons/ColumnTotalIcon.js +1 -1
  796. package/dist/icons/ColumnTotalIcon.js.map +1 -1
  797. package/dist/icons/CopyIcon.js +1 -1
  798. package/dist/icons/CopyIcon.js.map +1 -1
  799. package/dist/icons/CountIcon.js +1 -1
  800. package/dist/icons/CountIcon.js.map +1 -1
  801. package/dist/icons/CubeIcon.js +1 -1
  802. package/dist/icons/CubeIcon.js.map +1 -1
  803. package/dist/icons/CubePauseIcon.js +1 -1
  804. package/dist/icons/CubePauseIcon.js.map +1 -1
  805. package/dist/icons/CubePlayIcon.js +1 -1
  806. package/dist/icons/CubePlayIcon.js.map +1 -1
  807. package/dist/icons/CurrencyDollarIcon.js +1 -1
  808. package/dist/icons/CurrencyDollarIcon.js.map +1 -1
  809. package/dist/icons/DangerIcon.js +1 -1
  810. package/dist/icons/DangerIcon.js.map +1 -1
  811. package/dist/icons/DashboardIcon.js +1 -1
  812. package/dist/icons/DashboardIcon.js.map +1 -1
  813. package/dist/icons/DatabaseIcon.js +1 -1
  814. package/dist/icons/DatabaseIcon.js.map +1 -1
  815. package/dist/icons/DecimalDecreaseIcon.js +1 -1
  816. package/dist/icons/DecimalDecreaseIcon.js.map +1 -1
  817. package/dist/icons/DecimalIncreaseIcon.js +1 -1
  818. package/dist/icons/DecimalIncreaseIcon.js.map +1 -1
  819. package/dist/icons/DirectionIcon.js +67 -22
  820. package/dist/icons/DirectionIcon.js.map +1 -1
  821. package/dist/icons/DonutIcon.js +1 -1
  822. package/dist/icons/DonutIcon.js.map +1 -1
  823. package/dist/icons/DownIcon.js +1 -1
  824. package/dist/icons/DownIcon.js.map +1 -1
  825. package/dist/icons/EditIcon.js +1 -1
  826. package/dist/icons/EditIcon.js.map +1 -1
  827. package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
  828. package/dist/icons/ExclamationCircleFilledIcon.js.map +1 -1
  829. package/dist/icons/ExclamationCircleIcon.js +1 -1
  830. package/dist/icons/ExclamationCircleIcon.js.map +1 -1
  831. package/dist/icons/ExclamationIcon.js +1 -1
  832. package/dist/icons/ExclamationIcon.js.map +1 -1
  833. package/dist/icons/EyeIcon.js +1 -1
  834. package/dist/icons/EyeIcon.js.map +1 -1
  835. package/dist/icons/EyeInvisibleIcon.js +1 -1
  836. package/dist/icons/EyeInvisibleIcon.js.map +1 -1
  837. package/dist/icons/FilterIcon.js +1 -1
  838. package/dist/icons/FilterIcon.js.map +1 -1
  839. package/dist/icons/FolderFilledIcon.js +1 -1
  840. package/dist/icons/FolderFilledIcon.js.map +1 -1
  841. package/dist/icons/FolderIcon.js +1 -1
  842. package/dist/icons/FolderIcon.js.map +1 -1
  843. package/dist/icons/FolderOpenFilledIcon.js +1 -1
  844. package/dist/icons/FolderOpenFilledIcon.js.map +1 -1
  845. package/dist/icons/FolderOpenIcon.js +1 -1
  846. package/dist/icons/FolderOpenIcon.js.map +1 -1
  847. package/dist/icons/ForwardIcon.js +1 -1
  848. package/dist/icons/ForwardIcon.js.map +1 -1
  849. package/dist/icons/GripVerticalIcon.js +1 -1
  850. package/dist/icons/GripVerticalIcon.js.map +1 -1
  851. package/dist/icons/HierarchyIcon.js +1 -1
  852. package/dist/icons/HierarchyIcon.js.map +1 -1
  853. package/dist/icons/HierarchyOpenIcon.js +1 -1
  854. package/dist/icons/HierarchyOpenIcon.js.map +1 -1
  855. package/dist/icons/Icon.js +60 -16
  856. package/dist/icons/Icon.js.map +1 -1
  857. package/dist/icons/InfoCircleIcon.js +1 -1
  858. package/dist/icons/InfoCircleIcon.js.map +1 -1
  859. package/dist/icons/InfoIcon.js +1 -1
  860. package/dist/icons/InfoIcon.js.map +1 -1
  861. package/dist/icons/KeyIcon.js +1 -1
  862. package/dist/icons/KeyIcon.js.map +1 -1
  863. package/dist/icons/LeftIcon.js +1 -1
  864. package/dist/icons/LeftIcon.js.map +1 -1
  865. package/dist/icons/LineChartIcon.js +1 -1
  866. package/dist/icons/LineChartIcon.js.map +1 -1
  867. package/dist/icons/LoadingIcon.js +1 -1
  868. package/dist/icons/LoadingIcon.js.map +1 -1
  869. package/dist/icons/LockFilledIcon.js +1 -1
  870. package/dist/icons/LockFilledIcon.js.map +1 -1
  871. package/dist/icons/LockIcon.js +1 -1
  872. package/dist/icons/LockIcon.js.map +1 -1
  873. package/dist/icons/MoreIcon.js +1 -1
  874. package/dist/icons/MoreIcon.js.map +1 -1
  875. package/dist/icons/NotAllowedIcon.js +1 -1
  876. package/dist/icons/NotAllowedIcon.js.map +1 -1
  877. package/dist/icons/Number123Icon.js +1 -1
  878. package/dist/icons/Number123Icon.js.map +1 -1
  879. package/dist/icons/NumberIcon.js +1 -1
  880. package/dist/icons/NumberIcon.js.map +1 -1
  881. package/dist/icons/PauseCircleFilledIcon.js +1 -1
  882. package/dist/icons/PauseCircleFilledIcon.js.map +1 -1
  883. package/dist/icons/PauseCircleIcon.js +1 -1
  884. package/dist/icons/PauseCircleIcon.js.map +1 -1
  885. package/dist/icons/PauseIcon.js +1 -1
  886. package/dist/icons/PauseIcon.js.map +1 -1
  887. package/dist/icons/PercentageIcon.js +1 -1
  888. package/dist/icons/PercentageIcon.js.map +1 -1
  889. package/dist/icons/PieChartIcon.js +1 -1
  890. package/dist/icons/PieChartIcon.js.map +1 -1
  891. package/dist/icons/PipetteIcon.js +1 -1
  892. package/dist/icons/PipetteIcon.js.map +1 -1
  893. package/dist/icons/PlayCircleIcon.js +1 -1
  894. package/dist/icons/PlayCircleIcon.js.map +1 -1
  895. package/dist/icons/PlayIcon.js +1 -1
  896. package/dist/icons/PlayIcon.js.map +1 -1
  897. package/dist/icons/PlusIcon.js +1 -1
  898. package/dist/icons/PlusIcon.js.map +1 -1
  899. package/dist/icons/ProgressBarIcon.js +1 -1
  900. package/dist/icons/ProgressBarIcon.js.map +1 -1
  901. package/dist/icons/ReloadIcon.js +1 -1
  902. package/dist/icons/ReloadIcon.js.map +1 -1
  903. package/dist/icons/ReportIcon.js +1 -1
  904. package/dist/icons/ReportIcon.js.map +1 -1
  905. package/dist/icons/ReturnIcon.js +1 -1
  906. package/dist/icons/ReturnIcon.js.map +1 -1
  907. package/dist/icons/RightIcon.js +1 -1
  908. package/dist/icons/RightIcon.js.map +1 -1
  909. package/dist/icons/RowTotalsIcon.js +1 -1
  910. package/dist/icons/RowTotalsIcon.js.map +1 -1
  911. package/dist/icons/SchemeIcon.js +1 -1
  912. package/dist/icons/SchemeIcon.js.map +1 -1
  913. package/dist/icons/SearchIcon.js +1 -1
  914. package/dist/icons/SearchIcon.js.map +1 -1
  915. package/dist/icons/SemanticQueryIcon.js +1 -1
  916. package/dist/icons/SemanticQueryIcon.js.map +1 -1
  917. package/dist/icons/SettingsIcon.js +1 -1
  918. package/dist/icons/SettingsIcon.js.map +1 -1
  919. package/dist/icons/ShieldFilledIcon.js +1 -1
  920. package/dist/icons/ShieldFilledIcon.js.map +1 -1
  921. package/dist/icons/ShieldIcon.js +1 -1
  922. package/dist/icons/ShieldIcon.js.map +1 -1
  923. package/dist/icons/SlashIcon.js +1 -1
  924. package/dist/icons/SlashIcon.js.map +1 -1
  925. package/dist/icons/SparklesIcon.js +1 -1
  926. package/dist/icons/SparklesIcon.js.map +1 -1
  927. package/dist/icons/SqlIcon.js +1 -1
  928. package/dist/icons/SqlIcon.js.map +1 -1
  929. package/dist/icons/StatsIcon.js +1 -1
  930. package/dist/icons/StatsIcon.js.map +1 -1
  931. package/dist/icons/StopIcon.js +1 -1
  932. package/dist/icons/StopIcon.js.map +1 -1
  933. package/dist/icons/StringIcon.js +1 -1
  934. package/dist/icons/StringIcon.js.map +1 -1
  935. package/dist/icons/SubtotalsIcon.js +1 -1
  936. package/dist/icons/SubtotalsIcon.js.map +1 -1
  937. package/dist/icons/SwitchIcon.js +1 -1
  938. package/dist/icons/SwitchIcon.js.map +1 -1
  939. package/dist/icons/TableIcon.js +1 -1
  940. package/dist/icons/TableIcon.js.map +1 -1
  941. package/dist/icons/ThumbsDownIcon.js +1 -1
  942. package/dist/icons/ThumbsDownIcon.js.map +1 -1
  943. package/dist/icons/ThumbsUpIcon.js +1 -1
  944. package/dist/icons/ThumbsUpIcon.js.map +1 -1
  945. package/dist/icons/ThunderboltCrossedIcon.js +1 -1
  946. package/dist/icons/ThunderboltCrossedIcon.js.map +1 -1
  947. package/dist/icons/ThunderboltFilledIcon.js +1 -1
  948. package/dist/icons/ThunderboltFilledIcon.js.map +1 -1
  949. package/dist/icons/ThunderboltIcon.js +1 -1
  950. package/dist/icons/ThunderboltIcon.js.map +1 -1
  951. package/dist/icons/TimeIcon.js +1 -1
  952. package/dist/icons/TimeIcon.js.map +1 -1
  953. package/dist/icons/TrashIcon.js +1 -1
  954. package/dist/icons/TrashIcon.js.map +1 -1
  955. package/dist/icons/UnlockIcon.js +1 -1
  956. package/dist/icons/UnlockIcon.js.map +1 -1
  957. package/dist/icons/UpIcon.js +1 -1
  958. package/dist/icons/UpIcon.js.map +1 -1
  959. package/dist/icons/UserGroupIcon.js +1 -1
  960. package/dist/icons/UserGroupIcon.js.map +1 -1
  961. package/dist/icons/UserIcon.js +1 -1
  962. package/dist/icons/UserIcon.js.map +1 -1
  963. package/dist/icons/UserLockIcon.js +1 -1
  964. package/dist/icons/UserLockIcon.js.map +1 -1
  965. package/dist/icons/ViewIcon.js +1 -1
  966. package/dist/icons/ViewIcon.js.map +1 -1
  967. package/dist/icons/WarningFilledIcon.js +1 -1
  968. package/dist/icons/WarningFilledIcon.js.map +1 -1
  969. package/dist/icons/WarningIcon.js +1 -1
  970. package/dist/icons/WarningIcon.js.map +1 -1
  971. package/dist/icons/wrap-icon.js +15 -7
  972. package/dist/icons/wrap-icon.js.map +1 -1
  973. package/dist/index.d.ts +22 -22
  974. package/dist/index.js +1 -1
  975. package/dist/index.js.map +1 -1
  976. package/dist/probe/canonicalize.js +2 -2
  977. package/dist/probe/canonicalize.js.map +1 -1
  978. package/dist/probe/css.js +1 -1
  979. package/dist/probe/css.js.map +1 -1
  980. package/dist/probe/index.js +1 -1
  981. package/dist/provider.js +17 -7
  982. package/dist/provider.js.map +1 -1
  983. package/dist/providers/TrackingProvider.js +33 -9
  984. package/dist/providers/TrackingProvider.js.map +1 -1
  985. package/dist/providers/navigationAdapter.default.js +1 -1
  986. package/dist/providers/navigationAdapter.default.js.map +1 -1
  987. package/dist/tokens/all-tokens.js +1 -1
  988. package/dist/tokens/all-tokens.js.map +1 -1
  989. package/dist/tokens/base.js +1 -1
  990. package/dist/tokens/base.js.map +1 -1
  991. package/dist/tokens/color-seed.js +1 -1
  992. package/dist/tokens/color-seed.js.map +1 -1
  993. package/dist/tokens/color-theme.js +18 -3
  994. package/dist/tokens/color-theme.js.map +1 -1
  995. package/dist/tokens/colors.js +1 -1
  996. package/dist/tokens/colors.js.map +1 -1
  997. package/dist/tokens/layout.js +1 -1
  998. package/dist/tokens/layout.js.map +1 -1
  999. package/dist/tokens/lazy-styles.js +1 -1
  1000. package/dist/tokens/lazy-styles.js.map +1 -1
  1001. package/dist/tokens/legacy-color.js +1 -1
  1002. package/dist/tokens/legacy-color.js.map +1 -1
  1003. package/dist/tokens/palette-config.js +9 -2
  1004. package/dist/tokens/palette-config.js.map +1 -1
  1005. package/dist/tokens/palette.js +1 -1
  1006. package/dist/tokens/palette.js.map +1 -1
  1007. package/dist/tokens/resolve.js +85 -21
  1008. package/dist/tokens/resolve.js.map +1 -1
  1009. package/dist/tokens/shadows.js +1 -1
  1010. package/dist/tokens/shadows.js.map +1 -1
  1011. package/dist/tokens/sizes.js +1 -1
  1012. package/dist/tokens/sizes.js.map +1 -1
  1013. package/dist/tokens/spacing.js +1 -1
  1014. package/dist/tokens/spacing.js.map +1 -1
  1015. package/dist/tokens/typography.js +1 -1
  1016. package/dist/tokens/typography.js.map +1 -1
  1017. package/dist/utils/ResizeSensor.js +1 -1
  1018. package/dist/utils/ResizeSensor.js.map +1 -1
  1019. package/dist/utils/colors.js +1 -1
  1020. package/dist/utils/colors.js.map +1 -1
  1021. package/dist/utils/dotize.js +1 -1
  1022. package/dist/utils/dotize.js.map +1 -1
  1023. package/dist/utils/is-dev-env.js +1 -1
  1024. package/dist/utils/is-dev-env.js.map +1 -1
  1025. package/dist/utils/modules.js +1 -1
  1026. package/dist/utils/modules.js.map +1 -1
  1027. package/dist/utils/promise.js +1 -1
  1028. package/dist/utils/promise.js.map +1 -1
  1029. package/dist/utils/raf.js +1 -1
  1030. package/dist/utils/raf.js.map +1 -1
  1031. package/dist/utils/random.js +1 -1
  1032. package/dist/utils/random.js.map +1 -1
  1033. package/dist/utils/range.js +1 -1
  1034. package/dist/utils/range.js.map +1 -1
  1035. package/dist/utils/react/RenderCache.js +2 -2
  1036. package/dist/utils/react/RenderCache.js.map +1 -1
  1037. package/dist/utils/react/Slots.js +67 -24
  1038. package/dist/utils/react/Slots.js.map +1 -1
  1039. package/dist/utils/react/chain.js +1 -1
  1040. package/dist/utils/react/chain.js.map +1 -1
  1041. package/dist/utils/react/disabledProps.js +1 -1
  1042. package/dist/utils/react/disabledProps.js.map +1 -1
  1043. package/dist/utils/react/escapePropagation.js +1 -1
  1044. package/dist/utils/react/escapePropagation.js.map +1 -1
  1045. package/dist/utils/react/forwardRefWithGenerics.js +1 -1
  1046. package/dist/utils/react/forwardRefWithGenerics.js.map +1 -1
  1047. package/dist/utils/react/index.js +1 -1
  1048. package/dist/utils/react/interactions.js +35 -12
  1049. package/dist/utils/react/interactions.js.map +1 -1
  1050. package/dist/utils/react/isTextOnly.js +1 -1
  1051. package/dist/utils/react/isTextOnly.js.map +1 -1
  1052. package/dist/utils/react/mapProps.js +1 -1
  1053. package/dist/utils/react/mapProps.js.map +1 -1
  1054. package/dist/utils/react/mergeProps.js +1 -1
  1055. package/dist/utils/react/mergeProps.js.map +1 -1
  1056. package/dist/utils/react/nullableValue.js +1 -1
  1057. package/dist/utils/react/nullableValue.js.map +1 -1
  1058. package/dist/utils/react/programmaticFocus.js +1 -1
  1059. package/dist/utils/react/programmaticFocus.js.map +1 -1
  1060. package/dist/utils/react/resolveIcon.js +1 -1
  1061. package/dist/utils/react/resolveIcon.js.map +1 -1
  1062. package/dist/utils/react/sharedStore.js +13 -2
  1063. package/dist/utils/react/sharedStore.js.map +1 -1
  1064. package/dist/utils/react/useBufferedValue.js +5 -5
  1065. package/dist/utils/react/useBufferedValue.js.map +1 -1
  1066. package/dist/utils/react/useCombinedRefs.js +20 -5
  1067. package/dist/utils/react/useCombinedRefs.js.map +1 -1
  1068. package/dist/utils/react/useControlledFocusVisible.js +53 -17
  1069. package/dist/utils/react/useControlledFocusVisible.js.map +1 -1
  1070. package/dist/utils/react/useEventBus.js +43 -18
  1071. package/dist/utils/react/useEventBus.js.map +1 -1
  1072. package/dist/utils/react/useId.js +2 -1
  1073. package/dist/utils/react/useId.js.map +1 -1
  1074. package/dist/utils/react/useIsDarwin.js +29 -16
  1075. package/dist/utils/react/useIsDarwin.js.map +1 -1
  1076. package/dist/utils/react/useKeySymbols.js +23 -9
  1077. package/dist/utils/react/useKeySymbols.js.map +1 -1
  1078. package/dist/utils/react/useLayoutEffect.js +1 -1
  1079. package/dist/utils/react/useLayoutEffect.js.map +1 -1
  1080. package/dist/utils/react/useLocalStorage.js +75 -30
  1081. package/dist/utils/react/useLocalStorage.js.map +1 -1
  1082. package/dist/utils/react/useMergeStyles.js +1 -1
  1083. package/dist/utils/react/useMergeStyles.js.map +1 -1
  1084. package/dist/utils/react/useOverlayEscapeGuard.js +25 -9
  1085. package/dist/utils/react/useOverlayEscapeGuard.js.map +1 -1
  1086. package/dist/utils/react/usePopoverSync.js +175 -73
  1087. package/dist/utils/react/usePopoverSync.js.map +1 -1
  1088. package/dist/utils/react/useQaProps.js +1 -1
  1089. package/dist/utils/react/useQaProps.js.map +1 -1
  1090. package/dist/utils/react/useScheme.js +1 -1
  1091. package/dist/utils/react/useScheme.js.map +1 -1
  1092. package/dist/utils/react/useViewportSize.js +43 -19
  1093. package/dist/utils/react/useViewportSize.js.map +1 -1
  1094. package/dist/utils/react/wrapNodeIfPlain.js +1 -1
  1095. package/dist/utils/react/wrapNodeIfPlain.js.map +1 -1
  1096. package/dist/utils/selection.js +1 -1
  1097. package/dist/utils/selection.js.map +1 -1
  1098. package/dist/utils/styles.js +1 -1
  1099. package/dist/utils/styles.js.map +1 -1
  1100. package/dist/utils/tree.js +1 -1
  1101. package/dist/utils/tree.js.map +1 -1
  1102. package/dist/utils/warnings.js +1 -1
  1103. package/dist/utils/warnings.js.map +1 -1
  1104. package/dist/version.js +2 -2
  1105. package/dist/version.js.map +1 -1
  1106. package/docs/Usage.md +9 -1
  1107. package/docs/components/content/InlineInput.md +1 -1
  1108. package/docs/components/fields/ColorInput.md +13 -8
  1109. package/docs/components/fields/ColorPicker.md +13 -8
  1110. package/docs/components/fields/ComboBox.md +16 -12
  1111. package/docs/components/fields/FilterListBox.md +24 -19
  1112. package/docs/components/fields/FilterPicker.md +24 -19
  1113. package/docs/components/fields/ListBox.md +36 -26
  1114. package/docs/components/fields/Picker.md +27 -21
  1115. package/docs/components/fields/Select.md +16 -12
  1116. package/docs/components/form/Field.md +2 -2
  1117. package/docs/components/form/Form.md +60 -579
  1118. package/docs/components/form/ModernForm.md +22 -1
  1119. package/docs/components/overlays/DialogForm.md +121 -263
  1120. package/docs/components/overlays/DialogTrigger.md +1 -1
  1121. package/docs/components/overlays/UseDialogContainer.md +11 -13
  1122. package/docs/modern-form-guide.md +22 -1
  1123. package/docs/modern-form-migration.md +1 -1
  1124. package/package.json +7 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.js","names":["useFocus","Item","BaseSection"],"sources":["../../../../src/components/fields/ComboBox/ComboBox.tsx"],"sourcesContent":["import { FocusableRef, Key } from '@react-types/shared';\nimport {\n BASE_STYLES,\n BasePropsWithoutChildren,\n BaseStyleProps,\n COLOR_STYLES,\n ColorStyleProps,\n OUTER_STYLES,\n OuterStyleProps,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport React, {\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useKeyboard } from 'react-aria';\nimport { Section as BaseSection, useListState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal';\nimport { useI18n } from '../../../i18n';\nimport { CloseIcon } from '../../../icons/CloseIcon';\nimport { DirectionIcon } from '../../../icons/DirectionIcon';\nimport { LoadingIcon } from '../../../icons/LoadingIcon';\nimport { FieldBaseProps } from '../../../shared';\nimport { generateRandomId } from '../../../utils/random';\nimport { useCombinedRefs, useLayoutEffect } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { usePopoverSync } from '../../../utils/react/usePopoverSync';\nimport { extractStyles } from '../../../utils/styles';\nimport { CollectionItem as Item } from '../../CollectionItem';\nimport {\n getValidationIcon,\n getValidationMods,\n useFieldProps,\n wrapWithField,\n} from '../../form';\nimport {\n filterCollectionNodes,\n getEdgeVisibleKey,\n getNextVisibleKey,\n ListBoxPopover,\n markKeyboardFocus,\n useCompositeFocus,\n} from '../ListBoxPopover';\nimport {\n DEFAULT_INPUT_STYLES,\n INPUT_WRAPPER_STYLES,\n} from '../TextInput/TextInputBase';\n\ntype FilterFn = (textValue: string, inputValue: string) => boolean;\n\nexport type PopoverTriggerAction = 'focus' | 'input' | 'manual';\n\nconst ComboBoxWrapperElement = tasty({\n qa: 'ComboBoxWrapper',\n styles: INPUT_WRAPPER_STYLES,\n});\n\nconst InputElement = tasty({\n as: 'input',\n styles: DEFAULT_INPUT_STYLES,\n});\n\nexport interface CubeComboBoxProps<T>\n extends BasePropsWithoutChildren,\n BaseStyleProps,\n OuterStyleProps,\n ColorStyleProps,\n FieldBaseProps<string | null | undefined> {\n /** The selected key in controlled mode */\n selectedKey?: string | null;\n /** The default selected key in uncontrolled mode */\n defaultSelectedKey?: string | null;\n /** Callback fired when selection changes */\n onSelectionChange?: (key: string | null) => void;\n\n /** The input value in controlled mode */\n inputValue?: string;\n /** The default input value in uncontrolled mode */\n defaultInputValue?: string;\n /** Callback fired when input value changes */\n onInputChange?: (value: string) => void;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the input should have autofocus */\n autoFocus?: boolean;\n /** HTML autocomplete attribute for the input */\n autoComplete?: string;\n /** Callback fired when focus enters the component (input, trigger, or popover). Does not receive event object. */\n onFocus?: () => void;\n /** Callback fired when focus leaves the component entirely. Does not receive event object. */\n onBlur?: () => void;\n /** Callback fired when a key is pressed on the input */\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /** Popover trigger behavior: 'focus', 'input', or 'manual'. Defaults to 'input' */\n popoverTrigger?: PopoverTriggerAction;\n\n /** Items for the listbox (alternative to children) */\n items?: Iterable<T>;\n /** Children for the listbox (static items or render function) */\n children?: ReactNode | ((item: T) => ReactElement);\n\n /**\n * Custom filter function for determining if an option should be included.\n * Pass `false` to disable internal filtering completely.\n */\n filter?: FilterFn | false;\n\n /** Whether to allow entering custom values that are not in the predefined options */\n allowsCustomValue?: boolean;\n /** Whether to commit custom value on blur in allowsCustomValue mode (default: true) */\n shouldCommitOnBlur?: boolean;\n /** Whether to clear selection and input on blur (default: false, only applies to non-custom-value mode) */\n clearOnBlur?: boolean;\n /** Whether the combobox is clearable using ESC key or clear button */\n isClearable?: boolean;\n /** Callback called when the clear button is pressed */\n onClear?: () => void;\n\n /** Left input icon */\n icon?: ReactElement;\n /** Input decoration before the main input */\n prefix?: ReactNode;\n /** Input decoration after the main input */\n suffix?: ReactNode;\n /** Whether to hide the trigger button */\n hideTrigger?: boolean;\n /** Size of the combobox */\n size?: 'small' | 'medium' | 'large' | (string & {});\n\n /** Ref for accessing the input element */\n inputRef?: RefObject<HTMLInputElement>;\n /** Ref for accessing the wrapper element */\n wrapperRef?: RefObject<HTMLDivElement>;\n /** Ref for accessing the listbox element */\n listBoxRef?: RefObject<HTMLDivElement>;\n /** Ref for accessing the popover element */\n popoverRef?: RefObject<HTMLDivElement>;\n /** Ref for accessing the trigger button element */\n triggerRef?: FocusableRef<HTMLButtonElement>;\n\n /** Custom styles for the input */\n inputStyles?: Styles;\n /** Custom styles for the trigger button */\n triggerStyles?: Styles;\n /** Custom styles for the listbox */\n listBoxStyles?: Styles;\n /** Custom styles for the popover overlay */\n overlayStyles?: Styles;\n /** Custom styles for individual options */\n optionStyles?: Styles;\n /** Custom styles for sections */\n sectionStyles?: Styles;\n /** Custom styles for section headings */\n headingStyles?: Styles;\n\n /** Whether the combobox is disabled */\n isDisabled?: boolean;\n /** Whether the combobox is in loading state */\n isLoading?: boolean;\n /** Keys of disabled items */\n disabledKeys?: Iterable<Key>;\n /** Whether to flip the popover placement */\n shouldFlip?: boolean;\n /** Placement direction for the popover */\n direction?: 'bottom' | 'top';\n /** Offset for the popover */\n overlayOffset?: number;\n /** Minimum padding in pixels between the popover and viewport edges */\n containerPadding?: number;\n /** Whether the combobox is read-only */\n isReadOnly?: boolean;\n /** Suffix position goes before or after the validation and loading statuses */\n suffixPosition?: 'before' | 'after';\n /**\n * Sort selected item to the top when the popover opens.\n * Only works when using the `items` prop (data-driven mode).\n * Ignored when using JSX children.\n * @default true when items are provided, false when using JSX children\n */\n sortSelectedToTop?: boolean;\n /** Callback called when the popover open state changes */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nconst PROP_STYLES = [...BASE_STYLES, ...OUTER_STYLES, ...COLOR_STYLES];\n\n// ============================================================================\n// Hook: useComboBoxState\n// ============================================================================\ninterface UseComboBoxStateProps {\n selectedKey?: string | null;\n defaultSelectedKey?: string | null;\n inputValue?: string;\n defaultInputValue?: string;\n comboBoxId: string;\n triggerRef?: RefObject<HTMLElement | null>;\n popoverRef?: RefObject<HTMLElement | null>;\n}\n\ninterface UseComboBoxStateReturn {\n effectiveSelectedKey: Key | null;\n effectiveInputValue: string;\n isPopoverOpen: boolean;\n setIsPopoverOpen: (open: boolean) => void;\n setInternalSelectedKey: (key: Key | null) => void;\n setInternalInputValue: (value: string) => void;\n isControlledKey: boolean;\n isControlledInput: boolean;\n}\n\nfunction useComboBoxState({\n selectedKey,\n defaultSelectedKey,\n inputValue,\n defaultInputValue,\n comboBoxId,\n triggerRef,\n popoverRef,\n}: UseComboBoxStateProps): UseComboBoxStateReturn {\n // Internal state for uncontrolled mode\n const [internalSelectedKey, setInternalSelectedKey] = useState<Key | null>(\n defaultSelectedKey ?? null,\n );\n const [internalInputValue, setInternalInputValue] = useState(\n defaultInputValue ?? '',\n );\n\n const isControlledKey = selectedKey !== undefined;\n const isControlledInput = inputValue !== undefined;\n\n const effectiveSelectedKey = isControlledKey\n ? selectedKey\n : internalSelectedKey;\n const effectiveInputValue = isControlledInput\n ? inputValue\n : internalInputValue;\n\n // Popover state\n const [isPopoverOpen, setIsPopoverOpen] = useState(false);\n\n usePopoverSync({\n menuId: comboBoxId,\n isOpen: isPopoverOpen,\n onClose: () => setIsPopoverOpen(false),\n triggerRef,\n containerRef: popoverRef,\n });\n\n return {\n effectiveSelectedKey,\n effectiveInputValue,\n isPopoverOpen,\n setIsPopoverOpen,\n setInternalSelectedKey,\n setInternalInputValue,\n isControlledKey,\n isControlledInput,\n };\n}\n\n// ============================================================================\n// Hook: useComboBoxFiltering\n// ============================================================================\ninterface UseComboBoxFilteringProps {\n effectiveInputValue: string;\n filter: FilterFn | false | undefined;\n}\n\ninterface UseComboBoxFilteringReturn {\n filterFn: (nodes: Iterable<any>) => Iterable<any>;\n isFilterActive: boolean;\n setIsFilterActive: (active: boolean) => void;\n}\n\nfunction useComboBoxFiltering({\n effectiveInputValue,\n filter,\n}: UseComboBoxFilteringProps): UseComboBoxFilteringReturn {\n const [isFilterActive, setIsFilterActive] = useState(false);\n\n const { contains } = useFilter({ sensitivity: 'base' });\n\n const textFilterFn = useMemo<FilterFn>(\n () => (filter === false ? () => true : filter || contains),\n [filter, contains],\n );\n\n // Create a filter function for collection nodes\n const filterFn = useCallback(\n (nodes: Iterable<any>) => {\n const term = effectiveInputValue.trim();\n\n // Don't filter if not active or no search term\n if (!isFilterActive || !term) {\n return nodes;\n }\n\n return filterCollectionNodes(nodes, term, textFilterFn);\n },\n [isFilterActive, effectiveInputValue, textFilterFn],\n );\n\n return {\n filterFn,\n isFilterActive,\n setIsFilterActive,\n };\n}\n\n// ============================================================================\n// Hook: useComboBoxKeyboard\n// ============================================================================\ninterface UseComboBoxKeyboardProps {\n isPopoverOpen: boolean;\n listStateRef: RefObject<any>;\n hasResults: boolean;\n allowsCustomValue?: boolean;\n effectiveInputValue: string;\n isClearable?: boolean;\n onSelectionChange: (selection: Key | Key[] | null) => void;\n onClearValue: () => void;\n onOpenPopover: () => void;\n onClosePopover: () => void;\n inputRef: RefObject<HTMLInputElement>;\n setIsFilterActive: (active: boolean) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n}\n\nfunction useComboBoxKeyboard({\n isPopoverOpen,\n listStateRef,\n hasResults,\n allowsCustomValue,\n effectiveInputValue,\n isClearable,\n onSelectionChange,\n onClearValue,\n onOpenPopover,\n onClosePopover,\n inputRef,\n setIsFilterActive,\n onKeyDown,\n}: UseComboBoxKeyboardProps) {\n const { keyboardProps } = useKeyboard({\n onKeyDown: (e) => {\n // Call user's handler first\n onKeyDown?.(e as React.KeyboardEvent<HTMLInputElement>);\n\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n\n // Open popover if closed\n if (!isPopoverOpen) {\n // If opening with no filtered results, disable filter to show all items\n if (!hasResults) {\n setIsFilterActive(false);\n }\n onOpenPopover();\n return;\n }\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const isArrowDown = e.key === 'ArrowDown';\n const nextKey = getNextVisibleKey(listState, isArrowDown ? 1 : -1);\n\n if (nextKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(nextKey);\n }\n } else if (e.key === 'Enter') {\n // If popover is open, try to select the focused item first\n if (isPopoverOpen) {\n const listState = listStateRef.current;\n if (listState) {\n const keyToSelect = listState.selectionManager.focusedKey;\n\n if (keyToSelect != null) {\n e.preventDefault();\n listState.selectionManager.select(keyToSelect, e);\n // Ensure the popover closes even if selection stays the same\n onClosePopover();\n inputRef.current?.focus();\n return;\n }\n }\n }\n\n // If no results, handle empty input or custom values\n if (!hasResults) {\n if (allowsCustomValue) {\n const value = effectiveInputValue.trim();\n\n // Commit the custom value\n onSelectionChange(\n (value as unknown as Key) ?? (null as unknown as Key),\n );\n\n // If popover is closed and we have a value, allow Enter to propagate for form submission\n // If popover is open OR value is empty, prevent default to avoid premature submission\n if (isPopoverOpen || !value) {\n e.preventDefault();\n }\n } else {\n e.preventDefault();\n onSelectionChange(null);\n }\n\n return;\n }\n\n // Clear selection if input is empty and popover is closed (or no focused item)\n const trimmed = (effectiveInputValue || '').trim();\n if (trimmed === '') {\n e.preventDefault();\n onSelectionChange(null);\n return;\n }\n } else if (e.key === 'Escape') {\n if (isPopoverOpen) {\n e.preventDefault();\n onClosePopover();\n inputRef.current?.focus();\n } else if (effectiveInputValue && isClearable) {\n e.preventDefault();\n onClearValue();\n }\n } else if (e.key === 'Home' || e.key === 'End') {\n if (isPopoverOpen) {\n e.preventDefault();\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const targetKey = getEdgeVisibleKey(\n listState,\n e.key === 'Home' ? 'first' : 'last',\n );\n\n if (targetKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(targetKey);\n }\n }\n }\n },\n });\n\n return { keyboardProps };\n}\n\n// ============================================================================\n// Component: ComboBoxInput\n// ============================================================================\ninterface ComboBoxInputProps {\n qa?: string;\n inputRef: RefObject<HTMLInputElement>;\n id?: string;\n value: string;\n placeholder?: string;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n isRequired?: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n size: string;\n mods: Record<string, any>;\n inputStyles?: Styles;\n keyboardProps: any;\n focusProps: any;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n onFocus: (e: React.FocusEvent<HTMLInputElement>) => void;\n isPopoverOpen: boolean;\n hasResults: boolean;\n comboBoxId: string;\n listStateRef: RefObject<any>;\n}\n\nconst ComboBoxInput = forwardRef<HTMLInputElement, ComboBoxInputProps>(\n function ComboBoxInput(\n {\n qa,\n inputRef,\n id,\n value,\n placeholder,\n isDisabled,\n isReadOnly,\n isRequired,\n autoFocus,\n autoComplete,\n size,\n mods,\n inputStyles,\n keyboardProps,\n focusProps,\n onChange,\n onFocus,\n isPopoverOpen,\n hasResults,\n comboBoxId,\n listStateRef,\n },\n ref,\n ) {\n const combinedRef = useCombinedRefs(ref, inputRef);\n\n return (\n <InputElement\n ref={combinedRef}\n qa={qa}\n id={id}\n type=\"text\"\n value={value}\n placeholder={placeholder}\n isDisabled={isDisabled}\n readOnly={isReadOnly}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n data-autofocus={autoFocus ? '' : undefined}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={focusProps.onBlur}\n {...keyboardProps}\n styles={inputStyles}\n mods={mods}\n data-size={size}\n data-input-type=\"combobox\"\n role=\"combobox\"\n // `ComboBox` builds its own trigger rather than going through a\n // react-aria field hook, so nothing else would announce that the field\n // is mandatory — the label marker alone is not exposed to assistive\n // technology.\n aria-required={isRequired || undefined}\n aria-expanded={isPopoverOpen && hasResults}\n aria-haspopup=\"listbox\"\n aria-controls={\n isPopoverOpen && hasResults\n ? `ComboBoxListBox-${comboBoxId}`\n : undefined\n }\n aria-activedescendant={\n isPopoverOpen &&\n hasResults &&\n listStateRef.current?.selectionManager.focusedKey != null\n ? `ListBoxItem-${listStateRef.current?.selectionManager.focusedKey}`\n : undefined\n }\n />\n );\n },\n);\n\n// ============================================================================\n// Main Component: ComboBox\n// ============================================================================\nexport const ComboBox = forwardRef(function ComboBox<T extends object>(\n props: CubeComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n props = useFieldProps(props, {\n valuePropsMapper: ({ value, onChange }) => {\n return {\n // Form value maps to selectedKey (the committed value) in both modes\n selectedKey: value ?? null,\n onSelectionChange(val: string | null) {\n // Commit selection changes to the form\n onChange(val);\n },\n };\n },\n });\n\n const { t } = useI18n();\n\n let {\n qa,\n label,\n extra,\n labelStyles,\n isRequired,\n necessityIndicator,\n isInvalid,\n isValid,\n id,\n icon,\n prefix,\n isDisabled,\n autoFocus,\n autoComplete = 'off',\n wrapperRef,\n inputRef,\n triggerRef,\n popoverRef,\n listBoxRef,\n isLoading,\n inputStyles,\n optionStyles,\n triggerStyles,\n listBoxStyles,\n overlayStyles,\n suffix,\n hideTrigger,\n message,\n description,\n size = 'medium',\n direction = 'bottom',\n shouldFlip = true,\n popoverTrigger = 'input',\n suffixPosition = 'before',\n filter,\n styles,\n labelSuffix,\n selectedKey,\n defaultSelectedKey,\n inputValue,\n defaultInputValue,\n onInputChange,\n isClearable,\n onClear,\n placeholder,\n allowsCustomValue,\n shouldCommitOnBlur = true,\n clearOnBlur,\n items,\n children: renderChildren,\n sectionStyles,\n headingStyles,\n isReadOnly,\n overlayOffset = 8,\n containerPadding = 8,\n onSelectionChange: externalOnSelectionChange,\n sortSelectedToTop: sortSelectedToTopProp,\n onOpenChange,\n onFocus,\n onBlur,\n onKeyDown,\n form,\n ...otherProps\n } = props;\n\n // Generate a unique ID for this combobox instance\n const comboBoxId = useMemo(() => generateRandomId(), []);\n\n // Hoist the wrapper/popover ref normalization above `useComboBoxState` so\n // the popover-sync inside it sees stable, attached refs. Other ref combines\n // happen below alongside the legacy ordering.\n wrapperRef = useCombinedRefs(wrapperRef);\n popoverRef = useCombinedRefs(popoverRef);\n\n // State management hook\n const {\n effectiveSelectedKey,\n effectiveInputValue,\n isPopoverOpen,\n setIsPopoverOpen,\n setInternalSelectedKey,\n setInternalInputValue,\n isControlledKey,\n isControlledInput,\n } = useComboBoxState({\n selectedKey,\n defaultSelectedKey,\n inputValue,\n defaultInputValue,\n comboBoxId,\n triggerRef: wrapperRef as RefObject<HTMLElement | null>,\n popoverRef: popoverRef as RefObject<HTMLElement | null>,\n });\n\n // Track if sortSelectedToTop was explicitly provided\n const sortSelectedToTopExplicit = sortSelectedToTopProp !== undefined;\n // Default to true if items are provided, false otherwise\n const sortSelectedToTop = sortSelectedToTopProp ?? (items ? true : false);\n\n // Cache for sorted items array when using `items` prop\n const cachedItemsOrder = useRef<T[] | null>(null);\n const selectionWhenClosed = useRef<string | null>(null);\n\n styles = extractStyles(otherProps, PROP_STYLES, styles);\n\n ref = useCombinedRefs(ref);\n inputRef = useCombinedRefs(inputRef);\n triggerRef = useCombinedRefs(triggerRef);\n listBoxRef = useCombinedRefs(listBoxRef);\n\n // Sort items with selected on top if enabled\n const getSortedItems = useCallback((): typeof items => {\n if (!items) return items;\n\n if (!sortSelectedToTop) return items;\n\n // Reuse cached order if available\n if (cachedItemsOrder.current) {\n return cachedItemsOrder.current;\n }\n\n // Warn if explicitly requested but not supported\n if (sortSelectedToTopExplicit && !items) {\n console.warn(\n 'ComboBox: sortSelectedToTop only works with the items prop. ' +\n 'Sorting will be skipped when using JSX children.',\n );\n return items;\n }\n\n const selectedKey = isPopoverOpen\n ? effectiveSelectedKey\n : selectionWhenClosed.current;\n\n if (!selectedKey) return items;\n\n const itemsArray = Array.isArray(items) ? items : Array.from(items);\n const selectedItem = itemsArray.find((item) => {\n const key = (item as any)?.key ?? (item as any)?.id;\n return key != null && String(key) === String(selectedKey);\n });\n\n if (!selectedItem) return items;\n\n const sorted = [\n selectedItem,\n ...itemsArray.filter((item) => {\n const key = (item as any)?.key ?? (item as any)?.id;\n return key == null || String(key) !== String(selectedKey);\n }),\n ] as T[];\n\n if (isPopoverOpen) {\n cachedItemsOrder.current = sorted;\n }\n\n return sorted;\n }, [\n items,\n sortSelectedToTop,\n sortSelectedToTopExplicit,\n effectiveSelectedKey,\n isPopoverOpen,\n ]);\n\n const sortedItems = getSortedItems();\n\n // Preserve the original `children` (may be a render function) before we\n // potentially overwrite it.\n let children: ReactNode = renderChildren as ReactNode;\n\n const renderFn = renderChildren as unknown;\n\n if (sortedItems && typeof renderFn === 'function') {\n try {\n const itemsArray = Array.from(sortedItems as Iterable<any>);\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n if (\n React.isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return React.cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n\n return rendered as ReactNode;\n });\n } catch {\n // If conversion fails, proceed with the original children\n }\n }\n\n // Invalidate cached sorting whenever items change\n useEffect(() => {\n cachedItemsOrder.current = null;\n }, [items]);\n\n // Capture selection when popover closes\n useEffect(() => {\n if (!isPopoverOpen) {\n selectionWhenClosed.current =\n effectiveSelectedKey != null ? String(effectiveSelectedKey) : null;\n cachedItemsOrder.current = null;\n }\n }, [isPopoverOpen, effectiveSelectedKey]);\n\n // Call onOpenChange when popover state changes\n useEffect(() => {\n onOpenChange?.(isPopoverOpen);\n }, [isPopoverOpen]);\n\n // Filtering hook\n const { filterFn, isFilterActive, setIsFilterActive } = useComboBoxFiltering({\n effectiveInputValue,\n filter,\n });\n\n // Create local collection state for reading item data (labels, etc.)\n // This allows us to read item labels even before the popover opens\n const localCollectionState = useListState({\n children,\n items: sortedItems,\n selectionMode: 'none', // Don't manage selection in this state\n });\n\n const { isFocused, focusProps } = useFocus({ isDisabled });\n\n // Helper to check if current input value is valid\n const checkInputValidity = useCallback(() => {\n if (!effectiveInputValue.trim()) {\n return { isInputValid: false, singleMatchKey: null, filteredCount: 0 };\n }\n\n // Get filtered collection based on current input\n const filteredNodes = filterFn(localCollectionState.collection);\n const filteredItems: Array<{ key: Key; textValue: string }> = [];\n\n // Flatten filtered nodes (handle sections)\n for (const node of filteredNodes) {\n if (node.type === 'section' && node.childNodes) {\n for (const child of node.childNodes) {\n if (child.type === 'item') {\n filteredItems.push({\n key: child.key,\n textValue: child.textValue || '',\n });\n }\n }\n } else if (node.type === 'item') {\n filteredItems.push({\n key: node.key,\n textValue: node.textValue || '',\n });\n }\n }\n\n const filteredCount = filteredItems.length;\n\n // Check for exact match\n const exactMatch = filteredItems.find(\n (item) =>\n item.textValue.toLowerCase() ===\n effectiveInputValue.trim().toLowerCase(),\n );\n\n if (exactMatch) {\n return {\n isInputValid: true,\n singleMatchKey: exactMatch.key,\n filteredCount,\n };\n }\n\n // If exactly one filtered result, consider it valid\n if (filteredCount === 1) {\n return {\n isInputValid: true,\n singleMatchKey: filteredItems[0].key,\n filteredCount,\n };\n }\n\n return { isInputValid: false, singleMatchKey: null, filteredCount };\n }, [effectiveInputValue, filterFn, localCollectionState.collection]);\n\n // Composite blur handler - fires when focus leaves the entire component\n const handleCompositeBlur = useEvent(() => {\n // NOTE: Do NOT disable filter yet; we need it active for validity check\n\n // In allowsCustomValue mode\n if (allowsCustomValue) {\n // Commit the input value if it's non-empty and nothing is selected\n if (\n shouldCommitOnBlur &&\n effectiveInputValue &&\n effectiveSelectedKey == null\n ) {\n externalOnSelectionChange?.(effectiveInputValue as string);\n if (!isControlledKey) {\n setInternalSelectedKey(effectiveInputValue as Key);\n }\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n\n // Clear selection if input is empty\n if (!String(effectiveInputValue).trim()) {\n externalOnSelectionChange?.(null);\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n }\n\n // In non-custom-value mode, validate input and handle accordingly\n if (!allowsCustomValue) {\n const { isInputValid, singleMatchKey } = checkInputValidity();\n\n // If there's exactly one filtered result, auto-select it\n if (\n isInputValid &&\n singleMatchKey != null &&\n singleMatchKey !== effectiveSelectedKey\n ) {\n const label = getItemLabel(singleMatchKey);\n\n if (!isControlledKey) {\n setInternalSelectedKey(singleMatchKey);\n }\n if (!isControlledInput) {\n setInternalInputValue(label);\n }\n onInputChange?.(label);\n externalOnSelectionChange?.(singleMatchKey as string | null);\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n\n // If input is invalid (no exact match, not a single result)\n if (!isInputValid) {\n const trimmedInput = effectiveInputValue.trim();\n\n // Clear if clearOnBlur is set or input is empty\n if (clearOnBlur || !trimmedInput) {\n externalOnSelectionChange?.(null);\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n\n // Reset input to current selected value (or empty if none)\n const nextValue =\n effectiveSelectedKey != null\n ? getItemLabel(effectiveSelectedKey)\n : '';\n\n if (!isControlledInput) {\n setInternalInputValue(nextValue);\n }\n onInputChange?.(nextValue);\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n }\n\n // Fallback: Reset input to show current selection (or empty if none)\n const nextValue =\n effectiveSelectedKey != null ? getItemLabel(effectiveSelectedKey) : '';\n\n if (!isControlledInput) {\n setInternalInputValue(nextValue);\n }\n onInputChange?.(nextValue);\n onBlur?.();\n setIsFilterActive(false);\n });\n\n // Composite focus hook - handles focus tracking across wrapper and portaled popover\n const { compositeFocusProps } = useCompositeFocus({\n wrapperRef,\n popoverRef,\n onFocus,\n onBlur: handleCompositeBlur,\n isDisabled,\n });\n\n let validationIcon = getValidationIcon({ isInvalid, isValid });\n\n // Ref to access internal ListBox state\n const listStateRef = useRef<any>(null);\n const focusInitAttemptsRef = useRef(0);\n\n // Helper to get label from local collection\n const getItemLabel = useCallback(\n (key: Key): string => {\n const item = localCollectionState?.collection?.getItem(key);\n return item?.textValue || String(key);\n },\n [localCollectionState?.collection],\n );\n\n // Selection change handler\n const handleSelectionChange = useEvent((selection: Key | Key[] | null) => {\n // Extract single key from selection (we only support single selection)\n const key = Array.isArray(selection) ? selection[0] : selection;\n\n // Update selected key\n if (!isControlledKey) {\n setInternalSelectedKey(key ?? null);\n }\n\n // Update input value to show selected item label\n if (key != null) {\n setIsFilterActive(false);\n\n const label = getItemLabel(key);\n\n if (!isControlledInput) {\n setInternalInputValue(label);\n }\n onInputChange?.(label);\n } else {\n // Clear input when selection is cleared\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n setIsFilterActive(false);\n }\n\n externalOnSelectionChange?.(key as string | null);\n\n // Close popover after selection\n setIsPopoverOpen(false);\n\n // Focus input\n setTimeout(() => {\n inputRef.current?.focus();\n }, 0);\n });\n\n const lastSyncedSelectedKey = useRef<Key | null | undefined>(undefined);\n const selectionClearedByTyping = useRef(false);\n\n // Input change handler\n const handleInputChange = useEvent(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n\n // Update input value\n if (!isControlledInput) {\n setInternalInputValue(value);\n }\n onInputChange?.(value);\n\n const trimmed = value.trim();\n setIsFilterActive(trimmed.length > 0);\n\n // Only clear selection in allowsCustomValue mode\n // In normal mode, typing just filters - selection stays until explicitly changed\n if (allowsCustomValue && effectiveSelectedKey != null) {\n selectionClearedByTyping.current = true;\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n externalOnSelectionChange?.(null);\n }\n\n // Open popover based on trigger\n if (popoverTrigger !== 'manual' && value && !isPopoverOpen) {\n setIsPopoverOpen(true);\n }\n },\n );\n\n // Initialize input value from defaultInputValue or defaultSelectedKey (uncontrolled mode only, one-time)\n const [hasInitialized, setHasInitialized] = useState(false);\n\n useEffect(() => {\n // Only initialize once, in uncontrolled input mode\n if (hasInitialized || isControlledInput) return;\n\n // Priority 1: defaultInputValue takes precedence\n if (defaultInputValue !== undefined) {\n setInternalInputValue(defaultInputValue);\n setHasInitialized(true);\n return;\n }\n\n // Priority 2: fall back to defaultSelectedKey's label\n if (defaultSelectedKey) {\n const label = getItemLabel(defaultSelectedKey);\n\n setInternalInputValue(label);\n setHasInitialized(true);\n }\n }, [\n hasInitialized,\n isControlledInput,\n defaultInputValue,\n defaultSelectedKey,\n getItemLabel,\n children,\n ]);\n\n // Sync input value with controlled selectedKey\n useEffect(() => {\n const preserveTypedInput = selectionClearedByTyping.current;\n selectionClearedByTyping.current = false;\n // Only run when selectedKey is controlled but inputValue is uncontrolled\n if (!isControlledKey || isControlledInput) return;\n\n // Skip if the key hasn't actually changed (prevents unnecessary resets when collection rebuilds)\n if (\n lastSyncedSelectedKey.current !== undefined &&\n lastSyncedSelectedKey.current === effectiveSelectedKey\n ) {\n return;\n }\n\n lastSyncedSelectedKey.current = effectiveSelectedKey;\n\n // Acknowledging the selection cleared by this edit must not erase the\n // text that caused it. Later external clears still reset the input.\n if (preserveTypedInput && effectiveSelectedKey == null) return;\n\n // Get the expected label for the current selection\n const expectedLabel =\n effectiveSelectedKey != null ? getItemLabel(effectiveSelectedKey) : '';\n\n // Update the input value to match the selected key's label\n setInternalInputValue(expectedLabel);\n }, [\n isControlledKey,\n isControlledInput,\n effectiveSelectedKey,\n effectiveInputValue,\n getItemLabel,\n ]);\n\n // Input focus handler\n const handleInputFocus = useEvent((e: React.FocusEvent<HTMLInputElement>) => {\n // Call focus props handler if it exists\n focusProps.onFocus?.(e as any);\n\n if (popoverTrigger === 'focus' && !isPopoverOpen) {\n setIsPopoverOpen(true);\n }\n });\n\n // Input blur handler - just handles internal focus props\n const handleInputBlur = useEvent((e: React.FocusEvent<HTMLInputElement>) => {\n focusProps.onBlur?.(e as any);\n });\n\n // Clear button logic\n let hasValue = allowsCustomValue\n ? effectiveInputValue !== ''\n : effectiveSelectedKey != null;\n let showClearButton = isClearable && hasValue && !isDisabled && !isReadOnly;\n\n // Check if there are any results after filtering\n const hasResults = useMemo(() => {\n if (!children) return false;\n if (!Array.isArray(children) && children === null) return false;\n\n // If we have a collection, check if filtering will produce any results\n if (localCollectionState?.collection) {\n const filteredNodes = filterFn(localCollectionState.collection);\n const resultArray = Array.from(filteredNodes).flatMap((node: any) => {\n if (node.type === 'section' && node.childNodes) {\n return [...node.childNodes];\n }\n\n return [node];\n });\n return resultArray.length > 0;\n }\n\n // Fallback: check if children exists\n return Array.isArray(children) ? children.length > 0 : true;\n }, [children, localCollectionState?.collection, filterFn]);\n\n // Clear function\n let clearValue = useEvent(() => {\n // Clear input\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n\n // Clear selection\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n externalOnSelectionChange?.(null);\n\n // Close popover\n if (isPopoverOpen) {\n setIsPopoverOpen(false);\n }\n\n // Focus input\n inputRef.current?.focus();\n\n onClear?.();\n });\n\n // Keyboard navigation hook\n const { keyboardProps } = useComboBoxKeyboard({\n isPopoverOpen,\n listStateRef,\n hasResults,\n allowsCustomValue,\n effectiveInputValue,\n isClearable,\n onSelectionChange: handleSelectionChange,\n onClearValue: clearValue,\n onOpenPopover: () => setIsPopoverOpen(true),\n onClosePopover: () => setIsPopoverOpen(false),\n inputRef,\n setIsFilterActive,\n onKeyDown,\n });\n\n if (icon) {\n icon = <div data-element=\"InputIcon\">{icon}</div>;\n\n if (prefix) {\n prefix = (\n <>\n {icon}\n {prefix}\n </>\n );\n } else {\n prefix = icon;\n }\n }\n\n let mods = useMemo(\n () => ({\n ...getValidationMods({ isInvalid, isValid }),\n disabled: isDisabled,\n hovered: false,\n focused: isFocused,\n loading: isLoading,\n prefix: !!prefix,\n suffix: true,\n clearable: showClearButton,\n }),\n [\n isInvalid,\n isValid,\n isDisabled,\n isFocused,\n isLoading,\n prefix,\n showClearButton,\n ],\n );\n\n const comboBoxWidth = wrapperRef?.current?.offsetWidth;\n\n const shouldShowPopover = Boolean(isPopoverOpen && hasResults);\n\n // Close popover if no results\n useEffect(() => {\n if (isPopoverOpen && !hasResults) {\n setIsPopoverOpen(false);\n }\n }, [isPopoverOpen, hasResults]);\n\n const ensureInitialFocus = useCallback(() => {\n if (!shouldShowPopover) return;\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const { selectionManager, collection, disabledKeys, lastFocusSourceRef } =\n listState;\n if (!selectionManager || !collection) return;\n\n const collectFirstKey = (): Key | null => {\n for (const node of collection) {\n if (node.type === 'item') {\n if (!disabledKeys?.has(node.key)) return node.key;\n } else if (node.childNodes) {\n for (const child of node.childNodes) {\n if (child.type === 'item' && !disabledKeys?.has(child.key)) {\n return child.key;\n }\n }\n }\n }\n return null;\n };\n\n if (lastFocusSourceRef) lastFocusSourceRef.current = 'keyboard';\n\n // Check if we need to set or update focus\n const currentFocusedKey = selectionManager.focusedKey;\n let needsRefocus = false;\n\n if (currentFocusedKey == null) {\n // No focus at all - need to set initial focus\n needsRefocus = true;\n } else {\n // Check if currently focused key still exists in the collection\n const focusedItemExists = collection.getItem(currentFocusedKey) != null;\n if (!focusedItemExists) {\n // Focused item was filtered out - need to refocus\n needsRefocus = true;\n }\n }\n\n if (needsRefocus) {\n let keyToFocus: Key | null = null;\n\n // First try to focus on the selected key if it exists in the collection\n if (\n effectiveSelectedKey != null &&\n collection.getItem(effectiveSelectedKey) != null\n ) {\n keyToFocus = effectiveSelectedKey;\n } else {\n // Fall back to the first key in the collection\n keyToFocus = collectFirstKey();\n }\n\n if (keyToFocus != null) {\n selectionManager.setFocusedKey(keyToFocus);\n }\n }\n }, [shouldShowPopover, effectiveSelectedKey]);\n\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n focusInitAttemptsRef.current = 0;\n\n const tick = () => {\n if (!shouldShowPopover) return;\n ensureInitialFocus();\n focusInitAttemptsRef.current += 1;\n // Try a few frames to wait for collection to mount\n if (\n focusInitAttemptsRef.current < 8 &&\n listStateRef.current?.selectionManager?.focusedKey == null\n ) {\n requestAnimationFrame(tick);\n }\n };\n\n requestAnimationFrame(() => requestAnimationFrame(tick));\n }, [shouldShowPopover, ensureInitialFocus]);\n\n const comboBoxField = (\n <ComboBoxWrapperElement\n ref={wrapperRef}\n mods={mods}\n styles={styles}\n style={{\n zIndex: isFocused ? 1 : 'initial',\n }}\n data-size={size}\n {...compositeFocusProps}\n >\n {prefix ? <div data-element=\"Prefix\">{prefix}</div> : null}\n <ComboBoxInput\n qa={qa || 'ComboBox'}\n inputRef={inputRef}\n id={id}\n value={effectiveInputValue}\n placeholder={placeholder}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n size={size}\n mods={mods}\n inputStyles={inputStyles}\n keyboardProps={keyboardProps}\n focusProps={{ ...focusProps, onBlur: handleInputBlur }}\n isPopoverOpen={isPopoverOpen}\n hasResults={hasResults}\n comboBoxId={comboBoxId}\n listStateRef={listStateRef}\n onChange={handleInputChange}\n onFocus={handleInputFocus}\n />\n <div data-element=\"Suffix\">\n {suffixPosition === 'before' ? suffix : null}\n {isLoading ? <LoadingIcon data-element=\"InputIcon\" /> : validationIcon}\n {suffixPosition === 'after' ? suffix : null}\n {showClearButton && (\n <Item.Action\n icon={<CloseIcon />}\n size={size}\n // No `theme` — the default `current` type inherits the input's own\n // text color, which is already validation-tinted, so the button\n // matches the text beside it exactly instead of using the fixed\n // `danger.clear` palette.\n qa=\"ComboBoxClearButton\"\n data-no-trigger={hideTrigger ? '' : undefined}\n data-popover-dismiss=\"\"\n aria-label={t('comboBox.clearValue', 'Clear value')}\n onPress={clearValue}\n />\n )}\n {!hideTrigger ? (\n <Item.Action\n ref={triggerRef}\n data-popover-trigger\n icon={<DirectionIcon to={isPopoverOpen ? 'up' : 'down'} />}\n qa=\"ComboBoxTrigger\"\n mods={{\n pressed: isPopoverOpen,\n disabled: isDisabled,\n loading: isLoading,\n }}\n data-size={size}\n isDisabled={isDisabled}\n styles={triggerStyles}\n aria-expanded={isPopoverOpen}\n aria-haspopup=\"listbox\"\n aria-label={t('comboBox.showOptions', 'Show options')}\n onPress={() => {\n if (!isDisabled) {\n const willOpen = !isPopoverOpen;\n setIsPopoverOpen(willOpen);\n if (willOpen) {\n inputRef.current?.focus();\n // If opening with no filtered results, disable filter to show all items\n if (!hasResults) {\n setIsFilterActive(false);\n }\n }\n }\n }}\n />\n ) : null}\n </div>\n <ListBoxPopover\n isOpen={shouldShowPopover}\n triggerRef={wrapperRef as RefObject<HTMLElement>}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n direction={direction}\n shouldFlip={shouldFlip}\n overlayOffset={overlayOffset}\n containerPadding={containerPadding}\n comboBoxWidth={comboBoxWidth}\n listBoxId={`ComboBoxListBox-${comboBoxId}`}\n overlayStyles={overlayStyles}\n listBoxStyles={listBoxStyles}\n optionStyles={optionStyles}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n selectedKey={effectiveSelectedKey}\n isDisabled={isDisabled}\n disabledKeys={props.disabledKeys}\n items={sortedItems}\n listStateRef={listStateRef}\n label={label}\n ariaLabel={(props as any)['aria-label']}\n compositeFocusProps={compositeFocusProps}\n filter={filterFn}\n size={size}\n onSelectionChange={handleSelectionChange}\n onClose={() => setIsPopoverOpen(false)}\n >\n {children}\n </ListBoxPopover>\n </ComboBoxWrapperElement>\n );\n\n const { children: _, ...propsWithoutChildren } = props;\n\n return wrapWithField<Omit<CubeComboBoxProps<T>, 'children'>>(\n comboBoxField,\n ref,\n propsWithoutChildren,\n );\n}) as unknown as (<T>(\n props: CubeComboBoxProps<T> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReactElement) & { Item: typeof Item; Section: typeof BaseSection };\n\nComboBox.Item = Item;\n\nComboBox.Section = BaseSection;\n\nObject.defineProperty(ComboBox, 'cubeInputType', {\n value: 'ComboBox',\n enumerable: false,\n configurable: false,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAM,yBAAyB,MAAM;CACnC,IAAI;CACJ,QAAQ;CACT,CAAC;AAEF,MAAM,eAAe,MAAM;CACzB,IAAI;CACJ,QAAQ;CACT,CAAC;AA6HF,MAAM,cAAc;CAAC,GAAG;CAAa,GAAG;CAAc,GAAG;CAAa;AA0BtE,SAAS,iBAAiB,EACxB,aACA,oBACA,YACA,mBACA,YACA,YACA,cACgD;CAEhD,MAA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YACA,WACA,cACA,MACA,MACA,aACA,eACA,YACA,UACA,SACA,eACA,YACA,YACA,gBAEF,KACA;AAGA,QACE,oBAAC;EACC,KAJgB,gBAAgB,KAAK,SAAS;EAK1C;EACA;EACJ,MAAK;EACE;EACM;EACD;EACZ,UAAU;EACC;EACG;EACd,kBAAgB,YAAY,KAAK;EACvB;EACD;EACT,QAAQ,WAAW;EACnB,GAAI;EACJ,QAAQ;EACF;EACN,aAAW;EACX,mBAAgB;EAChB,MAAK;EAKL,iBAAe,cAAc;EAC7B,iBAAe,iBAAiB;EAChC,iBAAc;EACd,iBACE,iBAAiB,aACb,mBAAmB,eACnB;EAEN,yBACE,iBACA,cACA,aAAa,SAAS,iBAAiB,cAAc,OACjD,eAAe,aAAa,SAAS,iBAAiB,eACtD;GAEN;EAGP;AAKD,MAAa,WAAW,WAAW,SAAS,SAC1C,OACA,KACA;AACA,SAAQ,cAAc,OAAO,EAC3B,mBAAmB,EAAE,OAAO,eAAe;AACzC,SAAO;GAEL,aAAa,SAAS;GACtB,kBAAkB,KAAoB;AAEpC,aAAS,IAAI;;GAEhB;IAEJ,CAAC;CAEF,MAAM,EAAE,MAAM,SAAS;CAEvB,IAAI,EACF,IACA,OACA,OACA,aACA,YACA,oBACA,WACA,SACA,IACA,MACA,QACA,YACA,WACA,eAAe,OACf,YACA,UACA,YACA,YACA,YACA,WACA,aACA,cACA,eACA,eACA,eACA,QACA,aACA,SACA,aACA,OAAO,UACP,YAAY,UACZ,aAAa,MACb,iBAAiB,SACjB,iBAAiB,UACjB,QACA,QACA,aACA,aACA,oBACA,YACA,mBACA,eACA,aACA,SACA,aACA,mBACA,qBAAqB,MACrB,aACA,OACA,UAAU,gBACV,eACA,eACA,YACA,gBAAgB,GAChB,mBAAmB,GACnB,mBAAmB,2BACnB,mBAAmB,uBACnB,cACA,SACA,QACA,WACA,MACA,GAAG,eACD;CAGJ,MAAM,aAAa,cAAc,kBAAkB,EAAE,EAAE,CAAC;AAKxD,cAAa,gBAAg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;IACpB,OAAO;IACO;IACP;IACP,WAAY,MAAc;IACL;IACrB,QAAQ;IACF;IACN,mBAAmB;IACnB,eAAe,iBAAiB,MAAM;IAErC;KACc;;GACM;CAG3B,MAAM,EAAE,UAAU,GAAG,GAAG,yBAAyB;AAEjD,QAAO,cACL,eACA,KACA,qBACD;EACD;AAIF,SAAS,OAAOA;AAEhB,SAAS,UAAUC;AAEnB,OAAO,eAAe,UAAU,iBAAiB;CAC/C,OAAO;CACP,YAAY;CACZ,cAAc;CACf,CAAC"}
1
+ {"version":3,"file":"ComboBox.js","names":["FocusableRef","Key","BASE_STYLES","BasePropsWithoutChildren","BaseStyleProps","COLOR_STYLES","ColorStyleProps","OUTER_STYLES","OuterStyleProps","Styles","tasty","React","ForwardedRef","forwardRef","ReactElement","ReactNode","RefObject","useCallback","useEffect","useMemo","useRef","useState","useFilter","useKeyboard","Section","BaseSection","useListState","useEvent","useI18n","CloseIcon","DirectionIcon","LoadingIcon","FieldBaseProps","generateRandomId","useCombinedRefs","useLayoutEffect","useFocus","usePopoverSync","extractStyles","CollectionItem","Item","getValidationIcon","getValidationMods","useFieldProps","wrapWithField","filterCollectionNodes","getEdgeVisibleKey","getNextVisibleKey","ListBoxPopover","markKeyboardFocus","useCompositeFocus","DEFAULT_INPUT_STYLES","INPUT_WRAPPER_STYLES","FilterFn","textValue","inputValue","PopoverTriggerAction","ComboBoxWrapperElement","qa","styles","InputElement","as","CubeComboBoxProps","selectedKey","defaultSelectedKey","onSelectionChange","key","defaultInputValue","onInputChange","value","placeholder","autoFocus","autoComplete","onFocus","onBlur","onKeyDown","e","KeyboardEvent","HTMLInputElement","popoverTrigger","items","Iterable","T","children","item","filter","allowsCustomValue","shouldCommitOnBlur","clearOnBlur","isClearable","onClear","icon","prefix","suffix","hideTrigger","size","inputRef","wrapperRef","HTMLDivElement","listBoxRef","popoverRef","triggerRef","HTMLButtonElement","inputStyles","triggerStyles","listBoxStyles","overlayStyles","optionStyles","sectionStyles","headingStyles","isDisabled","isLoading","disabledKeys","shouldFlip","direction","overlayOffset","containerPadding","isReadOnly","suffixPosition","sortSelectedToTop","onOpenChange","isOpen","PROP_STYLES","UseComboBoxStateProps","comboBoxId","HTMLElement","UseComboBoxStateReturn","effectiveSelectedKey","effectiveInputValue","isPopoverOpen","setIsPopoverOpen","open","setInternalSelectedKey","setInternalInputValue","isControlledKey","isControlledInput","useComboBoxState","t0","$","_c","internalSelectedKey","internalInputValue","undefined","t1","Symbol","for","t2","menuId","onClose","containerRef","t3","UseComboBoxFilteringProps","UseComboBoxFilteringReturn","filterFn","nodes","isFilterActive","setIsFilterActive","active","useComboBoxFiltering","sensitivity","contains","_temp","textFilterFn","term","trim","t4","UseComboBoxKeyboardProps","listStateRef","hasResults","selection","onClearValue","onOpenPopover","onClosePopover","useComboBoxKeyboard","preventDefault","listState","current","isArrowDown","nextKey","selectionManager","setFocusedKey","listState_0","keyToSelect","focusedKey","select","focus","trimmed","listState_1","targetKey","keyboardProps","ComboBoxInputProps","id","isRequired","mods","Record","focusProps","onChange","ChangeEvent","FocusEvent","ComboBoxInput","ref","combinedRef","ComboBox","props","valuePropsMapper","val","t","label","extra","labelStyles","necessityIndicator","isInvalid","isValid","message","description","labelSuffix","renderChildren","externalOnSelectionChange","sortSelectedToTopProp","form","otherProps","sortSelectedToTopExplicit","cachedItemsOrder","selectionWhenClosed","getSortedItems","console","warn","itemsArray","Array","isArray","from","selectedItem","find","String","sorted","sortedItems","renderFn","map","idx","rendered","it","isValidElement","cloneElement","localCollectionState","selectionMode","isFocused","checkInputValidity","isInputValid","singleMatchKey","filteredCount","filteredNodes","collection","filteredItems","node","type","childNodes","child","push","length","exactMatch","toLowerCase","handleCompositeBlur","getItemLabel","trimmedInput","nextValue","compositeFocusProps","validationIcon","focusInitAttemptsRef","getItem","handleSelectionChange","setTimeout","lastSyncedSelectedKey","selectionClearedByTyping","handleInputChange","target","hasInitialized","setHasInitialized","preserveTypedInput","expectedLabel","handleInputFocus","handleInputBlur","hasValue","showClearButton","resultArray","flatMap","clearValue","disabled","hovered","focused","loading","clearable","comboBoxWidth","offsetWidth","shouldShowPopover","Boolean","ensureInitialFocus","lastFocusSourceRef","collectFirstKey","has","currentFocusedKey","needsRefocus","focusedItemExists","keyToFocus","tick","requestAnimationFrame","comboBoxField","zIndex","pressed","willOpen","_","propsWithoutChildren","Omit","Object","defineProperty","enumerable","configurable"],"sources":["../../../../src/components/fields/ComboBox/ComboBox.tsx"],"sourcesContent":["import { FocusableRef, Key } from '@react-types/shared';\nimport {\n BASE_STYLES,\n BasePropsWithoutChildren,\n BaseStyleProps,\n COLOR_STYLES,\n ColorStyleProps,\n OUTER_STYLES,\n OuterStyleProps,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport React, {\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useKeyboard } from 'react-aria';\nimport { Section as BaseSection, useListState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal';\nimport { useI18n } from '../../../i18n';\nimport { CloseIcon } from '../../../icons/CloseIcon';\nimport { DirectionIcon } from '../../../icons/DirectionIcon';\nimport { LoadingIcon } from '../../../icons/LoadingIcon';\nimport { FieldBaseProps } from '../../../shared';\nimport { generateRandomId } from '../../../utils/random';\nimport { useCombinedRefs, useLayoutEffect } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { usePopoverSync } from '../../../utils/react/usePopoverSync';\nimport { extractStyles } from '../../../utils/styles';\nimport { CollectionItem as Item } from '../../CollectionItem';\nimport {\n getValidationIcon,\n getValidationMods,\n useFieldProps,\n wrapWithField,\n} from '../../form';\nimport {\n filterCollectionNodes,\n getEdgeVisibleKey,\n getNextVisibleKey,\n ListBoxPopover,\n markKeyboardFocus,\n useCompositeFocus,\n} from '../ListBoxPopover';\nimport {\n DEFAULT_INPUT_STYLES,\n INPUT_WRAPPER_STYLES,\n} from '../TextInput/TextInputBase';\n\ntype FilterFn = (textValue: string, inputValue: string) => boolean;\n\nexport type PopoverTriggerAction = 'focus' | 'input' | 'manual';\n\nconst ComboBoxWrapperElement = tasty({\n qa: 'ComboBoxWrapper',\n styles: INPUT_WRAPPER_STYLES,\n});\n\nconst InputElement = tasty({\n as: 'input',\n styles: DEFAULT_INPUT_STYLES,\n});\n\nexport interface CubeComboBoxProps<T>\n extends BasePropsWithoutChildren,\n BaseStyleProps,\n OuterStyleProps,\n ColorStyleProps,\n FieldBaseProps<string | null | undefined> {\n /** The selected key in controlled mode */\n selectedKey?: string | null;\n /** The default selected key in uncontrolled mode */\n defaultSelectedKey?: string | null;\n /** Callback fired when selection changes */\n onSelectionChange?: (key: string | null) => void;\n\n /** The input value in controlled mode */\n inputValue?: string;\n /** The default input value in uncontrolled mode */\n defaultInputValue?: string;\n /** Callback fired when input value changes */\n onInputChange?: (value: string) => void;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the input should have autofocus */\n autoFocus?: boolean;\n /** HTML autocomplete attribute for the input */\n autoComplete?: string;\n /** Callback fired when focus enters the component (input, trigger, or popover). Does not receive event object. */\n onFocus?: () => void;\n /** Callback fired when focus leaves the component entirely. Does not receive event object. */\n onBlur?: () => void;\n /** Callback fired when a key is pressed on the input */\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /** Popover trigger behavior: 'focus', 'input', or 'manual'. Defaults to 'input' */\n popoverTrigger?: PopoverTriggerAction;\n\n /** Items for the listbox (alternative to children) */\n items?: Iterable<T>;\n /** Children for the listbox (static items or render function) */\n children?: ReactNode | ((item: T) => ReactElement);\n\n /**\n * Custom filter function for determining if an option should be included.\n * Pass `false` to disable internal filtering completely.\n */\n filter?: FilterFn | false;\n\n /** Whether to allow entering custom values that are not in the predefined options */\n allowsCustomValue?: boolean;\n /** Whether to commit custom value on blur in allowsCustomValue mode (default: true) */\n shouldCommitOnBlur?: boolean;\n /** Whether to clear selection and input on blur (default: false, only applies to non-custom-value mode) */\n clearOnBlur?: boolean;\n /** Whether the combobox is clearable using ESC key or clear button */\n isClearable?: boolean;\n /** Callback called when the clear button is pressed */\n onClear?: () => void;\n\n /** Left input icon */\n icon?: ReactElement;\n /** Input decoration before the main input */\n prefix?: ReactNode;\n /** Input decoration after the main input */\n suffix?: ReactNode;\n /** Whether to hide the trigger button */\n hideTrigger?: boolean;\n /** Size of the combobox */\n size?: 'small' | 'medium' | 'large' | (string & {});\n\n /** Ref for accessing the input element */\n inputRef?: RefObject<HTMLInputElement>;\n /** Ref for accessing the wrapper element */\n wrapperRef?: RefObject<HTMLDivElement>;\n /** Ref for accessing the listbox element */\n listBoxRef?: RefObject<HTMLDivElement>;\n /** Ref for accessing the popover element */\n popoverRef?: RefObject<HTMLDivElement>;\n /** Ref for accessing the trigger button element */\n triggerRef?: FocusableRef<HTMLButtonElement>;\n\n /** Custom styles for the input */\n inputStyles?: Styles;\n /** Custom styles for the trigger button */\n triggerStyles?: Styles;\n /** Custom styles for the listbox */\n listBoxStyles?: Styles;\n /** Custom styles for the popover overlay */\n overlayStyles?: Styles;\n /** Custom styles for individual options */\n optionStyles?: Styles;\n /** Custom styles for sections */\n sectionStyles?: Styles;\n /** Custom styles for section headings */\n headingStyles?: Styles;\n\n /** Whether the combobox is disabled */\n isDisabled?: boolean;\n /** Whether the combobox is in loading state */\n isLoading?: boolean;\n /** Keys of disabled items */\n disabledKeys?: Iterable<Key>;\n /** Whether to flip the popover placement */\n shouldFlip?: boolean;\n /** Placement direction for the popover */\n direction?: 'bottom' | 'top';\n /** Offset for the popover */\n overlayOffset?: number;\n /** Minimum padding in pixels between the popover and viewport edges */\n containerPadding?: number;\n /** Whether the combobox is read-only */\n isReadOnly?: boolean;\n /** Suffix position goes before or after the validation and loading statuses */\n suffixPosition?: 'before' | 'after';\n /**\n * Sort selected item to the top when the popover opens.\n * Only works when using the `items` prop (data-driven mode).\n * Ignored when using JSX children.\n * @default true when items are provided, false when using JSX children\n */\n sortSelectedToTop?: boolean;\n /** Callback called when the popover open state changes */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nconst PROP_STYLES = [...BASE_STYLES, ...OUTER_STYLES, ...COLOR_STYLES];\n\n// ============================================================================\n// Hook: useComboBoxState\n// ============================================================================\ninterface UseComboBoxStateProps {\n selectedKey?: string | null;\n defaultSelectedKey?: string | null;\n inputValue?: string;\n defaultInputValue?: string;\n comboBoxId: string;\n triggerRef?: RefObject<HTMLElement | null>;\n popoverRef?: RefObject<HTMLElement | null>;\n}\n\ninterface UseComboBoxStateReturn {\n effectiveSelectedKey: Key | null;\n effectiveInputValue: string;\n isPopoverOpen: boolean;\n setIsPopoverOpen: (open: boolean) => void;\n setInternalSelectedKey: (key: Key | null) => void;\n setInternalInputValue: (value: string) => void;\n isControlledKey: boolean;\n isControlledInput: boolean;\n}\n\nfunction useComboBoxState({\n selectedKey,\n defaultSelectedKey,\n inputValue,\n defaultInputValue,\n comboBoxId,\n triggerRef,\n popoverRef,\n}: UseComboBoxStateProps): UseComboBoxStateReturn {\n // Internal state for uncontrolled mode\n const [internalSelectedKey, setInternalSelectedKey] = useState<Key | null>(\n defaultSelectedKey ?? null,\n );\n const [internalInputValue, setInternalInputValue] = useState(\n defaultInputValue ?? '',\n );\n\n const isControlledKey = selectedKey !== undefined;\n const isControlledInput = inputValue !== undefined;\n\n const effectiveSelectedKey = isControlledKey\n ? selectedKey\n : internalSelectedKey;\n const effectiveInputValue = isControlledInput\n ? inputValue\n : internalInputValue;\n\n // Popover state\n const [isPopoverOpen, setIsPopoverOpen] = useState(false);\n\n usePopoverSync({\n menuId: comboBoxId,\n isOpen: isPopoverOpen,\n onClose: () => setIsPopoverOpen(false),\n triggerRef,\n containerRef: popoverRef,\n });\n\n return {\n effectiveSelectedKey,\n effectiveInputValue,\n isPopoverOpen,\n setIsPopoverOpen,\n setInternalSelectedKey,\n setInternalInputValue,\n isControlledKey,\n isControlledInput,\n };\n}\n\n// ============================================================================\n// Hook: useComboBoxFiltering\n// ============================================================================\ninterface UseComboBoxFilteringProps {\n effectiveInputValue: string;\n filter: FilterFn | false | undefined;\n}\n\ninterface UseComboBoxFilteringReturn {\n filterFn: (nodes: Iterable<any>) => Iterable<any>;\n isFilterActive: boolean;\n setIsFilterActive: (active: boolean) => void;\n}\n\nfunction useComboBoxFiltering({\n effectiveInputValue,\n filter,\n}: UseComboBoxFilteringProps): UseComboBoxFilteringReturn {\n const [isFilterActive, setIsFilterActive] = useState(false);\n\n const { contains } = useFilter({ sensitivity: 'base' });\n\n const textFilterFn = useMemo<FilterFn>(\n () => (filter === false ? () => true : filter || contains),\n [filter, contains],\n );\n\n // Create a filter function for collection nodes\n const filterFn = useCallback(\n (nodes: Iterable<any>) => {\n const term = effectiveInputValue.trim();\n\n // Don't filter if not active or no search term\n if (!isFilterActive || !term) {\n return nodes;\n }\n\n return filterCollectionNodes(nodes, term, textFilterFn);\n },\n [isFilterActive, effectiveInputValue, textFilterFn],\n );\n\n return {\n filterFn,\n isFilterActive,\n setIsFilterActive,\n };\n}\n\n// ============================================================================\n// Hook: useComboBoxKeyboard\n// ============================================================================\ninterface UseComboBoxKeyboardProps {\n isPopoverOpen: boolean;\n listStateRef: RefObject<any>;\n hasResults: boolean;\n allowsCustomValue?: boolean;\n effectiveInputValue: string;\n isClearable?: boolean;\n onSelectionChange: (selection: Key | Key[] | null) => void;\n onClearValue: () => void;\n onOpenPopover: () => void;\n onClosePopover: () => void;\n inputRef: RefObject<HTMLInputElement>;\n setIsFilterActive: (active: boolean) => void;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n}\n\nfunction useComboBoxKeyboard({\n isPopoverOpen,\n listStateRef,\n hasResults,\n allowsCustomValue,\n effectiveInputValue,\n isClearable,\n onSelectionChange,\n onClearValue,\n onOpenPopover,\n onClosePopover,\n inputRef,\n setIsFilterActive,\n onKeyDown,\n}: UseComboBoxKeyboardProps) {\n const { keyboardProps } = useKeyboard({\n onKeyDown: (e) => {\n // Call user's handler first\n onKeyDown?.(e as React.KeyboardEvent<HTMLInputElement>);\n\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n\n // Open popover if closed\n if (!isPopoverOpen) {\n // If opening with no filtered results, disable filter to show all items\n if (!hasResults) {\n setIsFilterActive(false);\n }\n onOpenPopover();\n return;\n }\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const isArrowDown = e.key === 'ArrowDown';\n const nextKey = getNextVisibleKey(listState, isArrowDown ? 1 : -1);\n\n if (nextKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(nextKey);\n }\n } else if (e.key === 'Enter') {\n // If popover is open, try to select the focused item first\n if (isPopoverOpen) {\n const listState = listStateRef.current;\n if (listState) {\n const keyToSelect = listState.selectionManager.focusedKey;\n\n if (keyToSelect != null) {\n e.preventDefault();\n listState.selectionManager.select(keyToSelect, e);\n // Ensure the popover closes even if selection stays the same\n onClosePopover();\n inputRef.current?.focus();\n return;\n }\n }\n }\n\n // If no results, handle empty input or custom values\n if (!hasResults) {\n if (allowsCustomValue) {\n const value = effectiveInputValue.trim();\n\n // Commit the custom value\n onSelectionChange(\n (value as unknown as Key) ?? (null as unknown as Key),\n );\n\n // If popover is closed and we have a value, allow Enter to propagate for form submission\n // If popover is open OR value is empty, prevent default to avoid premature submission\n if (isPopoverOpen || !value) {\n e.preventDefault();\n }\n } else {\n e.preventDefault();\n onSelectionChange(null);\n }\n\n return;\n }\n\n // Clear selection if input is empty and popover is closed (or no focused item)\n const trimmed = (effectiveInputValue || '').trim();\n if (trimmed === '') {\n e.preventDefault();\n onSelectionChange(null);\n return;\n }\n } else if (e.key === 'Escape') {\n if (isPopoverOpen) {\n e.preventDefault();\n onClosePopover();\n inputRef.current?.focus();\n } else if (effectiveInputValue && isClearable) {\n e.preventDefault();\n onClearValue();\n }\n } else if (e.key === 'Home' || e.key === 'End') {\n if (isPopoverOpen) {\n e.preventDefault();\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const targetKey = getEdgeVisibleKey(\n listState,\n e.key === 'Home' ? 'first' : 'last',\n );\n\n if (targetKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(targetKey);\n }\n }\n }\n },\n });\n\n return { keyboardProps };\n}\n\n// ============================================================================\n// Component: ComboBoxInput\n// ============================================================================\ninterface ComboBoxInputProps {\n qa?: string;\n inputRef: RefObject<HTMLInputElement>;\n id?: string;\n value: string;\n placeholder?: string;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n isRequired?: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n size: string;\n mods: Record<string, any>;\n inputStyles?: Styles;\n keyboardProps: any;\n focusProps: any;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n onFocus: (e: React.FocusEvent<HTMLInputElement>) => void;\n isPopoverOpen: boolean;\n hasResults: boolean;\n comboBoxId: string;\n listStateRef: RefObject<any>;\n}\n\nconst ComboBoxInput = forwardRef<HTMLInputElement, ComboBoxInputProps>(\n function ComboBoxInput(\n {\n qa,\n inputRef,\n id,\n value,\n placeholder,\n isDisabled,\n isReadOnly,\n isRequired,\n autoFocus,\n autoComplete,\n size,\n mods,\n inputStyles,\n keyboardProps,\n focusProps,\n onChange,\n onFocus,\n isPopoverOpen,\n hasResults,\n comboBoxId,\n listStateRef,\n },\n ref,\n ) {\n const combinedRef = useCombinedRefs(ref, inputRef);\n\n return (\n <InputElement\n ref={combinedRef}\n qa={qa}\n id={id}\n type=\"text\"\n value={value}\n placeholder={placeholder}\n isDisabled={isDisabled}\n readOnly={isReadOnly}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n data-autofocus={autoFocus ? '' : undefined}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={focusProps.onBlur}\n {...keyboardProps}\n styles={inputStyles}\n mods={mods}\n data-size={size}\n data-input-type=\"combobox\"\n role=\"combobox\"\n // `ComboBox` builds its own trigger rather than going through a\n // react-aria field hook, so nothing else would announce that the field\n // is mandatory — the label marker alone is not exposed to assistive\n // technology.\n aria-required={isRequired || undefined}\n aria-expanded={isPopoverOpen && hasResults}\n aria-haspopup=\"listbox\"\n aria-controls={\n isPopoverOpen && hasResults\n ? `ComboBoxListBox-${comboBoxId}`\n : undefined\n }\n aria-activedescendant={\n isPopoverOpen &&\n hasResults &&\n listStateRef.current?.selectionManager.focusedKey != null\n ? `ListBoxItem-${listStateRef.current?.selectionManager.focusedKey}`\n : undefined\n }\n />\n );\n },\n);\n\n// ============================================================================\n// Main Component: ComboBox\n// ============================================================================\nexport const ComboBox = forwardRef(function ComboBox<T extends object>(\n props: CubeComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n props = useFieldProps(props, {\n valuePropsMapper: ({ value, onChange }) => {\n return {\n // Form value maps to selectedKey (the committed value) in both modes\n selectedKey: value ?? null,\n onSelectionChange(val: string | null) {\n // Commit selection changes to the form\n onChange(val);\n },\n };\n },\n });\n\n const { t } = useI18n();\n\n let {\n qa,\n label,\n extra,\n labelStyles,\n isRequired,\n necessityIndicator,\n isInvalid,\n isValid,\n id,\n icon,\n prefix,\n isDisabled,\n autoFocus,\n autoComplete = 'off',\n wrapperRef,\n inputRef,\n triggerRef,\n popoverRef,\n listBoxRef,\n isLoading,\n inputStyles,\n optionStyles,\n triggerStyles,\n listBoxStyles,\n overlayStyles,\n suffix,\n hideTrigger,\n message,\n description,\n size = 'medium',\n direction = 'bottom',\n shouldFlip = true,\n popoverTrigger = 'input',\n suffixPosition = 'before',\n filter,\n styles,\n labelSuffix,\n selectedKey,\n defaultSelectedKey,\n inputValue,\n defaultInputValue,\n onInputChange,\n isClearable,\n onClear,\n placeholder,\n allowsCustomValue,\n shouldCommitOnBlur = true,\n clearOnBlur,\n items,\n children: renderChildren,\n sectionStyles,\n headingStyles,\n isReadOnly,\n overlayOffset = 8,\n containerPadding = 8,\n onSelectionChange: externalOnSelectionChange,\n sortSelectedToTop: sortSelectedToTopProp,\n onOpenChange,\n onFocus,\n onBlur,\n onKeyDown,\n form,\n ...otherProps\n } = props;\n\n // Generate a unique ID for this combobox instance\n const comboBoxId = useMemo(() => generateRandomId(), []);\n\n // Hoist the wrapper/popover ref normalization above `useComboBoxState` so\n // the popover-sync inside it sees stable, attached refs. Other ref combines\n // happen below alongside the legacy ordering.\n wrapperRef = useCombinedRefs(wrapperRef);\n popoverRef = useCombinedRefs(popoverRef);\n\n // State management hook\n const {\n effectiveSelectedKey,\n effectiveInputValue,\n isPopoverOpen,\n setIsPopoverOpen,\n setInternalSelectedKey,\n setInternalInputValue,\n isControlledKey,\n isControlledInput,\n } = useComboBoxState({\n selectedKey,\n defaultSelectedKey,\n inputValue,\n defaultInputValue,\n comboBoxId,\n triggerRef: wrapperRef as RefObject<HTMLElement | null>,\n popoverRef: popoverRef as RefObject<HTMLElement | null>,\n });\n\n // Track if sortSelectedToTop was explicitly provided\n const sortSelectedToTopExplicit = sortSelectedToTopProp !== undefined;\n // Default to true if items are provided, false otherwise\n const sortSelectedToTop = sortSelectedToTopProp ?? (items ? true : false);\n\n // Cache for sorted items array when using `items` prop\n const cachedItemsOrder = useRef<T[] | null>(null);\n const selectionWhenClosed = useRef<string | null>(null);\n\n styles = extractStyles(otherProps, PROP_STYLES, styles);\n\n ref = useCombinedRefs(ref);\n inputRef = useCombinedRefs(inputRef);\n triggerRef = useCombinedRefs(triggerRef);\n listBoxRef = useCombinedRefs(listBoxRef);\n\n // Sort items with selected on top if enabled\n const getSortedItems = useCallback((): typeof items => {\n if (!items) return items;\n\n if (!sortSelectedToTop) return items;\n\n // Reuse cached order if available\n if (cachedItemsOrder.current) {\n return cachedItemsOrder.current;\n }\n\n // Warn if explicitly requested but not supported\n if (sortSelectedToTopExplicit && !items) {\n console.warn(\n 'ComboBox: sortSelectedToTop only works with the items prop. ' +\n 'Sorting will be skipped when using JSX children.',\n );\n return items;\n }\n\n const selectedKey = isPopoverOpen\n ? effectiveSelectedKey\n : selectionWhenClosed.current;\n\n if (!selectedKey) return items;\n\n const itemsArray = Array.isArray(items) ? items : Array.from(items);\n const selectedItem = itemsArray.find((item) => {\n const key = (item as any)?.key ?? (item as any)?.id;\n return key != null && String(key) === String(selectedKey);\n });\n\n if (!selectedItem) return items;\n\n const sorted = [\n selectedItem,\n ...itemsArray.filter((item) => {\n const key = (item as any)?.key ?? (item as any)?.id;\n return key == null || String(key) !== String(selectedKey);\n }),\n ] as T[];\n\n if (isPopoverOpen) {\n cachedItemsOrder.current = sorted;\n }\n\n return sorted;\n }, [\n items,\n sortSelectedToTop,\n sortSelectedToTopExplicit,\n effectiveSelectedKey,\n isPopoverOpen,\n ]);\n\n const sortedItems = getSortedItems();\n\n // Preserve the original `children` (may be a render function) before we\n // potentially overwrite it.\n let children: ReactNode = renderChildren as ReactNode;\n\n const renderFn = renderChildren as unknown;\n\n if (sortedItems && typeof renderFn === 'function') {\n try {\n const itemsArray = Array.from(sortedItems as Iterable<any>);\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n if (\n React.isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return React.cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n\n return rendered as ReactNode;\n });\n } catch {\n // If conversion fails, proceed with the original children\n }\n }\n\n // Invalidate cached sorting whenever items change\n useEffect(() => {\n cachedItemsOrder.current = null;\n }, [items]);\n\n // Capture selection when popover closes\n useEffect(() => {\n if (!isPopoverOpen) {\n selectionWhenClosed.current =\n effectiveSelectedKey != null ? String(effectiveSelectedKey) : null;\n cachedItemsOrder.current = null;\n }\n }, [isPopoverOpen, effectiveSelectedKey]);\n\n // Call onOpenChange when popover state changes\n useEffect(() => {\n onOpenChange?.(isPopoverOpen);\n }, [isPopoverOpen]);\n\n // Filtering hook\n const { filterFn, isFilterActive, setIsFilterActive } = useComboBoxFiltering({\n effectiveInputValue,\n filter,\n });\n\n // Create local collection state for reading item data (labels, etc.)\n // This allows us to read item labels even before the popover opens\n const localCollectionState = useListState({\n children,\n items: sortedItems,\n selectionMode: 'none', // Don't manage selection in this state\n });\n\n const { isFocused, focusProps } = useFocus({ isDisabled });\n\n // Helper to check if current input value is valid\n const checkInputValidity = useCallback(() => {\n if (!effectiveInputValue.trim()) {\n return { isInputValid: false, singleMatchKey: null, filteredCount: 0 };\n }\n\n // Get filtered collection based on current input\n const filteredNodes = filterFn(localCollectionState.collection);\n const filteredItems: Array<{ key: Key; textValue: string }> = [];\n\n // Flatten filtered nodes (handle sections)\n for (const node of filteredNodes) {\n if (node.type === 'section' && node.childNodes) {\n for (const child of node.childNodes) {\n if (child.type === 'item') {\n filteredItems.push({\n key: child.key,\n textValue: child.textValue || '',\n });\n }\n }\n } else if (node.type === 'item') {\n filteredItems.push({\n key: node.key,\n textValue: node.textValue || '',\n });\n }\n }\n\n const filteredCount = filteredItems.length;\n\n // Check for exact match\n const exactMatch = filteredItems.find(\n (item) =>\n item.textValue.toLowerCase() ===\n effectiveInputValue.trim().toLowerCase(),\n );\n\n if (exactMatch) {\n return {\n isInputValid: true,\n singleMatchKey: exactMatch.key,\n filteredCount,\n };\n }\n\n // If exactly one filtered result, consider it valid\n if (filteredCount === 1) {\n return {\n isInputValid: true,\n singleMatchKey: filteredItems[0].key,\n filteredCount,\n };\n }\n\n return { isInputValid: false, singleMatchKey: null, filteredCount };\n }, [effectiveInputValue, filterFn, localCollectionState.collection]);\n\n // Composite blur handler - fires when focus leaves the entire component\n const handleCompositeBlur = useEvent(() => {\n // NOTE: Do NOT disable filter yet; we need it active for validity check\n\n // In allowsCustomValue mode\n if (allowsCustomValue) {\n // Commit the input value if it's non-empty and nothing is selected\n if (\n shouldCommitOnBlur &&\n effectiveInputValue &&\n effectiveSelectedKey == null\n ) {\n externalOnSelectionChange?.(effectiveInputValue as string);\n if (!isControlledKey) {\n setInternalSelectedKey(effectiveInputValue as Key);\n }\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n\n // Clear selection if input is empty\n if (!String(effectiveInputValue).trim()) {\n externalOnSelectionChange?.(null);\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n }\n\n // In non-custom-value mode, validate input and handle accordingly\n if (!allowsCustomValue) {\n const { isInputValid, singleMatchKey } = checkInputValidity();\n\n // If there's exactly one filtered result, auto-select it\n if (\n isInputValid &&\n singleMatchKey != null &&\n singleMatchKey !== effectiveSelectedKey\n ) {\n const label = getItemLabel(singleMatchKey);\n\n if (!isControlledKey) {\n setInternalSelectedKey(singleMatchKey);\n }\n if (!isControlledInput) {\n setInternalInputValue(label);\n }\n onInputChange?.(label);\n externalOnSelectionChange?.(singleMatchKey as string | null);\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n\n // If input is invalid (no exact match, not a single result)\n if (!isInputValid) {\n const trimmedInput = effectiveInputValue.trim();\n\n // Clear if clearOnBlur is set or input is empty\n if (clearOnBlur || !trimmedInput) {\n externalOnSelectionChange?.(null);\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n\n // Reset input to current selected value (or empty if none)\n const nextValue =\n effectiveSelectedKey != null\n ? getItemLabel(effectiveSelectedKey)\n : '';\n\n if (!isControlledInput) {\n setInternalInputValue(nextValue);\n }\n onInputChange?.(nextValue);\n onBlur?.();\n setIsFilterActive(false);\n return;\n }\n }\n\n // Fallback: Reset input to show current selection (or empty if none)\n const nextValue =\n effectiveSelectedKey != null ? getItemLabel(effectiveSelectedKey) : '';\n\n if (!isControlledInput) {\n setInternalInputValue(nextValue);\n }\n onInputChange?.(nextValue);\n onBlur?.();\n setIsFilterActive(false);\n });\n\n // Composite focus hook - handles focus tracking across wrapper and portaled popover\n const { compositeFocusProps } = useCompositeFocus({\n wrapperRef,\n popoverRef,\n onFocus,\n onBlur: handleCompositeBlur,\n isDisabled,\n });\n\n let validationIcon = getValidationIcon({ isInvalid, isValid });\n\n // Ref to access internal ListBox state\n const listStateRef = useRef<any>(null);\n const focusInitAttemptsRef = useRef(0);\n\n // Helper to get label from local collection\n const getItemLabel = useCallback(\n (key: Key): string => {\n const item = localCollectionState?.collection?.getItem(key);\n return item?.textValue || String(key);\n },\n [localCollectionState?.collection],\n );\n\n // Selection change handler\n const handleSelectionChange = useEvent((selection: Key | Key[] | null) => {\n // Extract single key from selection (we only support single selection)\n const key = Array.isArray(selection) ? selection[0] : selection;\n\n // Update selected key\n if (!isControlledKey) {\n setInternalSelectedKey(key ?? null);\n }\n\n // Update input value to show selected item label\n if (key != null) {\n setIsFilterActive(false);\n\n const label = getItemLabel(key);\n\n if (!isControlledInput) {\n setInternalInputValue(label);\n }\n onInputChange?.(label);\n } else {\n // Clear input when selection is cleared\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n setIsFilterActive(false);\n }\n\n externalOnSelectionChange?.(key as string | null);\n\n // Close popover after selection\n setIsPopoverOpen(false);\n\n // Focus input\n setTimeout(() => {\n inputRef.current?.focus();\n }, 0);\n });\n\n const lastSyncedSelectedKey = useRef<Key | null | undefined>(undefined);\n const selectionClearedByTyping = useRef(false);\n\n // Input change handler\n const handleInputChange = useEvent(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n\n // Update input value\n if (!isControlledInput) {\n setInternalInputValue(value);\n }\n onInputChange?.(value);\n\n const trimmed = value.trim();\n setIsFilterActive(trimmed.length > 0);\n\n // Only clear selection in allowsCustomValue mode\n // In normal mode, typing just filters - selection stays until explicitly changed\n if (allowsCustomValue && effectiveSelectedKey != null) {\n selectionClearedByTyping.current = true;\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n externalOnSelectionChange?.(null);\n }\n\n // Open popover based on trigger\n if (popoverTrigger !== 'manual' && value && !isPopoverOpen) {\n setIsPopoverOpen(true);\n }\n },\n );\n\n // Initialize input value from defaultInputValue or defaultSelectedKey (uncontrolled mode only, one-time)\n const [hasInitialized, setHasInitialized] = useState(false);\n\n useEffect(() => {\n // Only initialize once, in uncontrolled input mode\n if (hasInitialized || isControlledInput) return;\n\n // Priority 1: defaultInputValue takes precedence\n if (defaultInputValue !== undefined) {\n setInternalInputValue(defaultInputValue);\n setHasInitialized(true);\n return;\n }\n\n // Priority 2: fall back to defaultSelectedKey's label\n if (defaultSelectedKey) {\n const label = getItemLabel(defaultSelectedKey);\n\n setInternalInputValue(label);\n setHasInitialized(true);\n }\n }, [\n hasInitialized,\n isControlledInput,\n defaultInputValue,\n defaultSelectedKey,\n getItemLabel,\n children,\n ]);\n\n // Sync input value with controlled selectedKey\n useEffect(() => {\n const preserveTypedInput = selectionClearedByTyping.current;\n selectionClearedByTyping.current = false;\n // Only run when selectedKey is controlled but inputValue is uncontrolled\n if (!isControlledKey || isControlledInput) return;\n\n // Skip if the key hasn't actually changed (prevents unnecessary resets when collection rebuilds)\n if (\n lastSyncedSelectedKey.current !== undefined &&\n lastSyncedSelectedKey.current === effectiveSelectedKey\n ) {\n return;\n }\n\n lastSyncedSelectedKey.current = effectiveSelectedKey;\n\n // Acknowledging the selection cleared by this edit must not erase the\n // text that caused it. Later external clears still reset the input.\n if (preserveTypedInput && effectiveSelectedKey == null) return;\n\n // Get the expected label for the current selection\n const expectedLabel =\n effectiveSelectedKey != null ? getItemLabel(effectiveSelectedKey) : '';\n\n // Update the input value to match the selected key's label\n setInternalInputValue(expectedLabel);\n }, [\n isControlledKey,\n isControlledInput,\n effectiveSelectedKey,\n effectiveInputValue,\n getItemLabel,\n ]);\n\n // Input focus handler\n const handleInputFocus = useEvent((e: React.FocusEvent<HTMLInputElement>) => {\n // Call focus props handler if it exists\n focusProps.onFocus?.(e as any);\n\n if (popoverTrigger === 'focus' && !isPopoverOpen) {\n setIsPopoverOpen(true);\n }\n });\n\n // Input blur handler - just handles internal focus props\n const handleInputBlur = useEvent((e: React.FocusEvent<HTMLInputElement>) => {\n focusProps.onBlur?.(e as any);\n });\n\n // Clear button logic\n let hasValue = allowsCustomValue\n ? effectiveInputValue !== ''\n : effectiveSelectedKey != null;\n let showClearButton = isClearable && hasValue && !isDisabled && !isReadOnly;\n\n // Check if there are any results after filtering\n const hasResults = useMemo(() => {\n if (!children) return false;\n if (!Array.isArray(children) && children === null) return false;\n\n // If we have a collection, check if filtering will produce any results\n if (localCollectionState?.collection) {\n const filteredNodes = filterFn(localCollectionState.collection);\n const resultArray = Array.from(filteredNodes).flatMap((node: any) => {\n if (node.type === 'section' && node.childNodes) {\n return [...node.childNodes];\n }\n\n return [node];\n });\n return resultArray.length > 0;\n }\n\n // Fallback: check if children exists\n return Array.isArray(children) ? children.length > 0 : true;\n }, [children, localCollectionState?.collection, filterFn]);\n\n // Clear function\n let clearValue = useEvent(() => {\n // Clear input\n if (!isControlledInput) {\n setInternalInputValue('');\n }\n onInputChange?.('');\n\n // Clear selection\n if (!isControlledKey) {\n setInternalSelectedKey(null);\n }\n externalOnSelectionChange?.(null);\n\n // Close popover\n if (isPopoverOpen) {\n setIsPopoverOpen(false);\n }\n\n // Focus input\n inputRef.current?.focus();\n\n onClear?.();\n });\n\n // Keyboard navigation hook\n const { keyboardProps } = useComboBoxKeyboard({\n isPopoverOpen,\n listStateRef,\n hasResults,\n allowsCustomValue,\n effectiveInputValue,\n isClearable,\n onSelectionChange: handleSelectionChange,\n onClearValue: clearValue,\n onOpenPopover: () => setIsPopoverOpen(true),\n onClosePopover: () => setIsPopoverOpen(false),\n inputRef,\n setIsFilterActive,\n onKeyDown,\n });\n\n if (icon) {\n icon = <div data-element=\"InputIcon\">{icon}</div>;\n\n if (prefix) {\n prefix = (\n <>\n {icon}\n {prefix}\n </>\n );\n } else {\n prefix = icon;\n }\n }\n\n let mods = useMemo(\n () => ({\n ...getValidationMods({ isInvalid, isValid }),\n disabled: isDisabled,\n hovered: false,\n focused: isFocused,\n loading: isLoading,\n prefix: !!prefix,\n suffix: true,\n clearable: showClearButton,\n }),\n [\n isInvalid,\n isValid,\n isDisabled,\n isFocused,\n isLoading,\n prefix,\n showClearButton,\n ],\n );\n\n const comboBoxWidth = wrapperRef?.current?.offsetWidth;\n\n const shouldShowPopover = Boolean(isPopoverOpen && hasResults);\n\n // Close popover if no results\n useEffect(() => {\n if (isPopoverOpen && !hasResults) {\n setIsPopoverOpen(false);\n }\n }, [isPopoverOpen, hasResults]);\n\n const ensureInitialFocus = useCallback(() => {\n if (!shouldShowPopover) return;\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const { selectionManager, collection, disabledKeys, lastFocusSourceRef } =\n listState;\n if (!selectionManager || !collection) return;\n\n const collectFirstKey = (): Key | null => {\n for (const node of collection) {\n if (node.type === 'item') {\n if (!disabledKeys?.has(node.key)) return node.key;\n } else if (node.childNodes) {\n for (const child of node.childNodes) {\n if (child.type === 'item' && !disabledKeys?.has(child.key)) {\n return child.key;\n }\n }\n }\n }\n return null;\n };\n\n if (lastFocusSourceRef) lastFocusSourceRef.current = 'keyboard';\n\n // Check if we need to set or update focus\n const currentFocusedKey = selectionManager.focusedKey;\n let needsRefocus = false;\n\n if (currentFocusedKey == null) {\n // No focus at all - need to set initial focus\n needsRefocus = true;\n } else {\n // Check if currently focused key still exists in the collection\n const focusedItemExists = collection.getItem(currentFocusedKey) != null;\n if (!focusedItemExists) {\n // Focused item was filtered out - need to refocus\n needsRefocus = true;\n }\n }\n\n if (needsRefocus) {\n let keyToFocus: Key | null = null;\n\n // First try to focus on the selected key if it exists in the collection\n if (\n effectiveSelectedKey != null &&\n collection.getItem(effectiveSelectedKey) != null\n ) {\n keyToFocus = effectiveSelectedKey;\n } else {\n // Fall back to the first key in the collection\n keyToFocus = collectFirstKey();\n }\n\n if (keyToFocus != null) {\n selectionManager.setFocusedKey(keyToFocus);\n }\n }\n }, [shouldShowPopover, effectiveSelectedKey]);\n\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n focusInitAttemptsRef.current = 0;\n\n const tick = () => {\n if (!shouldShowPopover) return;\n ensureInitialFocus();\n focusInitAttemptsRef.current += 1;\n // Try a few frames to wait for collection to mount\n if (\n focusInitAttemptsRef.current < 8 &&\n listStateRef.current?.selectionManager?.focusedKey == null\n ) {\n requestAnimationFrame(tick);\n }\n };\n\n requestAnimationFrame(() => requestAnimationFrame(tick));\n }, [shouldShowPopover, ensureInitialFocus]);\n\n const comboBoxField = (\n <ComboBoxWrapperElement\n ref={wrapperRef}\n mods={mods}\n styles={styles}\n style={{\n zIndex: isFocused ? 1 : 'initial',\n }}\n data-size={size}\n {...compositeFocusProps}\n >\n {prefix ? <div data-element=\"Prefix\">{prefix}</div> : null}\n <ComboBoxInput\n qa={qa || 'ComboBox'}\n inputRef={inputRef}\n id={id}\n value={effectiveInputValue}\n placeholder={placeholder}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n size={size}\n mods={mods}\n inputStyles={inputStyles}\n keyboardProps={keyboardProps}\n focusProps={{ ...focusProps, onBlur: handleInputBlur }}\n isPopoverOpen={isPopoverOpen}\n hasResults={hasResults}\n comboBoxId={comboBoxId}\n listStateRef={listStateRef}\n onChange={handleInputChange}\n onFocus={handleInputFocus}\n />\n <div data-element=\"Suffix\">\n {suffixPosition === 'before' ? suffix : null}\n {isLoading ? <LoadingIcon data-element=\"InputIcon\" /> : validationIcon}\n {suffixPosition === 'after' ? suffix : null}\n {showClearButton && (\n <Item.Action\n icon={<CloseIcon />}\n size={size}\n // No `theme` — the default `current` type inherits the input's own\n // text color, which is already validation-tinted, so the button\n // matches the text beside it exactly instead of using the fixed\n // `danger.clear` palette.\n qa=\"ComboBoxClearButton\"\n data-no-trigger={hideTrigger ? '' : undefined}\n data-popover-dismiss=\"\"\n aria-label={t('comboBox.clearValue', 'Clear value')}\n onPress={clearValue}\n />\n )}\n {!hideTrigger ? (\n <Item.Action\n ref={triggerRef}\n data-popover-trigger\n icon={<DirectionIcon to={isPopoverOpen ? 'up' : 'down'} />}\n qa=\"ComboBoxTrigger\"\n mods={{\n pressed: isPopoverOpen,\n disabled: isDisabled,\n loading: isLoading,\n }}\n data-size={size}\n isDisabled={isDisabled}\n styles={triggerStyles}\n aria-expanded={isPopoverOpen}\n aria-haspopup=\"listbox\"\n aria-label={t('comboBox.showOptions', 'Show options')}\n onPress={() => {\n if (!isDisabled) {\n const willOpen = !isPopoverOpen;\n setIsPopoverOpen(willOpen);\n if (willOpen) {\n inputRef.current?.focus();\n // If opening with no filtered results, disable filter to show all items\n if (!hasResults) {\n setIsFilterActive(false);\n }\n }\n }\n }}\n />\n ) : null}\n </div>\n <ListBoxPopover\n isOpen={shouldShowPopover}\n triggerRef={wrapperRef as RefObject<HTMLElement>}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n direction={direction}\n shouldFlip={shouldFlip}\n overlayOffset={overlayOffset}\n containerPadding={containerPadding}\n comboBoxWidth={comboBoxWidth}\n listBoxId={`ComboBoxListBox-${comboBoxId}`}\n overlayStyles={overlayStyles}\n listBoxStyles={listBoxStyles}\n optionStyles={optionStyles}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n selectedKey={effectiveSelectedKey}\n isDisabled={isDisabled}\n disabledKeys={props.disabledKeys}\n items={sortedItems}\n listStateRef={listStateRef}\n label={label}\n ariaLabel={(props as any)['aria-label']}\n compositeFocusProps={compositeFocusProps}\n filter={filterFn}\n size={size}\n onSelectionChange={handleSelectionChange}\n onClose={() => setIsPopoverOpen(false)}\n >\n {children}\n </ListBoxPopover>\n </ComboBoxWrapperElement>\n );\n\n const { children: _, ...propsWithoutChildren } = props;\n\n return wrapWithField<Omit<CubeComboBoxProps<T>, 'children'>>(\n comboBoxField,\n ref,\n propsWithoutChildren,\n );\n}) as unknown as (<T>(\n props: CubeComboBoxProps<T> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReactElement) & { Item: typeof Item; Section: typeof BaseSection };\n\nComboBox.Item = Item;\n\nComboBox.Section = BaseSection;\n\nObject.defineProperty(ComboBox, 'cubeInputType', {\n value: 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L8D;IACrB,QAAQhH;IACF1D;IACN,mBAAmB8K;IACnB,eAAe3I,iBAAiB,MAAM;IAErC/C;KACa;;GAEnB;CAED,MAAM,EAAEA,UAAUkO,GAAG,GAAGC,yBAAyB3G;AAEjD,QAAO/J,cACLqQ,eACAzG,KACA8G,qBACD;EACD;AAIF5G,SAASlK,OAAOA;AAEhBkK,SAASlL,UAAUC;AAEnB+R,OAAOC,eAAe/G,UAAU,iBAAiB;CAC/CrI,OAAO;CACPqP,YAAY;CACZC,cAAc;CACf,CAAC"}
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.182.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.183.0 | Cube Dev Team */
2
2
  import { chain } from "../../../utils/react/chain.js";
3
3
  import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
4
4
  import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
@@ -1 +1 @@
1
- {"version":3,"file":"CommandTextArea.js","names":["mergeProps","BaseSection"],"sources":["../../../../src/components/fields/CommandTextArea/CommandTextArea.tsx"],"sourcesContent":["import { Collection, Key, Node } from '@react-types/shared';\nimport { Styles } from '@tenphi/tasty';\nimport React, {\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useTextField } from 'react-aria';\nimport { Section as BaseSection, useListState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal';\nimport { generateRandomId } from '../../../utils/random';\nimport { chain, mergeProps, useCombinedRefs } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { CollectionItem as Item } from '../../CollectionItem';\nimport { useFieldProps } from '../../form';\nimport {\n collectVisibleKeys,\n filterCollectionNodes,\n getEdgeVisibleKey,\n getNextVisibleKey,\n ListBoxPopover,\n ListStateLike,\n markKeyboardFocus,\n TextFilterFn,\n useCompositeFocus,\n} from '../ListBoxPopover';\nimport {\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\nimport { useAutoSizeTextArea } from '../TextInput/useAutoSizeTextArea';\n\nimport { useCaretAnchor } from './useCaretAnchor';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** A single trigger character with optional placement constraint. */\nexport interface CommandTrigger {\n /** The character that opens the autocomplete (e.g. `/` or `@`). */\n char: string;\n /**\n * When true, the trigger token must start at the beginning of the line the\n * caret is on (right after a newline, or at the very start of the input) —\n * i.e. line-scoped slash commands. When false, the token may appear after\n * any whitespace, anywhere in the text (Slack/Notion-style).\n */\n atLineStart?: boolean;\n}\n\n/** Result of scanning the textarea for an active trigger token. */\nexport interface ActiveToken {\n /** The matched trigger descriptor. */\n trigger: CommandTrigger;\n /** The active token text, INCLUDING the trigger char (e.g. `/cle`). */\n token: string;\n /** Inclusive start index of the token in the textarea value. */\n start: number;\n /** Exclusive end index of the token (caret position while typing). */\n end: number;\n}\n\nexport type CommandTextAreaFilterFn = TextFilterFn;\n\nexport interface CubeCommandTextAreaProps<T>\n extends Omit<CubeTextInputBaseProps, 'children' | 'multiLine'> {\n /** Whether the textarea should resize to fit its content. */\n autoSize?: boolean;\n /** Max visible rows when `autoSize` is true. Defaults to 10. */\n maxRows?: number;\n /** Number of visible rows. Defaults to 3. */\n rows?: number;\n\n /** Command/option source (alternative to JSX children). */\n items?: Iterable<T>;\n /** Static items or a render function (same shape as ComboBox/ListBox). */\n children?: ReactNode | ((item: T) => ReactElement);\n /**\n * Triggers that open the autocomplete. Defaults to a single slash command\n * that must start at the beginning of the input.\n */\n triggers?: CommandTrigger[];\n /**\n * Custom filter. Pass `false` to disable internal filtering (server-side).\n */\n filter?: CommandTextAreaFilterFn | false;\n /**\n * Fired when the user picks a command (Enter/Tab/click). The option's\n * `textValue` is also inserted into the textarea regardless.\n *\n * `start` / `end` locate that insertion in the value handed to `onChange`, so\n * a consumer can anchor its own record to the picked item rather than\n * re-deriving the offset by searching the new value for the inserted text —\n * a search that cannot tell two occurrences apart when one option's text is a\n * prefix of another's.\n */\n onCommand?: (\n key: Key,\n item: {\n textValue: string;\n /** Index in the new value where the inserted text starts. */\n start: number;\n /** Index where it ends, excluding any inserted trailing space. */\n end: number;\n [k: string]: any;\n },\n ) => void;\n /**\n * Fired when the command popover opens or closes. Lets a consumer with its own\n * `Enter` behaviour tell \"pick the focused option\" from \"submit\" without\n * reading `aria-expanded` off the DOM.\n */\n onOpenChange?: (isOpen: boolean) => void;\n /**\n * Fired when the active trigger token changes, with the component's own\n * caret-aware scan result — `null` once the caret leaves a token. Saves a\n * consumer running a second, approximate scan of the same value.\n */\n onActiveTokenChange?: (token: ActiveToken | null) => void;\n /** Insert a trailing space after the chosen command. Defaults to true. */\n insertSpaceAfter?: boolean;\n /** Keys of disabled options. */\n disabledKeys?: Iterable<Key>;\n /** Popover placement. Chat inputs usually want `top`. Defaults to `top`. */\n direction?: 'bottom' | 'top';\n /** Whether the popover should flip when overflowing. Defaults to true. */\n shouldFlip?: boolean;\n /** Offset between the textarea and the popover. */\n overlayOffset?: number;\n /** Padding between the popover and the viewport edge. */\n containerPadding?: number;\n\n // Refs\n /** Ref for the textarea element. */\n inputRef?: RefObject<HTMLTextAreaElement>;\n /** Ref for the wrapper element (popover anchor). */\n wrapperRef?: RefObject<HTMLDivElement>;\n /** Ref for the popover overlay element. */\n popoverRef?: RefObject<HTMLDivElement>;\n /** Ref for the listbox element. */\n listBoxRef?: RefObject<HTMLDivElement>;\n /** Ref through which the internal list state is exposed. */\n listStateRef?: RefObject<ListStateLike | null>;\n\n // Style props\n overlayStyles?: any;\n listBoxStyles?: any;\n optionStyles?: any;\n sectionStyles?: any;\n headingStyles?: any;\n}\n\nconst DEFAULT_TRIGGERS: CommandTrigger[] = [{ char: '/', atLineStart: true }];\n\n// ---------------------------------------------------------------------------\n// Trigger parsing\n// ---------------------------------------------------------------------------\n\n/**\n * Inspect the textarea contents up to the caret and find the active trigger\n * token, if any. The token includes the trigger character and ends at the\n * caret (so it grows as the user types). A token ends at whitespace or the end\n * of the input.\n */\nexport function parseActiveToken(\n value: string,\n caret: number,\n triggers: CommandTrigger[],\n): ActiveToken | null {\n if (!triggers.length) return null;\n const before = value.slice(0, caret);\n const after = value.slice(caret);\n\n for (const trigger of triggers) {\n const ch = trigger.char;\n if (trigger.atLineStart) {\n // Line-start command: the trigger char must sit at the start of the line\n // the caret is on (right after a newline, or at index 0), with no\n // whitespace between it and the caret. On a single-line input with no\n // newlines this is equivalent to \"index 0 of the whole input\".\n const lineStart = before.lastIndexOf('\\n') + 1;\n const linePrefix = before.slice(lineStart);\n if (linePrefix[0] !== ch) continue;\n // No whitespace allowed within the token (after the trigger char).\n const wsIndex = linePrefix.slice(1).search(/\\s/);\n if (wsIndex !== -1) continue;\n if (!linePrefix) continue;\n return { trigger, token: linePrefix, start: lineStart, end: caret };\n }\n\n // Caret-token mode: find the last trigger char that begins a token at or\n // after a line start / whitespace boundary, with no whitespace between it\n // and the caret.\n const match = /(?:^|\\s)([\\S]+)$/.exec(before);\n if (!match) continue;\n const candidate = match[1];\n if (candidate[0] !== ch) continue;\n // Ensure the token hasn't already been closed by whitespace after caret.\n // (If there's non-whitespace after the caret, the user is mid-token.)\n const start = caret - candidate.length;\n // If immediately after the caret there's whitespace (or end), the token is\n // \"complete\" — still offer completions as long as the caret sits on the\n // token. We accept it.\n void after;\n return { trigger, token: candidate, start, end: caret };\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nfunction CommandTextArea<T extends object>(\n props: WithNullableValue<CubeCommandTextAreaProps<T>>,\n ref: ForwardedRef<HTMLElement>,\n) {\n props = castNullableStringValue(props);\n props = useFieldProps(props, {\n defaultValidationTrigger: 'onBlur',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: value?.toString() ?? '',\n }),\n });\n\n let {\n qa,\n autoSize = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n maxRows = 10,\n rows = 3,\n labelProps: userLabelProps,\n inputProps: userInputProps,\n inputRef: propsInputRef,\n value,\n defaultValue,\n placeholder,\n // command props\n items,\n children: renderChildren,\n triggers = DEFAULT_TRIGGERS,\n filter,\n onCommand,\n onOpenChange,\n onActiveTokenChange,\n insertSpaceAfter = true,\n disabledKeys,\n direction = 'top',\n shouldFlip = true,\n overlayOffset = 8,\n containerPadding = 8,\n overlayStyles,\n listBoxStyles,\n optionStyles,\n sectionStyles,\n headingStyles,\n wrapperRef: propsWrapperRef,\n popoverRef: propsPopoverRef,\n listBoxRef: propsListBoxRef,\n listStateRef: propsListStateRef,\n onKeyDown,\n onFocus,\n onBlur,\n ...otherProps\n } = props;\n\n rows = Math.max(rows, 1);\n maxRows = Math.max(maxRows, rows);\n\n // ---- refs -------------------------------------------------------------\n const localInputRef = useRef<HTMLTextAreaElement>(null);\n const inputRef = (propsInputRef ??\n localInputRef) as RefObject<HTMLTextAreaElement>;\n const wrapperRef = useCombinedRefs<HTMLDivElement>(propsWrapperRef);\n const popoverRef = useCombinedRefs<HTMLDivElement>(propsPopoverRef);\n const listBoxRef = useCombinedRefs<HTMLDivElement>(propsListBoxRef);\n const localListStateRef = useRef<ListStateLike | null>(null);\n const listStateRef = (propsListStateRef ??\n localListStateRef) as RefObject<ListStateLike | null>;\n\n const commandTextAreaId = useMemo(() => generateRandomId(), []);\n\n // ---- controlled / uncontrolled value ----------------------------------\n // When no `value` is provided (standalone, no form), track the text\n // internally so trigger detection and commit still work.\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n (value as string) ?? (defaultValue as string) ?? '',\n );\n const effectiveValue: string = isControlled\n ? (value as string)\n : internalValue;\n const handleChange = useEvent((next: string) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n });\n\n // ---- children / items normalization -----------------------------------\n let children: ReactNode = renderChildren as ReactNode;\n const renderFn = renderChildren as unknown;\n if (items && typeof renderFn === 'function') {\n const itemsArray = Array.from(items as Iterable<any>);\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n if (\n React.isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return React.cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n return rendered as ReactNode;\n });\n }\n\n // ---- caret tracking ---------------------------------------------------\n // The caret drives trigger detection. We keep it in state so a caret move\n // (arrow keys without typing) re-renders and recomputes the active token.\n const [caret, setCaret] = useState(() => effectiveValue.length);\n const syncCaret = useEvent(() => {\n const el = inputRef.current;\n if (!el) return;\n setCaret(el.selectionStart ?? el.value.length);\n });\n\n // ---- trigger detection ------------------------------------------------\n const activeToken = useMemo(\n () =>\n parseActiveToken(\n effectiveValue,\n Math.min(caret, effectiveValue.length),\n triggers,\n ),\n [effectiveValue, caret, triggers],\n );\n\n // The active token includes the trigger char (e.g. `/co`). Strip it before\n // filtering so the query is matched against the meaningful text — this lets\n // options match by their label/description (which don't contain the trigger\n // char) as well as by their `textValue`.\n const term = useMemo(() => {\n if (!activeToken) return '';\n const { token, trigger } = activeToken;\n return token.startsWith(trigger.char)\n ? token.slice(trigger.char.length)\n : token;\n }, [activeToken]);\n\n // ---- filtering --------------------------------------------------------\n const { contains } = useFilter({ sensitivity: 'base' });\n const textFilterFn = useMemo<CommandTextAreaFilterFn>(\n () => (filter === false ? () => true : filter || contains),\n [filter, contains],\n );\n\n // Local collection used to read option textValues and to count matches.\n const localCollectionState = useListState({\n children: children as any,\n items: items as any,\n selectionMode: 'none',\n });\n\n const filterFn = useCallback(\n (nodes: Iterable<any>) =>\n filterCollectionNodes(nodes, term, textFilterFn, {\n matchExtraFields: true,\n }),\n [term, textFilterFn],\n );\n\n // Keys of the currently visible (filtered) options, in display order.\n // Derived from our own local collection + filter (rather than the ListBox's\n // exposed state ref) so it is always in sync with the current token — the\n // ListBox's `stateRef.collection` can momentarily lag by a render right after\n // the token narrows, which would otherwise leave virtual focus on (and commit)\n // an option that is no longer visible.\n const visibleFilteredKeys = useMemo<Key[]>(() => {\n if (!activeToken) return [];\n const keys: Key[] = [];\n const disabled = disabledKeys ? new Set<Key>(disabledKeys) : undefined;\n collectVisibleKeys(\n filterFn(localCollectionState.collection),\n keys,\n disabled,\n );\n return keys;\n }, [activeToken, filterFn, localCollectionState.collection, disabledKeys]);\n\n const filteredCount = visibleFilteredKeys.length;\n\n // ---- dismiss handling (Escape keeps the text but hides the popover) ---\n const [dismissedToken, setDismissedToken] = useState<string | null>(null);\n // Bumped whenever we move the virtual focus so the textarea's\n // `aria-activedescendant` (read from the ListBox's stateRef at render time)\n // stays in sync — the ListBox's own state update does not re-render us.\n const [, setFocusTick] = useState(0);\n const bumpFocus = useEvent(() => setFocusTick((t) => t + 1));\n // Reset dismissal whenever the active token changes (user typed/backspaced).\n useEffect(() => {\n setDismissedToken((prev) =>\n prev != null && activeToken?.token !== prev ? null : prev,\n );\n }, [activeToken?.token]);\n\n const isCommandMode = !!activeToken && activeToken.token !== dismissedToken;\n const shouldShowPopover = isCommandMode && filteredCount > 0;\n\n // ---- reporting open state / active token to the consumer --------------\n // Both are already computed here; without these a consumer with its own\n // `Enter` handling has to read `aria-expanded` off the DOM and run a second,\n // approximate copy of the scan above — neither of which is a contract.\n // Seeded with the closed / no-token defaults so mounting in that state is not\n // reported as a change, while mounting with a `value` that already holds a\n // token is.\n const notifiedOpenRef = useRef(false);\n\n useEffect(() => {\n if (notifiedOpenRef.current === shouldShowPopover) return;\n\n notifiedOpenRef.current = shouldShowPopover;\n onOpenChange?.(shouldShowPopover);\n }, [shouldShowPopover, onOpenChange]);\n\n // `activeToken` is a fresh object on every value/caret change, so compare the\n // content rather than the identity — otherwise a consumer is re-notified for\n // a token that has not actually moved.\n const activeTokenSignature = activeToken\n ? `${activeToken.trigger.char}\\u0000${activeToken.token}\\u0000${activeToken.start}\\u0000${activeToken.end}`\n : null;\n const notifiedTokenRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (notifiedTokenRef.current === activeTokenSignature) return;\n\n notifiedTokenRef.current = activeTokenSignature;\n onActiveTokenChange?.(activeToken ?? null);\n // `activeToken` is intentionally not a dependency: the signature above is\n // its value-identity, and depending on the object would re-run this on every\n // keystroke that leaves the token unchanged.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeTokenSignature, onActiveTokenChange]);\n\n // ---- caret-anchored popover ------------------------------------------\n // A zero-size element positioned at the caret (both axes) drives the\n // popover's geometry; the wrapper remains the dismiss/outside-click trigger.\n const { anchorRef: caretAnchorRef, positionApiRef } = useCaretAnchor({\n inputRef: inputRef as RefObject<HTMLTextAreaElement>,\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n caret,\n value: effectiveValue,\n isActive: shouldShowPopover,\n });\n\n // ---- height autosize (shared with TextArea) ---------------------------\n const adjustHeight = useAutoSizeTextArea({\n inputRef,\n autoSize,\n rows,\n maxRows,\n value: effectiveValue,\n });\n\n // ---- useTextField (ARIA wiring for the textarea) ----------------------\n let { labelProps, inputProps } = useTextField(\n {\n ...otherProps,\n value: effectiveValue,\n placeholder,\n isDisabled,\n isReadOnly,\n isRequired,\n onChange: chain(handleChange, adjustHeight),\n inputElementType: 'textarea',\n } as any,\n inputRef as any,\n );\n\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const useEnvironmentalEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n // ---- caret restore after commit --------------------------------------\n const pendingCaretRef = useRef<number | null>(null);\n useEnvironmentalEffect(() => {\n const el = inputRef.current;\n if (!el) return;\n\n if (pendingCaretRef.current != null) {\n // Restore caret after we programmatically inserted a command.\n const pos = pendingCaretRef.current;\n pendingCaretRef.current = null;\n el.focus();\n el.setSelectionRange(pos, pos);\n setCaret(pos);\n return;\n }\n\n // The value changed without our own commit (controlled update from\n // outside, form reset, or defaultValue seeding). Resync the caret from\n // the DOM selection so trigger parsing works off a valid index instead of\n // a stale one. We intentionally do not steal focus here.\n const domCaret = el.selectionStart ?? el.value.length;\n setCaret((prev) => (prev === domCaret ? prev : domCaret));\n }, [effectiveValue]);\n\n // ---- helpers ----------------------------------------------------------\n const getItemTextValue = useCallback(\n (key: Key): string => {\n const item = localCollectionState?.collection?.getItem(key);\n return item?.textValue || String(key);\n },\n [localCollectionState?.collection],\n );\n\n // ---- commit (insert the chosen option's literal value) ---------------\n const commit = useEvent((key: Key) => {\n const listState = listStateRef.current;\n // Guard against committing a stale key that has been filtered out of the\n // visible list (e.g. the token was narrowed after focus landed on it).\n // Fall back to the first still-visible option so the inserted command\n // always matches what the user can see.\n if (visibleFilteredKeys.length > 0 && !visibleFilteredKeys.includes(key)) {\n key = visibleFilteredKeys[0];\n }\n const textValue = getItemTextValue(key);\n const token = activeToken;\n const el = inputRef.current;\n\n // Where the inserted text lands in the new value. Both branches below\n // already compute this to place the caret; it is reported through\n // `onCommand` instead of being thrown away. `end` excludes the trailing\n // space, which is padding around the insertion rather than part of it.\n let start = Math.min(caret, effectiveValue.length);\n\n if (token) {\n const next =\n effectiveValue.slice(0, token.start) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(token.end);\n const caretPos =\n token.start + textValue.length + (insertSpaceAfter ? 1 : 0);\n start = token.start;\n pendingCaretRef.current = caretPos;\n handleChange(next);\n // If controlled, caret is restored by the effect above; if not, set now.\n if (el) {\n el.focus();\n try {\n el.setSelectionRange(caretPos, caretPos);\n } catch {\n /* noop */\n }\n }\n } else if (el) {\n // Fallback: insert at caret.\n const selectionStart = el.selectionStart ?? effectiveValue.length;\n const selectionEnd = el.selectionEnd ?? effectiveValue.length;\n const next =\n effectiveValue.slice(0, selectionStart) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(selectionEnd);\n const caretPos =\n selectionStart + textValue.length + (insertSpaceAfter ? 1 : 0);\n start = selectionStart;\n pendingCaretRef.current = caretPos;\n handleChange(next);\n }\n\n setDismissedToken(null);\n onCommand?.(key, {\n textValue,\n ...((\n listState?.collection as Collection<Node<unknown>> | undefined\n )?.getItem(key)?.props ?? {}),\n // After the item's own props: the range is the component's measurement of\n // what it just did, so an item that happens to carry a `start`/`end` prop\n // must not shadow it.\n start,\n end: start + textValue.length,\n });\n });\n\n // ---- keyboard navigation (only while the popover is open) -------------\n const onKeyDownHandler = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n if (!shouldShowPopover) {\n // While not in command mode, the textarea behaves normally; but clear\n // any dismissal when the user edits.\n return;\n }\n\n const listState = listStateRef.current;\n\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n if (!listState) return;\n e.preventDefault();\n const nextKey = getNextVisibleKey(\n listState,\n e.key === 'ArrowDown' ? 1 : -1,\n );\n if (nextKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(nextKey);\n bumpFocus();\n }\n } else if (e.key === 'Home' || e.key === 'End') {\n if (!listState) return;\n e.preventDefault();\n const edgeKey = getEdgeVisibleKey(\n listState,\n e.key === 'Home' ? 'first' : 'last',\n );\n if (edgeKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(edgeKey);\n bumpFocus();\n }\n } else if (e.key === 'Enter' || e.key === 'Tab') {\n if (!listState) return;\n const focused = listState.selectionManager.focusedKey;\n if (focused != null) {\n e.preventDefault();\n commit(focused);\n }\n // Otherwise pass through (newline / form submit / tab navigation).\n } else if (e.key === 'Escape') {\n e.preventDefault();\n if (activeToken) {\n setDismissedToken(activeToken.token);\n }\n }\n },\n [shouldShowPopover, activeToken, commit, onKeyDown, listStateRef],\n );\n\n // ---- initial focus on the first option when the popover opens ---------\n const focusInitAttemptsRef = useRef(0);\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n focusInitAttemptsRef.current = 0;\n\n const tick = () => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) {\n focusInitAttemptsRef.current += 1;\n if (focusInitAttemptsRef.current < 8) {\n requestAnimationFrame(tick);\n }\n return;\n }\n if (listState.selectionManager.focusedKey == null) {\n const first = getEdgeVisibleKey(listState, 'first');\n if (first != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(first);\n bumpFocus();\n }\n }\n };\n\n requestAnimationFrame(() => requestAnimationFrame(tick));\n }, [shouldShowPopover]);\n\n // ---- keep virtual focus valid as the filtered list narrows -----------\n // When the user narrows the token, the previously focused option may drop\n // out of the filtered list. Move focus to the first still-visible option so\n // the highlight and any Enter/Tab commit stay in sync with what's shown.\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) return;\n\n if (visibleFilteredKeys.length === 0) return;\n\n const focused = listState.selectionManager.focusedKey;\n if (focused == null || !visibleFilteredKeys.includes(focused)) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(visibleFilteredKeys[0]);\n bumpFocus();\n }\n }, [visibleFilteredKeys, shouldShowPopover]);\n\n // ---- composite focus (wrapper + portaled popover) ---------------------\n const { compositeFocusProps } = useCompositeFocus({\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n popoverRef: popoverRef as RefObject<HTMLElement>,\n onFocus,\n onBlur,\n isDisabled,\n });\n\n // ---- aria-activedescendant -------------------------------------------\n const focusedKey = listStateRef.current?.selectionManager.focusedKey ?? null;\n const listBoxId = `CommandTextAreaListBox-${commandTextAreaId}`;\n\n // ---- popover width ----------------------------------------------------\n // The popover is anchored to the caret (a point), so it must not be sized to\n // the textarea. We use the same default as the shared `ListBoxPopover` /\n // `Picker` popovers: a `30x` floor (240px), `max-content` preferred, `50vw`\n // cap. The concrete floor keeps the virtualized ListBox from collapsing to a\n // sliver (it has no intrinsic width), and `max-content` lets short option\n // lists size to their content. The user's `overlayStyles` still win on top.\n const popoverOverlayStyles: Styles = {\n width: '30x max-content 50vw',\n ...overlayStyles,\n };\n\n // ---- assemble input props ---------------------------------------------\n const commandInputProps = mergeProps(\n inputProps,\n {\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': shouldShowPopover,\n 'aria-haspopup': 'listbox',\n 'aria-controls': shouldShowPopover ? listBoxId : undefined,\n 'aria-activedescendant':\n shouldShowPopover && focusedKey != null\n ? `ListBoxItem-${focusedKey}`\n : undefined,\n onKeyDown: onKeyDownHandler,\n onSelect: syncCaret,\n onKeyUp: syncCaret,\n onClick: syncCaret,\n 'data-input-type': 'command-textarea',\n },\n userInputProps,\n );\n\n // ---- render -----------------------------------------------------------\n const field = (\n <TextInputBase\n ref={ref as any}\n {...otherProps}\n multiLine\n qa={qa}\n inputRef={inputRef}\n wrapperRef={wrapperRef}\n wrapperProps={compositeFocusProps}\n labelProps={mergedLabelProps}\n inputProps={commandInputProps}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n rows={rows}\n />\n );\n\n return (\n <>\n {field}\n <ListBoxPopover\n isOpen={shouldShowPopover}\n triggerRef={wrapperRef as RefObject<HTMLElement>}\n positionTargetRef={caretAnchorRef as RefObject<Element | null>}\n positionApiRef={positionApiRef}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n direction={direction}\n shouldFlip={shouldFlip}\n overlayOffset={overlayOffset}\n containerPadding={containerPadding}\n listBoxId={listBoxId}\n overlayStyles={popoverOverlayStyles}\n listBoxStyles={listBoxStyles}\n optionStyles={optionStyles}\n optionHighlight={term}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n isDisabled={isDisabled}\n disabledKeys={disabledKeys}\n items={items as any}\n listStateRef={listStateRef}\n ariaLabel={\n (props as any)['aria-label'] ||\n (typeof otherProps.label === 'string' ? otherProps.label : 'Commands')\n }\n compositeFocusProps={compositeFocusProps}\n filter={filterFn}\n onClose={() => {\n if (activeToken) setDismissedToken(activeToken.token);\n }}\n onSelectionChange={(selection) => {\n const key = Array.isArray(selection) ? selection[0] : selection;\n if (key != null) commit(key);\n }}\n >\n {children as any}\n </ListBoxPopover>\n </>\n );\n}\n\nconst _CommandTextArea = forwardRef(CommandTextArea) as unknown as (<T>(\n props: CubeCommandTextAreaProps<T> & {\n ref?: ForwardedRef<HTMLElement>;\n },\n) => ReactElement) & {\n Item: typeof Item;\n Section: typeof BaseSection;\n};\n\nObject.assign(_CommandTextArea, {\n Item,\n Section: BaseSection,\n displayName: 'CommandTextArea',\n});\n\nObject.defineProperty(_CommandTextArea, 'cubeInputType', {\n value: 'CommandTextArea',\n enumerable: false,\n configurable: false,\n});\n\nexport { _CommandTextArea as CommandTextArea };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqKA,MAAM,mBAAqC,CAAC;CAAE,MAAM;CAAK,aAAa;CAAM,CAAC;;;;;;;AAY7E,SAAgB,iBACd,OACA,OACA,UACoB;AACpB,KAAI,CAAC,SAAS,OAAQ,QAAO;CAC7B,MAAM,SAAS,MAAM,MAAM,GAAG,MAAM;AACtB,OAAM,MAAM,MAAM;AAEhC,MAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,KAAK,QAAQ;AACnB,MAAI,QAAQ,aAAa;GAKvB,MAAM,YAAY,OAAO,YAAY,KAAK,GAAG;GAC7C,MAAM,aAAa,OAAO,MAAM,UAAU;AAC1C,OAAI,WAAW,OAAO,GAAI;AAG1B,OADgB,WAAW,MAAM,EAAE,CAAC,OAAO,KAAK,KAChC,GAAI;AACpB,OAAI,CAAC,WAAY;AACjB,UAAO;IAAE;IAAS,OAAO;IAAY,OAAO;IAAW,KAAK;IAAO;;EAMrE,MAAM,QAAQ,mBAAmB,KAAK,OAAO;AAC7C,MAAI,CAAC,MAAO;EACZ,MAAM,YAAY,MAAM;AACxB,MAAI,UAAU,OAAO,GAAI;AAQzB,SAAO;GAAE;GAAS,OAAO;GAAW,OALtB,QAAQ,UAAU;GAKW,KAAK;GAAO;;AAGzD,QAAO;;AAOT,SAAS,gBACP,OACA,KACA;AACA,SAAQ,wBAAwB,MAAM;AACtC,SAAQ,cAAc,OAAO;EAC3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AC;EACC,QAAQ;EACR,YAAY;EACZ,mBAAmB;EACH;EACJ;EACA;EACD;EACC;EACG;EACG;EACP;EACX,eAAe;EACA;EACD;EACd,iBAAiB;EACF;EACA;EACH;EACE;EACP;EACO;EACd,WACG,MAAc,kBACd,OAAO,WAAW,UAAU,WAAW,WAAW,QAAQ;EAExC;EACrB,QAAQ;EACR,eAAe;AACb,OAAI,YAAa,mBAAkB,YAAY,MAAM;;EAEvD,oBAAoB,cAAc;GAChC,MAAM,MAAM,MAAM,QAAQ,UAAU,GAAG,UAAU,KAAK;AACtD,OAAI,OAAO,KAAM,QAAO,IAAI;;EAG7B;GACc,IAChB;;AAIP,MAAM,mBAAmB,WAAW,gBAAgB;AASpD,OAAO,OAAO,kBAAkB;CAC9B;CACSC;CACT,aAAa;CACd,CAAC;AAEF,OAAO,eAAe,kBAAkB,iBAAiB;CACvD,OAAO;CACP,YAAY;CACZ,cAAc;CACf,CAAC"}
1
+ {"version":3,"file":"CommandTextArea.js","names":["Collection","Key","Node","Styles","React","ForwardedRef","forwardRef","ReactElement","ReactNode","RefObject","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","useFilter","useTextField","Section","BaseSection","useListState","useEvent","generateRandomId","chain","mergeProps","useCombinedRefs","castNullableStringValue","WithNullableValue","CollectionItem","Item","useFieldProps","collectVisibleKeys","filterCollectionNodes","getEdgeVisibleKey","getNextVisibleKey","ListBoxPopover","ListStateLike","markKeyboardFocus","TextFilterFn","useCompositeFocus","CubeTextInputBaseProps","TextInputBase","useAutoSizeTextArea","useCaretAnchor","CommandTrigger","char","atLineStart","ActiveToken","trigger","token","start","end","CommandTextAreaFilterFn","CubeCommandTextAreaProps","Omit","autoSize","maxRows","rows","items","Iterable","T","children","item","triggers","filter","onCommand","key","textValue","k","onOpenChange","isOpen","onActiveTokenChange","insertSpaceAfter","disabledKeys","direction","shouldFlip","overlayOffset","containerPadding","inputRef","HTMLTextAreaElement","wrapperRef","HTMLDivElement","popoverRef","listBoxRef","listStateRef","overlayStyles","listBoxStyles","optionStyles","sectionStyles","headingStyles","DEFAULT_TRIGGERS","parseActiveToken","value","caret","length","before","slice","after","ch","lineStart","lastIndexOf","linePrefix","wsIndex","search","match","exec","candidate","CommandTextArea","props","ref","HTMLElement","defaultValidationTrigger","valuePropsMapper","onChange","toString","qa","isDisabled","isReadOnly","isRequired","labelProps","userLabelProps","inputProps","userInputProps","propsInputRef","defaultValue","placeholder","renderChildren","propsWrapperRef","propsPopoverRef","propsListBoxRef","propsListStateRef","onKeyDown","onFocus","onBlur","otherProps","Math","max","localInputRef","localListStateRef","commandTextAreaId","isControlled","undefined","internalValue","setInternalValue","effectiveValue","handleChange","next","renderFn","itemsArray","Array","from","map","idx","rendered","it","isValidElement","cloneElement","setCaret","syncCaret","el","current","selectionStart","activeToken","min","term","startsWith","contains","sensitivity","textFilterFn","localCollectionState","selectionMode","filterFn","nodes","matchExtraFields","visibleFilteredKeys","keys","disabled","Set","collection","filteredCount","dismissedToken","setDismissedToken","setFocusTick","bumpFocus","t","prev","isCommandMode","shouldShowPopover","notifiedOpenRef","activeTokenSignature","notifiedTokenRef","anchorRef","caretAnchorRef","positionApiRef","isActive","adjustHeight","inputElementType","mergedLabelProps","useEnvironmentalEffect","window","pendingCaretRef","pos","focus","setSelectionRange","domCaret","getItemTextValue","getItem","String","commit","listState","includes","caretPos","selectionEnd","onKeyDownHandler","e","KeyboardEvent","defaultPrevented","preventDefault","nextKey","selectionManager","setFocusedKey","edgeKey","focused","focusedKey","focusInitAttemptsRef","tick","requestAnimationFrame","first","compositeFocusProps","listBoxId","popoverOverlayStyles","width","commandInputProps","role","onSelect","onKeyUp","onClick","field","Element","label","selection","isArray","_CommandTextArea","Object","assign","displayName","defineProperty","enumerable","configurable"],"sources":["../../../../src/components/fields/CommandTextArea/CommandTextArea.tsx"],"sourcesContent":["import { Collection, Key, Node } from '@react-types/shared';\nimport { Styles } from '@tenphi/tasty';\nimport React, {\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useTextField } from 'react-aria';\nimport { Section as BaseSection, useListState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal';\nimport { generateRandomId } from '../../../utils/random';\nimport { chain, mergeProps, useCombinedRefs } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { CollectionItem as Item } from '../../CollectionItem';\nimport { useFieldProps } from '../../form';\nimport {\n collectVisibleKeys,\n filterCollectionNodes,\n getEdgeVisibleKey,\n getNextVisibleKey,\n ListBoxPopover,\n ListStateLike,\n markKeyboardFocus,\n TextFilterFn,\n useCompositeFocus,\n} from '../ListBoxPopover';\nimport {\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\nimport { useAutoSizeTextArea } from '../TextInput/useAutoSizeTextArea';\n\nimport { useCaretAnchor } from './useCaretAnchor';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** A single trigger character with optional placement constraint. */\nexport interface CommandTrigger {\n /** The character that opens the autocomplete (e.g. `/` or `@`). */\n char: string;\n /**\n * When true, the trigger token must start at the beginning of the line the\n * caret is on (right after a newline, or at the very start of the input) —\n * i.e. line-scoped slash commands. When false, the token may appear after\n * any whitespace, anywhere in the text (Slack/Notion-style).\n */\n atLineStart?: boolean;\n}\n\n/** Result of scanning the textarea for an active trigger token. */\nexport interface ActiveToken {\n /** The matched trigger descriptor. */\n trigger: CommandTrigger;\n /** The active token text, INCLUDING the trigger char (e.g. `/cle`). */\n token: string;\n /** Inclusive start index of the token in the textarea value. */\n start: number;\n /** Exclusive end index of the token (caret position while typing). */\n end: number;\n}\n\nexport type CommandTextAreaFilterFn = TextFilterFn;\n\nexport interface CubeCommandTextAreaProps<T>\n extends Omit<CubeTextInputBaseProps, 'children' | 'multiLine'> {\n /** Whether the textarea should resize to fit its content. */\n autoSize?: boolean;\n /** Max visible rows when `autoSize` is true. Defaults to 10. */\n maxRows?: number;\n /** Number of visible rows. Defaults to 3. */\n rows?: number;\n\n /** Command/option source (alternative to JSX children). */\n items?: Iterable<T>;\n /** Static items or a render function (same shape as ComboBox/ListBox). */\n children?: ReactNode | ((item: T) => ReactElement);\n /**\n * Triggers that open the autocomplete. Defaults to a single slash command\n * that must start at the beginning of the input.\n */\n triggers?: CommandTrigger[];\n /**\n * Custom filter. Pass `false` to disable internal filtering (server-side).\n */\n filter?: CommandTextAreaFilterFn | false;\n /**\n * Fired when the user picks a command (Enter/Tab/click). The option's\n * `textValue` is also inserted into the textarea regardless.\n *\n * `start` / `end` locate that insertion in the value handed to `onChange`, so\n * a consumer can anchor its own record to the picked item rather than\n * re-deriving the offset by searching the new value for the inserted text —\n * a search that cannot tell two occurrences apart when one option's text is a\n * prefix of another's.\n */\n onCommand?: (\n key: Key,\n item: {\n textValue: string;\n /** Index in the new value where the inserted text starts. */\n start: number;\n /** Index where it ends, excluding any inserted trailing space. */\n end: number;\n [k: string]: any;\n },\n ) => void;\n /**\n * Fired when the command popover opens or closes. Lets a consumer with its own\n * `Enter` behaviour tell \"pick the focused option\" from \"submit\" without\n * reading `aria-expanded` off the DOM.\n */\n onOpenChange?: (isOpen: boolean) => void;\n /**\n * Fired when the active trigger token changes, with the component's own\n * caret-aware scan result — `null` once the caret leaves a token. Saves a\n * consumer running a second, approximate scan of the same value.\n */\n onActiveTokenChange?: (token: ActiveToken | null) => void;\n /** Insert a trailing space after the chosen command. Defaults to true. */\n insertSpaceAfter?: boolean;\n /** Keys of disabled options. */\n disabledKeys?: Iterable<Key>;\n /** Popover placement. Chat inputs usually want `top`. Defaults to `top`. */\n direction?: 'bottom' | 'top';\n /** Whether the popover should flip when overflowing. Defaults to true. */\n shouldFlip?: boolean;\n /** Offset between the textarea and the popover. */\n overlayOffset?: number;\n /** Padding between the popover and the viewport edge. */\n containerPadding?: number;\n\n // Refs\n /** Ref for the textarea element. */\n inputRef?: RefObject<HTMLTextAreaElement>;\n /** Ref for the wrapper element (popover anchor). */\n wrapperRef?: RefObject<HTMLDivElement>;\n /** Ref for the popover overlay element. */\n popoverRef?: RefObject<HTMLDivElement>;\n /** Ref for the listbox element. */\n listBoxRef?: RefObject<HTMLDivElement>;\n /** Ref through which the internal list state is exposed. */\n listStateRef?: RefObject<ListStateLike | null>;\n\n // Style props\n overlayStyles?: any;\n listBoxStyles?: any;\n optionStyles?: any;\n sectionStyles?: any;\n headingStyles?: any;\n}\n\nconst DEFAULT_TRIGGERS: CommandTrigger[] = [{ char: '/', atLineStart: true }];\n\n// ---------------------------------------------------------------------------\n// Trigger parsing\n// ---------------------------------------------------------------------------\n\n/**\n * Inspect the textarea contents up to the caret and find the active trigger\n * token, if any. The token includes the trigger character and ends at the\n * caret (so it grows as the user types). A token ends at whitespace or the end\n * of the input.\n */\nexport function parseActiveToken(\n value: string,\n caret: number,\n triggers: CommandTrigger[],\n): ActiveToken | null {\n if (!triggers.length) return null;\n const before = value.slice(0, caret);\n const after = value.slice(caret);\n\n for (const trigger of triggers) {\n const ch = trigger.char;\n if (trigger.atLineStart) {\n // Line-start command: the trigger char must sit at the start of the line\n // the caret is on (right after a newline, or at index 0), with no\n // whitespace between it and the caret. On a single-line input with no\n // newlines this is equivalent to \"index 0 of the whole input\".\n const lineStart = before.lastIndexOf('\\n') + 1;\n const linePrefix = before.slice(lineStart);\n if (linePrefix[0] !== ch) continue;\n // No whitespace allowed within the token (after the trigger char).\n const wsIndex = linePrefix.slice(1).search(/\\s/);\n if (wsIndex !== -1) continue;\n if (!linePrefix) continue;\n return { trigger, token: linePrefix, start: lineStart, end: caret };\n }\n\n // Caret-token mode: find the last trigger char that begins a token at or\n // after a line start / whitespace boundary, with no whitespace between it\n // and the caret.\n const match = /(?:^|\\s)([\\S]+)$/.exec(before);\n if (!match) continue;\n const candidate = match[1];\n if (candidate[0] !== ch) continue;\n // Ensure the token hasn't already been closed by whitespace after caret.\n // (If there's non-whitespace after the caret, the user is mid-token.)\n const start = caret - candidate.length;\n // If immediately after the caret there's whitespace (or end), the token is\n // \"complete\" — still offer completions as long as the caret sits on the\n // token. We accept it.\n void after;\n return { trigger, token: candidate, start, end: caret };\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nfunction CommandTextArea<T extends object>(\n props: WithNullableValue<CubeCommandTextAreaProps<T>>,\n ref: ForwardedRef<HTMLElement>,\n) {\n props = castNullableStringValue(props);\n props = useFieldProps(props, {\n defaultValidationTrigger: 'onBlur',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: value?.toString() ?? '',\n }),\n });\n\n let {\n qa,\n autoSize = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n maxRows = 10,\n rows = 3,\n labelProps: userLabelProps,\n inputProps: userInputProps,\n inputRef: propsInputRef,\n value,\n defaultValue,\n placeholder,\n // command props\n items,\n children: renderChildren,\n triggers = DEFAULT_TRIGGERS,\n filter,\n onCommand,\n onOpenChange,\n onActiveTokenChange,\n insertSpaceAfter = true,\n disabledKeys,\n direction = 'top',\n shouldFlip = true,\n overlayOffset = 8,\n containerPadding = 8,\n overlayStyles,\n listBoxStyles,\n optionStyles,\n sectionStyles,\n headingStyles,\n wrapperRef: propsWrapperRef,\n popoverRef: propsPopoverRef,\n listBoxRef: propsListBoxRef,\n listStateRef: propsListStateRef,\n onKeyDown,\n onFocus,\n onBlur,\n ...otherProps\n } = props;\n\n rows = Math.max(rows, 1);\n maxRows = Math.max(maxRows, rows);\n\n // ---- refs -------------------------------------------------------------\n const localInputRef = useRef<HTMLTextAreaElement>(null);\n const inputRef = (propsInputRef ??\n localInputRef) as RefObject<HTMLTextAreaElement>;\n const wrapperRef = useCombinedRefs<HTMLDivElement>(propsWrapperRef);\n const popoverRef = useCombinedRefs<HTMLDivElement>(propsPopoverRef);\n const listBoxRef = useCombinedRefs<HTMLDivElement>(propsListBoxRef);\n const localListStateRef = useRef<ListStateLike | null>(null);\n const listStateRef = (propsListStateRef ??\n localListStateRef) as RefObject<ListStateLike | null>;\n\n const commandTextAreaId = useMemo(() => generateRandomId(), []);\n\n // ---- controlled / uncontrolled value ----------------------------------\n // When no `value` is provided (standalone, no form), track the text\n // internally so trigger detection and commit still work.\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n (value as string) ?? (defaultValue as string) ?? '',\n );\n const effectiveValue: string = isControlled\n ? (value as string)\n : internalValue;\n const handleChange = useEvent((next: string) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n });\n\n // ---- children / items normalization -----------------------------------\n let children: ReactNode = renderChildren as ReactNode;\n const renderFn = renderChildren as unknown;\n if (items && typeof renderFn === 'function') {\n const itemsArray = Array.from(items as Iterable<any>);\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n if (\n React.isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return React.cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n return rendered as ReactNode;\n });\n }\n\n // ---- caret tracking ---------------------------------------------------\n // The caret drives trigger detection. We keep it in state so a caret move\n // (arrow keys without typing) re-renders and recomputes the active token.\n const [caret, setCaret] = useState(() => effectiveValue.length);\n const syncCaret = useEvent(() => {\n const el = inputRef.current;\n if (!el) return;\n setCaret(el.selectionStart ?? el.value.length);\n });\n\n // ---- trigger detection ------------------------------------------------\n const activeToken = useMemo(\n () =>\n parseActiveToken(\n effectiveValue,\n Math.min(caret, effectiveValue.length),\n triggers,\n ),\n [effectiveValue, caret, triggers],\n );\n\n // The active token includes the trigger char (e.g. `/co`). Strip it before\n // filtering so the query is matched against the meaningful text — this lets\n // options match by their label/description (which don't contain the trigger\n // char) as well as by their `textValue`.\n const term = useMemo(() => {\n if (!activeToken) return '';\n const { token, trigger } = activeToken;\n return token.startsWith(trigger.char)\n ? token.slice(trigger.char.length)\n : token;\n }, [activeToken]);\n\n // ---- filtering --------------------------------------------------------\n const { contains } = useFilter({ sensitivity: 'base' });\n const textFilterFn = useMemo<CommandTextAreaFilterFn>(\n () => (filter === false ? () => true : filter || contains),\n [filter, contains],\n );\n\n // Local collection used to read option textValues and to count matches.\n const localCollectionState = useListState({\n children: children as any,\n items: items as any,\n selectionMode: 'none',\n });\n\n const filterFn = useCallback(\n (nodes: Iterable<any>) =>\n filterCollectionNodes(nodes, term, textFilterFn, {\n matchExtraFields: true,\n }),\n [term, textFilterFn],\n );\n\n // Keys of the currently visible (filtered) options, in display order.\n // Derived from our own local collection + filter (rather than the ListBox's\n // exposed state ref) so it is always in sync with the current token — the\n // ListBox's `stateRef.collection` can momentarily lag by a render right after\n // the token narrows, which would otherwise leave virtual focus on (and commit)\n // an option that is no longer visible.\n const visibleFilteredKeys = useMemo<Key[]>(() => {\n if (!activeToken) return [];\n const keys: Key[] = [];\n const disabled = disabledKeys ? new Set<Key>(disabledKeys) : undefined;\n collectVisibleKeys(\n filterFn(localCollectionState.collection),\n keys,\n disabled,\n );\n return keys;\n }, [activeToken, filterFn, localCollectionState.collection, disabledKeys]);\n\n const filteredCount = visibleFilteredKeys.length;\n\n // ---- dismiss handling (Escape keeps the text but hides the popover) ---\n const [dismissedToken, setDismissedToken] = useState<string | null>(null);\n // Bumped whenever we move the virtual focus so the textarea's\n // `aria-activedescendant` (read from the ListBox's stateRef at render time)\n // stays in sync — the ListBox's own state update does not re-render us.\n const [, setFocusTick] = useState(0);\n const bumpFocus = useEvent(() => setFocusTick((t) => t + 1));\n // Reset dismissal whenever the active token changes (user typed/backspaced).\n useEffect(() => {\n setDismissedToken((prev) =>\n prev != null && activeToken?.token !== prev ? null : prev,\n );\n }, [activeToken?.token]);\n\n const isCommandMode = !!activeToken && activeToken.token !== dismissedToken;\n const shouldShowPopover = isCommandMode && filteredCount > 0;\n\n // ---- reporting open state / active token to the consumer --------------\n // Both are already computed here; without these a consumer with its own\n // `Enter` handling has to read `aria-expanded` off the DOM and run a second,\n // approximate copy of the scan above — neither of which is a contract.\n // Seeded with the closed / no-token defaults so mounting in that state is not\n // reported as a change, while mounting with a `value` that already holds a\n // token is.\n const notifiedOpenRef = useRef(false);\n\n useEffect(() => {\n if (notifiedOpenRef.current === shouldShowPopover) return;\n\n notifiedOpenRef.current = shouldShowPopover;\n onOpenChange?.(shouldShowPopover);\n }, [shouldShowPopover, onOpenChange]);\n\n // `activeToken` is a fresh object on every value/caret change, so compare the\n // content rather than the identity — otherwise a consumer is re-notified for\n // a token that has not actually moved.\n const activeTokenSignature = activeToken\n ? `${activeToken.trigger.char}\\u0000${activeToken.token}\\u0000${activeToken.start}\\u0000${activeToken.end}`\n : null;\n const notifiedTokenRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (notifiedTokenRef.current === activeTokenSignature) return;\n\n notifiedTokenRef.current = activeTokenSignature;\n onActiveTokenChange?.(activeToken ?? null);\n // `activeToken` is intentionally not a dependency: the signature above is\n // its value-identity, and depending on the object would re-run this on every\n // keystroke that leaves the token unchanged.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeTokenSignature, onActiveTokenChange]);\n\n // ---- caret-anchored popover ------------------------------------------\n // A zero-size element positioned at the caret (both axes) drives the\n // popover's geometry; the wrapper remains the dismiss/outside-click trigger.\n const { anchorRef: caretAnchorRef, positionApiRef } = useCaretAnchor({\n inputRef: inputRef as RefObject<HTMLTextAreaElement>,\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n caret,\n value: effectiveValue,\n isActive: shouldShowPopover,\n });\n\n // ---- height autosize (shared with TextArea) ---------------------------\n const adjustHeight = useAutoSizeTextArea({\n inputRef,\n autoSize,\n rows,\n maxRows,\n value: effectiveValue,\n });\n\n // ---- useTextField (ARIA wiring for the textarea) ----------------------\n let { labelProps, inputProps } = useTextField(\n {\n ...otherProps,\n value: effectiveValue,\n placeholder,\n isDisabled,\n isReadOnly,\n isRequired,\n onChange: chain(handleChange, adjustHeight),\n inputElementType: 'textarea',\n } as any,\n inputRef as any,\n );\n\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const useEnvironmentalEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n // ---- caret restore after commit --------------------------------------\n const pendingCaretRef = useRef<number | null>(null);\n useEnvironmentalEffect(() => {\n const el = inputRef.current;\n if (!el) return;\n\n if (pendingCaretRef.current != null) {\n // Restore caret after we programmatically inserted a command.\n const pos = pendingCaretRef.current;\n pendingCaretRef.current = null;\n el.focus();\n el.setSelectionRange(pos, pos);\n setCaret(pos);\n return;\n }\n\n // The value changed without our own commit (controlled update from\n // outside, form reset, or defaultValue seeding). Resync the caret from\n // the DOM selection so trigger parsing works off a valid index instead of\n // a stale one. We intentionally do not steal focus here.\n const domCaret = el.selectionStart ?? el.value.length;\n setCaret((prev) => (prev === domCaret ? prev : domCaret));\n }, [effectiveValue]);\n\n // ---- helpers ----------------------------------------------------------\n const getItemTextValue = useCallback(\n (key: Key): string => {\n const item = localCollectionState?.collection?.getItem(key);\n return item?.textValue || String(key);\n },\n [localCollectionState?.collection],\n );\n\n // ---- commit (insert the chosen option's literal value) ---------------\n const commit = useEvent((key: Key) => {\n const listState = listStateRef.current;\n // Guard against committing a stale key that has been filtered out of the\n // visible list (e.g. the token was narrowed after focus landed on it).\n // Fall back to the first still-visible option so the inserted command\n // always matches what the user can see.\n if (visibleFilteredKeys.length > 0 && !visibleFilteredKeys.includes(key)) {\n key = visibleFilteredKeys[0];\n }\n const textValue = getItemTextValue(key);\n const token = activeToken;\n const el = inputRef.current;\n\n // Where the inserted text lands in the new value. Both branches below\n // already compute this to place the caret; it is reported through\n // `onCommand` instead of being thrown away. `end` excludes the trailing\n // space, which is padding around the insertion rather than part of it.\n let start = Math.min(caret, effectiveValue.length);\n\n if (token) {\n const next =\n effectiveValue.slice(0, token.start) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(token.end);\n const caretPos =\n token.start + textValue.length + (insertSpaceAfter ? 1 : 0);\n start = token.start;\n pendingCaretRef.current = caretPos;\n handleChange(next);\n // If controlled, caret is restored by the effect above; if not, set now.\n if (el) {\n el.focus();\n try {\n el.setSelectionRange(caretPos, caretPos);\n } catch {\n /* noop */\n }\n }\n } else if (el) {\n // Fallback: insert at caret.\n const selectionStart = el.selectionStart ?? effectiveValue.length;\n const selectionEnd = el.selectionEnd ?? effectiveValue.length;\n const next =\n effectiveValue.slice(0, selectionStart) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(selectionEnd);\n const caretPos =\n selectionStart + textValue.length + (insertSpaceAfter ? 1 : 0);\n start = selectionStart;\n pendingCaretRef.current = caretPos;\n handleChange(next);\n }\n\n setDismissedToken(null);\n onCommand?.(key, {\n textValue,\n ...((\n listState?.collection as Collection<Node<unknown>> | undefined\n )?.getItem(key)?.props ?? {}),\n // After the item's own props: the range is the component's measurement of\n // what it just did, so an item that happens to carry a `start`/`end` prop\n // must not shadow it.\n start,\n end: start + textValue.length,\n });\n });\n\n // ---- keyboard navigation (only while the popover is open) -------------\n const onKeyDownHandler = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n if (!shouldShowPopover) {\n // While not in command mode, the textarea behaves normally; but clear\n // any dismissal when the user edits.\n return;\n }\n\n const listState = listStateRef.current;\n\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n if (!listState) return;\n e.preventDefault();\n const nextKey = getNextVisibleKey(\n listState,\n e.key === 'ArrowDown' ? 1 : -1,\n );\n if (nextKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(nextKey);\n bumpFocus();\n }\n } else if (e.key === 'Home' || e.key === 'End') {\n if (!listState) return;\n e.preventDefault();\n const edgeKey = getEdgeVisibleKey(\n listState,\n e.key === 'Home' ? 'first' : 'last',\n );\n if (edgeKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(edgeKey);\n bumpFocus();\n }\n } else if (e.key === 'Enter' || e.key === 'Tab') {\n if (!listState) return;\n const focused = listState.selectionManager.focusedKey;\n if (focused != null) {\n e.preventDefault();\n commit(focused);\n }\n // Otherwise pass through (newline / form submit / tab navigation).\n } else if (e.key === 'Escape') {\n e.preventDefault();\n if (activeToken) {\n setDismissedToken(activeToken.token);\n }\n }\n },\n [shouldShowPopover, activeToken, commit, onKeyDown, listStateRef],\n );\n\n // ---- initial focus on the first option when the popover opens ---------\n const focusInitAttemptsRef = useRef(0);\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n focusInitAttemptsRef.current = 0;\n\n const tick = () => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) {\n focusInitAttemptsRef.current += 1;\n if (focusInitAttemptsRef.current < 8) {\n requestAnimationFrame(tick);\n }\n return;\n }\n if (listState.selectionManager.focusedKey == null) {\n const first = getEdgeVisibleKey(listState, 'first');\n if (first != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(first);\n bumpFocus();\n }\n }\n };\n\n requestAnimationFrame(() => requestAnimationFrame(tick));\n }, [shouldShowPopover]);\n\n // ---- keep virtual focus valid as the filtered list narrows -----------\n // When the user narrows the token, the previously focused option may drop\n // out of the filtered list. Move focus to the first still-visible option so\n // the highlight and any Enter/Tab commit stay in sync with what's shown.\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) return;\n\n if (visibleFilteredKeys.length === 0) return;\n\n const focused = listState.selectionManager.focusedKey;\n if (focused == null || !visibleFilteredKeys.includes(focused)) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(visibleFilteredKeys[0]);\n bumpFocus();\n }\n }, [visibleFilteredKeys, shouldShowPopover]);\n\n // ---- composite focus (wrapper + portaled popover) ---------------------\n const { compositeFocusProps } = useCompositeFocus({\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n popoverRef: popoverRef as RefObject<HTMLElement>,\n onFocus,\n onBlur,\n isDisabled,\n });\n\n // ---- aria-activedescendant -------------------------------------------\n const focusedKey = listStateRef.current?.selectionManager.focusedKey ?? null;\n const listBoxId = `CommandTextAreaListBox-${commandTextAreaId}`;\n\n // ---- popover width ----------------------------------------------------\n // The popover is anchored to the caret (a point), so it must not be sized to\n // the textarea. We use the same default as the shared `ListBoxPopover` /\n // `Picker` popovers: a `30x` floor (240px), `max-content` preferred, `50vw`\n // cap. The concrete floor keeps the virtualized ListBox from collapsing to a\n // sliver (it has no intrinsic width), and `max-content` lets short option\n // lists size to their content. The user's `overlayStyles` still win on top.\n const popoverOverlayStyles: Styles = {\n width: '30x max-content 50vw',\n ...overlayStyles,\n };\n\n // ---- assemble input props ---------------------------------------------\n const commandInputProps = mergeProps(\n inputProps,\n {\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': shouldShowPopover,\n 'aria-haspopup': 'listbox',\n 'aria-controls': shouldShowPopover ? listBoxId : undefined,\n 'aria-activedescendant':\n shouldShowPopover && focusedKey != null\n ? `ListBoxItem-${focusedKey}`\n : undefined,\n onKeyDown: onKeyDownHandler,\n onSelect: syncCaret,\n onKeyUp: syncCaret,\n onClick: syncCaret,\n 'data-input-type': 'command-textarea',\n },\n userInputProps,\n );\n\n // ---- render -----------------------------------------------------------\n const field = (\n <TextInputBase\n ref={ref as any}\n {...otherProps}\n multiLine\n qa={qa}\n inputRef={inputRef}\n wrapperRef={wrapperRef}\n wrapperProps={compositeFocusProps}\n labelProps={mergedLabelProps}\n inputProps={commandInputProps}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n rows={rows}\n />\n );\n\n return (\n <>\n {field}\n <ListBoxPopover\n isOpen={shouldShowPopover}\n triggerRef={wrapperRef as RefObject<HTMLElement>}\n positionTargetRef={caretAnchorRef as RefObject<Element | null>}\n positionApiRef={positionApiRef}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n direction={direction}\n shouldFlip={shouldFlip}\n overlayOffset={overlayOffset}\n containerPadding={containerPadding}\n listBoxId={listBoxId}\n overlayStyles={popoverOverlayStyles}\n listBoxStyles={listBoxStyles}\n optionStyles={optionStyles}\n optionHighlight={term}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n isDisabled={isDisabled}\n disabledKeys={disabledKeys}\n items={items as any}\n listStateRef={listStateRef}\n ariaLabel={\n (props as any)['aria-label'] ||\n (typeof otherProps.label === 'string' ? otherProps.label : 'Commands')\n }\n compositeFocusProps={compositeFocusProps}\n filter={filterFn}\n onClose={() => {\n if (activeToken) setDismissedToken(activeToken.token);\n }}\n onSelectionChange={(selection) => {\n const key = Array.isArray(selection) ? selection[0] : selection;\n if (key != null) commit(key);\n }}\n >\n {children as any}\n </ListBoxPopover>\n </>\n );\n}\n\nconst _CommandTextArea = forwardRef(CommandTextArea) as unknown as (<T>(\n props: CubeCommandTextAreaProps<T> & {\n ref?: ForwardedRef<HTMLElement>;\n },\n) => ReactElement) & {\n Item: typeof Item;\n Section: typeof BaseSection;\n};\n\nObject.assign(_CommandTextArea, {\n Item,\n Section: BaseSection,\n displayName: 'CommandTextArea',\n});\n\nObject.defineProperty(_CommandTextArea, 'cubeInputType', {\n value: 'CommandTextArea',\n enumerable: false,\n configurable: false,\n});\n\nexport { _CommandTextArea as CommandTextArea };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqKA,MAAM0F,mBAAqC,CAAC;CAAE7C,MAAM;CAAKC,aAAa;CAAM,CAAC;;;;;;;AAY7E,SAAgB6C,iBACdC,OACAC,OACA9B,UACoB;AACpB,KAAI,CAACA,SAAS+B,OAAQ,QAAO;CAC7B,MAAMC,SAASH,MAAMI,MAAM,GAAGH,MAAM;AACtBD,OAAMI,MAAMH,MAAM;AAEhC,MAAK,MAAM7C,WAAWe,UAAU;EAC9B,MAAMmC,KAAKlD,QAAQH;AACnB,MAAIG,QAAQF,aAAa;GAKvB,MAAMqD,YAAYJ,OAAOK,YAAY,KAAK,GAAG;GAC7C,MAAMC,aAAaN,OAAOC,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BAAiB;CACvDtJ,OAAO;CACP2J,YAAY;CACZC,cAAc;CACf,CAAC"}
@@ -1,4 +1,4 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.182.0 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.183.0 | Cube Dev Team */
2
2
  //#region src/components/fields/CommandTextArea/caretPosition.ts
3
3
  const MIRROR_STYLES = [
4
4
  "boxSizing",
@@ -1 +1 @@
1
- {"version":3,"file":"caretPosition.js","names":[],"sources":["../../../../src/components/fields/CommandTextArea/caretPosition.ts"],"sourcesContent":["/**\n * Computes the caret's position for a `<textarea>` using a mirror-element\n * technique. jsdom returns zeros (no layout), but in a real browser this gives\n * the caret's viewport coordinates and its line height, so a popover can be\n * anchored to it.\n */\n\nexport interface CaretRect {\n /** Caret left edge, in viewport coordinates (px). */\n left: number;\n /** Caret top edge, in viewport coordinates (px). */\n top: number;\n /** Caret height (the textarea's line height), in px. */\n height: number;\n}\n\n// Computed styles that affect text wrapping / caret placement inside a textarea.\nconst MIRROR_STYLES = [\n 'boxSizing',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n 'wordBreak',\n 'overflowWrap',\n] as const satisfies ReadonlyArray<keyof CSSStyleDeclaration>;\n\n/**\n * Returns the viewport-space rect of the caret at `index` within `textarea`,\n * or `null` if it can't be measured (e.g. jsdom, no layout, detached node).\n */\nexport function getCaretRect(\n textarea: HTMLTextAreaElement,\n index: number,\n): CaretRect | null {\n if (typeof document === 'undefined') return null;\n\n const doc = textarea.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(textarea);\n if (!style) return null;\n\n // Bail out in environments without real layout (jsdom reports 0x0).\n const box = textarea.getBoundingClientRect();\n if (box.width === 0 && box.height === 0) return null;\n\n const mirror = doc.createElement('div');\n mirror.setAttribute('data-caret-mirror', '');\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n mirror.style.top = '0';\n mirror.style.left = '0';\n // Prevent the mirror from affecting scroll/anchor lookups.\n mirror.style.overflow = 'hidden';\n\n for (const prop of MIRROR_STYLES) {\n const value = style[prop];\n if (value != null) {\n mirror.style.setProperty(\n prop.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase()),\n value,\n );\n }\n }\n\n // Match the textarea's content width, not its border-box scroll width.\n mirror.style.width = style.width;\n\n const value = textarea.value;\n const before = value.slice(0, index);\n const after = value.slice(index) || '.';\n\n mirror.textContent = before;\n\n const marker = doc.createElement('span');\n marker.textContent = after;\n marker.style.display = 'inline-block';\n mirror.appendChild(marker);\n\n // The mirror must be attached to the same document to inherit fonts.\n doc.body.appendChild(mirror);\n\n let rect: CaretRect | null = null;\n try {\n const mirrorRect = mirror.getBoundingClientRect();\n const markerRect = marker.getBoundingClientRect();\n // The mirror is not scrolled, so subtract the textarea's scroll to map the\n // unscrolled caret offset back into viewport space.\n const { scrollTop, scrollLeft } = textarea;\n rect = {\n left: box.left - scrollLeft + (markerRect.left - mirrorRect.left),\n top: box.top - scrollTop + (markerRect.top - mirrorRect.top),\n height: markerRect.height || parseFloat(style.lineHeight) || 0,\n };\n } finally {\n mirror.remove();\n }\n\n return rect.height > 0 ? rect : null;\n}\n"],"mappings":";;AAiBA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;C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AW;GACxD,QAAQ,WAAW,UAAU,WAAW,MAAM,WAAW,IAAI;GAC9D;WACO;AACR,SAAO,QAAQ;;AAGjB,QAAO,KAAK,SAAS,IAAI,OAAO"}
1
+ {"version":3,"file":"caretPosition.js","names":["CaretRect","left","top","height","MIRROR_STYLES","const","ReadonlyArray","CSSStyleDeclaration","getCaretRect","textarea","HTMLTextAreaElement","index","document","doc","ownerDocument","style","defaultView","getComputedStyle","box","getBoundingClientRect","width","mirror","createElement","setAttribute","position","visibility","whiteSpace","wordWrap","overflow","prop","value","setProperty","replace","m","toLowerCase","before","slice","after","textContent","marker","display","appendChild","body","rect","mirrorRect","markerRect","scrollTop","scrollLeft","parseFloat","lineHeight","remove"],"sources":["../../../../src/components/fields/CommandTextArea/caretPosition.ts"],"sourcesContent":["/**\n * Computes the caret's position for a `<textarea>` using a mirror-element\n * technique. jsdom returns zeros (no layout), but in a real browser this gives\n * the caret's viewport coordinates and its line height, so a popover can be\n * anchored to it.\n */\n\nexport interface CaretRect {\n /** Caret left edge, in viewport coordinates (px). */\n left: number;\n /** Caret top edge, in viewport coordinates (px). */\n top: number;\n /** Caret height (the textarea's line height), in px. */\n height: number;\n}\n\n// Computed styles that affect text wrapping / caret placement inside a textarea.\nconst MIRROR_STYLES = [\n 'boxSizing',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n 'wordBreak',\n 'overflowWrap',\n] as const satisfies ReadonlyArray<keyof CSSStyleDeclaration>;\n\n/**\n * Returns the viewport-space rect of the caret at `index` within `textarea`,\n * or `null` if it can't be measured (e.g. jsdom, no layout, detached node).\n */\nexport function getCaretRect(\n textarea: HTMLTextAreaElement,\n index: number,\n): CaretRect | null {\n if (typeof document === 'undefined') return null;\n\n const doc = textarea.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(textarea);\n if (!style) return null;\n\n // Bail out in environments without real layout (jsdom reports 0x0).\n const box = textarea.getBoundingClientRect();\n if (box.width === 0 && box.height === 0) return null;\n\n const mirror = doc.createElement('div');\n mirror.setAttribute('data-caret-mirror', '');\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n mirror.style.top = '0';\n mirror.style.left = '0';\n // Prevent the mirror from affecting scroll/anchor lookups.\n mirror.style.overflow = 'hidden';\n\n for (const prop of MIRROR_STYLES) {\n const value = style[prop];\n if (value != null) {\n mirror.style.setProperty(\n prop.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase()),\n value,\n );\n }\n }\n\n // Match the textarea's content width, not its border-box scroll width.\n mirror.style.width = style.width;\n\n const value = textarea.value;\n const before = value.slice(0, index);\n const after = value.slice(index) || '.';\n\n mirror.textContent = before;\n\n const marker = doc.createElement('span');\n marker.textContent = after;\n marker.style.display = 'inline-block';\n mirror.appendChild(marker);\n\n // The mirror must be attached to the same document to inherit fonts.\n doc.body.appendChild(mirror);\n\n let rect: CaretRect | null = null;\n try {\n const mirrorRect = mirror.getBoundingClientRect();\n const markerRect = marker.getBoundingClientRect();\n // The mirror is not scrolled, so subtract the textarea's scroll to map the\n // unscrolled caret offset back into viewport space.\n const { scrollTop, scrollLeft } = textarea;\n rect = {\n left: box.left - scrollLeft + (markerRect.left - mirrorRect.left),\n top: box.top - scrollTop + (markerRect.top - mirrorRect.top),\n height: markerRect.height || parseFloat(style.lineHeight) || 0,\n };\n } finally {\n mirror.remove();\n }\n\n return rect.height > 0 ? rect : null;\n}\n"],"mappings":";;A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