@assistant-ui/react 0.12.22 → 0.12.24

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 (136) hide show
  1. package/dist/client/ExternalThread.d.ts.map +1 -1
  2. package/dist/client/ExternalThread.js +1 -0
  3. package/dist/client/ExternalThread.js.map +1 -1
  4. package/dist/client/InMemoryThreadList.d.ts.map +1 -1
  5. package/dist/client/InMemoryThreadList.js +2 -0
  6. package/dist/client/InMemoryThreadList.js.map +1 -1
  7. package/dist/client/SingleThreadList.d.ts.map +1 -1
  8. package/dist/client/SingleThreadList.js +2 -0
  9. package/dist/client/SingleThreadList.js.map +1 -1
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/internal.d.ts +1 -0
  15. package/dist/internal.d.ts.map +1 -1
  16. package/dist/internal.js +2 -0
  17. package/dist/internal.js.map +1 -1
  18. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  19. package/dist/primitives/composer/ComposerInput.js +27 -12
  20. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  21. package/dist/primitives/composer/ComposerInputPluginContext.d.ts +31 -0
  22. package/dist/primitives/composer/ComposerInputPluginContext.d.ts.map +1 -0
  23. package/dist/primitives/composer/ComposerInputPluginContext.js +32 -0
  24. package/dist/primitives/composer/ComposerInputPluginContext.js.map +1 -0
  25. package/dist/primitives/composer/mention/ComposerMentionContext.d.ts +4 -2
  26. package/dist/primitives/composer/mention/ComposerMentionContext.d.ts.map +1 -1
  27. package/dist/primitives/composer/mention/ComposerMentionContext.js +21 -13
  28. package/dist/primitives/composer/mention/ComposerMentionContext.js.map +1 -1
  29. package/dist/primitives/composer/mention/index.d.ts +4 -4
  30. package/dist/primitives/composer/mention/index.d.ts.map +1 -1
  31. package/dist/primitives/composer/mention/index.js +6 -4
  32. package/dist/primitives/composer/mention/index.js.map +1 -1
  33. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.d.ts +36 -0
  34. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.d.ts.map +1 -0
  35. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.js +36 -0
  36. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.js.map +1 -0
  37. package/dist/primitives/composer/slash-command/index.d.ts +2 -0
  38. package/dist/primitives/composer/slash-command/index.d.ts.map +1 -0
  39. package/dist/primitives/composer/slash-command/index.js +2 -0
  40. package/dist/primitives/composer/slash-command/index.js.map +1 -0
  41. package/dist/primitives/composer/{mention/ComposerMentionBack.d.ts → trigger/TriggerPopoverBack.d.ts} +3 -10
  42. package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts.map +1 -0
  43. package/dist/primitives/composer/trigger/TriggerPopoverBack.js +19 -0
  44. package/dist/primitives/composer/trigger/TriggerPopoverBack.js.map +1 -0
  45. package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts +38 -0
  46. package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts.map +1 -0
  47. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js +35 -0
  48. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js.map +1 -0
  49. package/dist/primitives/composer/trigger/TriggerPopoverContext.d.ts +37 -0
  50. package/dist/primitives/composer/trigger/TriggerPopoverContext.d.ts.map +1 -0
  51. package/dist/primitives/composer/trigger/TriggerPopoverContext.js +70 -0
  52. package/dist/primitives/composer/trigger/TriggerPopoverContext.js.map +1 -0
  53. package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts +40 -0
  54. package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts.map +1 -0
  55. package/dist/primitives/composer/trigger/TriggerPopoverItems.js +35 -0
  56. package/dist/primitives/composer/trigger/TriggerPopoverItems.js.map +1 -0
  57. package/dist/primitives/composer/trigger/TriggerPopoverPopover.d.ts +26 -0
  58. package/dist/primitives/composer/trigger/TriggerPopoverPopover.d.ts.map +1 -0
  59. package/dist/primitives/composer/trigger/TriggerPopoverPopover.js +28 -0
  60. package/dist/primitives/composer/trigger/TriggerPopoverPopover.js.map +1 -0
  61. package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts +53 -0
  62. package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts.map +1 -0
  63. package/dist/primitives/composer/{mention/MentionResource.js → trigger/TriggerPopoverResource.js} +50 -25
  64. package/dist/primitives/composer/trigger/TriggerPopoverResource.js.map +1 -0
  65. package/dist/primitives/composer/trigger/detectTrigger.d.ts +2 -0
  66. package/dist/primitives/composer/trigger/detectTrigger.d.ts.map +1 -0
  67. package/dist/primitives/composer/{mention/detectMentionTrigger.js → trigger/detectTrigger.js} +4 -4
  68. package/dist/primitives/composer/trigger/detectTrigger.js.map +1 -0
  69. package/dist/primitives/composer/trigger/index.d.ts +7 -0
  70. package/dist/primitives/composer/trigger/index.d.ts.map +1 -0
  71. package/dist/primitives/composer/trigger/index.js +6 -0
  72. package/dist/primitives/composer/trigger/index.js.map +1 -0
  73. package/dist/primitives/composer.d.ts +10 -0
  74. package/dist/primitives/composer.d.ts.map +1 -1
  75. package/dist/primitives/composer.js +14 -0
  76. package/dist/primitives/composer.js.map +1 -1
  77. package/dist/primitives/message/MessageRoot.d.ts +25 -3
  78. package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
  79. package/dist/primitives/message/MessageRoot.js +2 -2
  80. package/dist/primitives/message/MessageRoot.js.map +1 -1
  81. package/dist/primitives/thread/ThreadViewportSlack.d.ts +2 -2
  82. package/dist/primitives/thread/ThreadViewportSlack.d.ts.map +1 -1
  83. package/dist/unstable/useSlashCommandAdapter.d.ts +34 -0
  84. package/dist/unstable/useSlashCommandAdapter.d.ts.map +1 -0
  85. package/dist/unstable/useSlashCommandAdapter.js +50 -0
  86. package/dist/unstable/useSlashCommandAdapter.js.map +1 -0
  87. package/package.json +7 -7
  88. package/src/client/ExternalThread.ts +1 -0
  89. package/src/client/InMemoryThreadList.ts +3 -0
  90. package/src/client/SingleThreadList.ts +2 -0
  91. package/src/index.ts +14 -0
  92. package/src/internal.ts +3 -0
  93. package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.test.ts +186 -3
  94. package/src/primitives/composer/ComposerInput.tsx +25 -18
  95. package/src/primitives/composer/ComposerInputPluginContext.tsx +100 -0
  96. package/src/primitives/composer/mention/ComposerMentionContext.tsx +56 -22
  97. package/src/primitives/composer/mention/index.ts +11 -8
  98. package/src/primitives/composer/slash-command/ComposerSlashCommandRoot.tsx +76 -0
  99. package/src/primitives/composer/slash-command/index.ts +1 -0
  100. package/src/primitives/composer/trigger/TriggerPopoverBack.tsx +40 -0
  101. package/src/primitives/composer/{mention/ComposerMentionCategories.tsx → trigger/TriggerPopoverCategories.tsx} +33 -28
  102. package/src/primitives/composer/trigger/TriggerPopoverContext.tsx +129 -0
  103. package/src/primitives/composer/{mention/ComposerMentionItems.tsx → trigger/TriggerPopoverItems.tsx} +34 -29
  104. package/src/primitives/composer/trigger/TriggerPopoverPopover.tsx +51 -0
  105. package/src/primitives/composer/{mention/MentionResource.ts → trigger/TriggerPopoverResource.ts} +146 -98
  106. package/src/primitives/composer/{mention/detectMentionTrigger.test.ts → trigger/detectTrigger.test.ts} +15 -15
  107. package/src/primitives/composer/{mention/detectMentionTrigger.ts → trigger/detectTrigger.ts} +3 -3
  108. package/src/primitives/composer/trigger/index.ts +16 -0
  109. package/src/primitives/composer.ts +16 -0
  110. package/src/primitives/message/MessageRoot.tsx +18 -4
  111. package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
  112. package/src/tests/BaseComposerRuntimeCore.test.ts +33 -1
  113. package/src/unstable/useSlashCommandAdapter.ts +83 -0
  114. package/dist/primitives/composer/mention/ComposerMentionBack.d.ts.map +0 -1
  115. package/dist/primitives/composer/mention/ComposerMentionBack.js +0 -28
  116. package/dist/primitives/composer/mention/ComposerMentionBack.js.map +0 -1
  117. package/dist/primitives/composer/mention/ComposerMentionCategories.d.ts +0 -46
  118. package/dist/primitives/composer/mention/ComposerMentionCategories.d.ts.map +0 -1
  119. package/dist/primitives/composer/mention/ComposerMentionCategories.js +0 -32
  120. package/dist/primitives/composer/mention/ComposerMentionCategories.js.map +0 -1
  121. package/dist/primitives/composer/mention/ComposerMentionItems.d.ts +0 -50
  122. package/dist/primitives/composer/mention/ComposerMentionItems.d.ts.map +0 -1
  123. package/dist/primitives/composer/mention/ComposerMentionItems.js +0 -30
  124. package/dist/primitives/composer/mention/ComposerMentionItems.js.map +0 -1
  125. package/dist/primitives/composer/mention/ComposerMentionPopover.d.ts +0 -26
  126. package/dist/primitives/composer/mention/ComposerMentionPopover.d.ts.map +0 -1
  127. package/dist/primitives/composer/mention/ComposerMentionPopover.js +0 -28
  128. package/dist/primitives/composer/mention/ComposerMentionPopover.js.map +0 -1
  129. package/dist/primitives/composer/mention/MentionResource.d.ts +0 -39
  130. package/dist/primitives/composer/mention/MentionResource.d.ts.map +0 -1
  131. package/dist/primitives/composer/mention/MentionResource.js.map +0 -1
  132. package/dist/primitives/composer/mention/detectMentionTrigger.d.ts +0 -2
  133. package/dist/primitives/composer/mention/detectMentionTrigger.d.ts.map +0 -1
  134. package/dist/primitives/composer/mention/detectMentionTrigger.js.map +0 -1
  135. package/src/primitives/composer/mention/ComposerMentionBack.tsx +0 -55
  136. package/src/primitives/composer/mention/ComposerMentionPopover.tsx +0 -52
@@ -0,0 +1,83 @@
1
+ "use client";
2
+
3
+ import { useMemo } from "react";
4
+ import type {
5
+ Unstable_SlashCommandAdapter,
6
+ Unstable_SlashCommandItem,
7
+ Unstable_TriggerCategory,
8
+ } from "@assistant-ui/core";
9
+
10
+ export type Unstable_SlashCommandDefinition = {
11
+ /** Unique command name (e.g. "summarize"). */
12
+ readonly name: string;
13
+ /** Display label (e.g. "/summarize"). */
14
+ readonly label?: string | undefined;
15
+ /** Short description shown in the popover. */
16
+ readonly description?: string | undefined;
17
+ /** Icon identifier. */
18
+ readonly icon?: string | undefined;
19
+ /** Action to execute when the command is selected. */
20
+ readonly execute?: (() => void) | undefined;
21
+ };
22
+
23
+ export type Unstable_UseSlashCommandAdapterOptions = {
24
+ /** List of available slash commands. */
25
+ commands: readonly Unstable_SlashCommandDefinition[];
26
+ };
27
+
28
+ /**
29
+ * @deprecated This API is still under active development and might change without notice.
30
+ *
31
+ * Creates a SlashCommandAdapter from a list of command definitions.
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * const slashAdapter = unstable_useSlashCommandAdapter({
36
+ * commands: [
37
+ * { name: "summarize", description: "Summarize the conversation", execute: () => {} },
38
+ * { name: "translate", description: "Translate text", execute: () => {} },
39
+ * ],
40
+ * });
41
+ * ```
42
+ */
43
+ export function unstable_useSlashCommandAdapter(
44
+ options: Unstable_UseSlashCommandAdapterOptions,
45
+ ): Unstable_SlashCommandAdapter {
46
+ const { commands } = options;
47
+
48
+ return useMemo<Unstable_SlashCommandAdapter>(() => {
49
+ // Build items lazily at call time so execute callbacks are always fresh
50
+ const getItems = (): Unstable_SlashCommandItem[] =>
51
+ commands.map((cmd) => ({
52
+ id: cmd.name,
53
+ type: "command",
54
+ label: cmd.label ?? `/${cmd.name}`,
55
+ description: cmd.description,
56
+ icon: cmd.icon,
57
+ execute: cmd.execute,
58
+ }));
59
+
60
+ return {
61
+ // No categories — slash commands show items directly via search mode
62
+ categories(): Unstable_TriggerCategory[] {
63
+ return [];
64
+ },
65
+
66
+ categoryItems(): Unstable_SlashCommandItem[] {
67
+ return [];
68
+ },
69
+
70
+ search(query: string): Unstable_SlashCommandItem[] {
71
+ const items = getItems();
72
+ if (!query) return items;
73
+ const lower = query.toLowerCase();
74
+ return items.filter(
75
+ (item) =>
76
+ item.id.toLowerCase().includes(lower) ||
77
+ item.label.toLowerCase().includes(lower) ||
78
+ item.description?.toLowerCase().includes(lower),
79
+ );
80
+ },
81
+ };
82
+ }, [commands]);
83
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionBack.d.ts","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionBack.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAG9B,MAAM,OAAO,CAAC;AAQf,yBAAiB,4BAA4B,CAAC;IAC5C,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5D,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;CACvE;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B;;;;gHAoBvC,CAAC"}
@@ -1,28 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Primitive } from "../../../utils/Primitive.js";
4
- import { forwardRef, useCallback, } from "react";
5
- import { composeEventHandlers } from "@radix-ui/primitive";
6
- import { useMentionContext } from "./ComposerMentionContext.js";
7
- /**
8
- * A button that navigates back from category items to the category list.
9
- * Only renders when a category is active (drill-down view).
10
- *
11
- * @example
12
- * ```tsx
13
- * <ComposerPrimitive.MentionBack>
14
- * &larr; Back
15
- * </ComposerPrimitive.MentionBack>
16
- * ```
17
- */
18
- export const ComposerPrimitiveMentionBack = forwardRef(({ onClick, ...props }, forwardedRef) => {
19
- const { activeCategoryId, isSearchMode, goBack } = useMentionContext();
20
- const handleClick = useCallback(() => {
21
- goBack();
22
- }, [goBack]);
23
- if (!activeCategoryId || isSearchMode)
24
- return null;
25
- return (_jsx(Primitive.button, { type: "button", ...props, ref: forwardedRef, onClick: composeEventHandlers(onClick, handleClick) }));
26
- });
27
- ComposerPrimitiveMentionBack.displayName = "ComposerPrimitive.MentionBack";
28
- //# sourceMappingURL=ComposerMentionBack.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionBack.js","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionBack.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EAGL,UAAU,EACV,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,oCAAiC;AAW7D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAGpD,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE;IACxC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAEvE,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,MAAM,EAAE,CAAC;IACX,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,IAAI,CAAC,gBAAgB,IAAI,YAAY;QAAE,OAAO,IAAI,CAAC;IAEnD,OAAO,CACL,KAAC,SAAS,CAAC,MAAM,IACf,IAAI,EAAC,QAAQ,KACT,KAAK,EACT,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAC,GACnD,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,4BAA4B,CAAC,WAAW,GAAG,+BAA+B,CAAC"}
@@ -1,46 +0,0 @@
1
- import { Primitive } from "../../../utils/Primitive.js";
2
- import { type ComponentRef, type ComponentPropsWithoutRef, type ReactNode } from "react";
3
- import type { Unstable_MentionCategory } from "@assistant-ui/core";
4
- export declare namespace ComposerPrimitiveMentionCategories {
5
- type Element = ComponentRef<typeof Primitive.div>;
6
- type Props = Omit<ComponentPropsWithoutRef<typeof Primitive.div>, "children"> & {
7
- /**
8
- * Render function that receives the filtered categories and returns
9
- * the UI. A render-function pattern is used here (instead of a
10
- * `components` prop) to give consumers full control over list layout,
11
- * ordering, grouping, and empty states.
12
- */
13
- children: (categories: readonly Unstable_MentionCategory[]) => ReactNode;
14
- };
15
- }
16
- export declare const ComposerPrimitiveMentionCategories: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
17
- asChild?: boolean;
18
- }, "ref"> & {
19
- render?: import("react").ReactElement | undefined;
20
- } & import("react").RefAttributes<HTMLDivElement>, "ref">, "children"> & {
21
- /**
22
- * Render function that receives the filtered categories and returns
23
- * the UI. A render-function pattern is used here (instead of a
24
- * `components` prop) to give consumers full control over list layout,
25
- * ordering, grouping, and empty states.
26
- */
27
- children: (categories: readonly Unstable_MentionCategory[]) => ReactNode;
28
- } & import("react").RefAttributes<HTMLDivElement>>;
29
- export declare namespace ComposerPrimitiveMentionCategoryItem {
30
- type Element = ComponentRef<typeof Primitive.button>;
31
- type Props = ComponentPropsWithoutRef<typeof Primitive.button> & {
32
- categoryId: string;
33
- };
34
- }
35
- /**
36
- * A button that selects a category and triggers drill-down navigation.
37
- * Automatically receives `data-highlighted` when keyboard-navigated.
38
- */
39
- export declare const ComposerPrimitiveMentionCategoryItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
40
- asChild?: boolean;
41
- }, "ref"> & {
42
- render?: import("react").ReactElement | undefined;
43
- } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
44
- categoryId: string;
45
- } & import("react").RefAttributes<HTMLButtonElement>>;
46
- //# sourceMappingURL=ComposerMentionCategories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionCategories.d.ts","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionCategories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAMnE,yBAAiB,kCAAkC,CAAC;IAClD,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,IAAI,CACtB,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,EAC9C,UAAU,CACX,GAAG;QACF;;;;;WAKG;QACH,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,wBAAwB,EAAE,KAAK,SAAS,CAAC;KAC1E,CAAC;CACH;AAED,eAAO,MAAM,kCAAkC;;;;;IAV3C;;;;;OAKG;cACO,CAAC,UAAU,EAAE,SAAS,wBAAwB,EAAE,KAAK,SAAS;kDAiB1E,CAAC;AASH,yBAAiB,oCAAoC,CAAC;IACpD,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5D,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG;QACtE,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,oCAAoC;;;;;gBARjC,MAAM;qDAyCpB,CAAC"}
@@ -1,32 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Primitive } from "../../../utils/Primitive.js";
4
- import { forwardRef, useCallback, } from "react";
5
- import { composeEventHandlers } from "@radix-ui/primitive";
6
- import { useMentionContext } from "./ComposerMentionContext.js";
7
- export const ComposerPrimitiveMentionCategories = forwardRef(({ children, ...props }, forwardedRef) => {
8
- const { categories, activeCategoryId, isSearchMode } = useMentionContext();
9
- if (activeCategoryId || isSearchMode)
10
- return null;
11
- return (_jsx(Primitive.div, { role: "group", ...props, ref: forwardedRef, children: children(categories) }));
12
- });
13
- ComposerPrimitiveMentionCategories.displayName =
14
- "ComposerPrimitive.MentionCategories";
15
- /**
16
- * A button that selects a category and triggers drill-down navigation.
17
- * Automatically receives `data-highlighted` when keyboard-navigated.
18
- */
19
- export const ComposerPrimitiveMentionCategoryItem = forwardRef(({ categoryId, onClick, ...props }, forwardedRef) => {
20
- const { selectCategory, categories, highlightedIndex, activeCategoryId, isSearchMode, } = useMentionContext();
21
- const handleClick = useCallback(() => {
22
- selectCategory(categoryId);
23
- }, [selectCategory, categoryId]);
24
- // Derive highlighted state from context — no manual wiring needed
25
- const isHighlighted = !activeCategoryId &&
26
- !isSearchMode &&
27
- categories.findIndex((c) => c.id === categoryId) === highlightedIndex;
28
- return (_jsx(Primitive.button, { type: "button", role: "option", "aria-selected": isHighlighted, "data-highlighted": isHighlighted ? "" : undefined, ...props, ref: forwardedRef, onClick: composeEventHandlers(onClick, handleClick) }));
29
- });
30
- ComposerPrimitiveMentionCategoryItem.displayName =
31
- "ComposerPrimitive.MentionCategoryItem";
32
- //# sourceMappingURL=ComposerMentionCategories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionCategories.js","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionCategories.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EAIL,UAAU,EACV,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,oCAAiC;AAuB7D,MAAM,CAAC,MAAM,kCAAkC,GAAG,UAAU,CAG1D,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE;IACzC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAE3E,IAAI,gBAAgB,IAAI,YAAY;QAAE,OAAO,IAAI,CAAC;IAElD,OAAO,CACL,KAAC,SAAS,CAAC,GAAG,IAAC,IAAI,EAAC,OAAO,KAAK,KAAK,EAAE,GAAG,EAAE,YAAY,YACrD,QAAQ,CAAC,UAAU,CAAC,GACP,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kCAAkC,CAAC,WAAW;IAC5C,qCAAqC,CAAC;AAaxC;;;GAGG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,UAAU,CAG5D,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE;IACpD,MAAM,EACJ,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACb,GAAG,iBAAiB,EAAE,CAAC;IAExB,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IAEjC,kEAAkE;IAClE,MAAM,aAAa,GACjB,CAAC,gBAAgB;QACjB,CAAC,YAAY;QACb,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,KAAK,gBAAgB,CAAC;IAExE,OAAO,CACL,KAAC,SAAS,CAAC,MAAM,IACf,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,QAAQ,mBACE,aAAa,sBACV,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAC5C,KAAK,EACT,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAC,GACnD,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,oCAAoC,CAAC,WAAW;IAC9C,uCAAuC,CAAC"}
@@ -1,50 +0,0 @@
1
- import { Primitive } from "../../../utils/Primitive.js";
2
- import { type ComponentRef, type ComponentPropsWithoutRef, type ReactNode } from "react";
3
- import type { Unstable_MentionItem } from "@assistant-ui/core";
4
- export declare namespace ComposerPrimitiveMentionItems {
5
- type Element = ComponentRef<typeof Primitive.div>;
6
- type Props = Omit<ComponentPropsWithoutRef<typeof Primitive.div>, "children"> & {
7
- /**
8
- * Render function that receives the filtered items and returns
9
- * the UI. A render-function pattern is used here (instead of a
10
- * `components` prop) to give consumers full control over list layout,
11
- * ordering, grouping, and empty states.
12
- */
13
- children: (items: readonly Unstable_MentionItem[]) => ReactNode;
14
- };
15
- }
16
- export declare const ComposerPrimitiveMentionItems: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
17
- asChild?: boolean;
18
- }, "ref"> & {
19
- render?: import("react").ReactElement | undefined;
20
- } & import("react").RefAttributes<HTMLDivElement>, "ref">, "children"> & {
21
- /**
22
- * Render function that receives the filtered items and returns
23
- * the UI. A render-function pattern is used here (instead of a
24
- * `components` prop) to give consumers full control over list layout,
25
- * ordering, grouping, and empty states.
26
- */
27
- children: (items: readonly Unstable_MentionItem[]) => ReactNode;
28
- } & import("react").RefAttributes<HTMLDivElement>>;
29
- export declare namespace ComposerPrimitiveMentionItem {
30
- type Element = ComponentRef<typeof Primitive.button>;
31
- type Props = ComponentPropsWithoutRef<typeof Primitive.button> & {
32
- item: Unstable_MentionItem;
33
- /** Position in the items list. Used for keyboard highlight matching. Falls back to findIndex by id. */
34
- index?: number | undefined;
35
- };
36
- }
37
- /**
38
- * A button that inserts the mention item into the composer.
39
- * Automatically receives `data-highlighted` when keyboard-navigated.
40
- */
41
- export declare const ComposerPrimitiveMentionItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
42
- asChild?: boolean;
43
- }, "ref"> & {
44
- render?: import("react").ReactElement | undefined;
45
- } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
46
- item: Unstable_MentionItem;
47
- /** Position in the items list. Used for keyboard highlight matching. Falls back to findIndex by id. */
48
- index?: number | undefined;
49
- } & import("react").RefAttributes<HTMLButtonElement>>;
50
- //# sourceMappingURL=ComposerMentionItems.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionItems.d.ts","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionItems.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAM/D,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,IAAI,CACtB,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,EAC9C,UAAU,CACX,GAAG;QACF;;;;;WAKG;QACH,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,KAAK,SAAS,CAAC;KACjE,CAAC;CACH;AAED,eAAO,MAAM,6BAA6B;;;;;IAVtC;;;;;OAKG;cACO,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,KAAK,SAAS;kDAiBjE,CAAC;AAQH,yBAAiB,4BAA4B,CAAC;IAC5C,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5D,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG;QACtE,IAAI,EAAE,oBAAoB,CAAC;QAC3B,uGAAuG;QACvG,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC5B,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;UAV/B,oBAAoB;IAC1B,uGAAuG;YAC/F,MAAM,GAAG,SAAS;qDAyC5B,CAAC"}
@@ -1,30 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Primitive } from "../../../utils/Primitive.js";
4
- import { forwardRef, useCallback, } from "react";
5
- import { composeEventHandlers } from "@radix-ui/primitive";
6
- import { useMentionContext } from "./ComposerMentionContext.js";
7
- export const ComposerPrimitiveMentionItems = forwardRef(({ children, ...props }, forwardedRef) => {
8
- const { items, activeCategoryId, isSearchMode } = useMentionContext();
9
- if (!activeCategoryId && !isSearchMode)
10
- return null;
11
- return (_jsx(Primitive.div, { role: "group", ...props, ref: forwardedRef, children: children(items) }));
12
- });
13
- ComposerPrimitiveMentionItems.displayName = "ComposerPrimitive.MentionItems";
14
- /**
15
- * A button that inserts the mention item into the composer.
16
- * Automatically receives `data-highlighted` when keyboard-navigated.
17
- */
18
- export const ComposerPrimitiveMentionItem = forwardRef(({ item, index: indexProp, onClick, ...props }, forwardedRef) => {
19
- const { selectItem, items, highlightedIndex, activeCategoryId, isSearchMode, } = useMentionContext();
20
- const handleClick = useCallback(() => {
21
- selectItem(item);
22
- }, [selectItem, item]);
23
- // Use explicit index prop if provided, fall back to findIndex
24
- const itemIndex = indexProp ?? items.findIndex((i) => i.id === item.id);
25
- const isHighlighted = (isSearchMode || activeCategoryId !== null) &&
26
- itemIndex === highlightedIndex;
27
- return (_jsx(Primitive.button, { type: "button", role: "option", "aria-selected": isHighlighted, "data-highlighted": isHighlighted ? "" : undefined, ...props, ref: forwardedRef, onClick: composeEventHandlers(onClick, handleClick) }));
28
- });
29
- ComposerPrimitiveMentionItem.displayName = "ComposerPrimitive.MentionItem";
30
- //# sourceMappingURL=ComposerMentionItems.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionItems.js","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionItems.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EAI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ACjB,CAAC,YAAY,IAAI,gBAAgB,KAAK,IAAI,CAAC;QAC3C,SAAS,KAAK,gBAAgB,CAAC;IAEjC,OAAO,CACL,KAAC,SAAS,CAAC,MAAM,IACf,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,QAAQ,mBACE,aAAa,sBACV,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAC5C,KAAK,EACT,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAC,GACnD,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,4BAA4B,CAAC,WAAW,GAAG,+BAA+B,CAAC"}
@@ -1,26 +0,0 @@
1
- import { Primitive } from "../../../utils/Primitive.js";
2
- import { type ComponentRef, type ComponentPropsWithoutRef } from "react";
3
- export declare namespace ComposerPrimitiveMentionPopover {
4
- type Element = ComponentRef<typeof Primitive.div>;
5
- type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
6
- }
7
- /**
8
- * Renders a container for the mention picker popover.
9
- * Only renders when a `@` trigger is detected in the composer text.
10
- *
11
- * @example
12
- * ```tsx
13
- * <ComposerPrimitive.MentionRoot adapter={mentionAdapter}>
14
- * <ComposerPrimitive.Input />
15
- * <ComposerPrimitive.MentionPopover>
16
- * <ComposerPrimitive.MentionCategories />
17
- * </ComposerPrimitive.MentionPopover>
18
- * </ComposerPrimitive.MentionRoot>
19
- * ```
20
- */
21
- export declare const ComposerPrimitiveMentionPopover: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
22
- asChild?: boolean;
23
- }, "ref"> & {
24
- render?: import("react").ReactElement | undefined;
25
- } & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
26
- //# sourceMappingURL=ComposerMentionPopover.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionPopover.d.ts","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionPopover.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAE9B,MAAM,OAAO,CAAC;AAOf,yBAAiB,+BAA+B,CAAC;IAC/C,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,+BAA+B;;;;0GAe1C,CAAC"}
@@ -1,28 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Primitive } from "../../../utils/Primitive.js";
4
- import { forwardRef, } from "react";
5
- import { useMentionContext } from "./ComposerMentionContext.js";
6
- /**
7
- * Renders a container for the mention picker popover.
8
- * Only renders when a `@` trigger is detected in the composer text.
9
- *
10
- * @example
11
- * ```tsx
12
- * <ComposerPrimitive.MentionRoot adapter={mentionAdapter}>
13
- * <ComposerPrimitive.Input />
14
- * <ComposerPrimitive.MentionPopover>
15
- * <ComposerPrimitive.MentionCategories />
16
- * </ComposerPrimitive.MentionPopover>
17
- * </ComposerPrimitive.MentionRoot>
18
- * ```
19
- */
20
- export const ComposerPrimitiveMentionPopover = forwardRef((props, forwardedRef) => {
21
- const { open } = useMentionContext();
22
- if (!open)
23
- return null;
24
- return (_jsx(Primitive.div, { role: "listbox", "data-state": "open", ...props, ref: forwardedRef }));
25
- });
26
- ComposerPrimitiveMentionPopover.displayName =
27
- "ComposerPrimitive.MentionPopover";
28
- //# sourceMappingURL=ComposerMentionPopover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComposerMentionPopover.js","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/ComposerMentionPopover.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,oCAAiC;AACrD,OAAO,EAGL,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,iBAAiB,EAAE,oCAAiC;AAW7D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,UAAU,CAGvD,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IACxB,MAAM,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,CAAC;IACrC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,OAAO,CACL,KAAC,SAAS,CAAC,GAAG,IACZ,IAAI,EAAC,SAAS,gBACH,MAAM,KACb,KAAK,EACT,GAAG,EAAE,YAAY,GACjB,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,+BAA+B,CAAC,WAAW;IACzC,kCAAkC,CAAC"}
@@ -1,39 +0,0 @@
1
- import type { Unstable_MentionAdapter, Unstable_MentionCategory, Unstable_MentionItem, Unstable_DirectiveFormatter } from "@assistant-ui/core";
2
- import type { AssistantClient } from "@assistant-ui/store";
3
- export type MentionKeyEvent = {
4
- readonly key: string;
5
- readonly shiftKey: boolean;
6
- preventDefault(): void;
7
- };
8
- export type SelectItemOverride = (item: Unstable_MentionItem) => boolean;
9
- export type MentionResourceOutput = {
10
- readonly open: boolean;
11
- readonly query: string;
12
- readonly activeCategoryId: string | null;
13
- readonly categories: readonly Unstable_MentionCategory[];
14
- readonly items: readonly Unstable_MentionItem[];
15
- readonly highlightedIndex: number;
16
- readonly isSearchMode: boolean;
17
- readonly formatter: Unstable_DirectiveFormatter;
18
- selectCategory(categoryId: string): void;
19
- goBack(): void;
20
- selectItem(item: Unstable_MentionItem): void;
21
- close(): void;
22
- handleKeyDown(e: MentionKeyEvent): boolean;
23
- setCursorPosition(pos: number): void;
24
- registerSelectItemOverride(fn: SelectItemOverride): () => void;
25
- };
26
- export declare const MentionResource: (props: {
27
- adapter: Unstable_MentionAdapter | undefined;
28
- text: string;
29
- triggerChar: string;
30
- formatter: Unstable_DirectiveFormatter;
31
- aui: AssistantClient;
32
- }) => import("@assistant-ui/tap").ResourceElement<MentionResourceOutput, {
33
- adapter: Unstable_MentionAdapter | undefined;
34
- text: string;
35
- triggerChar: string;
36
- formatter: Unstable_DirectiveFormatter;
37
- aui: AssistantClient;
38
- }>;
39
- //# sourceMappingURL=MentionResource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MentionResource.d.ts","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/MentionResource.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAO3D,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,cAAc,IAAI,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,oBAAoB,KAAK,OAAO,CAAC;AAEzE,MAAM,MAAM,qBAAqB,GAAG;IAElC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAChD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAC;IAGhD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,MAAM,IAAI,IAAI,CAAC;IACf,UAAU,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC7C,KAAK,IAAI,IAAI,CAAC;IACd,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC;IAG3C,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,0BAA0B,CAAC,EAAE,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAAC;CAChE,CAAC;AAMF,eAAO,MAAM,eAAe;aAQf,uBAAuB,GAAG,SAAS;UACtC,MAAM;iBACC,MAAM;eACR,2BAA2B;SACjC,eAAe;;aAJX,uBAAuB,GAAG,SAAS;UACtC,MAAM;iBACC,MAAM;eACR,2BAA2B;SACjC,eAAe;EAmQvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MentionResource.js","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/MentionResource.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,cAAc,EACd,SAAS,EACT,MAAM,GACP,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,oBAAoB,EAAE,kCAA+B;AAqC9D,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CACrC,CAAC,EACC,OAAO,EACP,IAAI,EACJ,WAAW,EACX,SAAS,EACT,GAAG,GAOJ,EAAyB,EAAE;IAC1B,4EAA4E;IAC5E,sCAAsC;IACtC,4EAA4E;IAE5E,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAElE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,OAA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CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,MAAM,EAAE,CAAC;oBACT,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;YACD;gBACE,OAAO,KAAK,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,4EAA4E;IAC5E,SAAS;IACT,4EAA4E;IAE5E,OAAO;QACL,IAAI;QACJ,KAAK;QACL,gBAAgB,EAAE,yBAAyB;QAC3C,UAAU,EAAE,kBAAkB;QAC9B,KAAK,EAAE,aAAa;QACpB,gBAAgB;QAChB,YAAY;QACZ,SAAS;QACT,cAAc;QACd,MAAM;QACN,UAAU;QACV,KAAK;QACL,aAAa;QACb,iBAAiB;QACjB,0BAA0B;KAC3B,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=detectMentionTrigger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectMentionTrigger.d.ts","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/detectMentionTrigger.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectMentionTrigger.js","sourceRoot":"","sources":["../../../../src/primitives/composer/mention/detectMentionTrigger.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,WAAmB,EACnB,cAAsB;IAKtB,sCAAsC;IACtC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IAErD,0DAA0D;IAC1D,+EAA+E;IAC/E,KAAK,IAAI,CAAC,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,cAAc,CAAC,CAAC,CAAE,CAAC;QAEhC,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAE1C,IAAI,cAAc,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;YAC9C,gEAAgE;YAChE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC;gBAAE,SAAS;YAEnE,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;YAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,55 +0,0 @@
1
- "use client";
2
-
3
- import { Primitive } from "../../../utils/Primitive";
4
- import {
5
- type ComponentRef,
6
- type ComponentPropsWithoutRef,
7
- forwardRef,
8
- useCallback,
9
- } from "react";
10
- import { composeEventHandlers } from "@radix-ui/primitive";
11
- import { useMentionContext } from "./ComposerMentionContext";
12
-
13
- // =============================================================================
14
- // MentionBack — Button to navigate back from items to categories
15
- // =============================================================================
16
-
17
- export namespace ComposerPrimitiveMentionBack {
18
- export type Element = ComponentRef<typeof Primitive.button>;
19
- export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;
20
- }
21
-
22
- /**
23
- * A button that navigates back from category items to the category list.
24
- * Only renders when a category is active (drill-down view).
25
- *
26
- * @example
27
- * ```tsx
28
- * <ComposerPrimitive.MentionBack>
29
- * &larr; Back
30
- * </ComposerPrimitive.MentionBack>
31
- * ```
32
- */
33
- export const ComposerPrimitiveMentionBack = forwardRef<
34
- ComposerPrimitiveMentionBack.Element,
35
- ComposerPrimitiveMentionBack.Props
36
- >(({ onClick, ...props }, forwardedRef) => {
37
- const { activeCategoryId, isSearchMode, goBack } = useMentionContext();
38
-
39
- const handleClick = useCallback(() => {
40
- goBack();
41
- }, [goBack]);
42
-
43
- if (!activeCategoryId || isSearchMode) return null;
44
-
45
- return (
46
- <Primitive.button
47
- type="button"
48
- {...props}
49
- ref={forwardedRef}
50
- onClick={composeEventHandlers(onClick, handleClick)}
51
- />
52
- );
53
- });
54
-
55
- ComposerPrimitiveMentionBack.displayName = "ComposerPrimitive.MentionBack";
@@ -1,52 +0,0 @@
1
- "use client";
2
-
3
- import { Primitive } from "../../../utils/Primitive";
4
- import {
5
- type ComponentRef,
6
- type ComponentPropsWithoutRef,
7
- forwardRef,
8
- } from "react";
9
- import { useMentionContext } from "./ComposerMentionContext";
10
-
11
- // =============================================================================
12
- // MentionPopover — Container that only renders when mention is active
13
- // =============================================================================
14
-
15
- export namespace ComposerPrimitiveMentionPopover {
16
- export type Element = ComponentRef<typeof Primitive.div>;
17
- export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
18
- }
19
-
20
- /**
21
- * Renders a container for the mention picker popover.
22
- * Only renders when a `@` trigger is detected in the composer text.
23
- *
24
- * @example
25
- * ```tsx
26
- * <ComposerPrimitive.MentionRoot adapter={mentionAdapter}>
27
- * <ComposerPrimitive.Input />
28
- * <ComposerPrimitive.MentionPopover>
29
- * <ComposerPrimitive.MentionCategories />
30
- * </ComposerPrimitive.MentionPopover>
31
- * </ComposerPrimitive.MentionRoot>
32
- * ```
33
- */
34
- export const ComposerPrimitiveMentionPopover = forwardRef<
35
- ComposerPrimitiveMentionPopover.Element,
36
- ComposerPrimitiveMentionPopover.Props
37
- >((props, forwardedRef) => {
38
- const { open } = useMentionContext();
39
- if (!open) return null;
40
-
41
- return (
42
- <Primitive.div
43
- role="listbox"
44
- data-state="open"
45
- {...props}
46
- ref={forwardedRef}
47
- />
48
- );
49
- });
50
-
51
- ComposerPrimitiveMentionPopover.displayName =
52
- "ComposerPrimitive.MentionPopover";