react-kui 3.2.1 → 3.3.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 (352) hide show
  1. package/ai/kui-components.json +819 -162
  2. package/es/_virtual/_rolldown/runtime.js +2 -3
  3. package/es/affix/index.js +73 -185
  4. package/es/alert/index.js +3 -4
  5. package/es/anchor/anchor-context.js +2 -3
  6. package/es/anchor/anchor-link.js +3 -4
  7. package/es/anchor/anchor.js +195 -398
  8. package/es/auto-complete/index.js +160 -561
  9. package/es/avatar/avatar-group-context.js +2 -3
  10. package/es/avatar/avatar-group.js +32 -124
  11. package/es/avatar/avatar.js +58 -159
  12. package/es/back-top/index.js +66 -201
  13. package/es/badge/index.js +4 -5
  14. package/es/base/teleport.js +22 -54
  15. package/es/base/transition-props.js +2 -3
  16. package/es/base/transition.js +2 -3
  17. package/es/breadcrumb/breadcrumb-context.js +2 -3
  18. package/es/breadcrumb/breadcrumb-item.js +19 -102
  19. package/es/breadcrumb/breadcrumb.js +10 -59
  20. package/es/button/button-group-context.js +2 -3
  21. package/es/button/button-group.js +15 -75
  22. package/es/button/button.js +4 -5
  23. package/es/calendar/index.js +4 -5
  24. package/es/card/index.js +4 -5
  25. package/es/carousel/carousel-context.js +2 -3
  26. package/es/carousel/carousel-item.js +3 -4
  27. package/es/carousel/carousel.js +281 -628
  28. package/es/carousel/drag.js +2 -3
  29. package/es/cascader/index.js +7 -8
  30. package/es/check-card/check-card-group.js +53 -179
  31. package/es/check-card/check-card.js +100 -293
  32. package/es/check-card/context.js +2 -3
  33. package/es/checkbox/checkbox-group-context.js +2 -3
  34. package/es/checkbox/checkbox-group.js +34 -138
  35. package/es/checkbox/checkbox.js +4 -5
  36. package/es/checkbox/index.js +2 -3
  37. package/es/collapse/collapse-panel.js +84 -206
  38. package/es/collapse/collapse.js +38 -170
  39. package/es/color-picker/alpha.js +44 -125
  40. package/es/color-picker/hue.js +39 -108
  41. package/es/color-picker/index.js +7 -6
  42. package/es/color-picker/mode.js +76 -159
  43. package/es/color-picker/paint.js +66 -163
  44. package/es/color-picker/presets.js +12 -44
  45. package/es/components.js +37 -32
  46. package/es/config/config-context.js +2 -3
  47. package/es/config/context.js +2 -3
  48. package/es/config/index.js +3 -4
  49. package/es/config/popup-host.js +3 -4
  50. package/es/config/size-context.js +2 -3
  51. package/es/config/use-config-appearance.js +3 -4
  52. package/es/const/var.js +2 -3
  53. package/es/date-picker/index.js +8 -9
  54. package/es/descriptions/descriptions-item.js +3 -4
  55. package/es/descriptions/descriptions.js +53 -144
  56. package/es/divider/index.js +2 -3
  57. package/es/drawer/index.js +171 -465
  58. package/es/dropdown/dropdown-button.js +25 -128
  59. package/es/dropdown/dropdown-context.js +2 -3
  60. package/es/dropdown/dropdown.js +56 -207
  61. package/es/dropdown/trigger.js +37 -125
  62. package/es/empty/index.js +34 -111
  63. package/es/feature-card/index.js +2 -3
  64. package/es/feedback-panel/index.js +30 -155
  65. package/es/flame-wrap/index.js +3 -4
  66. package/es/flame-wrap/types.js +2 -3
  67. package/es/flex/index.js +2 -3
  68. package/es/form/field-context.js +3 -4
  69. package/es/form/form-context.js +2 -3
  70. package/es/form/form-item.js +4 -5
  71. package/es/form/form.js +108 -279
  72. package/es/form/utils.js +2 -3
  73. package/es/gradient-picker/corners.js +55 -0
  74. package/es/gradient-picker/index.js +191 -0
  75. package/es/gradient-picker/stops.js +219 -0
  76. package/es/gradient-picker/types.js +147 -0
  77. package/es/grid/grid-item.js +25 -116
  78. package/es/grid/grid.js +40 -151
  79. package/es/grid/useBreakpoint.js +3 -4
  80. package/es/icon/index.js +24 -126
  81. package/es/image/group.js +3 -4
  82. package/es/image/image-group-context.js +2 -3
  83. package/es/image/image.js +5 -6
  84. package/es/image/instance.js +2 -3
  85. package/es/image/preview.js +4 -5
  86. package/es/image/utils.js +2 -3
  87. package/es/index.js +5 -4
  88. package/es/input/index.js +2 -3
  89. package/es/input/input-base.js +4 -5
  90. package/es/input/input-box.js +2 -3
  91. package/es/input/input-group.js +4 -5
  92. package/es/input/input.js +3 -4
  93. package/es/input/textarea.js +3 -4
  94. package/es/input-number/drag.js +63 -0
  95. package/es/input-number/index.js +41 -11
  96. package/es/input-otp/index.js +3 -4
  97. package/es/input-tag/index.js +5 -6
  98. package/es/kanban/index.js +31 -168
  99. package/es/layout/index.js +43 -215
  100. package/es/layout/layout-context.js +2 -3
  101. package/es/list-panel/index.js +47 -185
  102. package/es/loading/index.js +2 -3
  103. package/es/loading/loading-bar.js +54 -114
  104. package/es/locale/de.js +2 -3
  105. package/es/locale/el.js +2 -3
  106. package/es/locale/en.js +2 -3
  107. package/es/locale/fr.js +2 -3
  108. package/es/locale/it.js +2 -3
  109. package/es/locale/ja.js +2 -3
  110. package/es/locale/ko.js +2 -3
  111. package/es/locale/ru.js +2 -3
  112. package/es/locale/th.js +2 -3
  113. package/es/locale/uk.js +2 -3
  114. package/es/locale/vi.js +2 -3
  115. package/es/locale/zh-CN.js +2 -3
  116. package/es/locale/zh-TW.js +2 -3
  117. package/es/mentions/index.js +214 -581
  118. package/es/menu/menu-context.js +2 -3
  119. package/es/menu/menu-divider.js +3 -4
  120. package/es/menu/menu-group.js +3 -4
  121. package/es/menu/menu-item.js +2 -3
  122. package/es/menu/menu-keyboard.js +2 -3
  123. package/es/menu/menu.js +184 -442
  124. package/es/menu/recursive-menu.js +3 -4
  125. package/es/menu/sub-menu.js +5 -6
  126. package/es/message/index.js +2 -3
  127. package/es/modal/api.js +2 -3
  128. package/es/modal/modal.js +263 -599
  129. package/es/modal/toast.js +63 -179
  130. package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +2 -3
  131. package/es/notice/container.js +2 -3
  132. package/es/notice/content.js +4 -5
  133. package/es/notice/index.js +2 -3
  134. package/es/notice/instance.js +2 -3
  135. package/es/page/index.js +4 -5
  136. package/es/page/responsive.js +2 -3
  137. package/es/page-header/index.js +3 -4
  138. package/es/popconfirm/index.js +24 -70
  139. package/es/poptip/index.js +29 -88
  140. package/es/popup/index.js +8 -6
  141. package/es/popup/layers.js +2 -3
  142. package/es/progress/index.js +95 -229
  143. package/es/qrcode/index.js +3 -4
  144. package/es/radio/radio-button.js +37 -131
  145. package/es/radio/radio-group-context.js +2 -3
  146. package/es/radio/radio-group.js +69 -223
  147. package/es/radio/radio.js +3 -4
  148. package/es/rate/index.js +68 -226
  149. package/es/rate/star.js +38 -129
  150. package/es/result/index.js +35 -127
  151. package/es/ripple/index.js +3 -4
  152. package/es/ripple/types.js +2 -3
  153. package/es/row-col/col.js +59 -149
  154. package/es/row-col/row.js +2 -3
  155. package/es/segmented/index.js +66 -210
  156. package/es/select/option.js +23 -116
  157. package/es/select/select.js +9 -10
  158. package/es/skeleton/skeleton-avatar.js +2 -3
  159. package/es/skeleton/skeleton-button.js +2 -3
  160. package/es/skeleton/skeleton-image.js +28 -108
  161. package/es/skeleton/skeleton-text.js +17 -93
  162. package/es/skeleton/skeleton.js +46 -133
  163. package/es/skeleton/use-skeleton-loading.js +3 -4
  164. package/es/slider/index.js +92 -286
  165. package/es/slider/thumb.js +43 -133
  166. package/es/space/index.js +3 -4
  167. package/es/spin/index.js +2 -3
  168. package/es/splitter/splitter-panel.js +3 -4
  169. package/es/splitter/splitter.js +77 -219
  170. package/es/stat-card/countup.js +46 -141
  171. package/es/stat-card/rollup.js +27 -105
  172. package/es/stat-card/stat-card.js +3 -4
  173. package/es/stat-card/stat-number.js +26 -113
  174. package/es/stat-card/utils/countup.js +2 -3
  175. package/es/stat-card/utils/odometer.js +2 -3
  176. package/es/stat-card/utils/stat-item-key.js +2 -3
  177. package/es/steps/index.js +45 -123
  178. package/es/switch/index.js +4 -5
  179. package/es/table/column-setting.js +43 -139
  180. package/es/table/index.js +8 -9
  181. package/es/table/utils.js +2 -3
  182. package/es/tabs/tab-panel.js +19 -71
  183. package/es/tabs/tabs.js +6 -7
  184. package/es/tag/index.js +4 -5
  185. package/es/time-line/timeline-item.js +3 -4
  186. package/es/time-line/timeline.js +8 -44
  187. package/es/tooltip/index.js +41 -142
  188. package/es/tour/index.js +138 -356
  189. package/es/transfer/index.js +184 -487
  190. package/es/tree/index.js +8 -9
  191. package/es/tree/utils.js +2 -3
  192. package/es/tree-select/index.js +8 -9
  193. package/es/typography/index.js +75 -306
  194. package/es/upload/file-list.js +95 -119
  195. package/es/upload/index.js +8 -9
  196. package/es/upload/picture-sort.js +2 -3
  197. package/es/upload/selector.js +63 -193
  198. package/es/utils/checked.js +2 -3
  199. package/es/utils/color.js +2 -3
  200. package/es/utils/css.js +2 -3
  201. package/es/utils/focus.js +2 -3
  202. package/es/utils/number.js +2 -3
  203. package/es/utils/overlay-order.js +2 -3
  204. package/es/utils/overlay-stack.js +3 -4
  205. package/es/utils/placement.js +16 -4
  206. package/es/utils/popup-arrow.js +45 -0
  207. package/es/utils/popup.js +2 -3
  208. package/es/utils/promise.js +2 -3
  209. package/es/utils/react-node.js +2 -3
  210. package/es/utils/selection-tags.js +2 -3
  211. package/es/utils/share.js +2 -3
  212. package/es/utils/theme.js +2 -3
  213. package/es/utils/transition.js +2 -3
  214. package/es/utils/use-value.js +3 -4
  215. package/es/virtual-list/index.js +49 -187
  216. package/es/virtual-list/range.js +2 -3
  217. package/es/watermark/index.js +149 -289
  218. package/lib/index.cjs +2 -2
  219. package/lib/locale/de.cjs +1 -1
  220. package/lib/locale/el.cjs +1 -1
  221. package/lib/locale/en.cjs +1 -1
  222. package/lib/locale/fr.cjs +1 -1
  223. package/lib/locale/it.cjs +1 -1
  224. package/lib/locale/ja.cjs +1 -1
  225. package/lib/locale/ko.cjs +1 -1
  226. package/lib/locale/ru.cjs +1 -1
  227. package/lib/locale/th.cjs +1 -1
  228. package/lib/locale/uk.cjs +1 -1
  229. package/lib/locale/vi.cjs +1 -1
  230. package/lib/locale/zh-CN.cjs +1 -1
  231. package/lib/locale/zh-TW.cjs +1 -1
  232. package/package.json +24 -24
  233. package/style/base.css +1 -1
  234. package/style/components.css +2 -2
  235. package/style/index.css +2 -2
  236. package/style/theme.css +1 -1
  237. package/types/affix/index.d.cts +1 -1
  238. package/types/affix/index.d.ts +1 -1
  239. package/types/anchor/anchor-link.d.cts +1 -1
  240. package/types/anchor/anchor-link.d.ts +1 -1
  241. package/types/anchor/anchor.d.cts +1 -1
  242. package/types/anchor/anchor.d.ts +1 -1
  243. package/types/back-top/index.d.cts +1 -1
  244. package/types/back-top/index.d.ts +1 -1
  245. package/types/carousel/carousel-item.d.cts +1 -1
  246. package/types/carousel/carousel-item.d.ts +1 -1
  247. package/types/cascader/index.d.cts +1 -1
  248. package/types/cascader/index.d.ts +1 -1
  249. package/types/color-picker/alpha.d.cts +1 -1
  250. package/types/color-picker/alpha.d.ts +1 -1
  251. package/types/color-picker/hue.d.cts +1 -1
  252. package/types/color-picker/hue.d.ts +1 -1
  253. package/types/color-picker/index.d.cts +3 -2
  254. package/types/color-picker/index.d.ts +3 -2
  255. package/types/color-picker/mode.d.cts +1 -1
  256. package/types/color-picker/mode.d.ts +1 -1
  257. package/types/color-picker/paint.d.cts +1 -1
  258. package/types/color-picker/paint.d.ts +1 -1
  259. package/types/color-picker/presets.d.cts +1 -1
  260. package/types/color-picker/presets.d.ts +1 -1
  261. package/types/components.d.cts +3 -0
  262. package/types/components.d.ts +3 -0
  263. package/types/date-picker/index.d.cts +2 -2
  264. package/types/date-picker/index.d.ts +2 -2
  265. package/types/feature-card/index.d.cts +1 -1
  266. package/types/feature-card/index.d.ts +1 -1
  267. package/types/feedback-panel/index.d.cts +1 -1
  268. package/types/feedback-panel/index.d.ts +1 -1
  269. package/types/flame-wrap/index.d.cts +1 -1
  270. package/types/flame-wrap/index.d.ts +1 -1
  271. package/types/form/form-item.d.cts +1 -1
  272. package/types/form/form-item.d.ts +1 -1
  273. package/types/gradient-picker/corners.d.cts +8 -0
  274. package/types/gradient-picker/corners.d.ts +8 -0
  275. package/types/gradient-picker/index.d.cts +25 -0
  276. package/types/gradient-picker/index.d.ts +25 -0
  277. package/types/gradient-picker/stops.d.cts +12 -0
  278. package/types/gradient-picker/stops.d.ts +12 -0
  279. package/types/gradient-picker/types.d.cts +34 -0
  280. package/types/gradient-picker/types.d.ts +34 -0
  281. package/types/grid/grid-item.d.cts +1 -1
  282. package/types/grid/grid-item.d.ts +1 -1
  283. package/types/grid/grid.d.cts +1 -1
  284. package/types/grid/grid.d.ts +1 -1
  285. package/types/image/group.d.cts +1 -1
  286. package/types/image/group.d.ts +1 -1
  287. package/types/input-number/drag.d.cts +9 -0
  288. package/types/input-number/drag.d.ts +9 -0
  289. package/types/input-number/index.d.cts +1 -0
  290. package/types/input-number/index.d.ts +1 -0
  291. package/types/kanban/index.d.cts +1 -1
  292. package/types/kanban/index.d.ts +1 -1
  293. package/types/list-panel/index.d.cts +1 -1
  294. package/types/list-panel/index.d.ts +1 -1
  295. package/types/loading/loading-bar.d.cts +1 -1
  296. package/types/loading/loading-bar.d.ts +1 -1
  297. package/types/modal/toast.d.cts +1 -1
  298. package/types/modal/toast.d.ts +1 -1
  299. package/types/notice/content.d.cts +2 -2
  300. package/types/notice/content.d.ts +2 -2
  301. package/types/page-header/index.d.cts +1 -1
  302. package/types/page-header/index.d.ts +1 -1
  303. package/types/popconfirm/index.d.cts +1 -0
  304. package/types/popconfirm/index.d.ts +1 -0
  305. package/types/poptip/index.d.cts +1 -0
  306. package/types/poptip/index.d.ts +1 -0
  307. package/types/popup/index.d.cts +1 -0
  308. package/types/popup/index.d.ts +1 -0
  309. package/types/result/index.d.cts +1 -1
  310. package/types/result/index.d.ts +1 -1
  311. package/types/ripple/index.d.cts +1 -1
  312. package/types/ripple/index.d.ts +1 -1
  313. package/types/slider/index.d.cts +1 -1
  314. package/types/slider/index.d.ts +1 -1
  315. package/types/splitter/splitter-panel.d.cts +1 -1
  316. package/types/splitter/splitter-panel.d.ts +1 -1
  317. package/types/splitter/splitter.d.cts +1 -1
  318. package/types/splitter/splitter.d.ts +1 -1
  319. package/types/stat-card/countup.d.cts +1 -1
  320. package/types/stat-card/countup.d.ts +1 -1
  321. package/types/stat-card/rollup.d.cts +1 -1
  322. package/types/stat-card/rollup.d.ts +1 -1
  323. package/types/stat-card/stat-card.d.cts +1 -1
  324. package/types/stat-card/stat-card.d.ts +1 -1
  325. package/types/stat-card/stat-number.d.cts +1 -1
  326. package/types/stat-card/stat-number.d.ts +1 -1
  327. package/types/table/column-setting.d.cts +1 -1
  328. package/types/table/column-setting.d.ts +1 -1
  329. package/types/table/index.d.cts +1 -1
  330. package/types/table/index.d.ts +1 -1
  331. package/types/time-line/timeline-item.d.cts +1 -1
  332. package/types/time-line/timeline-item.d.ts +1 -1
  333. package/types/time-line/timeline.d.cts +1 -1
  334. package/types/time-line/timeline.d.ts +1 -1
  335. package/types/tooltip/index.d.cts +1 -0
  336. package/types/tooltip/index.d.ts +1 -0
  337. package/types/transfer/index.d.cts +1 -1
  338. package/types/transfer/index.d.ts +1 -1
  339. package/types/tree-select/index.d.cts +1 -1
  340. package/types/tree-select/index.d.ts +1 -1
  341. package/types/upload/file-list.d.cts +1 -1
  342. package/types/upload/file-list.d.ts +1 -1
  343. package/types/upload/selector.d.cts +1 -1
  344. package/types/upload/selector.d.ts +1 -1
  345. package/types/utils/placement.d.cts +2 -1
  346. package/types/utils/placement.d.ts +2 -1
  347. package/types/utils/popup-arrow.d.cts +5 -0
  348. package/types/utils/popup-arrow.d.ts +5 -0
  349. package/types/utils/selection-tags.d.cts +1 -1
  350. package/types/utils/selection-tags.d.ts +1 -1
  351. package/types/watermark/index.d.cts +1 -1
  352. package/types/watermark/index.d.ts +1 -1
@@ -1,24 +1,23 @@
1
1
  /*!
2
- * react-kui v3.2.1
2
+ * react-kui v3.3.0
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
6
6
  * Author: Qiu / https://chuchur.com
7
7
  */
8
8
 
9
- import Popup from "../popup/index.js";
9
+ import { useValue } from "../utils/use-value.js";
10
10
  import { useFormAppearance } from "../config/use-config-appearance.js";
11
+ import { createFormFieldComponent } from "../form/field-context.js";
11
12
  import { CircleX, Loading } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
12
- import Icon from "../icon/index.js";
13
- import { useValue } from "../utils/use-value.js";
13
+ import Popup from "../popup/index.js";
14
14
  import Empty from "../empty/index.js";
15
- import { createFormFieldComponent } from "../form/field-context.js";
15
+ import Icon from "../icon/index.js";
16
16
  import textarea_default from "../input/textarea.js";
17
- import { c } from "react/compiler-runtime";
18
17
  import clsx from "clsx";
19
- import { useEffect, useId, useRef, useState } from "react";
18
+ import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
20
19
  import { jsx, jsxs } from "react/jsx-runtime";
21
- //#region components/mentions/index.tsx
20
+ // components/mentions/index.tsx
22
21
  var caretPosition = (element) => {
23
22
  const style = window.getComputedStyle(element);
24
23
  const rect = element.getBoundingClientRect();
@@ -69,601 +68,235 @@ var caretPosition = (element) => {
69
68
  return markerRect;
70
69
  };
71
70
  var EMPTY_OPTIONS = [];
72
- var Mentions = (t0) => {
73
- const $ = c(147);
74
- let className;
75
- let disabled;
76
- let emptyText;
77
- let filterOption;
78
- let loadingText;
79
- let onChange;
80
- let onClear;
81
- let onSearch;
82
- let onSelect;
83
- let readOnly;
84
- let rest;
85
- let shapeProp;
86
- let sizeProp;
87
- let t1;
88
- let t2;
89
- let t3;
90
- let t4;
91
- let t5;
92
- let t6;
93
- let t7;
94
- let themeProp;
95
- let value;
96
- if ($[0] !== t0) {
97
- ({value, options: t1, triggers: t2, rows: t3, placement: t4, destroyOnClose: t5, size: sizeProp, shape: shapeProp, theme: themeProp, emptyText, loading: t6, loadingText, clearable: t7, filterOption, onChange, onSearch, onSelect, onClear, className, disabled, readOnly, ...rest} = t0);
98
- $[0] = t0;
99
- $[1] = className;
100
- $[2] = disabled;
101
- $[3] = emptyText;
102
- $[4] = filterOption;
103
- $[5] = loadingText;
104
- $[6] = onChange;
105
- $[7] = onClear;
106
- $[8] = onSearch;
107
- $[9] = onSelect;
108
- $[10] = readOnly;
109
- $[11] = rest;
110
- $[12] = shapeProp;
111
- $[13] = sizeProp;
112
- $[14] = t1;
113
- $[15] = t2;
114
- $[16] = t3;
115
- $[17] = t4;
116
- $[18] = t5;
117
- $[19] = t6;
118
- $[20] = t7;
119
- $[21] = themeProp;
120
- $[22] = value;
121
- } else {
122
- className = $[1];
123
- disabled = $[2];
124
- emptyText = $[3];
125
- filterOption = $[4];
126
- loadingText = $[5];
127
- onChange = $[6];
128
- onClear = $[7];
129
- onSearch = $[8];
130
- onSelect = $[9];
131
- readOnly = $[10];
132
- rest = $[11];
133
- shapeProp = $[12];
134
- sizeProp = $[13];
135
- t1 = $[14];
136
- t2 = $[15];
137
- t3 = $[16];
138
- t4 = $[17];
139
- t5 = $[18];
140
- t6 = $[19];
141
- t7 = $[20];
142
- themeProp = $[21];
143
- value = $[22];
144
- }
145
- const options = t1 === void 0 ? EMPTY_OPTIONS : t1;
146
- let t8;
147
- if ($[23] !== t2) {
148
- t8 = t2 === void 0 ? ["@"] : t2;
149
- $[23] = t2;
150
- $[24] = t8;
151
- } else t8 = $[24];
152
- const triggers = t8;
153
- const rows = t3 === void 0 ? 1 : t3;
154
- const placement = t4 === void 0 ? "bottom-left" : t4;
155
- const destroyOnClose = t5 === void 0 ? true : t5;
156
- const loading = t6 === void 0 ? false : t6;
157
- const clearable = t7 === void 0 ? true : t7;
71
+ var Mentions = ({ value, options = EMPTY_OPTIONS, triggers = ["@"], rows = 1, placement = "bottom-left", destroyOnClose = true, size: sizeProp, shape: shapeProp, theme: themeProp, emptyText, loading = false, loadingText, clearable = true, filterOption, onChange, onSearch, onSelect, onClear, className, disabled, readOnly, ...rest }) => {
158
72
  const inheritedAppearance = useFormAppearance();
159
73
  const size = sizeProp ?? inheritedAppearance.size;
160
74
  const shape = shapeProp ?? inheritedAppearance.shape;
161
75
  const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
162
- const [inner, setInner] = useValue(value, _temp);
163
- const t9 = useId();
164
- let t10;
165
- if ($[25] !== t9) {
166
- let t11;
167
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
168
- t11 = /:/g;
169
- $[27] = t11;
170
- } else t11 = $[27];
171
- t10 = t9.replace(t11, "");
172
- $[25] = t9;
173
- $[26] = t10;
174
- } else t10 = $[26];
175
- const listboxId = `k-mentions-listbox-${t10}`;
76
+ const [inner, setInner] = useValue(value, (next) => next ?? "");
77
+ const listboxId = `k-mentions-listbox-${useId().replace(/:/g, "")}`;
176
78
  const [query, setQuery] = useState(null);
177
79
  const [active, setActive] = useState(0);
178
- let t11;
179
- if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
180
- t11 = [];
181
- $[28] = t11;
182
- } else t11 = $[28];
183
- const [shown, setShown] = useState(t11);
80
+ const [shown, setShown] = useState([]);
184
81
  const [popupWidth, setPopupWidth] = useState(260);
185
82
  const rootRef = useRef(null);
186
83
  const textareaRef = useRef(null);
187
84
  const dropdownRef = useRef(null);
188
85
  const composing = useRef(false);
189
86
  const current = inner;
190
- let t12;
191
- if ($[29] !== options) {
192
- t12 = options.map(_temp2);
193
- $[29] = options;
194
- $[30] = t12;
195
- } else t12 = $[30];
196
- const normalized = t12;
197
- let t13;
198
- if ($[31] !== triggers) {
199
- t13 = triggers.filter(Boolean);
200
- $[31] = triggers;
201
- $[32] = t13;
202
- } else t13 = $[32];
203
- const effectiveTriggers = t13;
204
- const firstEnabled = _temp4;
205
- let t14;
206
- if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
207
- t14 = (items_0) => {
208
- setShown(items_0);
209
- setActive(firstEnabled(items_0));
210
- };
211
- $[33] = t14;
212
- } else t14 = $[33];
213
- const setMatches = t14;
214
- let t15;
215
- if ($[34] !== active || $[35] !== shown) {
216
- t15 = (offset) => {
217
- const enabled = shown.map(_temp5).filter(_temp6);
218
- if (!enabled.length) return;
219
- const currentIndex = enabled.indexOf(active);
220
- setActive(enabled[(Math.max(currentIndex, 0) + offset + enabled.length) % enabled.length]);
221
- };
222
- $[34] = active;
223
- $[35] = shown;
224
- $[36] = t15;
225
- } else t15 = $[36];
226
- const moveActive = t15;
227
- let t16;
228
- if ($[37] !== filterOption || $[38] !== normalized || $[39] !== onSearch) {
229
- t16 = (state) => {
230
- if (onSearch && !filterOption) return normalized;
231
- return normalized.filter((option_1) => filterOption ? filterOption(state.text, option_1) : option_1.value.toLocaleLowerCase().includes(state.text.toLocaleLowerCase()));
232
- };
233
- $[37] = filterOption;
234
- $[38] = normalized;
235
- $[39] = onSearch;
236
- $[40] = t16;
237
- } else t16 = $[40];
238
- const getMatches = t16;
87
+ const normalized = useMemo(() => options.map((item) => typeof item === "string" ? {
88
+ value: item,
89
+ label: item
90
+ } : item), [options]);
91
+ const effectiveTriggers = useMemo(() => triggers.filter(Boolean), [triggers]);
92
+ const firstEnabled = (items) => {
93
+ const index = items.findIndex((option) => !option.disabled);
94
+ return index < 0 ? 0 : index;
95
+ };
96
+ const setMatches = (items_0) => {
97
+ setShown(items_0);
98
+ setActive(firstEnabled(items_0));
99
+ };
100
+ const moveActive = (offset) => {
101
+ const enabled = shown.map((option_0, index_0) => !option_0.disabled ? index_0 : -1).filter((index_1) => index_1 >= 0);
102
+ if (!enabled.length) return;
103
+ const currentIndex = enabled.indexOf(active);
104
+ setActive(enabled[(Math.max(currentIndex, 0) + offset + enabled.length) % enabled.length]);
105
+ };
106
+ const getMatches = useCallback((state) => {
107
+ if (onSearch && !filterOption) return normalized;
108
+ return normalized.filter((option_1) => filterOption ? filterOption(state.text, option_1) : option_1.value.toLocaleLowerCase().includes(state.text.toLocaleLowerCase()));
109
+ }, [
110
+ filterOption,
111
+ normalized,
112
+ onSearch
113
+ ]);
239
114
  const [previousNormalized, setPreviousNormalized] = useState(normalized);
240
115
  if (previousNormalized !== normalized) {
241
116
  setPreviousNormalized(normalized);
242
117
  if (query) setMatches(getMatches(query));
243
118
  }
244
- let t17;
245
- if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
246
- t17 = () => {
247
- if (!textareaRef.current) return null;
248
- const rect = caretPosition(textareaRef.current);
249
- setPopupWidth(Math.min(260, rootRef.current?.offsetWidth || 260));
250
- return {
251
- x: rect.left,
252
- y: rect.bottom
253
- };
254
- };
255
- $[41] = t17;
256
- } else t17 = $[41];
257
- const getAnchorPosition = t17;
258
- let t18;
259
- if ($[42] !== effectiveTriggers || $[43] !== getMatches || $[44] !== onSearch || $[45] !== readOnly) {
260
- t18 = (text, caret, t19) => {
261
- const search = t19 === void 0 ? false : t19;
262
- if (readOnly) {
263
- setQuery(null);
264
- return;
265
- }
266
- const prefix = text.slice(0, caret);
267
- let found = null;
268
- effectiveTriggers.forEach((trigger) => {
269
- const start = prefix.lastIndexOf(trigger);
270
- if (start >= 0 && !/\s/.test(prefix.slice(start + trigger.length)) && (!found || start > found.start)) found = {
271
- start,
272
- trigger,
273
- text: prefix.slice(start + trigger.length)
274
- };
275
- });
276
- const nextQuery = found;
277
- setQuery(nextQuery);
278
- if (nextQuery) {
279
- setMatches(onSearch && search && nextQuery.text ? [] : getMatches(nextQuery));
280
- if (search && nextQuery.text) onSearch?.(nextQuery.text, nextQuery.trigger);
281
- } else setMatches([]);
282
- };
283
- $[42] = effectiveTriggers;
284
- $[43] = getMatches;
285
- $[44] = onSearch;
286
- $[45] = readOnly;
287
- $[46] = t18;
288
- } else t18 = $[46];
289
- const updateQuery = t18;
290
- let t19;
291
- let t20;
292
- if ($[47] !== active || $[48] !== listboxId) {
293
- t19 = () => {
294
- dropdownRef.current?.querySelector(`#${listboxId}-option-${active}`)?.scrollIntoView({ block: "nearest" });
119
+ const getAnchorPosition = useCallback(() => {
120
+ if (!textareaRef.current) return null;
121
+ const rect = caretPosition(textareaRef.current);
122
+ setPopupWidth(Math.min(260, rootRef.current?.offsetWidth || 260));
123
+ return {
124
+ x: rect.left,
125
+ y: rect.bottom
295
126
  };
296
- t20 = [active, listboxId];
297
- $[47] = active;
298
- $[48] = listboxId;
299
- $[49] = t19;
300
- $[50] = t20;
301
- } else {
302
- t19 = $[49];
303
- t20 = $[50];
304
- }
305
- useEffect(t19, t20);
306
- let t21;
307
- if ($[51] !== disabled || $[52] !== onChange || $[53] !== readOnly || $[54] !== setInner) {
308
- t21 = (next_0) => {
309
- if (disabled || readOnly) return;
310
- setInner(next_0);
311
- onChange?.(next_0);
312
- };
313
- $[51] = disabled;
314
- $[52] = onChange;
315
- $[53] = readOnly;
316
- $[54] = setInner;
317
- $[55] = t21;
318
- } else t21 = $[55];
319
- const setValue = t21;
320
- let t22;
321
- if ($[56] !== disabled || $[57] !== onClear || $[58] !== readOnly || $[59] !== setValue) {
322
- t22 = (event) => {
323
- if (disabled || readOnly) return;
324
- event.stopPropagation();
325
- setValue("");
127
+ }, []);
128
+ const updateQuery = (text, caret, search = false) => {
129
+ if (readOnly) {
326
130
  setQuery(null);
327
- onClear?.();
328
- textareaRef.current?.focus();
329
- };
330
- $[56] = disabled;
331
- $[57] = onClear;
332
- $[58] = readOnly;
333
- $[59] = setValue;
334
- $[60] = t22;
335
- } else t22 = $[60];
336
- const clear = t22;
337
- let t23;
338
- if ($[61] !== current || $[62] !== disabled || $[63] !== onSelect || $[64] !== query || $[65] !== readOnly || $[66] !== setValue) {
339
- t23 = (option_2) => {
340
- const textarea = textareaRef.current;
341
- if (disabled || readOnly || !query || option_2.disabled || !textarea) return;
342
- const state_0 = query;
343
- const caret_0 = textarea.selectionStart;
344
- setValue(`${current.slice(0, state_0.start)}${state_0.trigger}${option_2.value} ${current.slice(caret_0)}`);
345
- setQuery(null);
346
- onSelect?.(option_2, state_0.trigger);
347
- requestAnimationFrame(() => {
348
- const at = state_0.start + state_0.trigger.length + option_2.value.length + 1;
349
- textarea.focus();
350
- textarea.setSelectionRange(at, at);
351
- });
352
- };
353
- $[61] = current;
354
- $[62] = disabled;
355
- $[63] = onSelect;
356
- $[64] = query;
357
- $[65] = readOnly;
358
- $[66] = setValue;
359
- $[67] = t23;
360
- } else t23 = $[67];
361
- const choose = t23;
362
- const t24 = size === "small";
363
- const t25 = size === "large";
364
- const t26 = clearable && !!current && !disabled && !readOnly;
365
- let t27;
366
- if ($[68] !== className || $[69] !== disabled || $[70] !== readOnly || $[71] !== t24 || $[72] !== t25 || $[73] !== t26) {
367
- t27 = clsx("k-mentions", className, {
368
- "k-mentions-sm": t24,
369
- "k-mentions-lg": t25,
370
- "k-mentions-disabled": disabled,
371
- "k-mentions-readonly": readOnly,
372
- "k-mentions-has-clear": t26
373
- });
374
- $[68] = className;
375
- $[69] = disabled;
376
- $[70] = readOnly;
377
- $[71] = t24;
378
- $[72] = t25;
379
- $[73] = t26;
380
- $[74] = t27;
381
- } else t27 = $[74];
382
- const t28 = Boolean(query);
383
- const t29 = query ? listboxId : void 0;
384
- const t30 = query && shown[active] ? `${listboxId}-option-${active}` : void 0;
385
- let t31;
386
- if ($[75] !== setValue || $[76] !== updateQuery) {
387
- t31 = (text_0) => {
388
- setValue(text_0);
389
- if (composing.current) return;
390
- if (textareaRef.current) updateQuery(text_0, textareaRef.current.selectionStart, true);
391
- };
392
- $[75] = setValue;
393
- $[76] = updateQuery;
394
- $[77] = t31;
395
- } else t31 = $[77];
396
- let t32;
397
- if ($[78] === Symbol.for("react.memo_cache_sentinel")) {
398
- t32 = () => {
399
- composing.current = true;
400
- };
401
- $[78] = t32;
402
- } else t32 = $[78];
403
- let t33;
404
- if ($[79] !== updateQuery) {
405
- t33 = (event_0) => {
406
- composing.current = false;
407
- updateQuery(event_0.currentTarget.value, event_0.currentTarget.selectionStart, true);
408
- };
409
- $[79] = updateQuery;
410
- $[80] = t33;
411
- } else t33 = $[80];
412
- let t34;
413
- let t35;
414
- let t36;
415
- if ($[81] !== current || $[82] !== updateQuery) {
416
- t34 = () => textareaRef.current && updateQuery(current, textareaRef.current.selectionStart);
417
- t35 = () => textareaRef.current && updateQuery(current, textareaRef.current.selectionStart);
418
- t36 = (event_1) => {
419
- if ([
420
- "ArrowLeft",
421
- "ArrowRight",
422
- "Home",
423
- "End"
424
- ].includes(event_1.key) && textareaRef.current) updateQuery(current, textareaRef.current.selectionStart);
425
- };
426
- $[81] = current;
427
- $[82] = updateQuery;
428
- $[83] = t34;
429
- $[84] = t35;
430
- $[85] = t36;
431
- } else {
432
- t34 = $[83];
433
- t35 = $[84];
434
- t36 = $[85];
435
- }
436
- let t37;
437
- if ($[86] !== active || $[87] !== choose || $[88] !== moveActive || $[89] !== query || $[90] !== shown) {
438
- t37 = (event_2) => {
439
- if (!query) return;
440
- if ((event_2.key === "ArrowDown" || event_2.key === "ArrowUp") && shown.length) {
441
- moveActive(event_2.key === "ArrowDown" ? 1 : -1);
442
- event_2.preventDefault();
443
- } else if (event_2.key === "Enter" && shown.length) {
444
- choose(shown[active]);
445
- event_2.preventDefault();
446
- } else if (event_2.key === "Escape") {
447
- event_2.preventDefault();
448
- event_2.stopPropagation();
449
- setQuery(null);
450
- }
451
- };
452
- $[86] = active;
453
- $[87] = choose;
454
- $[88] = moveActive;
455
- $[89] = query;
456
- $[90] = shown;
457
- $[91] = t37;
458
- } else t37 = $[91];
459
- let t38;
460
- if ($[92] !== current || $[93] !== disabled || $[94] !== readOnly || $[95] !== rest || $[96] !== rows || $[97] !== shape || $[98] !== size || $[99] !== t28 || $[100] !== t29 || $[101] !== t30 || $[102] !== t31 || $[103] !== t33 || $[104] !== t34 || $[105] !== t35 || $[106] !== t36 || $[107] !== t37 || $[108] !== theme) {
461
- t38 = /* @__PURE__ */ jsx(textarea_default, {
462
- ...rest,
463
- ref: textareaRef,
464
- value: current,
465
- rows,
466
- size,
467
- shape,
468
- theme,
469
- disabled,
470
- readOnly,
471
- "aria-haspopup": "listbox",
472
- "aria-expanded": t28,
473
- "aria-controls": t29,
474
- "aria-activedescendant": t30,
475
- onChange: t31,
476
- onCompositionStart: t32,
477
- onCompositionEnd: t33,
478
- onClick: t34,
479
- onSelect: t35,
480
- onKeyUp: t36,
481
- onKeyDown: t37
131
+ return;
132
+ }
133
+ const prefix = text.slice(0, caret);
134
+ let found = null;
135
+ effectiveTriggers.forEach((trigger) => {
136
+ const start = prefix.lastIndexOf(trigger);
137
+ if (start >= 0 && !/\s/.test(prefix.slice(start + trigger.length)) && (!found || start > found.start)) found = {
138
+ start,
139
+ trigger,
140
+ text: prefix.slice(start + trigger.length)
141
+ };
482
142
  });
483
- $[92] = current;
484
- $[93] = disabled;
485
- $[94] = readOnly;
486
- $[95] = rest;
487
- $[96] = rows;
488
- $[97] = shape;
489
- $[98] = size;
490
- $[99] = t28;
491
- $[100] = t29;
492
- $[101] = t30;
493
- $[102] = t31;
494
- $[103] = t33;
495
- $[104] = t34;
496
- $[105] = t35;
497
- $[106] = t36;
498
- $[107] = t37;
499
- $[108] = theme;
500
- $[109] = t38;
501
- } else t38 = $[109];
502
- let t39;
503
- if ($[110] !== clear || $[111] !== clearable || $[112] !== current || $[113] !== disabled || $[114] !== readOnly) {
504
- t39 = clearable && current && !disabled && !readOnly && /* @__PURE__ */ jsx(Icon, {
505
- className: "k-mentions-clearable",
506
- type: CircleX,
507
- role: "button",
508
- tabIndex: 0,
509
- "aria-label": "Clear",
510
- onPointerDown: _temp7,
511
- onClick: clear,
512
- onKeyDown: (event_4) => {
513
- if (event_4.key === "Enter" || event_4.key === " ") clear(event_4);
514
- }
143
+ const nextQuery = found;
144
+ setQuery(nextQuery);
145
+ if (nextQuery) {
146
+ setMatches(onSearch && search && nextQuery.text ? [] : getMatches(nextQuery));
147
+ if (search && nextQuery.text) onSearch?.(nextQuery.text, nextQuery.trigger);
148
+ } else setMatches([]);
149
+ };
150
+ useEffect(() => {
151
+ dropdownRef.current?.querySelector(`#${listboxId}-option-${active}`)?.scrollIntoView({ block: "nearest" });
152
+ }, [active, listboxId]);
153
+ const setValue = (next_0) => {
154
+ if (disabled || readOnly) return;
155
+ setInner(next_0);
156
+ onChange?.(next_0);
157
+ };
158
+ const clear = (event) => {
159
+ if (disabled || readOnly) return;
160
+ event.stopPropagation();
161
+ setValue("");
162
+ setQuery(null);
163
+ onClear?.();
164
+ textareaRef.current?.focus();
165
+ };
166
+ const choose = (option_2) => {
167
+ const textarea = textareaRef.current;
168
+ if (disabled || readOnly || !query || option_2.disabled || !textarea) return;
169
+ const state_0 = query;
170
+ const caret_0 = textarea.selectionStart;
171
+ setValue(`${current.slice(0, state_0.start)}${state_0.trigger}${option_2.value} ${current.slice(caret_0)}`);
172
+ setQuery(null);
173
+ onSelect?.(option_2, state_0.trigger);
174
+ requestAnimationFrame(() => {
175
+ const at = state_0.start + state_0.trigger.length + option_2.value.length + 1;
176
+ textarea.focus();
177
+ textarea.setSelectionRange(at, at);
515
178
  });
516
- $[110] = clear;
517
- $[111] = clearable;
518
- $[112] = current;
519
- $[113] = disabled;
520
- $[114] = readOnly;
521
- $[115] = t39;
522
- } else t39 = $[115];
523
- const t40 = !!query;
524
- let t41;
525
- if ($[116] !== popupWidth) {
526
- t41 = { minWidth: popupWidth };
527
- $[116] = popupWidth;
528
- $[117] = t41;
529
- } else t41 = $[117];
530
- let t42;
531
- if ($[118] === Symbol.for("react.memo_cache_sentinel")) {
532
- t42 = (next_1) => {
533
- if (!next_1) setQuery(null);
534
- };
535
- $[118] = t42;
536
- } else t42 = $[118];
537
- const t43 = size === "small";
538
- const t44 = size === "large";
539
- let t45;
540
- if ($[119] !== t43 || $[120] !== t44) {
541
- t45 = clsx("k-select-dropdown", "k-mentions-dropdown", {
542
- "k-select-dropdown-sm": t43,
543
- "k-select-dropdown-lg": t44
544
- });
545
- $[119] = t43;
546
- $[120] = t44;
547
- $[121] = t45;
548
- } else t45 = $[121];
549
- let t46;
550
- if ($[122] !== active || $[123] !== choose || $[124] !== disabled || $[125] !== emptyText || $[126] !== listboxId || $[127] !== loading || $[128] !== loadingText || $[129] !== readOnly || $[130] !== shown) {
551
- t46 = loading ? /* @__PURE__ */ jsxs("div", {
552
- className: "k-select-loading k-mentions-loading",
553
- children: [/* @__PURE__ */ jsx(Icon, {
554
- type: Loading,
555
- spin: true
556
- }), loadingText && /* @__PURE__ */ jsx("span", { children: loadingText })]
557
- }) : shown.length ? /* @__PURE__ */ jsx("ul", { children: shown.map((option_3, index_2) => /* @__PURE__ */ jsx("li", {
558
- id: `${listboxId}-option-${index_2}`,
559
- role: "option",
560
- "aria-selected": active === index_2,
561
- className: clsx("k-select-item", {
562
- "k-select-item-active": active === index_2,
563
- "k-select-item-disabled": option_3.disabled
179
+ };
180
+ return /* @__PURE__ */ jsxs("div", {
181
+ ref: rootRef,
182
+ className: clsx("k-mentions", className, {
183
+ "k-mentions-sm": size === "small",
184
+ "k-mentions-lg": size === "large",
185
+ "k-mentions-disabled": disabled,
186
+ "k-mentions-readonly": readOnly,
187
+ "k-mentions-has-clear": clearable && !!current && !disabled && !readOnly
188
+ }),
189
+ children: [
190
+ /* @__PURE__ */ jsx(textarea_default, {
191
+ ...rest,
192
+ ref: textareaRef,
193
+ value: current,
194
+ rows,
195
+ size,
196
+ shape,
197
+ theme,
198
+ disabled,
199
+ readOnly,
200
+ "aria-haspopup": "listbox",
201
+ "aria-expanded": Boolean(query),
202
+ "aria-controls": query ? listboxId : void 0,
203
+ "aria-activedescendant": query && shown[active] ? `${listboxId}-option-${active}` : void 0,
204
+ onChange: (text_0) => {
205
+ setValue(text_0);
206
+ if (composing.current) return;
207
+ if (textareaRef.current) updateQuery(text_0, textareaRef.current.selectionStart, true);
208
+ },
209
+ onCompositionStart: () => {
210
+ composing.current = true;
211
+ },
212
+ onCompositionEnd: (event_0) => {
213
+ composing.current = false;
214
+ updateQuery(event_0.currentTarget.value, event_0.currentTarget.selectionStart, true);
215
+ },
216
+ onClick: () => textareaRef.current && updateQuery(current, textareaRef.current.selectionStart),
217
+ onSelect: () => textareaRef.current && updateQuery(current, textareaRef.current.selectionStart),
218
+ onKeyUp: (event_1) => {
219
+ if ([
220
+ "ArrowLeft",
221
+ "ArrowRight",
222
+ "Home",
223
+ "End"
224
+ ].includes(event_1.key) && textareaRef.current) updateQuery(current, textareaRef.current.selectionStart);
225
+ },
226
+ onKeyDown: (event_2) => {
227
+ if (!query) return;
228
+ if ((event_2.key === "ArrowDown" || event_2.key === "ArrowUp") && shown.length) {
229
+ moveActive(event_2.key === "ArrowDown" ? 1 : -1);
230
+ event_2.preventDefault();
231
+ } else if (event_2.key === "Enter" && shown.length) {
232
+ choose(shown[active]);
233
+ event_2.preventDefault();
234
+ } else if (event_2.key === "Escape") {
235
+ event_2.preventDefault();
236
+ event_2.stopPropagation();
237
+ setQuery(null);
238
+ }
239
+ }
564
240
  }),
565
- onMouseDown: _temp8,
566
- onMouseEnter: () => !disabled && !readOnly && !option_3.disabled && setActive(index_2),
567
- onClick: () => choose(option_3),
568
- children: option_3.label ?? option_3.value
569
- }, option_3.value)) }) : /* @__PURE__ */ jsx(Empty, { description: emptyText });
570
- $[122] = active;
571
- $[123] = choose;
572
- $[124] = disabled;
573
- $[125] = emptyText;
574
- $[126] = listboxId;
575
- $[127] = loading;
576
- $[128] = loadingText;
577
- $[129] = readOnly;
578
- $[130] = shown;
579
- $[131] = t46;
580
- } else t46 = $[131];
581
- let t47;
582
- if ($[132] !== listboxId || $[133] !== t45 || $[134] !== t46) {
583
- t47 = /* @__PURE__ */ jsx("div", {
584
- ref: dropdownRef,
585
- id: listboxId,
586
- className: t45,
587
- role: "listbox",
588
- children: t46
589
- });
590
- $[132] = listboxId;
591
- $[133] = t45;
592
- $[134] = t46;
593
- $[135] = t47;
594
- } else t47 = $[135];
595
- let t48;
596
- if ($[136] !== destroyOnClose || $[137] !== placement || $[138] !== t40 || $[139] !== t41 || $[140] !== t47) {
597
- t48 = /* @__PURE__ */ jsx(Popup, {
598
- raw: true,
599
- open: t40,
600
- target: rootRef,
601
- trigger: "manual",
602
- placement,
603
- prefixCls: "k-mentions-dropdown",
604
- transitionName: "k-select",
605
- offset: 4,
606
- getAnchorPosition,
607
- style: t41,
608
- destroyOnClose,
609
- outsideEvent: "mousedown",
610
- onOpenChange: t42,
611
- overlay: t47
612
- });
613
- $[136] = destroyOnClose;
614
- $[137] = placement;
615
- $[138] = t40;
616
- $[139] = t41;
617
- $[140] = t47;
618
- $[141] = t48;
619
- } else t48 = $[141];
620
- let t49;
621
- if ($[142] !== t27 || $[143] !== t38 || $[144] !== t39 || $[145] !== t48) {
622
- t49 = /* @__PURE__ */ jsxs("div", {
623
- ref: rootRef,
624
- className: t27,
625
- children: [
626
- t38,
627
- t39,
628
- t48
629
- ]
630
- });
631
- $[142] = t27;
632
- $[143] = t38;
633
- $[144] = t39;
634
- $[145] = t48;
635
- $[146] = t49;
636
- } else t49 = $[146];
637
- return t49;
241
+ clearable && current && !disabled && !readOnly && /* @__PURE__ */ jsx(Icon, {
242
+ className: "k-mentions-clearable",
243
+ type: CircleX,
244
+ role: "button",
245
+ tabIndex: 0,
246
+ "aria-label": "Clear",
247
+ onPointerDown: (event_3) => event_3.preventDefault(),
248
+ onClick: clear,
249
+ onKeyDown: (event_4) => {
250
+ if (event_4.key === "Enter" || event_4.key === " ") clear(event_4);
251
+ }
252
+ }),
253
+ /* @__PURE__ */ jsx(Popup, {
254
+ raw: true,
255
+ open: !!query,
256
+ target: rootRef,
257
+ trigger: "manual",
258
+ placement,
259
+ prefixCls: "k-mentions-dropdown",
260
+ transitionName: "k-select",
261
+ offset: 4,
262
+ getAnchorPosition,
263
+ style: { minWidth: popupWidth },
264
+ destroyOnClose,
265
+ outsideEvent: "mousedown",
266
+ onOpenChange: (next_1) => {
267
+ if (!next_1) setQuery(null);
268
+ },
269
+ overlay: /* @__PURE__ */ jsx("div", {
270
+ ref: dropdownRef,
271
+ id: listboxId,
272
+ className: clsx("k-select-dropdown", "k-mentions-dropdown", {
273
+ "k-select-dropdown-sm": size === "small",
274
+ "k-select-dropdown-lg": size === "large"
275
+ }),
276
+ role: "listbox",
277
+ children: loading ? /* @__PURE__ */ jsxs("div", {
278
+ className: "k-select-loading k-mentions-loading",
279
+ children: [/* @__PURE__ */ jsx(Icon, {
280
+ type: Loading,
281
+ spin: true
282
+ }), loadingText && /* @__PURE__ */ jsx("span", { children: loadingText })]
283
+ }) : shown.length ? /* @__PURE__ */ jsx("ul", { children: shown.map((option_3, index_2) => /* @__PURE__ */ jsx("li", {
284
+ id: `${listboxId}-option-${index_2}`,
285
+ role: "option",
286
+ "aria-selected": active === index_2,
287
+ className: clsx("k-select-item", {
288
+ "k-select-item-active": active === index_2,
289
+ "k-select-item-disabled": option_3.disabled
290
+ }),
291
+ onMouseDown: (event_5) => event_5.preventDefault(),
292
+ onMouseEnter: () => !disabled && !readOnly && !option_3.disabled && setActive(index_2),
293
+ onClick: () => choose(option_3),
294
+ children: option_3.label ?? option_3.value
295
+ }, option_3.value)) }) : /* @__PURE__ */ jsx(Empty, { description: emptyText })
296
+ })
297
+ })
298
+ ]
299
+ });
638
300
  };
639
301
  var mentions_default = createFormFieldComponent(Mentions);
640
- function _temp(next) {
641
- return next ?? "";
642
- }
643
- function _temp2(item) {
644
- return typeof item === "string" ? {
645
- value: item,
646
- label: item
647
- } : item;
648
- }
649
- function _temp3(option) {
650
- return !option.disabled;
651
- }
652
- function _temp4(items) {
653
- const index = items.findIndex(_temp3);
654
- return index < 0 ? 0 : index;
655
- }
656
- function _temp5(option_0, index_0) {
657
- return !option_0.disabled ? index_0 : -1;
658
- }
659
- function _temp6(index_1) {
660
- return index_1 >= 0;
661
- }
662
- function _temp7(event_3) {
663
- return event_3.preventDefault();
664
- }
665
- function _temp8(event_5) {
666
- return event_5.preventDefault();
667
- }
668
- //#endregion
669
302
  export { mentions_default as default };