@seekalfred/primitives 0.6.0 → 0.7.3

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 (346) hide show
  1. package/README.md +214 -15
  2. package/dist/activity-heatmap/activity-heatmap.d.ts +92 -0
  3. package/dist/activity-heatmap/activity-heatmap.js +699 -0
  4. package/dist/activity-heatmap/activity-heatmap.js.map +1 -0
  5. package/dist/activity-heatmap/index.d.ts +2 -0
  6. package/dist/activity-heatmap/index.js +2 -0
  7. package/dist/alert/alert.d.ts +53 -4
  8. package/dist/alert/alert.js +100 -11
  9. package/dist/alert/alert.js.map +1 -1
  10. package/dist/alert/index.d.ts +2 -2
  11. package/dist/alert/index.js +2 -2
  12. package/dist/alert-dialog/alert-dialog.d.ts +58 -18
  13. package/dist/alert-dialog/alert-dialog.js +152 -9
  14. package/dist/alert-dialog/alert-dialog.js.map +1 -1
  15. package/dist/alert-dialog/index.d.ts +2 -2
  16. package/dist/alert-dialog/index.js +2 -2
  17. package/dist/animated-counter/animated-counter.d.ts +38 -0
  18. package/dist/animated-counter/animated-counter.js +230 -0
  19. package/dist/animated-counter/animated-counter.js.map +1 -0
  20. package/dist/animated-counter/index.d.ts +2 -0
  21. package/dist/animated-counter/index.js +2 -0
  22. package/dist/announcement-bar/announcement-bar.d.ts +67 -0
  23. package/dist/announcement-bar/announcement-bar.js +364 -0
  24. package/dist/announcement-bar/announcement-bar.js.map +1 -0
  25. package/dist/announcement-bar/index.d.ts +2 -0
  26. package/dist/announcement-bar/index.js +2 -0
  27. package/dist/badge/badge.d.ts +1 -1
  28. package/dist/bar-chart/bar-chart.d.ts +51 -0
  29. package/dist/bar-chart/bar-chart.js +565 -0
  30. package/dist/bar-chart/bar-chart.js.map +1 -0
  31. package/dist/bar-chart/index.d.ts +2 -0
  32. package/dist/bar-chart/index.js +2 -0
  33. package/dist/breadcrumb/breadcrumb.d.ts +2 -2
  34. package/dist/breadcrumb/breadcrumb.js +12 -3
  35. package/dist/breadcrumb/breadcrumb.js.map +1 -1
  36. package/dist/brush-chart/brush-chart.d.ts +64 -0
  37. package/dist/brush-chart/brush-chart.js +1056 -0
  38. package/dist/brush-chart/brush-chart.js.map +1 -0
  39. package/dist/brush-chart/index.d.ts +2 -0
  40. package/dist/brush-chart/index.js +2 -0
  41. package/dist/button/button.d.ts +1 -1
  42. package/dist/button/button.js +31 -21
  43. package/dist/button/button.js.map +1 -1
  44. package/dist/button-group/button-group.js +3 -4
  45. package/dist/button-group/button-group.js.map +1 -1
  46. package/dist/calendar/calendar.d.ts +1 -1
  47. package/dist/card/card.d.ts +22 -1
  48. package/dist/card/card.js +60 -7
  49. package/dist/card/card.js.map +1 -1
  50. package/dist/card-stack/card-stack.d.ts +54 -0
  51. package/dist/card-stack/card-stack.js +492 -0
  52. package/dist/card-stack/card-stack.js.map +1 -0
  53. package/dist/card-stack/index.d.ts +2 -0
  54. package/dist/card-stack/index.js +2 -0
  55. package/dist/carousel/carousel.d.ts +77 -0
  56. package/dist/carousel/carousel.js +415 -0
  57. package/dist/carousel/carousel.js.map +1 -0
  58. package/dist/carousel/index.d.ts +2 -0
  59. package/dist/carousel/index.js +2 -0
  60. package/dist/checkbox/checkbox.js +4 -4
  61. package/dist/checkbox/checkbox.js.map +1 -1
  62. package/dist/chip-group/chip-group.d.ts +37 -0
  63. package/dist/chip-group/chip-group.js +148 -0
  64. package/dist/chip-group/chip-group.js.map +1 -0
  65. package/dist/chip-group/index.d.ts +2 -0
  66. package/dist/chip-group/index.js +2 -0
  67. package/dist/copy-button/copy-button.d.ts +18 -2
  68. package/dist/copy-button/copy-button.js +29 -8
  69. package/dist/copy-button/copy-button.js.map +1 -1
  70. package/dist/countdown/countdown.d.ts +45 -0
  71. package/dist/countdown/countdown.js +298 -0
  72. package/dist/countdown/countdown.js.map +1 -0
  73. package/dist/countdown/index.d.ts +2 -0
  74. package/dist/countdown/index.js +2 -0
  75. package/dist/date-picker/picker-parts.js +1 -1
  76. package/dist/date-picker/picker-parts.js.map +1 -1
  77. package/dist/dialog/dialog.js +1 -1
  78. package/dist/dialog/dialog.js.map +1 -1
  79. package/dist/donut-chart/donut-chart.d.ts +86 -0
  80. package/dist/donut-chart/donut-chart.js +593 -0
  81. package/dist/donut-chart/donut-chart.js.map +1 -0
  82. package/dist/donut-chart/index.d.ts +2 -0
  83. package/dist/donut-chart/index.js +2 -0
  84. package/dist/empty-state/empty-state.d.ts +42 -10
  85. package/dist/empty-state/empty-state.js +44 -26
  86. package/dist/empty-state/empty-state.js.map +1 -1
  87. package/dist/empty-state/index.d.ts +2 -2
  88. package/dist/empty-state/index.js +2 -2
  89. package/dist/file-drop-zone/file-drop-zone.js +1 -1
  90. package/dist/file-drop-zone/file-drop-zone.js.map +1 -1
  91. package/dist/filter-bar/filter-bar.d.ts +50 -26
  92. package/dist/filter-bar/filter-bar.js +317 -157
  93. package/dist/filter-bar/filter-bar.js.map +1 -1
  94. package/dist/gauge/gauge.d.ts +45 -0
  95. package/dist/gauge/gauge.js +219 -0
  96. package/dist/gauge/gauge.js.map +1 -0
  97. package/dist/gauge/index.d.ts +2 -0
  98. package/dist/gauge/index.js +2 -0
  99. package/dist/in-view-title/in-view-title.d.ts +33 -0
  100. package/dist/in-view-title/in-view-title.js +119 -0
  101. package/dist/in-view-title/in-view-title.js.map +1 -0
  102. package/dist/in-view-title/index.d.ts +2 -0
  103. package/dist/in-view-title/index.js +2 -0
  104. package/dist/index.d.ts +53 -10
  105. package/dist/index.js +52 -12
  106. package/dist/input/input.js +4 -4
  107. package/dist/input/input.js.map +1 -1
  108. package/dist/lib/cn.js +11 -1
  109. package/dist/lib/cn.js.map +1 -1
  110. package/dist/lib/field-message.js +28 -10
  111. package/dist/lib/field-message.js.map +1 -1
  112. package/dist/lib/field-shell.js +10 -3
  113. package/dist/lib/field-shell.js.map +1 -1
  114. package/dist/lib/field-surface.js +31 -9
  115. package/dist/lib/field-surface.js.map +1 -1
  116. package/dist/lib/flag-emoji.js +50 -0
  117. package/dist/lib/flag-emoji.js.map +1 -0
  118. package/dist/lib/flip.js +11 -3
  119. package/dist/lib/flip.js.map +1 -1
  120. package/dist/lib/menu-highlight.js +64 -0
  121. package/dist/lib/menu-highlight.js.map +1 -0
  122. package/dist/lib/motion.js +9 -2
  123. package/dist/lib/motion.js.map +1 -1
  124. package/dist/lib/rolling-value.js +1 -1
  125. package/dist/lib/rolling-value.js.map +1 -1
  126. package/dist/lib/spring-tween.js +500 -0
  127. package/dist/lib/spring-tween.js.map +1 -0
  128. package/dist/lib/swap-text.js +3 -1
  129. package/dist/lib/swap-text.js.map +1 -1
  130. package/dist/lib/use-copy-feedback.js +17 -3
  131. package/dist/lib/use-copy-feedback.js.map +1 -1
  132. package/dist/line-chart/index.d.ts +2 -0
  133. package/dist/line-chart/index.js +2 -0
  134. package/dist/line-chart/line-chart.d.ts +116 -0
  135. package/dist/line-chart/line-chart.js +740 -0
  136. package/dist/line-chart/line-chart.js.map +1 -0
  137. package/dist/mention-input/index.d.ts +2 -0
  138. package/dist/mention-input/index.js +2 -0
  139. package/dist/mention-input/mention-input.d.ts +98 -0
  140. package/dist/mention-input/mention-input.js +576 -0
  141. package/dist/mention-input/mention-input.js.map +1 -0
  142. package/dist/menu/menu.d.ts +2 -0
  143. package/dist/menu/menu.js +23 -12
  144. package/dist/menu/menu.js.map +1 -1
  145. package/dist/money-input/index.d.ts +2 -0
  146. package/dist/money-input/index.js +2 -0
  147. package/dist/money-input/money-input.d.ts +86 -0
  148. package/dist/money-input/money-input.js +613 -0
  149. package/dist/money-input/money-input.js.map +1 -0
  150. package/dist/morph-select/index.d.ts +2 -0
  151. package/dist/morph-select/index.js +2 -0
  152. package/dist/morph-select/morph-select.d.ts +89 -0
  153. package/dist/morph-select/morph-select.js +712 -0
  154. package/dist/morph-select/morph-select.js.map +1 -0
  155. package/dist/multi-select/index.d.ts +2 -0
  156. package/dist/multi-select/index.js +2 -0
  157. package/dist/multi-select/multi-select.d.ts +77 -0
  158. package/dist/multi-select/multi-select.js +209 -0
  159. package/dist/multi-select/multi-select.js.map +1 -0
  160. package/dist/number-field/index.d.ts +2 -0
  161. package/dist/number-field/index.js +2 -0
  162. package/dist/number-field/number-field.d.ts +42 -0
  163. package/dist/number-field/number-field.js +199 -0
  164. package/dist/number-field/number-field.js.map +1 -0
  165. package/dist/onboarding-checklist/index.d.ts +2 -0
  166. package/dist/onboarding-checklist/index.js +2 -0
  167. package/dist/onboarding-checklist/onboarding-checklist.d.ts +55 -0
  168. package/dist/onboarding-checklist/onboarding-checklist.js +577 -0
  169. package/dist/onboarding-checklist/onboarding-checklist.js.map +1 -0
  170. package/dist/password-field/password-field.d.ts +16 -0
  171. package/dist/password-field/password-field.js +39 -10
  172. package/dist/password-field/password-field.js.map +1 -1
  173. package/dist/phone-input/index.d.ts +3 -0
  174. package/dist/phone-input/index.js +3 -0
  175. package/dist/phone-input/phone-countries.d.ts +29 -0
  176. package/dist/phone-input/phone-countries.js +170 -0
  177. package/dist/phone-input/phone-countries.js.map +1 -0
  178. package/dist/phone-input/phone-input.d.ts +66 -0
  179. package/dist/phone-input/phone-input.js +440 -0
  180. package/dist/phone-input/phone-input.js.map +1 -0
  181. package/dist/popover/index.d.ts +2 -2
  182. package/dist/popover/index.js +2 -2
  183. package/dist/popover/popover.d.ts +51 -2
  184. package/dist/popover/popover.js +59 -8
  185. package/dist/popover/popover.js.map +1 -1
  186. package/dist/progress/progress.d.ts +16 -2
  187. package/dist/progress/progress.js +16 -9
  188. package/dist/progress/progress.js.map +1 -1
  189. package/dist/radio-group/index.d.ts +2 -2
  190. package/dist/radio-group/index.js +2 -2
  191. package/dist/radio-group/radio-group.d.ts +33 -3
  192. package/dist/radio-group/radio-group.js +110 -10
  193. package/dist/radio-group/radio-group.js.map +1 -1
  194. package/dist/reactions/index.d.ts +2 -0
  195. package/dist/reactions/index.js +2 -0
  196. package/dist/reactions/reactions.d.ts +50 -0
  197. package/dist/reactions/reactions.js +315 -0
  198. package/dist/reactions/reactions.js.map +1 -0
  199. package/dist/rich-text-editor/index.d.ts +3 -0
  200. package/dist/rich-text-editor/index.js +2 -0
  201. package/dist/rich-text-editor/rich-text-editor.d.ts +70 -0
  202. package/dist/rich-text-editor/rich-text-editor.js +909 -0
  203. package/dist/rich-text-editor/rich-text-editor.js.map +1 -0
  204. package/dist/rich-text-editor/rich-text-engine.d.ts +16 -0
  205. package/dist/rich-text-editor/rich-text-engine.js +366 -0
  206. package/dist/rich-text-editor/rich-text-engine.js.map +1 -0
  207. package/dist/rich-text-editor/rich-text-html.js +174 -0
  208. package/dist/rich-text-editor/rich-text-html.js.map +1 -0
  209. package/dist/rich-text-editor/rich-text-icons.js +43 -0
  210. package/dist/rich-text-editor/rich-text-icons.js.map +1 -0
  211. package/dist/ridgeline/index.d.ts +2 -0
  212. package/dist/ridgeline/index.js +2 -0
  213. package/dist/ridgeline/ridgeline.d.ts +55 -0
  214. package/dist/ridgeline/ridgeline.js +701 -0
  215. package/dist/ridgeline/ridgeline.js.map +1 -0
  216. package/dist/scroll-area/index.d.ts +2 -2
  217. package/dist/scroll-area/index.js +2 -2
  218. package/dist/scroll-area/scroll-area.d.ts +68 -31
  219. package/dist/scroll-area/scroll-area.js +212 -62
  220. package/dist/scroll-area/scroll-area.js.map +1 -1
  221. package/dist/scrub-input/evaluate.d.ts +14 -0
  222. package/dist/scrub-input/evaluate.js +72 -0
  223. package/dist/scrub-input/evaluate.js.map +1 -0
  224. package/dist/scrub-input/index.d.ts +3 -0
  225. package/dist/scrub-input/index.js +3 -0
  226. package/dist/scrub-input/scrub-input.d.ts +74 -0
  227. package/dist/scrub-input/scrub-input.js +486 -0
  228. package/dist/scrub-input/scrub-input.js.map +1 -0
  229. package/dist/search-field/search-field.d.ts +24 -2
  230. package/dist/search-field/search-field.js +24 -9
  231. package/dist/search-field/search-field.js.map +1 -1
  232. package/dist/select/select.d.ts +3 -1
  233. package/dist/select/select.js +28 -14
  234. package/dist/select/select.js.map +1 -1
  235. package/dist/separator/separator.d.ts +22 -10
  236. package/dist/separator/separator.js +33 -11
  237. package/dist/separator/separator.js.map +1 -1
  238. package/dist/sheet/sheet.js +2 -1
  239. package/dist/sheet/sheet.js.map +1 -1
  240. package/dist/shortcut-recorder/index.d.ts +3 -0
  241. package/dist/shortcut-recorder/index.js +3 -0
  242. package/dist/shortcut-recorder/shortcut-model.d.ts +27 -0
  243. package/dist/shortcut-recorder/shortcut-model.js +206 -0
  244. package/dist/shortcut-recorder/shortcut-model.js.map +1 -0
  245. package/dist/shortcut-recorder/shortcut-recorder.d.ts +93 -0
  246. package/dist/shortcut-recorder/shortcut-recorder.js +489 -0
  247. package/dist/shortcut-recorder/shortcut-recorder.js.map +1 -0
  248. package/dist/slider/index.d.ts +2 -2
  249. package/dist/slider/slider.d.ts +46 -14
  250. package/dist/slider/slider.js +151 -67
  251. package/dist/slider/slider.js.map +1 -1
  252. package/dist/slope-chart/index.d.ts +2 -0
  253. package/dist/slope-chart/index.js +2 -0
  254. package/dist/slope-chart/slope-chart.d.ts +54 -0
  255. package/dist/slope-chart/slope-chart.js +568 -0
  256. package/dist/slope-chart/slope-chart.js.map +1 -0
  257. package/dist/sparkline/index.d.ts +2 -0
  258. package/dist/sparkline/index.js +2 -0
  259. package/dist/sparkline/sparkline.d.ts +46 -0
  260. package/dist/sparkline/sparkline.js +390 -0
  261. package/dist/sparkline/sparkline.js.map +1 -0
  262. package/dist/split-bar/index.d.ts +2 -0
  263. package/dist/split-bar/index.js +2 -0
  264. package/dist/split-bar/split-bar.d.ts +62 -0
  265. package/dist/split-bar/split-bar.js +513 -0
  266. package/dist/split-bar/split-bar.js.map +1 -0
  267. package/dist/split-button/split-button.d.ts +1 -1
  268. package/dist/split-button/split-button.js +12 -11
  269. package/dist/split-button/split-button.js.map +1 -1
  270. package/dist/stat-card/index.d.ts +2 -2
  271. package/dist/stat-card/index.js +2 -2
  272. package/dist/stat-card/stat-card.d.ts +58 -5
  273. package/dist/stat-card/stat-card.js +144 -17
  274. package/dist/stat-card/stat-card.js.map +1 -1
  275. package/dist/stepper/index.d.ts +2 -0
  276. package/dist/stepper/index.js +2 -0
  277. package/dist/stepper/stepper.d.ts +51 -0
  278. package/dist/stepper/stepper.js +215 -0
  279. package/dist/stepper/stepper.js.map +1 -0
  280. package/dist/streamgraph/index.d.ts +2 -0
  281. package/dist/streamgraph/index.js +2 -0
  282. package/dist/streamgraph/streamgraph.d.ts +70 -0
  283. package/dist/streamgraph/streamgraph.js +613 -0
  284. package/dist/streamgraph/streamgraph.js.map +1 -0
  285. package/dist/styles.css +1 -1
  286. package/dist/swipe-actions/index.d.ts +2 -0
  287. package/dist/swipe-actions/index.js +2 -0
  288. package/dist/swipe-actions/swipe-actions.d.ts +67 -0
  289. package/dist/swipe-actions/swipe-actions.js +552 -0
  290. package/dist/swipe-actions/swipe-actions.js.map +1 -0
  291. package/dist/switch/switch.js +2 -2
  292. package/dist/switch/switch.js.map +1 -1
  293. package/dist/table/index.d.ts +2 -2
  294. package/dist/table/index.js +2 -2
  295. package/dist/table/table.d.ts +55 -3
  296. package/dist/table/table.js +340 -165
  297. package/dist/table/table.js.map +1 -1
  298. package/dist/tabs/tabs.js +2 -2
  299. package/dist/tabs/tabs.js.map +1 -1
  300. package/dist/tag-input/index.d.ts +2 -0
  301. package/dist/tag-input/index.js +2 -0
  302. package/dist/tag-input/tag-input.d.ts +40 -0
  303. package/dist/tag-input/tag-input.js +269 -0
  304. package/dist/tag-input/tag-input.js.map +1 -0
  305. package/dist/text-morph/index.d.ts +2 -0
  306. package/dist/text-morph/index.js +2 -0
  307. package/dist/text-morph/text-morph.d.ts +23 -0
  308. package/dist/text-morph/text-morph.js +21 -0
  309. package/dist/text-morph/text-morph.js.map +1 -0
  310. package/dist/text-reveal/index.d.ts +2 -0
  311. package/dist/text-reveal/index.js +2 -0
  312. package/dist/text-reveal/text-reveal.d.ts +27 -0
  313. package/dist/text-reveal/text-reveal.js +51 -0
  314. package/dist/text-reveal/text-reveal.js.map +1 -0
  315. package/dist/text-shimmer/index.d.ts +2 -0
  316. package/dist/text-shimmer/index.js +2 -0
  317. package/dist/text-shimmer/text-shimmer.d.ts +29 -0
  318. package/dist/text-shimmer/text-shimmer.js +29 -0
  319. package/dist/text-shimmer/text-shimmer.js.map +1 -0
  320. package/dist/time-picker/time-picker.d.ts +36 -1
  321. package/dist/time-picker/time-picker.js +35 -7
  322. package/dist/time-picker/time-picker.js.map +1 -1
  323. package/dist/toast/index.d.ts +2 -2
  324. package/dist/toast/index.js +2 -2
  325. package/dist/toast/toast.d.ts +7 -1
  326. package/dist/toast/toast.js +82 -40
  327. package/dist/toast/toast.js.map +1 -1
  328. package/dist/tooltip/tooltip.d.ts +9 -2
  329. package/dist/tooltip/tooltip.js +7 -7
  330. package/dist/tooltip/tooltip.js.map +1 -1
  331. package/dist/treemap/index.d.ts +2 -0
  332. package/dist/treemap/index.js +2 -0
  333. package/dist/treemap/treemap.d.ts +53 -0
  334. package/dist/treemap/treemap.js +699 -0
  335. package/dist/treemap/treemap.js.map +1 -0
  336. package/dist/usage-meter/index.d.ts +2 -0
  337. package/dist/usage-meter/index.js +2 -0
  338. package/dist/usage-meter/usage-meter.d.ts +80 -0
  339. package/dist/usage-meter/usage-meter.js +458 -0
  340. package/dist/usage-meter/usage-meter.js.map +1 -0
  341. package/dist/waffle-chart/index.d.ts +2 -0
  342. package/dist/waffle-chart/index.js +2 -0
  343. package/dist/waffle-chart/waffle-chart.d.ts +57 -0
  344. package/dist/waffle-chart/waffle-chart.js +426 -0
  345. package/dist/waffle-chart/waffle-chart.js.map +1 -0
  346. package/package.json +165 -3
@@ -0,0 +1,576 @@
1
+ "use client";
2
+ import { cn, cnAll } from "../lib/cn.js";
3
+ import { prefersReducedMotion, useExitBackstop, useIsomorphicLayoutEffect } from "../lib/motion.js";
4
+ import { Avatar } from "../avatar/avatar.js";
5
+ import { fieldSurfaceVariants } from "../lib/field-surface.js";
6
+ import { FieldShell, useFieldWiring } from "../lib/field-shell.js";
7
+ import { forwardRef, useCallback, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ //#region src/mention-input/mention-input.tsx
10
+ const EMPTY = {
11
+ text: "",
12
+ mentions: []
13
+ };
14
+ const SYMBOL = {
15
+ person: "@",
16
+ channel: "#"
17
+ };
18
+ /** The list's width, in px: the same as `w-68`, which the list's class sets. */
19
+ const POPOVER_WIDTH = 272;
20
+ const mentionText = (kind, label) => `${SYMBOL[kind]}${label}`;
21
+ /** Turns a value into storage-friendly text, `<@id>` for people and `<#id>` for channels by default. */
22
+ function serializeMentions(value, format = (mention) => `<${SYMBOL[mention.kind]}${mention.id}>`) {
23
+ let out = "";
24
+ let at = 0;
25
+ for (const mention of [...value.mentions].sort((a, b) => a.start - b.start)) {
26
+ out += value.text.slice(at, mention.start) + format(mention);
27
+ at = mention.end;
28
+ }
29
+ return out + value.text.slice(at);
30
+ }
31
+ /** Moves mentions along with an edit and drops any the edit touched. `hint` is the caret before the edit, which settles repeated characters. */
32
+ function reconcile(previous, text, hint) {
33
+ const a = previous.text;
34
+ let prefix = 0;
35
+ const maxPrefix = Math.min(a.length, text.length, Math.max(0, hint));
36
+ while (prefix < maxPrefix && a[prefix] === text[prefix]) prefix++;
37
+ let suffix = 0;
38
+ while (suffix < a.length - prefix && suffix < text.length - prefix && a[a.length - 1 - suffix] === text[text.length - 1 - suffix]) suffix++;
39
+ const oldEnd = a.length - suffix;
40
+ const delta = text.length - a.length;
41
+ return previous.mentions.flatMap((mention) => {
42
+ if (mention.end <= prefix) return [mention];
43
+ if (mention.start >= oldEnd) return [{
44
+ ...mention,
45
+ start: mention.start + delta,
46
+ end: mention.end + delta
47
+ }];
48
+ return [];
49
+ }).filter((mention) => text.slice(mention.start, mention.end) === mentionText(mention.kind, mention.label));
50
+ }
51
+ function findTrigger(text, caret, mentions, kinds) {
52
+ for (let index = caret - 1; index >= 0 && index >= caret - 48; index--) {
53
+ const char = text[index];
54
+ if (char === "\n") return null;
55
+ if (char !== "@" && char !== "#") continue;
56
+ const kind = char === "@" ? "person" : "channel";
57
+ if (!kinds[kind]) return null;
58
+ if (index > 0 && !/[\s([{"']/.test(text[index - 1])) return null;
59
+ if (mentions.some((mention) => index >= mention.start && index < mention.end)) return null;
60
+ const query = text.slice(index + 1, caret);
61
+ return (kind === "person" ? /^[^\s@#]*( [^\s@#]*)?$/ : /^[^\s@#]*$/).test(query) ? {
62
+ kind,
63
+ start: index,
64
+ query
65
+ } : null;
66
+ }
67
+ return null;
68
+ }
69
+ function rank(label, extra, query) {
70
+ const name = label.toLowerCase();
71
+ if (!query) return 1;
72
+ if (name.startsWith(query)) return 4;
73
+ if (name.split(/[\s\-_.]+/).some((word) => word.startsWith(query))) return 3;
74
+ if (name.includes(query)) return 2;
75
+ return extra.toLowerCase().includes(query) ? 1 : 0;
76
+ }
77
+ function initials(name) {
78
+ return name.split(/\s+/).filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase()).join("");
79
+ }
80
+ /** The matched part of a label reads in full contrast; the rest stays quiet. */
81
+ function Highlight({ text, query }) {
82
+ const at = query ? text.toLowerCase().indexOf(query.toLowerCase()) : -1;
83
+ if (at < 0) return /* @__PURE__ */ jsx(Fragment$1, { children: text });
84
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
85
+ text.slice(0, at),
86
+ /* @__PURE__ */ jsx("mark", {
87
+ className: "bg-transparent text-foreground",
88
+ children: text.slice(at, at + query.length)
89
+ }),
90
+ text.slice(at + query.length)
91
+ ] });
92
+ }
93
+ /** The textarea and the mirror share these, so every character of one sits under the same character of the other. */
94
+ const textMetrics = "box-border m-0 w-full border-0 px-3.5 py-2.25 font-sans text-base leading-6 break-words whitespace-pre-wrap [tab-size:4]";
95
+ const shellClass = cnAll(fieldSurfaceVariants(), "relative overflow-hidden", "[&:where(:hover:not([data-disabled]))]:border-border-strong", "has-[textarea:focus]:not-data-[invalid]:border-foreground", "forced-colors:has-[textarea:focus]:outline-solid forced-colors:has-[textarea:focus]:outline-(length:--focus-ring-width) forced-colors:has-[textarea:focus]:outline-offset-(--focus-ring-offset)", "data-[ready]:motion-safe:transition-[height,border-color,background-color] data-[ready]:motion-safe:duration-(--duration-smooth) data-[ready]:motion-safe:ease-smooth");
96
+ const popoverClass = cnAll("absolute z-30 w-68 max-w-full overflow-hidden", "rounded-panel border-(length:--border-width) border-border bg-card p-1 text-card-foreground shadow-floating", "box-border font-sans text-sm leading-(--leading-normal)", "[--menu-x:0px] [--menu-y:-6px] origin-top-left", "data-[above]:[--menu-y:6px] data-[above]:origin-bottom-left data-[above]:-translate-y-full", "motion-safe:animate-select-popover-in motion-reduce:animate-select-fade-in", "data-[leaving]:pointer-events-none data-[leaving]:motion-safe:animate-select-popover-out data-[leaving]:motion-reduce:animate-select-fade-out");
97
+ const MentionInput = forwardRef(function MentionInput({ label, labelHidden = false, value: valueProp, defaultValue, onValueChange, people, channels, onMentionAdd, onSubmit, submitOnEnter = false, placeholder, minRows = 1, maxRows = 8, placement = "auto", maxSuggestions = 6, description, error, disabled, name, id, className }, ref) {
98
+ const uid = useId();
99
+ const listId = `${uid}-list`;
100
+ const [inner, setInner] = useState(defaultValue ?? EMPTY);
101
+ const value = valueProp ?? inner;
102
+ const live = useRef(value);
103
+ useIsomorphicLayoutEffect(() => {
104
+ live.current = value;
105
+ });
106
+ const rootRef = useRef(null);
107
+ const fieldRef = useRef(null);
108
+ const areaRef = useRef(null);
109
+ const backdropRef = useRef(null);
110
+ const lastCaret = useRef(0);
111
+ const pending = useRef(null);
112
+ const [caret, setCaret] = useState(null);
113
+ const [focused, setFocused] = useState(false);
114
+ const [dismissed, setDismissed] = useState(null);
115
+ const [active, setActive] = useState(0);
116
+ const commit = useCallback((next) => {
117
+ if (valueProp === void 0) setInner(next);
118
+ onValueChange?.(next);
119
+ }, [onValueChange, valueProp]);
120
+ const kinds = useMemo(() => ({
121
+ person: Boolean(people?.length),
122
+ channel: Boolean(channels?.length)
123
+ }), [channels, people]);
124
+ const trigger = useMemo(() => caret === null ? null : findTrigger(value.text, caret, value.mentions, kinds), [
125
+ caret,
126
+ kinds,
127
+ value.mentions,
128
+ value.text
129
+ ]);
130
+ const suggestions = useMemo(() => {
131
+ if (!trigger) return [];
132
+ const query = trigger.query.toLowerCase().trim();
133
+ return (trigger.kind === "person" ? (people ?? []).map((item) => ({
134
+ entry: {
135
+ kind: "person",
136
+ item
137
+ },
138
+ score: rank(item.name, item.role ?? "", query)
139
+ })) : (channels ?? []).map((item) => ({
140
+ entry: {
141
+ kind: "channel",
142
+ item
143
+ },
144
+ score: rank(item.name, item.description ?? "", query)
145
+ }))).filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score).slice(0, maxSuggestions).map((entry) => entry.entry);
146
+ }, [
147
+ channels,
148
+ maxSuggestions,
149
+ people,
150
+ trigger
151
+ ]);
152
+ const open = focused && !disabled && Boolean(trigger) && trigger?.start !== dismissed && (suggestions.length > 0 || !trigger?.query.includes(" "));
153
+ const activeIndex = Math.min(active, Math.max(0, suggestions.length - 1));
154
+ const queryKey = trigger ? `${trigger.start}:${trigger.query}` : "";
155
+ const [lastQueryKey, setLastQueryKey] = useState(queryKey);
156
+ if (lastQueryKey !== queryKey) {
157
+ setLastQueryKey(queryKey);
158
+ setActive(0);
159
+ }
160
+ if (dismissed !== null && trigger?.start !== dismissed) setDismissed(null);
161
+ const onSelect = () => {
162
+ const area = areaRef.current;
163
+ if (!area) return;
164
+ let start = area.selectionStart;
165
+ let end = area.selectionEnd;
166
+ const collapsed = start === end;
167
+ for (const mention of live.current.mentions) if (collapsed && start > mention.start && start < mention.end) {
168
+ const stepped = Math.abs(start - lastCaret.current) === 1;
169
+ const forward = start > lastCaret.current;
170
+ start = end = stepped ? forward ? mention.end : mention.start : start - mention.start < mention.end - start ? mention.start : mention.end;
171
+ } else if (!collapsed) {
172
+ if (start > mention.start && start < mention.end) start = mention.start;
173
+ if (end > mention.start && end < mention.end) end = mention.end;
174
+ }
175
+ if (start !== area.selectionStart || end !== area.selectionEnd) area.setSelectionRange(start, end, area.selectionDirection);
176
+ lastCaret.current = area.selectionStart;
177
+ setCaret(collapsed ? start : null);
178
+ };
179
+ const onInput = (event) => {
180
+ const text = event.target.value;
181
+ const mentions = reconcile(live.current, text, lastCaret.current);
182
+ const added = pending.current;
183
+ pending.current = null;
184
+ if (added && text.slice(added.start, added.end) === mentionText(added.kind, added.label)) {
185
+ mentions.push(added);
186
+ mentions.sort((a, b) => a.start - b.start);
187
+ }
188
+ const next = {
189
+ text,
190
+ mentions
191
+ };
192
+ live.current = next;
193
+ commit(next);
194
+ if (added) onMentionAdd?.(added);
195
+ lastCaret.current = event.target.selectionStart;
196
+ setCaret(event.target.selectionStart === event.target.selectionEnd ? event.target.selectionStart : null);
197
+ };
198
+ /** Types through the browser so the change joins the native undo stack; falls back to a direct edit. */
199
+ const typeText = useCallback((text, from, to) => {
200
+ const area = areaRef.current;
201
+ if (!area) return;
202
+ area.focus({ preventScroll: true });
203
+ if (from !== void 0) area.setSelectionRange(from, to ?? from);
204
+ lastCaret.current = area.selectionStart;
205
+ if (typeof document.execCommand === "function" && document.execCommand("insertText", false, text)) return;
206
+ const start = area.selectionStart;
207
+ const end = area.selectionEnd;
208
+ const current = live.current;
209
+ const nextText = current.text.slice(0, start) + text + current.text.slice(end);
210
+ const mentions = reconcile(current, nextText, start);
211
+ const added = pending.current;
212
+ pending.current = null;
213
+ if (added) mentions.push(added);
214
+ mentions.sort((a, b) => a.start - b.start);
215
+ const next = {
216
+ text: nextText,
217
+ mentions
218
+ };
219
+ live.current = next;
220
+ commit(next);
221
+ if (added) onMentionAdd?.(added);
222
+ requestAnimationFrame(() => {
223
+ area.setSelectionRange(start + text.length, start + text.length);
224
+ setCaret(start + text.length);
225
+ });
226
+ }, [commit, onMentionAdd]);
227
+ const choose = (suggestion) => {
228
+ if (!suggestion || !trigger || caret === null) return;
229
+ const label = suggestion.item.name;
230
+ const token = mentionText(suggestion.kind, label);
231
+ pending.current = {
232
+ kind: suggestion.kind,
233
+ id: suggestion.item.id,
234
+ label,
235
+ start: trigger.start,
236
+ end: trigger.start + token.length
237
+ };
238
+ const after = value.text[caret];
239
+ typeText(after === void 0 || !/\s/.test(after) ? `${token} ` : token, trigger.start, caret);
240
+ };
241
+ const onKeyDown = (event) => {
242
+ const area = event.currentTarget;
243
+ lastCaret.current = area.selectionStart;
244
+ if (open) {
245
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
246
+ event.preventDefault();
247
+ if (suggestions.length) setActive((activeIndex + (event.key === "ArrowDown" ? 1 : -1) + suggestions.length) % suggestions.length);
248
+ return;
249
+ }
250
+ if ((event.key === "Enter" || event.key === "Tab") && suggestions.length && !event.shiftKey) {
251
+ event.preventDefault();
252
+ choose(suggestions[activeIndex]);
253
+ return;
254
+ }
255
+ if (event.key === "Escape") {
256
+ event.preventDefault();
257
+ event.stopPropagation();
258
+ setDismissed(trigger?.start ?? null);
259
+ return;
260
+ }
261
+ }
262
+ const start = area.selectionStart;
263
+ if (start === area.selectionEnd && !event.metaKey && (event.key === "Backspace" || event.key === "Delete")) {
264
+ const hit = live.current.mentions.find((mention) => event.key === "Backspace" ? start > mention.start && start <= mention.end : start >= mention.start && start < mention.end);
265
+ if (hit) area.setSelectionRange(hit.start, hit.end);
266
+ return;
267
+ }
268
+ if (event.key === "Enter" && submitOnEnter && !event.shiftKey && !event.nativeEvent.isComposing) {
269
+ event.preventDefault();
270
+ if (live.current.text.trim()) onSubmit?.(live.current);
271
+ }
272
+ };
273
+ useImperativeHandle(ref, () => ({
274
+ focus: () => areaRef.current?.focus(),
275
+ insert: (text) => typeText(text),
276
+ openSuggestions: (kind) => {
277
+ const area = areaRef.current;
278
+ if (!area) return;
279
+ const focusedNow = document.activeElement === area;
280
+ const at = focusedNow ? area.selectionStart : live.current.text.length;
281
+ const before = live.current.text[at - 1];
282
+ setDismissed(null);
283
+ typeText(`${before && !/\s/.test(before) ? " " : ""}${SYMBOL[kind]}`, at, focusedNow ? area.selectionEnd : at);
284
+ },
285
+ clear: () => {
286
+ commit(EMPTY);
287
+ live.current = EMPTY;
288
+ setCaret(0);
289
+ },
290
+ get textarea() {
291
+ return areaRef.current;
292
+ }
293
+ }), [commit, typeText]);
294
+ useIsomorphicLayoutEffect(() => {
295
+ const backdrop = backdropRef.current;
296
+ const field = fieldRef.current;
297
+ if (!backdrop || !field) return;
298
+ const fit = () => {
299
+ const style = getComputedStyle(backdrop);
300
+ const line = parseFloat(style.lineHeight) || 24;
301
+ const pad = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);
302
+ const border = parseFloat(getComputedStyle(field).borderTopWidth) * 2;
303
+ const min = line * minRows + pad;
304
+ const max = line * Math.max(minRows, maxRows) + pad;
305
+ field.style.height = `${Math.min(max, Math.max(min, backdrop.offsetHeight)) + border}px`;
306
+ if (!field.hasAttribute("data-ready")) requestAnimationFrame(() => field.setAttribute("data-ready", ""));
307
+ };
308
+ fit();
309
+ if (typeof ResizeObserver === "undefined") return;
310
+ const observer = new ResizeObserver(fit);
311
+ observer.observe(backdrop);
312
+ return () => observer.disconnect();
313
+ }, [maxRows, minRows]);
314
+ const [anchor, setAnchor] = useState(null);
315
+ const measureAnchor = useCallback(() => {
316
+ const marker = backdropRef.current?.querySelector("[data-anchor]");
317
+ const root = rootRef.current;
318
+ const field = fieldRef.current;
319
+ const area = areaRef.current;
320
+ if (!marker || !root || !field || !area) {
321
+ setAnchor(null);
322
+ return;
323
+ }
324
+ const line = parseFloat(getComputedStyle(marker.parentElement ?? marker).lineHeight) || 24;
325
+ const x = Math.max(0, Math.min(field.offsetLeft + marker.offsetLeft - 10, root.offsetWidth - POPOVER_WIDTH));
326
+ const top = field.offsetTop + marker.offsetTop - area.scrollTop;
327
+ const box = root.getBoundingClientRect();
328
+ const roomBelow = window.innerHeight - (box.top + top + line);
329
+ const above = placement === "top" || placement === "auto" && roomBelow < 300 && box.top + top > roomBelow;
330
+ const y = above ? top - 6 : top + line + 6;
331
+ setAnchor((current) => current && current.x === x && current.y === y && current.above === above ? current : {
332
+ x,
333
+ y,
334
+ above
335
+ });
336
+ }, [placement]);
337
+ useIsomorphicLayoutEffect(() => {
338
+ if (open) measureAnchor();
339
+ }, [
340
+ measureAnchor,
341
+ open,
342
+ trigger?.start,
343
+ value.text
344
+ ]);
345
+ const shown = open && Boolean(anchor);
346
+ const onScroll = (event) => {
347
+ const backdrop = backdropRef.current;
348
+ if (backdrop) backdrop.style.transform = `translateY(${-event.currentTarget.scrollTop}px)`;
349
+ measureAnchor();
350
+ };
351
+ const current = shown && anchor ? {
352
+ suggestions,
353
+ trigger,
354
+ anchor,
355
+ activeIndex
356
+ } : null;
357
+ const [frozen, setFrozen] = useState(current);
358
+ if (current && (frozen?.suggestions !== current.suggestions || frozen.trigger !== current.trigger || frozen.anchor !== current.anchor || frozen.activeIndex !== current.activeIndex)) setFrozen(current);
359
+ const view = current ?? frozen;
360
+ const [rendered, setRendered] = useState(shown);
361
+ const leaving = rendered && !shown;
362
+ if (shown && !rendered) setRendered(true);
363
+ const unmount = useCallback(() => setRendered(false), []);
364
+ useExitBackstop(leaving, unmount);
365
+ useIsomorphicLayoutEffect(() => {
366
+ if (leaving && prefersReducedMotion()) unmount();
367
+ }, [leaving, unmount]);
368
+ const listRef = useRef(null);
369
+ const highlightRef = useRef(null);
370
+ useIsomorphicLayoutEffect(() => {
371
+ const row = listRef.current?.querySelector(`[data-index="${view?.activeIndex ?? 0}"]`);
372
+ const highlight = highlightRef.current;
373
+ if (!row || !highlight || !shown) return;
374
+ highlight.style.height = `${row.offsetHeight}px`;
375
+ highlight.style.transform = `translateY(${row.offsetTop}px)`;
376
+ if (!highlight.hasAttribute("data-ready")) requestAnimationFrame(() => highlight.setAttribute("data-ready", ""));
377
+ }, [
378
+ shown,
379
+ view?.activeIndex,
380
+ view?.suggestions
381
+ ]);
382
+ const mirror = useMemo(() => {
383
+ const parts = [];
384
+ const markAt = open && trigger ? trigger.start : -1;
385
+ let at = 0;
386
+ const pushText = (from, to) => {
387
+ if (markAt >= from && markAt < to) parts.push(value.text.slice(from, markAt), /* @__PURE__ */ jsx("span", { "data-anchor": "" }, "anchor"), value.text.slice(markAt, to));
388
+ else parts.push(value.text.slice(from, to));
389
+ };
390
+ for (const mention of value.mentions) {
391
+ pushText(at, mention.start);
392
+ parts.push(/* @__PURE__ */ jsx("span", {
393
+ "data-slot": "mention-token",
394
+ "data-kind": mention.kind,
395
+ className: "box-decoration-clone rounded-2xs bg-border-subtle py-px text-foreground",
396
+ children: value.text.slice(mention.start, mention.end)
397
+ }, `${mention.start}-${mention.id}`));
398
+ at = mention.end;
399
+ }
400
+ pushText(at, value.text.length);
401
+ return parts;
402
+ }, [
403
+ open,
404
+ trigger,
405
+ value.mentions,
406
+ value.text
407
+ ]);
408
+ const field = useFieldWiring({
409
+ enabled: true,
410
+ id,
411
+ describedBy: void 0,
412
+ invalid: void 0,
413
+ description,
414
+ error
415
+ });
416
+ const optionId = (index) => `${uid}-option-${index}`;
417
+ const noun = trigger?.kind === "person" ? ["person", "people"] : ["channel", "channels"];
418
+ const countLabel = open ? suggestions.length ? `${suggestions.length} ${suggestions.length === 1 ? noun[0] : noun[1]}` : "No matches" : "";
419
+ const control = /* @__PURE__ */ jsxs("div", {
420
+ ref: rootRef,
421
+ className: "relative",
422
+ children: [
423
+ /* @__PURE__ */ jsxs("div", {
424
+ ref: fieldRef,
425
+ "data-slot": "mention-input-field",
426
+ "data-disabled": disabled || void 0,
427
+ "data-invalid": error ? "" : void 0,
428
+ "data-focused": focused || void 0,
429
+ className: shellClass,
430
+ children: [/* @__PURE__ */ jsxs("div", {
431
+ ref: backdropRef,
432
+ "aria-hidden": "true",
433
+ "data-slot": "mention-input-mirror",
434
+ className: cn(textMetrics, "pointer-events-none absolute top-0 left-0 text-foreground will-change-transform"),
435
+ children: [mirror, "​"]
436
+ }), /* @__PURE__ */ jsx("textarea", {
437
+ ref: areaRef,
438
+ ...field.controlProps,
439
+ name,
440
+ "data-slot": "mention-input",
441
+ value: value.text,
442
+ placeholder,
443
+ disabled,
444
+ rows: minRows,
445
+ spellCheck: true,
446
+ "aria-label": labelHidden ? label : void 0,
447
+ "aria-autocomplete": "list",
448
+ "aria-controls": open ? listId : void 0,
449
+ "aria-activedescendant": open && suggestions.length ? optionId(activeIndex) : void 0,
450
+ onChange: onInput,
451
+ onSelect,
452
+ onKeyDown,
453
+ onScroll,
454
+ onFocus: () => setFocused(true),
455
+ onBlur: () => {
456
+ setFocused(false);
457
+ setCaret(null);
458
+ },
459
+ className: cn(textMetrics, "absolute inset-0 block h-full resize-none overflow-y-auto bg-transparent text-transparent caret-foreground outline-none [scrollbar-width:none] placeholder:text-muted-foreground selection:bg-primary/25 selection:text-transparent disabled:cursor-not-allowed [&::-webkit-scrollbar]:hidden")
460
+ })]
461
+ }),
462
+ /* @__PURE__ */ jsx("span", {
463
+ className: "sr-only",
464
+ role: "status",
465
+ "aria-live": "polite",
466
+ children: countLabel
467
+ }),
468
+ rendered && view ? /* @__PURE__ */ jsx("div", {
469
+ "data-slot": "mention-input-popover",
470
+ "data-above": view.anchor.above || void 0,
471
+ "data-leaving": leaving || void 0,
472
+ style: {
473
+ left: view.anchor.x,
474
+ top: view.anchor.y
475
+ },
476
+ onMouseDown: (event) => event.preventDefault(),
477
+ onAnimationEnd: (event) => {
478
+ if (leaving && event.target === event.currentTarget) unmount();
479
+ },
480
+ className: popoverClass,
481
+ children: view.suggestions.length ? /* @__PURE__ */ jsxs("ul", {
482
+ ref: listRef,
483
+ id: listId,
484
+ role: "listbox",
485
+ "aria-label": view.trigger?.kind === "person" ? "People" : "Channels",
486
+ className: "relative m-0 grid list-none p-0",
487
+ children: [/* @__PURE__ */ jsx("li", {
488
+ ref: highlightRef,
489
+ "aria-hidden": "true",
490
+ "data-slot": "mention-input-highlight",
491
+ className: "pointer-events-none absolute inset-x-0 top-0 rounded-control bg-muted data-[ready]:motion-safe:transition-[transform,height] data-[ready]:motion-safe:duration-(--duration-quick) data-[ready]:motion-safe:ease-settle"
492
+ }), view.suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs("li", {
493
+ id: optionId(index),
494
+ role: "option",
495
+ "aria-selected": index === view.activeIndex,
496
+ "data-index": index,
497
+ "data-slot": "mention-input-option",
498
+ className: "group/option relative flex min-w-0 cursor-pointer items-center gap-2.5 rounded-control py-1.5 ps-2 pe-2.5",
499
+ onPointerMove: () => {
500
+ if (index !== activeIndex) setActive(index);
501
+ },
502
+ onClick: () => choose(suggestion),
503
+ children: [
504
+ suggestion.kind === "person" ? /* @__PURE__ */ jsx(Avatar, {
505
+ size: "md",
506
+ alt: "",
507
+ src: suggestion.item.avatar,
508
+ fallback: initials(suggestion.item.name),
509
+ "aria-hidden": "true"
510
+ }) : /* @__PURE__ */ jsx("span", {
511
+ "aria-hidden": "true",
512
+ className: "grid size-8 flex-none place-items-center text-text-secondary",
513
+ children: /* @__PURE__ */ jsx("svg", {
514
+ viewBox: "0 0 16 16",
515
+ fill: "none",
516
+ stroke: "currentColor",
517
+ strokeWidth: "1.75",
518
+ strokeLinecap: "round",
519
+ className: "size-4",
520
+ children: /* @__PURE__ */ jsx("path", { d: "M6.5 2.5 5 13.5M11 2.5 9.5 13.5M2.5 6h11M2.5 10h11" })
521
+ })
522
+ }),
523
+ /* @__PURE__ */ jsxs("span", {
524
+ className: "grid min-w-0 flex-1",
525
+ children: [/* @__PURE__ */ jsx("span", {
526
+ className: "truncate font-medium text-text-secondary group-aria-selected/option:text-foreground",
527
+ children: /* @__PURE__ */ jsx(Highlight, {
528
+ text: suggestion.item.name,
529
+ query: view.trigger?.query.trim() ?? ""
530
+ })
531
+ }), suggestion.kind === "person" ? suggestion.item.role && /* @__PURE__ */ jsx("span", {
532
+ className: "truncate text-xs text-muted-foreground",
533
+ children: suggestion.item.role
534
+ }) : suggestion.item.description && /* @__PURE__ */ jsx("span", {
535
+ className: "truncate text-xs text-muted-foreground",
536
+ children: suggestion.item.description
537
+ })]
538
+ }),
539
+ suggestion.kind === "channel" && suggestion.item.members !== void 0 ? /* @__PURE__ */ jsx("span", {
540
+ className: "flex-none text-xs tabular-nums text-muted-foreground",
541
+ children: suggestion.item.members
542
+ }) : null
543
+ ]
544
+ }, `${suggestion.kind}-${suggestion.item.id}`))]
545
+ }) : /* @__PURE__ */ jsxs("p", {
546
+ className: "m-0 px-2.5 py-2.5 text-sm text-text-secondary",
547
+ children: [
548
+ "No ",
549
+ view.trigger?.kind === "person" ? "people" : "channels",
550
+ " match “",
551
+ view.trigger?.query,
552
+ "”"
553
+ ]
554
+ })
555
+ }) : null
556
+ ]
557
+ });
558
+ return /* @__PURE__ */ jsx("div", {
559
+ className: cn("w-full min-w-0 font-sans", className),
560
+ "data-slot": "mention-input-root",
561
+ children: /* @__PURE__ */ jsx(FieldShell, {
562
+ label: labelHidden ? null : label,
563
+ controlId: field.controlId,
564
+ description,
565
+ hintId: field.hintId,
566
+ error,
567
+ errorId: field.errorId,
568
+ children: control
569
+ })
570
+ });
571
+ });
572
+ MentionInput.displayName = "MentionInput";
573
+ //#endregion
574
+ export { MentionInput, mentionText, serializeMentions };
575
+
576
+ //# sourceMappingURL=mention-input.js.map