@astra-kit/ui 0.0.0-stage → 0.0.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 (304) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +384 -2
  4. package/THIRD_PARTY_NOTICES.md +31 -0
  5. package/assets/fonts/geist-LICENSE.txt +93 -0
  6. package/assets/fonts/geist-latin-variable.woff2 +0 -0
  7. package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
  8. package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
  9. package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
  10. package/assets/fonts/inter-LICENSE.txt +93 -0
  11. package/assets/fonts/inter-latin-variable.woff2 +0 -0
  12. package/dist/adapters/unpic-image.d.ts +3 -0
  13. package/dist/adapters/unpic-image.js +98 -0
  14. package/dist/components/account-menu.d.ts +67 -0
  15. package/dist/components/account-menu.js +440 -0
  16. package/dist/components/action-button.d.ts +25 -0
  17. package/dist/components/action-button.js +264 -0
  18. package/dist/components/alert.d.ts +31 -0
  19. package/dist/components/alert.js +503 -0
  20. package/dist/components/animated-collapse.d.ts +19 -0
  21. package/dist/components/animated-collapse.js +170 -0
  22. package/dist/components/animated-count.d.ts +13 -0
  23. package/dist/components/animated-count.js +105 -0
  24. package/dist/components/animated-list-item.d.ts +25 -0
  25. package/dist/components/animated-list-item.js +134 -0
  26. package/dist/components/animated-theme-toggler.d.ts +12 -0
  27. package/dist/components/animated-theme-toggler.js +200 -0
  28. package/dist/components/avatar.d.ts +65 -0
  29. package/dist/components/avatar.js +463 -0
  30. package/dist/components/badge.d.ts +21 -0
  31. package/dist/components/badge.js +297 -0
  32. package/dist/components/button-interaction.d.ts +23 -0
  33. package/dist/components/button-interaction.js +22 -0
  34. package/dist/components/button-label.d.ts +8 -0
  35. package/dist/components/button-label.js +203 -0
  36. package/dist/components/button.d.ts +23 -0
  37. package/dist/components/button.js +145 -0
  38. package/dist/components/calendar.d.ts +47 -0
  39. package/dist/components/calendar.js +155 -0
  40. package/dist/components/card.d.ts +38 -0
  41. package/dist/components/card.js +904 -0
  42. package/dist/components/carousel.d.ts +71 -0
  43. package/dist/components/carousel.js +585 -0
  44. package/dist/components/checkbox.d.ts +15 -0
  45. package/dist/components/checkbox.js +324 -0
  46. package/dist/components/control-button.d.ts +16 -0
  47. package/dist/components/control-button.js +215 -0
  48. package/dist/components/data-table.d.ts +118 -0
  49. package/dist/components/data-table.js +895 -0
  50. package/dist/components/dialog-surface.d.ts +49 -0
  51. package/dist/components/dialog-surface.js +220 -0
  52. package/dist/components/dialog.d.ts +92 -0
  53. package/dist/components/dialog.js +320 -0
  54. package/dist/components/dropdown-menu.d.ts +57 -0
  55. package/dist/components/dropdown-menu.js +107 -0
  56. package/dist/components/field.d.ts +53 -0
  57. package/dist/components/field.js +710 -0
  58. package/dist/components/file-upload.d.ts +88 -0
  59. package/dist/components/file-upload.js +776 -0
  60. package/dist/components/filter-presets-bar.d.ts +73 -0
  61. package/dist/components/filter-presets-bar.js +510 -0
  62. package/dist/components/filter-query-bar.d.ts +21 -0
  63. package/dist/components/filter-query-bar.js +881 -0
  64. package/dist/components/filter-query-grammar.d.ts +188 -0
  65. package/dist/components/filter-query-grammar.js +875 -0
  66. package/dist/components/form.d.ts +29 -0
  67. package/dist/components/form.js +330 -0
  68. package/dist/components/highlighter.d.ts +15 -0
  69. package/dist/components/highlighter.js +152 -0
  70. package/dist/components/hover-card.d.ts +50 -0
  71. package/dist/components/hover-card.js +80 -0
  72. package/dist/components/input-group.d.ts +16 -0
  73. package/dist/components/input-group.js +277 -0
  74. package/dist/components/input.d.ts +17 -0
  75. package/dist/components/input.js +120 -0
  76. package/dist/components/label.d.ts +4 -0
  77. package/dist/components/label.js +43 -0
  78. package/dist/components/link.d.ts +9 -0
  79. package/dist/components/link.js +43 -0
  80. package/dist/components/morph-text.d.ts +14 -0
  81. package/dist/components/morph-text.js +210 -0
  82. package/dist/components/pagination.d.ts +59 -0
  83. package/dist/components/pagination.js +190 -0
  84. package/dist/components/popover.d.ts +17 -0
  85. package/dist/components/popover.js +40 -0
  86. package/dist/components/presence-swap.d.ts +22 -0
  87. package/dist/components/presence-swap.js +209 -0
  88. package/dist/components/primitives/alert-dialog.d.ts +68 -0
  89. package/dist/components/primitives/alert-dialog.js +629 -0
  90. package/dist/components/primitives/avatar.d.ts +46 -0
  91. package/dist/components/primitives/avatar.js +265 -0
  92. package/dist/components/primitives/calendar.d.ts +37 -0
  93. package/dist/components/primitives/calendar.js +1250 -0
  94. package/dist/components/primitives/carousel.d.ts +106 -0
  95. package/dist/components/primitives/carousel.js +928 -0
  96. package/dist/components/primitives/dialog.d.ts +62 -0
  97. package/dist/components/primitives/dialog.js +490 -0
  98. package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
  99. package/dist/components/primitives/dropdown-menu-items.js +265 -0
  100. package/dist/components/primitives/dropdown-menu.d.ts +64 -0
  101. package/dist/components/primitives/dropdown-menu.js +560 -0
  102. package/dist/components/primitives/hover-card.d.ts +50 -0
  103. package/dist/components/primitives/hover-card.js +507 -0
  104. package/dist/components/primitives/pagination.d.ts +65 -0
  105. package/dist/components/primitives/pagination.js +373 -0
  106. package/dist/components/primitives/popover.d.ts +22 -0
  107. package/dist/components/primitives/popover.js +213 -0
  108. package/dist/components/primitives/select.d.ts +37 -0
  109. package/dist/components/primitives/select.js +428 -0
  110. package/dist/components/primitives/tooltip.d.ts +30 -0
  111. package/dist/components/primitives/tooltip.js +277 -0
  112. package/dist/components/progress-ring.d.ts +20 -0
  113. package/dist/components/progress-ring.js +53 -0
  114. package/dist/components/radio-group.d.ts +34 -0
  115. package/dist/components/radio-group.js +392 -0
  116. package/dist/components/reaction-button.d.ts +30 -0
  117. package/dist/components/reaction-button.js +189 -0
  118. package/dist/components/rich-link-editor.d.ts +25 -0
  119. package/dist/components/rich-link-editor.js +320 -0
  120. package/dist/components/rich-markdown-content.d.ts +10 -0
  121. package/dist/components/rich-markdown-content.js +56 -0
  122. package/dist/components/rich-text-content.d.ts +19 -0
  123. package/dist/components/rich-text-content.js +26 -0
  124. package/dist/components/select.d.ts +55 -0
  125. package/dist/components/select.js +188 -0
  126. package/dist/components/separator.d.ts +3 -0
  127. package/dist/components/separator.js +48 -0
  128. package/dist/components/sheet.d.ts +19 -0
  129. package/dist/components/sheet.js +420 -0
  130. package/dist/components/sidebar-panel-context.d.ts +17 -0
  131. package/dist/components/sidebar-panel-context.js +14 -0
  132. package/dist/components/sidebar.d.ts +195 -0
  133. package/dist/components/sidebar.js +2041 -0
  134. package/dist/components/skeleton.d.ts +23 -0
  135. package/dist/components/skeleton.js +334 -0
  136. package/dist/components/split-button.d.ts +36 -0
  137. package/dist/components/split-button.js +306 -0
  138. package/dist/components/svgs/whatsappIcon.d.ts +3 -0
  139. package/dist/components/svgs/whatsappIcon.js +14 -0
  140. package/dist/components/switch.d.ts +13 -0
  141. package/dist/components/switch.js +444 -0
  142. package/dist/components/table.d.ts +10 -0
  143. package/dist/components/table.js +298 -0
  144. package/dist/components/tabs.d.ts +36 -0
  145. package/dist/components/tabs.js +636 -0
  146. package/dist/components/textarea.d.ts +16 -0
  147. package/dist/components/textarea.js +111 -0
  148. package/dist/components/themed-toaster.d.ts +7 -0
  149. package/dist/components/themed-toaster.js +86 -0
  150. package/dist/components/toaster.d.ts +12 -0
  151. package/dist/components/toaster.js +62 -0
  152. package/dist/components/tooltip.d.ts +43 -0
  153. package/dist/components/tooltip.js +65 -0
  154. package/dist/components/typing-animation.d.ts +34 -0
  155. package/dist/components/typing-animation.js +389 -0
  156. package/dist/constants/action-button.d.ts +20 -0
  157. package/dist/constants/action-button.js +17 -0
  158. package/dist/constants/alert.d.ts +16 -0
  159. package/dist/constants/alert.js +13 -0
  160. package/dist/constants/avatar.d.ts +38 -0
  161. package/dist/constants/avatar.js +32 -0
  162. package/dist/constants/badge.d.ts +6 -0
  163. package/dist/constants/badge.js +6 -0
  164. package/dist/constants/button.d.ts +16 -0
  165. package/dist/constants/button.js +16 -0
  166. package/dist/constants/calendar.d.ts +36 -0
  167. package/dist/constants/calendar.js +34 -0
  168. package/dist/constants/card.d.ts +23 -0
  169. package/dist/constants/card.js +20 -0
  170. package/dist/constants/carousel.d.ts +55 -0
  171. package/dist/constants/carousel.js +74 -0
  172. package/dist/constants/checkbox.d.ts +17 -0
  173. package/dist/constants/checkbox.js +17 -0
  174. package/dist/constants/dialog.d.ts +11 -0
  175. package/dist/constants/dialog.js +10 -0
  176. package/dist/constants/dropdown-menu.d.ts +10 -0
  177. package/dist/constants/dropdown-menu.js +37 -0
  178. package/dist/constants/field.d.ts +24 -0
  179. package/dist/constants/field.js +24 -0
  180. package/dist/constants/hover-card.d.ts +37 -0
  181. package/dist/constants/hover-card.js +85 -0
  182. package/dist/constants/morph-text.d.ts +13 -0
  183. package/dist/constants/morph-text.js +13 -0
  184. package/dist/constants/motion.d.ts +12 -0
  185. package/dist/constants/motion.js +12 -0
  186. package/dist/constants/pagination.d.ts +20 -0
  187. package/dist/constants/pagination.js +20 -0
  188. package/dist/constants/popover.d.ts +7 -0
  189. package/dist/constants/popover.js +33 -0
  190. package/dist/constants/radio-group.d.ts +10 -0
  191. package/dist/constants/radio-group.js +10 -0
  192. package/dist/constants/select.d.ts +7 -0
  193. package/dist/constants/select.js +34 -0
  194. package/dist/constants/sidebar.d.ts +9 -0
  195. package/dist/constants/sidebar.js +17 -0
  196. package/dist/constants/skeleton.d.ts +17 -0
  197. package/dist/constants/skeleton.js +17 -0
  198. package/dist/constants/split-button.d.ts +7 -0
  199. package/dist/constants/split-button.js +5 -0
  200. package/dist/constants/switch.d.ts +33 -0
  201. package/dist/constants/switch.js +41 -0
  202. package/dist/constants/tabs.d.ts +17 -0
  203. package/dist/constants/tabs.js +17 -0
  204. package/dist/constants/toast.d.ts +3 -0
  205. package/dist/constants/toast.js +3 -0
  206. package/dist/constants/tooltip.d.ts +13 -0
  207. package/dist/constants/tooltip.js +52 -0
  208. package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
  209. package/dist/hooks/use-horizontal-swipe.js +80 -0
  210. package/dist/hooks/use-is-hydrated.d.ts +6 -0
  211. package/dist/hooks/use-is-hydrated.js +20 -0
  212. package/dist/hooks/use-mobile.d.ts +1 -0
  213. package/dist/hooks/use-mobile.js +19 -0
  214. package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
  215. package/dist/hooks/use-prefers-reduced-motion.js +27 -0
  216. package/dist/hooks/use-rich-link-editor.d.ts +55 -0
  217. package/dist/hooks/use-rich-link-editor.js +515 -0
  218. package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
  219. package/dist/hooks/use-sidebar-persistence.js +52 -0
  220. package/dist/hooks/use-today.d.ts +7 -0
  221. package/dist/hooks/use-today.js +50 -0
  222. package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
  223. package/dist/hooks/use-viewer-time-zone.js +20 -0
  224. package/dist/hooks.d.ts +11 -0
  225. package/dist/hooks.js +11 -0
  226. package/dist/index.d.ts +71 -0
  227. package/dist/index.js +69 -0
  228. package/dist/lib/browser-clipboard.d.ts +13 -0
  229. package/dist/lib/browser-clipboard.js +48 -0
  230. package/dist/lib/column-filter-value.d.ts +12 -0
  231. package/dist/lib/column-filter-value.js +52 -0
  232. package/dist/lib/file-acceptance.d.ts +43 -0
  233. package/dist/lib/file-acceptance.js +107 -0
  234. package/dist/lib/format-file-size.d.ts +16 -0
  235. package/dist/lib/format-file-size.js +34 -0
  236. package/dist/lib/fuzzy-search.d.ts +17 -0
  237. package/dist/lib/fuzzy-search.js +183 -0
  238. package/dist/lib/horizontal-swipe.d.ts +23 -0
  239. package/dist/lib/horizontal-swipe.js +29 -0
  240. package/dist/lib/image-dimensions.d.ts +2 -0
  241. package/dist/lib/image-dimensions.js +7 -0
  242. package/dist/lib/name-initials.d.ts +7 -0
  243. package/dist/lib/name-initials.js +11 -0
  244. package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
  245. package/dist/lib/rich-text/link-markdown-constants.js +458 -0
  246. package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
  247. package/dist/lib/rich-text/link-markdown-types.js +1 -0
  248. package/dist/lib/rich-text/link-markdown.d.ts +193 -0
  249. package/dist/lib/rich-text/link-markdown.js +592 -0
  250. package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
  251. package/dist/lib/rich-text/rich-markdown.js +105 -0
  252. package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
  253. package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
  254. package/dist/lib/toast-layer.d.ts +24 -0
  255. package/dist/lib/toast-layer.js +76 -0
  256. package/dist/lib/utils.d.ts +2 -0
  257. package/dist/lib/utils.js +2 -0
  258. package/dist/lib/year-month-filter.d.ts +16 -0
  259. package/dist/lib/year-month-filter.js +46 -0
  260. package/dist/motion/arc-floating-slot.d.ts +40 -0
  261. package/dist/motion/arc-floating-slot.js +177 -0
  262. package/dist/motion/arc-press.d.ts +6 -0
  263. package/dist/motion/arc-press.js +59 -0
  264. package/dist/motion/arc-swap.d.ts +22 -0
  265. package/dist/motion/arc-swap.js +49 -0
  266. package/dist/motion/arc-tokens.d.ts +53 -0
  267. package/dist/motion/arc-tokens.js +73 -0
  268. package/dist/motion/glide-indicator.d.ts +69 -0
  269. package/dist/motion/glide-indicator.js +309 -0
  270. package/dist/motion/glide-slot.d.ts +9 -0
  271. package/dist/motion/glide-slot.js +71 -0
  272. package/dist/motion/motion-slot.d.ts +12 -0
  273. package/dist/motion/motion-slot.js +376 -0
  274. package/dist/motion/overlay-warmth.d.ts +24 -0
  275. package/dist/motion/overlay-warmth.js +70 -0
  276. package/dist/motion/presence.d.ts +40 -0
  277. package/dist/motion/presence.js +101 -0
  278. package/dist/motion/surface-keyframes.d.ts +24 -0
  279. package/dist/motion/surface-keyframes.js +141 -0
  280. package/dist/motion/tokens.d.ts +81 -0
  281. package/dist/motion/tokens.js +67 -0
  282. package/dist/motion/use-attached-element.d.ts +7 -0
  283. package/dist/motion/use-attached-element.js +22 -0
  284. package/dist/motion/use-morph-width.d.ts +13 -0
  285. package/dist/motion/use-morph-width.js +59 -0
  286. package/dist/next.d.ts +14 -0
  287. package/dist/next.js +79 -0
  288. package/dist/providers/astra-ui-provider.d.ts +27 -0
  289. package/dist/providers/astra-ui-provider.js +100 -0
  290. package/dist/providers/native-provider.d.ts +4 -0
  291. package/dist/providers/native-provider.js +45 -0
  292. package/dist/sonner.d.ts +7 -0
  293. package/dist/sonner.js +8 -0
  294. package/dist/styles.css +2 -0
  295. package/dist/tanstack.d.ts +11 -0
  296. package/dist/tanstack.js +50 -0
  297. package/dist/theme.d.ts +3 -0
  298. package/dist/theme.js +1 -0
  299. package/dist/types/data-table.d.ts +27 -0
  300. package/dist/types/data-table.js +1 -0
  301. package/fonts.css +5 -0
  302. package/package.json +450 -4
  303. package/styles.css +4 -0
  304. package/theme.css +248 -0
@@ -0,0 +1,881 @@
1
+ "use client";
2
+ import { c as _c } from "react/compiler-runtime";
3
+ import * as React from "react";
4
+ import { Calendar, Check, CircleDot, CircleMinus, CircleSlash, Folder, Hash, List, Type, User, X } from "lucide-react";
5
+ import { ControlButton } from "./control-button.js";
6
+ import { Input } from "./input.js";
7
+ import { Popover, PopoverAnchor, PopoverContent } from "./primitives/popover.js";
8
+ import { cn } from "../lib/utils.js";
9
+ import { getActiveFilterToken, getValueHighlightRanges, normalizeFilterSlug, parseFilterQuery, PRESENCE_HAS_META_KEY, PRESENCE_NO_META_KEY, UNASSIGNED_FOLDER_FILTER_VALUE } from "./filter-query-grammar.js";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const DEFAULT_PLACEHOLDER = "Filtrar por campo o palabra clave";
12
+ const DEFAULT_ARIA_LABEL = "Filtrar gastos";
13
+ const CLEAR_FILTER_ARIA_LABEL = "Limpiar todos los filtros";
14
+ const KEY_GROUP_LABEL = "Campos";
15
+ const VALUE_GROUP_LABEL = "Valores";
16
+ const LISTBOX_ID = "filter-query-bar-listbox";
17
+ const OPTION_ID_PREFIX = "filter-query-bar-option";
18
+ const NUMBER_RANGE_VALUE_SUGGESTIONS = [
19
+ {
20
+ label: "Mayor o igual (≥)",
21
+ slug: ">="
22
+ },
23
+ {
24
+ label: "Menor o igual (≤)",
25
+ slug: "<="
26
+ },
27
+ {
28
+ label: "Rango (100..500)",
29
+ slug: ".."
30
+ }
31
+ ];
32
+ /**
33
+ * Operadores para qualifiers de fecha (mes-año). Reflejan los numéricos: cota
34
+ * inferior (`>=`), cota superior (`<=`) y rango (`..`). La presencia/ausencia de
35
+ * fecha se cubre con las meta-claves `tiene:`/`no:` del bloque universal.
36
+ */
37
+ const YEAR_MONTH_VALUE_SUGGESTIONS = [
38
+ {
39
+ keepOpen: true,
40
+ label: "Desde (≥)",
41
+ slug: ">="
42
+ },
43
+ {
44
+ keepOpen: true,
45
+ label: "Hasta (≤)",
46
+ slug: "<="
47
+ },
48
+ {
49
+ keepOpen: true,
50
+ label: "Rango (2026-01..2026-06)",
51
+ slug: ".."
52
+ }
53
+ ];
54
+ const TEXT_MATCH_VALUE_SUGGESTIONS = [
55
+ {
56
+ caretOffset: 0,
57
+ insertText: "*",
58
+ keepOpen: true,
59
+ label: "Empieza por…",
60
+ name: "starts",
61
+ slug: ""
62
+ },
63
+ {
64
+ caretOffset: 1,
65
+ insertText: "**",
66
+ keepOpen: true,
67
+ label: "Contiene…",
68
+ name: "contains",
69
+ slug: ""
70
+ },
71
+ {
72
+ insertText: "*",
73
+ keepOpen: true,
74
+ label: "Termina con…",
75
+ name: "ends",
76
+ slug: ""
77
+ }
78
+ ];
79
+ /** Meta-claves de presencia ofrecidas también como campos de primer nivel. */
80
+ const PRESENCE_META_KEY_SUGGESTIONS = [{
81
+ icon: Check,
82
+ key: PRESENCE_HAS_META_KEY,
83
+ label: "Tiene…"
84
+ }, {
85
+ icon: CircleSlash,
86
+ key: PRESENCE_NO_META_KEY,
87
+ label: "No tiene…"
88
+ }];
89
+ /** Icono representativo de cada tipo de qualifier, mostrado a su izquierda. */
90
+ function getKindIcon(kind) {
91
+ switch (kind) {
92
+ case "numberRange": return Hash;
93
+ case "textMatch": return Type;
94
+ case "enum": return List;
95
+ case "presence": return CircleDot;
96
+ case "yearMonthRange": return Calendar;
97
+ case "folder": return Folder;
98
+ default: return Type;
99
+ }
100
+ }
101
+ /** Iconos por nombre lógico declarado en el qualifier (`config.iconName`). */
102
+ const ICON_BY_NAME = { user: User };
103
+ /** Icono de un qualifier: override por `iconName`, o el icono por defecto del kind. */
104
+ function getQualifierIcon(config) {
105
+ if (config.iconName && ICON_BY_NAME[config.iconName]) {
106
+ return ICON_BY_NAME[config.iconName];
107
+ }
108
+ return getKindIcon(config.kind);
109
+ }
110
+ function startsWithNormalized(candidate, prefix) {
111
+ if (!prefix) {
112
+ return true;
113
+ }
114
+ return normalizeFilterSlug(candidate).startsWith(normalizeFilterSlug(prefix));
115
+ }
116
+ /** Etiqueta de la opción raíz de exclusión (arranca un token `-campo:`). */
117
+ const EXCLUDE_ROOT_LABEL = "Excluir";
118
+ function buildKeySuggestions(configs, keyPart, { negated, includeExclude, appliedFilters }) {
119
+ const prefix = negated ? "-" : "";
120
+ const fieldSuggestions = configs.filter((config) => config.kind !== "text" && config.key).filter((config) => getAppliedPresenceValue(config, appliedFilters) !== "noValue").filter((config) => startsWithNormalized(config.key, keyPart) || startsWithNormalized(config.label, keyPart)).map((config) => ({
121
+ group: "key",
122
+ icon: getQualifierIcon(config),
123
+ id: `${OPTION_ID_PREFIX}-key-${negated ? "neg-" : ""}${config.key}`,
124
+ insertText: `${prefix}${config.key}:`,
125
+ keepOpen: true,
126
+ label: config.label
127
+ }));
128
+ const hasPresenceCapableFields = configs.some((config) => config.kind !== "text" && Boolean(config.key) && config.supportsPresence !== false);
129
+ const metaSuggestions = negated || !hasPresenceCapableFields ? [] : PRESENCE_META_KEY_SUGGESTIONS.filter((meta) => startsWithNormalized(meta.key, keyPart) || startsWithNormalized(meta.label, keyPart)).map((meta) => ({
130
+ group: "meta",
131
+ icon: meta.icon,
132
+ id: `${OPTION_ID_PREFIX}-key-${meta.key}`,
133
+ insertText: `${meta.key}:`,
134
+ keepOpen: true,
135
+ label: meta.label
136
+ }));
137
+ const excludeSuggestion = includeExclude ? [{
138
+ group: "meta",
139
+ icon: CircleMinus,
140
+ id: `${OPTION_ID_PREFIX}-exclude-root`,
141
+ insertText: "-",
142
+ keepOpen: true,
143
+ label: EXCLUDE_ROOT_LABEL
144
+ }] : [];
145
+ return [
146
+ ...fieldSuggestions,
147
+ ...metaSuggestions,
148
+ ...excludeSuggestion
149
+ ];
150
+ }
151
+ /**
152
+ * Sugerencias de valor para una meta-clave de presencia (`tiene:` / `no:`): el
153
+ * "valor" es la clave del campo destino (`tiene:enviados`, `no:carpeta`).
154
+ */
155
+ function buildMetaValueSuggestions(configs, metaKey, valuePart, appliedFilters) {
156
+ return configs.filter((config) => config.kind !== "text" && config.key).filter((config) => config.supportsPresence !== false).filter((config) => !hasPresenceMetaFilterAlreadyApplied(config, appliedFilters)).filter((config) => startsWithNormalized(config.key, valuePart) || startsWithNormalized(config.label, valuePart)).map((config) => ({
157
+ group: "value",
158
+ icon: getQualifierIcon(config),
159
+ id: `${OPTION_ID_PREFIX}-meta-${metaKey}-${config.key}`,
160
+ insertText: `${config.key} `,
161
+ keepOpen: false,
162
+ label: config.label
163
+ }));
164
+ }
165
+ /**
166
+ * Bloque universal que aparece al entrar a cualquier filtro: presencia
167
+ * (`tiene:<clave>`), ausencia (`no:<clave>`) y exclusión de un valor
168
+ * (`-<clave>:`). Reescriben el token completo, por eso usan `replaceTokenStart`.
169
+ */
170
+ function buildPresenceAndExcludeSuggestions(config, appliedFilters) {
171
+ const appliedPresenceValue = getAppliedPresenceValue(config, appliedFilters);
172
+ const hasAppliedPresence = appliedPresenceValue != null;
173
+ const suggestions = hasAppliedPresence || config.supportsPresence === false ? [] : [{
174
+ group: "meta",
175
+ icon: CircleSlash,
176
+ id: `${OPTION_ID_PREFIX}-presence-no-${config.key}`,
177
+ insertText: `${PRESENCE_NO_META_KEY}:${config.key} `,
178
+ keepOpen: false,
179
+ label: `No tiene ${config.label}`,
180
+ replaceTokenStart: true
181
+ }, {
182
+ group: "meta",
183
+ icon: Check,
184
+ id: `${OPTION_ID_PREFIX}-presence-has-${config.key}`,
185
+ insertText: `${PRESENCE_HAS_META_KEY}:${config.key} `,
186
+ keepOpen: false,
187
+ label: `Tiene ${config.label}`,
188
+ replaceTokenStart: true
189
+ }];
190
+ if (config.kind !== "presence" && appliedPresenceValue !== "noValue") {
191
+ suggestions.push({
192
+ group: "meta",
193
+ icon: CircleMinus,
194
+ id: `${OPTION_ID_PREFIX}-exclude-${config.key}`,
195
+ insertText: `-${config.key}:`,
196
+ keepOpen: true,
197
+ label: `Excluir ${config.label}…`,
198
+ replaceTokenStart: true
199
+ });
200
+ }
201
+ return suggestions;
202
+ }
203
+ function getValueSuggestionSource(config) {
204
+ if (config.kind === "enum" || config.kind === "folder") {
205
+ return (config.options ?? []).map((option) => ({
206
+ label: option.label,
207
+ slug: option.slug,
208
+ value: option.value
209
+ }));
210
+ }
211
+ if (config.kind === "presence") {
212
+ return [];
213
+ }
214
+ if (config.kind === "yearMonthRange") {
215
+ return YEAR_MONTH_VALUE_SUGGESTIONS;
216
+ }
217
+ if (config.kind === "numberRange") {
218
+ return NUMBER_RANGE_VALUE_SUGGESTIONS;
219
+ }
220
+ if (config.kind === "textMatch") {
221
+ return TEXT_MATCH_VALUE_SUGGESTIONS;
222
+ }
223
+ return [];
224
+ }
225
+ function hasPresenceMetaFilterAlreadyApplied(config, appliedFilters) {
226
+ return appliedFilters.some((appliedFilter) => appliedFilter.key === config.key && !appliedFilter.negated && appliedFilter.value.kind === "presence");
227
+ }
228
+ function hasSelectableValueAlreadyApplied(config, option, appliedFilters) {
229
+ if (config.kind === "enum") {
230
+ return appliedFilters.some((appliedFilter) => appliedFilter.key === config.key && appliedFilter.value.kind === "enum" && appliedFilter.value.value === option.value);
231
+ }
232
+ if (config.kind === "folder") {
233
+ return appliedFilters.some((appliedFilter) => appliedFilter.key === config.key && appliedFilter.value.kind === "folder" && appliedFilter.value.folderId === option.value);
234
+ }
235
+ return false;
236
+ }
237
+ function getAppliedPresenceValue(config, appliedFilters) {
238
+ const presenceFilter = appliedFilters.find((appliedFilter) => appliedFilter.key === config.key && !appliedFilter.negated && appliedFilter.value.kind === "presence");
239
+ return presenceFilter?.value.kind === "presence" ? presenceFilter.value.value : null;
240
+ }
241
+ function isSelectableValueCompatibleWithPresence(config, option, appliedFilters) {
242
+ const presenceValue = getAppliedPresenceValue(config, appliedFilters);
243
+ if (presenceValue === "noValue") {
244
+ return false;
245
+ }
246
+ if (config.kind !== "folder") {
247
+ return true;
248
+ }
249
+ if (presenceValue === "hasValue") {
250
+ return option.value !== UNASSIGNED_FOLDER_FILTER_VALUE;
251
+ }
252
+ return true;
253
+ }
254
+ function buildValueSuggestions(config, valuePart, negated, appliedFilters) {
255
+ const defaultKeepOpen = config.kind === "numberRange";
256
+ const sourceOptions = config.kind === "textMatch" && valuePart !== "" ? [] : getValueSuggestionSource(config);
257
+ const filterValuePart = config.kind === "enum" || config.kind === "folder" ? valuePart.replace(/^@/, "") : valuePart;
258
+ const valueSuggestions = sourceOptions.filter((option) => !hasSelectableValueAlreadyApplied(config, option, appliedFilters) && isSelectableValueCompatibleWithPresence(config, option, appliedFilters)).filter((option) => startsWithNormalized(option.slug, filterValuePart)).map((option) => {
259
+ const keepOpen = option.keepOpen ?? defaultKeepOpen;
260
+ const insertText = option.insertText ?? (keepOpen ? option.slug : `${option.slug} `);
261
+ return {
262
+ caretOffset: option.caretOffset,
263
+ group: "value",
264
+ icon: getQualifierIcon(config),
265
+ id: `${OPTION_ID_PREFIX}-value-${config.key}-${option.name ?? option.slug}`,
266
+ insertText,
267
+ keepOpen,
268
+ label: option.label
269
+ };
270
+ });
271
+ if (negated || valuePart.length > 0) {
272
+ return valueSuggestions;
273
+ }
274
+ return [...buildPresenceAndExcludeSuggestions(config, appliedFilters), ...valueSuggestions];
275
+ }
276
+ function resolveConfigByKey(configs, rawKey) {
277
+ const normalized = normalizeFilterSlug(rawKey);
278
+ return configs.find((config) => {
279
+ if (config.kind === "text" || !config.key) {
280
+ return false;
281
+ }
282
+ if (normalizeFilterSlug(config.key) === normalized) {
283
+ return true;
284
+ }
285
+ return (config.aliases ?? []).some((alias) => normalizeFilterSlug(alias) === normalized);
286
+ });
287
+ }
288
+ /**
289
+ * Parte la query en nodos para el overlay de resaltado: los rangos de valores
290
+ * válidos se pintan con color de acento; el resto queda con el color normal.
291
+ */
292
+ function renderHighlightedQuery(value, ranges) {
293
+ if (ranges.length === 0) {
294
+ return value;
295
+ }
296
+ const nodes = [];
297
+ let cursor = 0;
298
+ ranges.forEach((range, index) => {
299
+ if (range.start > cursor) {
300
+ nodes.push(value.slice(cursor, range.start));
301
+ }
302
+ nodes.push(/* @__PURE__ */ _jsx("span", {
303
+ className: "text-primary",
304
+ children: value.slice(range.start, range.end)
305
+ }, `highlight-${index}`));
306
+ cursor = range.end;
307
+ });
308
+ if (cursor < value.length) {
309
+ nodes.push(value.slice(cursor));
310
+ }
311
+ return nodes;
312
+ }
313
+ /**
314
+ * Barra de filtro estilo GitHub Issues: input único con autocompletado de
315
+ * `clave:valor`. Sugiere primero los campos disponibles y luego los valores de
316
+ * cada campo, con navegación por teclado y semántica ARIA de combobox/listbox.
317
+ * La navegación es virtual: el foco real nunca abandona el input.
318
+ */
319
+ export function FilterQueryBar(t0) {
320
+ const $ = _c(98);
321
+ const { configs, value, onValueChange, placeholder: t1, ariaLabel: t2, className, onFocusChange, trailingAction } = t0;
322
+ const placeholder = t1 === undefined ? DEFAULT_PLACEHOLDER : t1;
323
+ const ariaLabel = t2 === undefined ? DEFAULT_ARIA_LABEL : t2;
324
+ const instanceId = React.useId();
325
+ const listboxId = `${instanceId}-${LISTBOX_ID}`;
326
+ const inputRef = React.useRef(null);
327
+ const highlightOverlayRef = React.useRef(null);
328
+ const pendingCaretRef = React.useRef(null);
329
+ const [caretIndex, setCaretIndex] = React.useState(0);
330
+ const [isOpen, setIsOpen] = React.useState(false);
331
+ const [activeIndex, setActiveIndex] = React.useState(0);
332
+ const [hasNavigatedSuggestions, setHasNavigatedSuggestions] = React.useState(false);
333
+ let t3;
334
+ if ($[0] !== caretIndex || $[1] !== configs || $[2] !== value) {
335
+ bb0: {
336
+ const activeToken = getActiveFilterToken(value, caretIndex);
337
+ const appliedFilters = parseFilterQuery(value, configs).appliedFilters;
338
+ if (activeToken.mode === "key") {
339
+ t3 = buildKeySuggestions(configs, activeToken.keyPart, {
340
+ appliedFilters,
341
+ includeExclude: !activeToken.negated && activeToken.keyPart === "",
342
+ negated: activeToken.negated
343
+ });
344
+ break bb0;
345
+ }
346
+ const normalizedResolvedKey = normalizeFilterSlug(activeToken.resolvedKey ?? "");
347
+ if (normalizedResolvedKey === PRESENCE_HAS_META_KEY || normalizedResolvedKey === PRESENCE_NO_META_KEY) {
348
+ t3 = buildMetaValueSuggestions(configs, normalizedResolvedKey, activeToken.valuePart, appliedFilters);
349
+ break bb0;
350
+ }
351
+ const config = resolveConfigByKey(configs, activeToken.resolvedKey ?? "");
352
+ if (!config) {
353
+ let t4;
354
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
355
+ t4 = [];
356
+ $[4] = t4;
357
+ } else {
358
+ t4 = $[4];
359
+ }
360
+ t3 = t4;
361
+ break bb0;
362
+ }
363
+ t3 = buildValueSuggestions(config, activeToken.valuePart, activeToken.negated, appliedFilters);
364
+ }
365
+ $[0] = caretIndex;
366
+ $[1] = configs;
367
+ $[2] = value;
368
+ $[3] = t3;
369
+ } else {
370
+ t3 = $[3];
371
+ }
372
+ const suggestions = t3;
373
+ let t4;
374
+ if ($[5] !== configs || $[6] !== value) {
375
+ t4 = parseFilterQuery(value, configs);
376
+ $[5] = configs;
377
+ $[6] = value;
378
+ $[7] = t4;
379
+ } else {
380
+ t4 = $[7];
381
+ }
382
+ const invalidTokenCount = t4.invalidTokens.length;
383
+ let t5;
384
+ if ($[8] !== configs || $[9] !== value) {
385
+ t5 = getValueHighlightRanges(value, configs);
386
+ $[8] = configs;
387
+ $[9] = value;
388
+ $[10] = t5;
389
+ } else {
390
+ t5 = $[10];
391
+ }
392
+ const highlightRanges = t5;
393
+ let t6;
394
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
395
+ t6 = () => {
396
+ if (highlightOverlayRef.current && inputRef.current) {
397
+ highlightOverlayRef.current.scrollLeft = inputRef.current.scrollLeft;
398
+ }
399
+ };
400
+ $[11] = t6;
401
+ } else {
402
+ t6 = $[11];
403
+ }
404
+ const syncOverlayScroll = t6;
405
+ let t7;
406
+ if ($[12] !== suggestions.length) {
407
+ t7 = () => {
408
+ setActiveIndex((previousIndex) => previousIndex < suggestions.length ? previousIndex : 0);
409
+ };
410
+ $[12] = suggestions.length;
411
+ $[13] = t7;
412
+ } else {
413
+ t7 = $[13];
414
+ }
415
+ let t8;
416
+ if ($[14] !== suggestions) {
417
+ t8 = [suggestions];
418
+ $[14] = suggestions;
419
+ $[15] = t8;
420
+ } else {
421
+ t8 = $[15];
422
+ }
423
+ React.useEffect(t7, t8);
424
+ let t9;
425
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
426
+ t9 = () => {
427
+ const pendingCaret = pendingCaretRef.current;
428
+ if (pendingCaret == null || !inputRef.current) {
429
+ return;
430
+ }
431
+ inputRef.current.setSelectionRange(pendingCaret, pendingCaret);
432
+ setCaretIndex(pendingCaret);
433
+ pendingCaretRef.current = null;
434
+ };
435
+ $[16] = t9;
436
+ } else {
437
+ t9 = $[16];
438
+ }
439
+ let t10;
440
+ if ($[17] !== value) {
441
+ t10 = [value];
442
+ $[17] = value;
443
+ $[18] = t10;
444
+ } else {
445
+ t10 = $[18];
446
+ }
447
+ React.useLayoutEffect(t9, t10);
448
+ let t11;
449
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
450
+ t11 = () => {
451
+ syncOverlayScroll();
452
+ };
453
+ $[19] = t11;
454
+ } else {
455
+ t11 = $[19];
456
+ }
457
+ let t12;
458
+ if ($[20] !== value) {
459
+ t12 = [syncOverlayScroll, value];
460
+ $[20] = value;
461
+ $[21] = t12;
462
+ } else {
463
+ t12 = $[21];
464
+ }
465
+ React.useLayoutEffect(t11, t12);
466
+ const isPopoverOpen = isOpen && suggestions.length > 0;
467
+ const activeSuggestion = isPopoverOpen ? suggestions[activeIndex] : undefined;
468
+ let t13;
469
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
470
+ t13 = () => {
471
+ if (inputRef.current) {
472
+ setCaretIndex(inputRef.current.selectionStart ?? 0);
473
+ }
474
+ };
475
+ $[22] = t13;
476
+ } else {
477
+ t13 = $[22];
478
+ }
479
+ const syncCaretFromInput = t13;
480
+ let t14;
481
+ if ($[23] !== caretIndex || $[24] !== onValueChange || $[25] !== value) {
482
+ t14 = (suggestion) => {
483
+ const activeToken_0 = getActiveFilterToken(value, inputRef.current?.selectionStart ?? caretIndex);
484
+ const replaceStart = suggestion.replaceTokenStart ? activeToken_0.tokenStart : activeToken_0.replaceStart;
485
+ const before = value.slice(0, replaceStart);
486
+ const after = value.slice(activeToken_0.replaceEnd);
487
+ const nextValue = before + suggestion.insertText + after;
488
+ pendingCaretRef.current = before.length + (suggestion.caretOffset ?? suggestion.insertText.length);
489
+ onValueChange(nextValue);
490
+ setIsOpen(true);
491
+ setActiveIndex(0);
492
+ setHasNavigatedSuggestions(false);
493
+ if (!suggestion.keepOpen) {
494
+ setIsOpen(false);
495
+ }
496
+ };
497
+ $[23] = caretIndex;
498
+ $[24] = onValueChange;
499
+ $[25] = value;
500
+ $[26] = t14;
501
+ } else {
502
+ t14 = $[26];
503
+ }
504
+ const applySuggestion = t14;
505
+ let t15;
506
+ if ($[27] !== activeSuggestion || $[28] !== applySuggestion || $[29] !== hasNavigatedSuggestions || $[30] !== isPopoverOpen || $[31] !== suggestions.length) {
507
+ t15 = (event) => {
508
+ if (event.key === "ArrowDown") {
509
+ event.preventDefault();
510
+ setHasNavigatedSuggestions(true);
511
+ if (!isPopoverOpen) {
512
+ setIsOpen(true);
513
+ return;
514
+ }
515
+ setActiveIndex((previousIndex_0) => suggestions.length === 0 ? 0 : (previousIndex_0 + 1) % suggestions.length);
516
+ return;
517
+ }
518
+ if (event.key === "ArrowUp") {
519
+ event.preventDefault();
520
+ setHasNavigatedSuggestions(true);
521
+ if (!isPopoverOpen) {
522
+ setIsOpen(true);
523
+ return;
524
+ }
525
+ setActiveIndex((previousIndex_1) => suggestions.length === 0 ? 0 : (previousIndex_1 - 1 + suggestions.length) % suggestions.length);
526
+ return;
527
+ }
528
+ if (event.key === "Enter" && activeSuggestion) {
529
+ event.preventDefault();
530
+ applySuggestion(activeSuggestion);
531
+ return;
532
+ }
533
+ if (event.key === "Tab" && hasNavigatedSuggestions && activeSuggestion) {
534
+ event.preventDefault();
535
+ applySuggestion(activeSuggestion);
536
+ return;
537
+ }
538
+ if (event.key === "Escape" && isPopoverOpen) {
539
+ event.preventDefault();
540
+ event.stopPropagation();
541
+ setIsOpen(false);
542
+ }
543
+ };
544
+ $[27] = activeSuggestion;
545
+ $[28] = applySuggestion;
546
+ $[29] = hasNavigatedSuggestions;
547
+ $[30] = isPopoverOpen;
548
+ $[31] = suggestions.length;
549
+ $[32] = t15;
550
+ } else {
551
+ t15 = $[32];
552
+ }
553
+ const handleKeyDown = t15;
554
+ let t16;
555
+ if ($[33] !== onValueChange) {
556
+ t16 = () => {
557
+ onValueChange("");
558
+ pendingCaretRef.current = 0;
559
+ setIsOpen(false);
560
+ inputRef.current?.focus();
561
+ };
562
+ $[33] = onValueChange;
563
+ $[34] = t16;
564
+ } else {
565
+ t16 = $[34];
566
+ }
567
+ const handleClear = t16;
568
+ let t17;
569
+ if ($[35] !== className) {
570
+ t17 = cn("grid w-full gap-2", className);
571
+ $[35] = className;
572
+ $[36] = t17;
573
+ } else {
574
+ t17 = $[36];
575
+ }
576
+ const t18 = activeSuggestion ? `${instanceId}-${activeSuggestion.id}` : undefined;
577
+ const t19 = trailingAction ? "pr-16" : "pr-9";
578
+ let t20;
579
+ if ($[37] !== t19) {
580
+ t20 = cn("w-full text-transparent", t19);
581
+ $[37] = t19;
582
+ $[38] = t20;
583
+ } else {
584
+ t20 = $[38];
585
+ }
586
+ let t21;
587
+ if ($[39] !== onValueChange) {
588
+ t21 = (event_0) => {
589
+ onValueChange(event_0.target.value);
590
+ setIsOpen(true);
591
+ setActiveIndex(0);
592
+ setHasNavigatedSuggestions(false);
593
+ setCaretIndex(event_0.target.selectionStart ?? event_0.target.value.length);
594
+ };
595
+ $[39] = onValueChange;
596
+ $[40] = t21;
597
+ } else {
598
+ t21 = $[40];
599
+ }
600
+ let t22;
601
+ let t23;
602
+ if ($[41] !== onFocusChange) {
603
+ t22 = () => {
604
+ setHasNavigatedSuggestions(false);
605
+ onFocusChange?.(false);
606
+ };
607
+ t23 = () => {
608
+ syncCaretFromInput();
609
+ setIsOpen(true);
610
+ onFocusChange?.(true);
611
+ };
612
+ $[41] = onFocusChange;
613
+ $[42] = t22;
614
+ $[43] = t23;
615
+ } else {
616
+ t22 = $[42];
617
+ t23 = $[43];
618
+ }
619
+ let t24;
620
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
621
+ t24 = { caretColor: "var(--foreground)" };
622
+ $[44] = t24;
623
+ } else {
624
+ t24 = $[44];
625
+ }
626
+ let t25;
627
+ if ($[45] !== ariaLabel || $[46] !== handleKeyDown || $[47] !== isPopoverOpen || $[48] !== listboxId || $[49] !== placeholder || $[50] !== t18 || $[51] !== t20 || $[52] !== t21 || $[53] !== t22 || $[54] !== t23 || $[55] !== value) {
628
+ t25 = /* @__PURE__ */ _jsx(Input, {
629
+ "aria-activedescendant": t18,
630
+ "aria-autocomplete": "list",
631
+ "aria-controls": listboxId,
632
+ "aria-expanded": isPopoverOpen,
633
+ "aria-label": ariaLabel,
634
+ autoComplete: "off",
635
+ className: t20,
636
+ onChange: t21,
637
+ onClick: syncCaretFromInput,
638
+ onBlur: t22,
639
+ onFocus: t23,
640
+ onKeyDown: handleKeyDown,
641
+ onKeyUp: syncCaretFromInput,
642
+ onScroll: syncOverlayScroll,
643
+ placeholder,
644
+ ref: inputRef,
645
+ role: "combobox",
646
+ style: t24,
647
+ type: "text",
648
+ value
649
+ });
650
+ $[45] = ariaLabel;
651
+ $[46] = handleKeyDown;
652
+ $[47] = isPopoverOpen;
653
+ $[48] = listboxId;
654
+ $[49] = placeholder;
655
+ $[50] = t18;
656
+ $[51] = t20;
657
+ $[52] = t21;
658
+ $[53] = t22;
659
+ $[54] = t23;
660
+ $[55] = value;
661
+ $[56] = t25;
662
+ } else {
663
+ t25 = $[56];
664
+ }
665
+ const t26 = trailingAction ? "pr-16" : "pr-9";
666
+ let t27;
667
+ if ($[57] !== t26) {
668
+ t27 = cn("pointer-events-none absolute inset-0 flex items-center overflow-hidden rounded-lg border border-transparent px-2.5 text-base text-foreground select-none md:text-sm", t26);
669
+ $[57] = t26;
670
+ $[58] = t27;
671
+ } else {
672
+ t27 = $[58];
673
+ }
674
+ let t28;
675
+ if ($[59] !== highlightRanges || $[60] !== value) {
676
+ t28 = renderHighlightedQuery(value, highlightRanges);
677
+ $[59] = highlightRanges;
678
+ $[60] = value;
679
+ $[61] = t28;
680
+ } else {
681
+ t28 = $[61];
682
+ }
683
+ let t29;
684
+ if ($[62] !== t28) {
685
+ t29 = /* @__PURE__ */ _jsx("span", {
686
+ className: "whitespace-pre",
687
+ children: t28
688
+ });
689
+ $[62] = t28;
690
+ $[63] = t29;
691
+ } else {
692
+ t29 = $[63];
693
+ }
694
+ let t30;
695
+ if ($[64] !== t27 || $[65] !== t29) {
696
+ t30 = /* @__PURE__ */ _jsx("div", {
697
+ "aria-hidden": "true",
698
+ className: t27,
699
+ ref: highlightOverlayRef,
700
+ children: t29
701
+ });
702
+ $[64] = t27;
703
+ $[65] = t29;
704
+ $[66] = t30;
705
+ } else {
706
+ t30 = $[66];
707
+ }
708
+ let t31;
709
+ if ($[67] !== handleClear || $[68] !== value) {
710
+ t31 = value ? /* @__PURE__ */ _jsx(ControlButton, {
711
+ "aria-label": CLEAR_FILTER_ARIA_LABEL,
712
+ className: "active:-translate-y-0",
713
+ onClick: handleClear,
714
+ size: "icon-xs",
715
+ type: "button",
716
+ variant: "ghost",
717
+ children: /* @__PURE__ */ _jsx(X, { "aria-hidden": "true" })
718
+ }) : null;
719
+ $[67] = handleClear;
720
+ $[68] = value;
721
+ $[69] = t31;
722
+ } else {
723
+ t31 = $[69];
724
+ }
725
+ let t32;
726
+ if ($[70] !== t31 || $[71] !== trailingAction) {
727
+ t32 = /* @__PURE__ */ _jsxs("div", {
728
+ className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5",
729
+ children: [t31, trailingAction]
730
+ });
731
+ $[70] = t31;
732
+ $[71] = trailingAction;
733
+ $[72] = t32;
734
+ } else {
735
+ t32 = $[72];
736
+ }
737
+ let t33;
738
+ if ($[73] !== t25 || $[74] !== t30 || $[75] !== t32) {
739
+ t33 = /* @__PURE__ */ _jsx(PopoverAnchor, {
740
+ asChild: true,
741
+ children: /* @__PURE__ */ _jsxs("div", {
742
+ className: "relative w-full",
743
+ children: [
744
+ t25,
745
+ t30,
746
+ t32
747
+ ]
748
+ })
749
+ });
750
+ $[73] = t25;
751
+ $[74] = t30;
752
+ $[75] = t32;
753
+ $[76] = t33;
754
+ } else {
755
+ t33 = $[76];
756
+ }
757
+ let t34;
758
+ if ($[77] === Symbol.for("react.memo_cache_sentinel")) {
759
+ t34 = (event_2) => {
760
+ if (event_2.target === inputRef.current) {
761
+ event_2.preventDefault();
762
+ }
763
+ };
764
+ $[77] = t34;
765
+ } else {
766
+ t34 = $[77];
767
+ }
768
+ const t35 = suggestions.some(_temp3) ? VALUE_GROUP_LABEL : KEY_GROUP_LABEL;
769
+ let t36;
770
+ if ($[78] !== activeIndex || $[79] !== applySuggestion || $[80] !== instanceId || $[81] !== suggestions) {
771
+ t36 = suggestions.map((suggestion_1, index) => {
772
+ const SuggestionIcon = suggestion_1.icon;
773
+ const showSeparator = index > 0 && suggestions[index - 1].group !== suggestion_1.group;
774
+ return /* @__PURE__ */ _jsxs(React.Fragment, { children: [showSeparator ? /* @__PURE__ */ _jsx("li", {
775
+ "aria-hidden": "true",
776
+ className: "my-1 border-t border-border",
777
+ role: "presentation"
778
+ }) : null, /* @__PURE__ */ _jsxs("li", {
779
+ "aria-selected": index === activeIndex,
780
+ className: cn("flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm", index === activeIndex ? "bg-accent text-accent-foreground" : "text-foreground"),
781
+ id: `${instanceId}-${suggestion_1.id}`,
782
+ onPointerMove: () => setActiveIndex(index),
783
+ onMouseDown: (event_4) => {
784
+ event_4.preventDefault();
785
+ applySuggestion(suggestion_1);
786
+ },
787
+ role: "option",
788
+ children: [/* @__PURE__ */ _jsx(SuggestionIcon, {
789
+ "aria-hidden": "true",
790
+ className: "size-4 shrink-0 text-muted-foreground"
791
+ }), /* @__PURE__ */ _jsx("span", {
792
+ className: "truncate",
793
+ children: suggestion_1.label
794
+ })]
795
+ })] }, suggestion_1.id);
796
+ });
797
+ $[78] = activeIndex;
798
+ $[79] = applySuggestion;
799
+ $[80] = instanceId;
800
+ $[81] = suggestions;
801
+ $[82] = t36;
802
+ } else {
803
+ t36 = $[82];
804
+ }
805
+ let t37;
806
+ if ($[83] !== listboxId || $[84] !== t35 || $[85] !== t36) {
807
+ t37 = /* @__PURE__ */ _jsx(PopoverContent, {
808
+ align: "start",
809
+ className: "w-[250px] max-h-[280px] gap-0 overflow-y-auto p-1",
810
+ onCloseAutoFocus: _temp,
811
+ onInteractOutside: t34,
812
+ onOpenAutoFocus: _temp2,
813
+ children: /* @__PURE__ */ _jsx("ul", {
814
+ "aria-label": t35,
815
+ className: "grid gap-0.5",
816
+ "data-slot": "filter-query-bar-suggestions",
817
+ id: listboxId,
818
+ role: "listbox",
819
+ children: t36
820
+ })
821
+ });
822
+ $[83] = listboxId;
823
+ $[84] = t35;
824
+ $[85] = t36;
825
+ $[86] = t37;
826
+ } else {
827
+ t37 = $[86];
828
+ }
829
+ let t38;
830
+ if ($[87] !== isPopoverOpen || $[88] !== t33 || $[89] !== t37) {
831
+ t38 = /* @__PURE__ */ _jsxs(Popover, {
832
+ onOpenChange: setIsOpen,
833
+ open: isPopoverOpen,
834
+ children: [t33, t37]
835
+ });
836
+ $[87] = isPopoverOpen;
837
+ $[88] = t33;
838
+ $[89] = t37;
839
+ $[90] = t38;
840
+ } else {
841
+ t38 = $[90];
842
+ }
843
+ const t39 = isPopoverOpen ? `${suggestions.length} sugerencias disponibles` : "";
844
+ const t40 = invalidTokenCount > 0 ? ` ${invalidTokenCount} filtros no aplicados` : "";
845
+ let t41;
846
+ if ($[91] !== t39 || $[92] !== t40) {
847
+ t41 = /* @__PURE__ */ _jsxs("span", {
848
+ "aria-live": "polite",
849
+ className: "sr-only",
850
+ children: [t39, t40]
851
+ });
852
+ $[91] = t39;
853
+ $[92] = t40;
854
+ $[93] = t41;
855
+ } else {
856
+ t41 = $[93];
857
+ }
858
+ let t42;
859
+ if ($[94] !== t17 || $[95] !== t38 || $[96] !== t41) {
860
+ t42 = /* @__PURE__ */ _jsxs("div", {
861
+ className: t17,
862
+ children: [t38, t41]
863
+ });
864
+ $[94] = t17;
865
+ $[95] = t38;
866
+ $[96] = t41;
867
+ $[97] = t42;
868
+ } else {
869
+ t42 = $[97];
870
+ }
871
+ return t42;
872
+ }
873
+ function _temp3(suggestion_0) {
874
+ return suggestion_0.group === "value";
875
+ }
876
+ function _temp2(event_3) {
877
+ return event_3.preventDefault();
878
+ }
879
+ function _temp(event_1) {
880
+ return event_1.preventDefault();
881
+ }