@assistant-ui/react 0.12.23 → 0.12.25

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 (127) 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/index.d.ts +3 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +4 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/internal.d.ts +1 -0
  9. package/dist/internal.d.ts.map +1 -1
  10. package/dist/internal.js +2 -0
  11. package/dist/internal.js.map +1 -1
  12. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  13. package/dist/primitives/composer/ComposerInput.js +27 -12
  14. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  15. package/dist/primitives/composer/ComposerInputPluginContext.d.ts +31 -0
  16. package/dist/primitives/composer/ComposerInputPluginContext.d.ts.map +1 -0
  17. package/dist/primitives/composer/ComposerInputPluginContext.js +32 -0
  18. package/dist/primitives/composer/ComposerInputPluginContext.js.map +1 -0
  19. package/dist/primitives/composer/mention/ComposerMentionContext.d.ts +4 -2
  20. package/dist/primitives/composer/mention/ComposerMentionContext.d.ts.map +1 -1
  21. package/dist/primitives/composer/mention/ComposerMentionContext.js +21 -13
  22. package/dist/primitives/composer/mention/ComposerMentionContext.js.map +1 -1
  23. package/dist/primitives/composer/mention/index.d.ts +4 -4
  24. package/dist/primitives/composer/mention/index.d.ts.map +1 -1
  25. package/dist/primitives/composer/mention/index.js +6 -4
  26. package/dist/primitives/composer/mention/index.js.map +1 -1
  27. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.d.ts +36 -0
  28. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.d.ts.map +1 -0
  29. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.js +36 -0
  30. package/dist/primitives/composer/slash-command/ComposerSlashCommandRoot.js.map +1 -0
  31. package/dist/primitives/composer/slash-command/index.d.ts +2 -0
  32. package/dist/primitives/composer/slash-command/index.d.ts.map +1 -0
  33. package/dist/primitives/composer/slash-command/index.js +2 -0
  34. package/dist/primitives/composer/slash-command/index.js.map +1 -0
  35. package/dist/primitives/composer/{mention/ComposerMentionBack.d.ts → trigger/TriggerPopoverBack.d.ts} +3 -10
  36. package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts.map +1 -0
  37. package/dist/primitives/composer/trigger/TriggerPopoverBack.js +19 -0
  38. package/dist/primitives/composer/trigger/TriggerPopoverBack.js.map +1 -0
  39. package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts +38 -0
  40. package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts.map +1 -0
  41. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js +35 -0
  42. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js.map +1 -0
  43. package/dist/primitives/composer/trigger/TriggerPopoverContext.d.ts +37 -0
  44. package/dist/primitives/composer/trigger/TriggerPopoverContext.d.ts.map +1 -0
  45. package/dist/primitives/composer/trigger/TriggerPopoverContext.js +70 -0
  46. package/dist/primitives/composer/trigger/TriggerPopoverContext.js.map +1 -0
  47. package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts +40 -0
  48. package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts.map +1 -0
  49. package/dist/primitives/composer/trigger/TriggerPopoverItems.js +35 -0
  50. package/dist/primitives/composer/trigger/TriggerPopoverItems.js.map +1 -0
  51. package/dist/primitives/composer/trigger/TriggerPopoverPopover.d.ts +26 -0
  52. package/dist/primitives/composer/trigger/TriggerPopoverPopover.d.ts.map +1 -0
  53. package/dist/primitives/composer/trigger/TriggerPopoverPopover.js +28 -0
  54. package/dist/primitives/composer/trigger/TriggerPopoverPopover.js.map +1 -0
  55. package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts +53 -0
  56. package/dist/primitives/composer/trigger/TriggerPopoverResource.d.ts.map +1 -0
  57. package/dist/primitives/composer/{mention/MentionResource.js → trigger/TriggerPopoverResource.js} +50 -25
  58. package/dist/primitives/composer/trigger/TriggerPopoverResource.js.map +1 -0
  59. package/dist/primitives/composer/trigger/detectTrigger.d.ts +2 -0
  60. package/dist/primitives/composer/trigger/detectTrigger.d.ts.map +1 -0
  61. package/dist/primitives/composer/{mention/detectMentionTrigger.js → trigger/detectTrigger.js} +4 -4
  62. package/dist/primitives/composer/trigger/detectTrigger.js.map +1 -0
  63. package/dist/primitives/composer/trigger/index.d.ts +7 -0
  64. package/dist/primitives/composer/trigger/index.d.ts.map +1 -0
  65. package/dist/primitives/composer/trigger/index.js +6 -0
  66. package/dist/primitives/composer/trigger/index.js.map +1 -0
  67. package/dist/primitives/composer.d.ts +10 -0
  68. package/dist/primitives/composer.d.ts.map +1 -1
  69. package/dist/primitives/composer.js +14 -0
  70. package/dist/primitives/composer.js.map +1 -1
  71. package/dist/primitives/message/MessageRoot.d.ts +25 -3
  72. package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
  73. package/dist/primitives/message/MessageRoot.js +2 -2
  74. package/dist/primitives/message/MessageRoot.js.map +1 -1
  75. package/dist/primitives/thread/ThreadViewportSlack.d.ts +2 -2
  76. package/dist/primitives/thread/ThreadViewportSlack.d.ts.map +1 -1
  77. package/dist/unstable/useSlashCommandAdapter.d.ts +34 -0
  78. package/dist/unstable/useSlashCommandAdapter.d.ts.map +1 -0
  79. package/dist/unstable/useSlashCommandAdapter.js +50 -0
  80. package/dist/unstable/useSlashCommandAdapter.js.map +1 -0
  81. package/package.json +12 -12
  82. package/src/client/ExternalThread.ts +1 -0
  83. package/src/index.ts +14 -0
  84. package/src/internal.ts +3 -0
  85. package/src/primitives/composer/ComposerInput.tsx +25 -18
  86. package/src/primitives/composer/ComposerInputPluginContext.tsx +100 -0
  87. package/src/primitives/composer/mention/ComposerMentionContext.tsx +56 -22
  88. package/src/primitives/composer/mention/index.ts +11 -8
  89. package/src/primitives/composer/slash-command/ComposerSlashCommandRoot.tsx +76 -0
  90. package/src/primitives/composer/slash-command/index.ts +1 -0
  91. package/src/primitives/composer/trigger/TriggerPopoverBack.tsx +40 -0
  92. package/src/primitives/composer/{mention/ComposerMentionCategories.tsx → trigger/TriggerPopoverCategories.tsx} +33 -28
  93. package/src/primitives/composer/trigger/TriggerPopoverContext.tsx +129 -0
  94. package/src/primitives/composer/{mention/ComposerMentionItems.tsx → trigger/TriggerPopoverItems.tsx} +34 -29
  95. package/src/primitives/composer/trigger/TriggerPopoverPopover.tsx +51 -0
  96. package/src/primitives/composer/{mention/MentionResource.ts → trigger/TriggerPopoverResource.ts} +146 -98
  97. package/src/primitives/composer/{mention/detectMentionTrigger.test.ts → trigger/detectTrigger.test.ts} +15 -15
  98. package/src/primitives/composer/{mention/detectMentionTrigger.ts → trigger/detectTrigger.ts} +3 -3
  99. package/src/primitives/composer/trigger/index.ts +16 -0
  100. package/src/primitives/composer.ts +16 -0
  101. package/src/primitives/message/MessageRoot.tsx +18 -4
  102. package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
  103. package/src/tests/BaseComposerRuntimeCore.test.ts +33 -1
  104. package/src/unstable/useSlashCommandAdapter.ts +83 -0
  105. package/dist/primitives/composer/mention/ComposerMentionBack.d.ts.map +0 -1
  106. package/dist/primitives/composer/mention/ComposerMentionBack.js +0 -28
  107. package/dist/primitives/composer/mention/ComposerMentionBack.js.map +0 -1
  108. package/dist/primitives/composer/mention/ComposerMentionCategories.d.ts +0 -46
  109. package/dist/primitives/composer/mention/ComposerMentionCategories.d.ts.map +0 -1
  110. package/dist/primitives/composer/mention/ComposerMentionCategories.js +0 -32
  111. package/dist/primitives/composer/mention/ComposerMentionCategories.js.map +0 -1
  112. package/dist/primitives/composer/mention/ComposerMentionItems.d.ts +0 -50
  113. package/dist/primitives/composer/mention/ComposerMentionItems.d.ts.map +0 -1
  114. package/dist/primitives/composer/mention/ComposerMentionItems.js +0 -30
  115. package/dist/primitives/composer/mention/ComposerMentionItems.js.map +0 -1
  116. package/dist/primitives/composer/mention/ComposerMentionPopover.d.ts +0 -26
  117. package/dist/primitives/composer/mention/ComposerMentionPopover.d.ts.map +0 -1
  118. package/dist/primitives/composer/mention/ComposerMentionPopover.js +0 -28
  119. package/dist/primitives/composer/mention/ComposerMentionPopover.js.map +0 -1
  120. package/dist/primitives/composer/mention/MentionResource.d.ts +0 -39
  121. package/dist/primitives/composer/mention/MentionResource.d.ts.map +0 -1
  122. package/dist/primitives/composer/mention/MentionResource.js.map +0 -1
  123. package/dist/primitives/composer/mention/detectMentionTrigger.d.ts +0 -2
  124. package/dist/primitives/composer/mention/detectMentionTrigger.d.ts.map +0 -1
  125. package/dist/primitives/composer/mention/detectMentionTrigger.js.map +0 -1
  126. package/src/primitives/composer/mention/ComposerMentionBack.tsx +0 -55
  127. package/src/primitives/composer/mention/ComposerMentionPopover.tsx +0 -52
@@ -1,28 +1,28 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { detectMentionTrigger } from "./detectMentionTrigger";
2
+ import { detectTrigger } from "./detectTrigger";
3
3
 
4
- describe("detectMentionTrigger", () => {
4
+ describe("detectTrigger", () => {
5
5
  it("detects @query at cursor position", () => {
6
- expect(detectMentionTrigger("hello @wea", "@", 10)).toEqual({
6
+ expect(detectTrigger("hello @wea", "@", 10)).toEqual({
7
7
  query: "wea",
8
8
  offset: 6,
9
9
  });
10
10
  });
11
11
 
12
12
  it("returns null when cursor is before the trigger", () => {
13
- expect(detectMentionTrigger("hello @weather", "@", 5)).toBeNull();
13
+ expect(detectTrigger("hello @weather", "@", 5)).toBeNull();
14
14
  });
15
15
 
16
16
  it("returns null when no trigger character", () => {
17
- expect(detectMentionTrigger("hello world", "@", 11)).toBeNull();
17
+ expect(detectTrigger("hello world", "@", 11)).toBeNull();
18
18
  });
19
19
 
20
20
  it("requires whitespace or start before trigger", () => {
21
- expect(detectMentionTrigger("email@test", "@", 10)).toBeNull();
21
+ expect(detectTrigger("email@test", "@", 10)).toBeNull();
22
22
  });
23
23
 
24
24
  it("trigger at start of text", () => {
25
- expect(detectMentionTrigger("@foo", "@", 4)).toEqual({
25
+ expect(detectTrigger("@foo", "@", 4)).toEqual({
26
26
  query: "foo",
27
27
  offset: 0,
28
28
  });
@@ -30,19 +30,19 @@ describe("detectMentionTrigger", () => {
30
30
 
31
31
  it("stops at whitespace in query", () => {
32
32
  // "@foo bar" — space terminates the mention
33
- expect(detectMentionTrigger("@foo bar", "@", 8)).toBeNull();
33
+ expect(detectTrigger("@foo bar", "@", 8)).toBeNull();
34
34
  });
35
35
 
36
36
  it("stops at newline", () => {
37
- expect(detectMentionTrigger("@foo\nbar", "@", 8)).toBeNull();
37
+ expect(detectTrigger("@foo\nbar", "@", 8)).toBeNull();
38
38
  });
39
39
 
40
40
  it("stops at tab", () => {
41
- expect(detectMentionTrigger("@foo\tbar", "@", 8)).toBeNull();
41
+ expect(detectTrigger("@foo\tbar", "@", 8)).toBeNull();
42
42
  });
43
43
 
44
44
  it("treats tab before trigger as valid boundary", () => {
45
- expect(detectMentionTrigger("hello\t@foo", "@", 10)).toEqual({
45
+ expect(detectTrigger("hello\t@foo", "@", 10)).toEqual({
46
46
  query: "foo",
47
47
  offset: 6,
48
48
  });
@@ -51,7 +51,7 @@ describe("detectMentionTrigger", () => {
51
51
  it("finds trigger closest to cursor, not earlier ones", () => {
52
52
  // Text has two @: "hello @old text @new"
53
53
  // Cursor at end → should find @new
54
- expect(detectMentionTrigger("hello @old text @new", "@", 20)).toEqual({
54
+ expect(detectTrigger("hello @old text @new", "@", 20)).toEqual({
55
55
  query: "new",
56
56
  offset: 16,
57
57
  });
@@ -59,18 +59,18 @@ describe("detectMentionTrigger", () => {
59
59
 
60
60
  it("ignores trigger after cursor", () => {
61
61
  // Cursor at position 5, trigger at position 10
62
- expect(detectMentionTrigger("hello text @foo", "@", 5)).toBeNull();
62
+ expect(detectTrigger("hello text @foo", "@", 5)).toBeNull();
63
63
  });
64
64
 
65
65
  it("works with multi-char trigger", () => {
66
- expect(detectMentionTrigger("hello @@foo", "@@", 11)).toEqual({
66
+ expect(detectTrigger("hello @@foo", "@@", 11)).toEqual({
67
67
  query: "foo",
68
68
  offset: 6,
69
69
  });
70
70
  });
71
71
 
72
72
  it("empty query when cursor is right after trigger", () => {
73
- expect(detectMentionTrigger("hello @", "@", 7)).toEqual({
73
+ expect(detectTrigger("hello @", "@", 7)).toEqual({
74
74
  query: "",
75
75
  offset: 6,
76
76
  });
@@ -1,11 +1,11 @@
1
1
  const WHITESPACE_RE = /\s/;
2
2
 
3
3
  /**
4
- * Detect a mention trigger in text relative to the cursor position.
4
+ * Detect a trigger character in text relative to the cursor position.
5
5
  *
6
- * @internal Exported for testing and for the MentionResource.
6
+ * @internal Exported for testing and for trigger resources.
7
7
  */
8
- export function detectMentionTrigger(
8
+ export function detectTrigger(
9
9
  text: string,
10
10
  triggerChar: string,
11
11
  cursorPosition: number,
@@ -0,0 +1,16 @@
1
+ export {
2
+ ComposerPrimitiveTriggerPopoverRoot,
3
+ useTriggerPopoverContext,
4
+ useTriggerPopoverContextOptional,
5
+ } from "./TriggerPopoverContext";
6
+ export { ComposerPrimitiveTriggerPopoverPopover } from "./TriggerPopoverPopover";
7
+ export {
8
+ ComposerPrimitiveTriggerPopoverCategories,
9
+ ComposerPrimitiveTriggerPopoverCategoryItem,
10
+ } from "./TriggerPopoverCategories";
11
+ export {
12
+ ComposerPrimitiveTriggerPopoverItems,
13
+ ComposerPrimitiveTriggerPopoverItem,
14
+ } from "./TriggerPopoverItems";
15
+ export { ComposerPrimitiveTriggerPopoverBack } from "./TriggerPopoverBack";
16
+ export type { OnSelectBehavior } from "./TriggerPopoverResource";
@@ -23,3 +23,19 @@ export { ComposerPrimitiveMentionItem as Unstable_MentionItem } from "./composer
23
23
  export { ComposerPrimitiveMentionBack as Unstable_MentionBack } from "./composer/mention";
24
24
  export { useMentionContext as unstable_useMentionContext } from "./composer/mention";
25
25
  export { useMentionContextOptional as unstable_useMentionContextOptional } from "./composer/mention";
26
+
27
+ // --- Generic Trigger Popover primitives (unstable) ---
28
+ export { ComposerPrimitiveTriggerPopoverRoot as Unstable_TriggerPopoverRoot } from "./composer/trigger";
29
+ export { ComposerPrimitiveTriggerPopoverPopover as Unstable_TriggerPopoverPopover } from "./composer/trigger";
30
+ export { ComposerPrimitiveTriggerPopoverCategories as Unstable_TriggerPopoverCategories } from "./composer/trigger";
31
+ export { ComposerPrimitiveTriggerPopoverCategoryItem as Unstable_TriggerPopoverCategoryItem } from "./composer/trigger";
32
+ export { ComposerPrimitiveTriggerPopoverItems as Unstable_TriggerPopoverItems } from "./composer/trigger";
33
+ export { ComposerPrimitiveTriggerPopoverItem as Unstable_TriggerPopoverItem } from "./composer/trigger";
34
+ export { ComposerPrimitiveTriggerPopoverBack as Unstable_TriggerPopoverBack } from "./composer/trigger";
35
+ export { useTriggerPopoverContext as unstable_useTriggerPopoverContext } from "./composer/trigger";
36
+ export { useTriggerPopoverContextOptional as unstable_useTriggerPopoverContextOptional } from "./composer/trigger";
37
+
38
+ // --- Slash Command primitives (unstable) ---
39
+ // SlashCommandRoot is the only slash-specific primitive; UI primitives
40
+ // (Popover, Items, Categories, Back) are the shared TriggerPopover* set above.
41
+ export { ComposerPrimitiveSlashCommandRoot as Unstable_SlashCommandRoot } from "./composer/slash-command";
@@ -79,9 +79,20 @@ export namespace MessagePrimitiveRoot {
79
79
  export type Element = ComponentRef<typeof Primitive.div>;
80
80
  /**
81
81
  * Props for the MessagePrimitive.Root component.
82
- * Accepts all standard div element props.
82
+ * Accepts all standard div element props plus optional viewport slack tuning.
83
83
  */
84
- export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
84
+ export type Props = ComponentPropsWithoutRef<typeof Primitive.div> & {
85
+ /**
86
+ * Threshold at which the user message height clamps to the offset.
87
+ * @default "10em"
88
+ */
89
+ fillClampThreshold?: string | undefined;
90
+ /**
91
+ * Offset used when clamping large user messages.
92
+ * @default "6em"
93
+ */
94
+ fillClampOffset?: string | undefined;
95
+ };
85
96
  }
86
97
 
87
98
  /**
@@ -108,7 +119,7 @@ export namespace MessagePrimitiveRoot {
108
119
  export const MessagePrimitiveRoot = forwardRef<
109
120
  MessagePrimitiveRoot.Element,
110
121
  MessagePrimitiveRoot.Props
111
- >((props, forwardRef) => {
122
+ >(({ fillClampThreshold, fillClampOffset, ...props }, forwardRef) => {
112
123
  const isHoveringRef = useIsHoveringRef();
113
124
  const anchorUserMessageRef = useMessageViewportRef();
114
125
  const ref = useComposedRefs<HTMLDivElement>(
@@ -119,7 +130,10 @@ export const MessagePrimitiveRoot = forwardRef<
119
130
  const messageId = useAuiState((s) => s.message.id);
120
131
 
121
132
  return (
122
- <ThreadPrimitiveViewportSlack>
133
+ <ThreadPrimitiveViewportSlack
134
+ fillClampThreshold={fillClampThreshold}
135
+ fillClampOffset={fillClampOffset}
136
+ >
123
137
  <Primitive.div {...props} ref={ref} data-message-id={messageId} />
124
138
  </ThreadPrimitiveViewportSlack>
125
139
  );
@@ -36,9 +36,9 @@ const parseCssLength = (value: string, element: HTMLElement): number => {
36
36
 
37
37
  export type ThreadViewportSlackProps = {
38
38
  /** Threshold at which the user message height clamps to the offset */
39
- fillClampThreshold?: string;
39
+ fillClampThreshold?: string | undefined;
40
40
  /** Offset used when clamping large user messages */
41
- fillClampOffset?: string;
41
+ fillClampOffset?: string | undefined;
42
42
  children: ReactNode;
43
43
  };
44
44
 
@@ -6,12 +6,14 @@ import type {
6
6
  AppendMessage,
7
7
  CreateAttachment,
8
8
  PendingAttachment,
9
+ SendOptions,
9
10
  } from "@assistant-ui/core";
10
11
 
11
12
  class TestComposerCore extends BaseComposerRuntimeCore {
12
13
  private _attachmentAdapter: AttachmentAdapter | undefined;
13
14
  private _dictationAdapter: DictationAdapter | undefined;
14
15
  public sentMessages: Array<Omit<AppendMessage, "parentId" | "sourceId">> = [];
16
+ public sentOptions: Array<SendOptions | undefined> = [];
15
17
  public cancelCalled = false;
16
18
 
17
19
  protected getAttachmentAdapter() {
@@ -33,8 +35,12 @@ class TestComposerCore extends BaseComposerRuntimeCore {
33
35
  return false;
34
36
  }
35
37
 
36
- protected handleSend(message: Omit<AppendMessage, "parentId" | "sourceId">) {
38
+ protected handleSend(
39
+ message: Omit<AppendMessage, "parentId" | "sourceId">,
40
+ options?: SendOptions,
41
+ ) {
37
42
  this.sentMessages.push(message);
43
+ this.sentOptions.push(options);
38
44
  }
39
45
 
40
46
  protected handleCancel() {
@@ -421,4 +427,30 @@ describe("BaseComposerRuntimeCore", () => {
421
427
  expect(adapter.send).toHaveBeenCalledTimes(1);
422
428
  });
423
429
  });
430
+
431
+ describe("send options", () => {
432
+ it("send() passes undefined options by default", async () => {
433
+ composer.setText("hello");
434
+ await composer.send();
435
+
436
+ expect(composer.sentOptions).toHaveLength(1);
437
+ expect(composer.sentOptions[0]).toBeUndefined();
438
+ });
439
+
440
+ it("send({ startRun: true }) forwards options to handleSend", async () => {
441
+ composer.setText("hello");
442
+ await composer.send({ startRun: true });
443
+
444
+ expect(composer.sentOptions).toHaveLength(1);
445
+ expect(composer.sentOptions[0]).toEqual({ startRun: true });
446
+ });
447
+
448
+ it("send({ startRun: false }) forwards options to handleSend", async () => {
449
+ composer.setText("hello");
450
+ await composer.send({ startRun: false });
451
+
452
+ expect(composer.sentOptions).toHaveLength(1);
453
+ expect(composer.sentOptions[0]).toEqual({ startRun: false });
454
+ });
455
+ });
424
456
  });
@@ -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,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,6BAA6B,GAAG,UAAU,CAGrD,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE;IACzC,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAEtE,IAAI,CAAC,gBAAgB,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAEpD,OAAO,CACL,KAAC,SAAS,CAAC,GAAG,IAAC,IAAI,EAAC,OAAO,KAAK,KAAK,EAAE,GAAG,EAAE,YAAY,YACrD,QAAQ,CAAC,KAAK,CAAC,GACF,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,6BAA6B,CAAC,WAAW,GAAG,gCAAgC,CAAC;AAe7E;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAGpD,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE;IAChE,MAAM,EACJ,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACb,GAAG,iBAAiB,EAAE,CAAC;IAExB,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;IAEvB,8DAA8D;IAC9D,MAAM,SAAS,GAAG,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC;IACxE,MAAM,aAAa,GACjB,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"}