@assistant-ui/react 0.7.6 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. package/dist/api/ContentPartRuntime.d.ts.map +1 -1
  2. package/dist/api/ContentPartRuntime.js +0 -1
  3. package/dist/api/ContentPartRuntime.js.map +1 -1
  4. package/dist/api/ContentPartRuntime.mjs +0 -1
  5. package/dist/api/ContentPartRuntime.mjs.map +1 -1
  6. package/dist/primitives/threadList/ThreadListItems.d.ts +2 -2
  7. package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
  8. package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
  9. package/dist/primitives/threadList/ThreadListItems.mjs.map +1 -1
  10. package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
  11. package/dist/primitives/threadList/ThreadListNew.js +23 -6
  12. package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
  13. package/dist/primitives/threadList/ThreadListNew.mjs +24 -9
  14. package/dist/primitives/threadList/ThreadListNew.mjs.map +1 -1
  15. package/dist/styles/index.css +66 -0
  16. package/dist/styles/index.css.map +1 -1
  17. package/dist/styles/tailwindcss/thread.css +30 -0
  18. package/dist/styles/tailwindcss/thread.css.json +21 -0
  19. package/dist/ui/assistant-action-bar.d.ts +7 -7
  20. package/dist/ui/assistant-action-bar.d.ts.map +1 -1
  21. package/dist/ui/assistant-action-bar.js.map +1 -1
  22. package/dist/ui/assistant-action-bar.mjs +1 -3
  23. package/dist/ui/assistant-action-bar.mjs.map +1 -1
  24. package/dist/ui/assistant-modal.d.ts +3 -3
  25. package/dist/ui/assistant-modal.d.ts.map +1 -1
  26. package/dist/ui/assistant-modal.js.map +1 -1
  27. package/dist/ui/assistant-modal.mjs +1 -3
  28. package/dist/ui/assistant-modal.mjs.map +1 -1
  29. package/dist/ui/attachment-ui.d.ts +2 -2
  30. package/dist/ui/attachment-ui.d.ts.map +1 -1
  31. package/dist/ui/attachment-ui.js.map +1 -1
  32. package/dist/ui/attachment-ui.mjs +1 -3
  33. package/dist/ui/attachment-ui.mjs.map +1 -1
  34. package/dist/ui/base/index.d.ts +1 -1
  35. package/dist/ui/base/index.d.ts.map +1 -1
  36. package/dist/ui/base/index.js.map +1 -1
  37. package/dist/ui/base/index.mjs +1 -3
  38. package/dist/ui/base/index.mjs.map +1 -1
  39. package/dist/ui/base/tooltip-icon-button.d.ts +6 -4
  40. package/dist/ui/base/tooltip-icon-button.d.ts.map +1 -1
  41. package/dist/ui/base/tooltip-icon-button.js.map +1 -1
  42. package/dist/ui/base/tooltip-icon-button.mjs.map +1 -1
  43. package/dist/ui/branch-picker.d.ts +3 -3
  44. package/dist/ui/branch-picker.d.ts.map +1 -1
  45. package/dist/ui/branch-picker.js.map +1 -1
  46. package/dist/ui/branch-picker.mjs +1 -3
  47. package/dist/ui/branch-picker.mjs.map +1 -1
  48. package/dist/ui/composer.d.ts +4 -4
  49. package/dist/ui/composer.d.ts.map +1 -1
  50. package/dist/ui/composer.js.map +1 -1
  51. package/dist/ui/composer.mjs +1 -3
  52. package/dist/ui/composer.mjs.map +1 -1
  53. package/dist/ui/index.d.ts +2 -0
  54. package/dist/ui/index.d.ts.map +1 -1
  55. package/dist/ui/index.js +6 -0
  56. package/dist/ui/index.js.map +1 -1
  57. package/dist/ui/index.mjs +4 -0
  58. package/dist/ui/index.mjs.map +1 -1
  59. package/dist/ui/thread-config.d.ts +13 -0
  60. package/dist/ui/thread-config.d.ts.map +1 -1
  61. package/dist/ui/thread-config.js +8 -1
  62. package/dist/ui/thread-config.js.map +1 -1
  63. package/dist/ui/thread-config.mjs +8 -1
  64. package/dist/ui/thread-config.mjs.map +1 -1
  65. package/dist/ui/thread-list-item.d.ts +24 -0
  66. package/dist/ui/thread-list-item.d.ts.map +1 -0
  67. package/dist/ui/thread-list-item.js +107 -0
  68. package/dist/ui/thread-list-item.js.map +1 -0
  69. package/dist/ui/thread-list-item.mjs +77 -0
  70. package/dist/ui/thread-list-item.mjs.map +1 -0
  71. package/dist/ui/thread-list.d.ts +20 -0
  72. package/dist/ui/thread-list.d.ts.map +1 -0
  73. package/dist/ui/thread-list.js +92 -0
  74. package/dist/ui/thread-list.js.map +1 -0
  75. package/dist/ui/thread-list.mjs +62 -0
  76. package/dist/ui/thread-list.mjs.map +1 -0
  77. package/dist/ui/thread.d.ts +2 -2
  78. package/dist/ui/thread.d.ts.map +1 -1
  79. package/dist/ui/thread.js.map +1 -1
  80. package/dist/ui/thread.mjs +1 -3
  81. package/dist/ui/thread.mjs.map +1 -1
  82. package/dist/ui/user-action-bar.d.ts +2 -2
  83. package/dist/ui/user-action-bar.d.ts.map +1 -1
  84. package/dist/ui/user-action-bar.js.map +1 -1
  85. package/dist/ui/user-action-bar.mjs +1 -3
  86. package/dist/ui/user-action-bar.mjs.map +1 -1
  87. package/package.json +4 -4
  88. package/src/api/ContentPartRuntime.ts +0 -1
  89. package/src/primitives/threadList/ThreadListItems.tsx +3 -3
  90. package/src/primitives/threadList/ThreadListNew.tsx +45 -0
  91. package/src/styles/tailwindcss/thread.css +30 -0
  92. package/src/ui/assistant-action-bar.tsx +7 -10
  93. package/src/ui/assistant-modal.tsx +3 -6
  94. package/src/ui/attachment-ui.tsx +2 -5
  95. package/src/ui/base/index.ts +1 -4
  96. package/src/ui/base/tooltip-icon-button.tsx +7 -5
  97. package/src/ui/branch-picker.tsx +3 -6
  98. package/src/ui/composer.tsx +4 -7
  99. package/src/ui/index.ts +4 -0
  100. package/src/ui/thread-config.tsx +29 -7
  101. package/src/ui/thread-list-item.tsx +99 -0
  102. package/src/ui/thread-list.tsx +72 -0
  103. package/src/ui/thread.tsx +2 -5
  104. package/src/ui/user-action-bar.tsx +2 -5
  105. package/src/primitives/threadList/ThreadListNew.ts +0 -25
@@ -219,3 +219,33 @@
219
219
  .aui-text-running::after {
220
220
  @apply animate-pulse font-sans content-['\25CF'] ltr:ml-1 rtl:mr-1;
221
221
  }
222
+
223
+ /* thread-list */
224
+
225
+ .aui-thread-list-root {
226
+ @apply flex flex-col items-stretch gap-1.5;
227
+ }
228
+
229
+ .aui-thread-list-item {
230
+ @apply data-[active]:bg-aui-muted hover:bg-aui-muted flex items-center gap-2 rounded-lg transition-all;
231
+ }
232
+
233
+ .aui-thread-list-new {
234
+ @apply data-[active]:bg-aui-muted hover:bg-aui-muted flex items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start;
235
+ }
236
+
237
+ .aui-thread-list-new > .lucide-plus {
238
+ @apply size-5;
239
+ }
240
+
241
+ .aui-thread-list-item-trigger {
242
+ @apply flex-grow px-3 py-2 text-start;
243
+ }
244
+
245
+ .aui-thread-list-item-title {
246
+ @apply text-sm;
247
+ }
248
+
249
+ .aui-thread-list-item-archive {
250
+ @apply hover:text-aui-primary text-aui-foreground ml-auto mr-3 size-4 p-0;
251
+ }
@@ -149,5 +149,26 @@
149
149
  },
150
150
  ".aui-text-running::after": {
151
151
  "@apply animate-pulse font-sans content-['\\25CF'] ltr:ml-1 rtl:mr-1": {}
152
+ },
153
+ ".aui-thread-list-root": {
154
+ "@apply flex flex-col items-stretch gap-1.5": {}
155
+ },
156
+ ".aui-thread-list-item": {
157
+ "@apply data-[active]:bg-aui-muted hover:bg-aui-muted flex items-center gap-2 rounded-lg transition-all": {}
158
+ },
159
+ ".aui-thread-list-new": {
160
+ "@apply data-[active]:bg-aui-muted hover:bg-aui-muted flex items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start": {}
161
+ },
162
+ ".aui-thread-list-new > .lucide-plus": {
163
+ "@apply size-5": {}
164
+ },
165
+ ".aui-thread-list-item-trigger": {
166
+ "@apply flex-grow px-3 py-2 text-start": {}
167
+ },
168
+ ".aui-thread-list-item-title": {
169
+ "@apply text-sm": {}
170
+ },
171
+ ".aui-thread-list-item-archive": {
172
+ "@apply hover:text-aui-primary text-aui-foreground ml-auto mr-3 size-4 p-0": {}
152
173
  }
153
174
  }
@@ -1,5 +1,5 @@
1
1
  import { type FC } from "react";
2
- import { TooltipIconButtonProps } from "./base/tooltip-icon-button";
2
+ import { TooltipIconButton } from "./base/tooltip-icon-button";
3
3
  declare const AssistantActionBar: FC;
4
4
  declare const exports: {
5
5
  Root: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -7,15 +7,15 @@ declare const exports: {
7
7
  } & {
8
8
  asChild?: boolean;
9
9
  }, "ref"> & import("../primitives/actionBar/useActionBarFloatStatus").UseActionBarFloatStatusProps & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
10
- Reload: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & import("react").RefAttributes<HTMLButtonElement>>;
11
- Copy: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & {
10
+ Reload: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
11
+ Copy: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & {
12
12
  copiedDuration?: number | undefined;
13
13
  } & import("react").RefAttributes<HTMLButtonElement>>;
14
- Speak: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & import("react").RefAttributes<HTMLButtonElement>>;
15
- StopSpeaking: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & import("react").RefAttributes<HTMLButtonElement>>;
14
+ Speak: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
15
+ StopSpeaking: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
16
16
  SpeechControl: FC;
17
- FeedbackPositive: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & import("react").RefAttributes<HTMLButtonElement>>;
18
- FeedbackNegative: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & import("react").RefAttributes<HTMLButtonElement>>;
17
+ FeedbackPositive: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
18
+ FeedbackNegative: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
19
19
  };
20
20
  declare const _default: typeof AssistantActionBar & typeof exports;
21
21
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-action-bar.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-action-bar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAW5C,OAAO,EAEL,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAqCpC,QAAA,MAAM,kBAAkB,EAAE,EA4BzB,CAAC;AAgNF,QAAA,MAAM,OAAO;;;;;;;;yBAnMQ,MAAM,GAAG,SAAS;;;;;;;CA4MtC,CAAC;wBAKG,OAAO,kBAAkB,GAAG,OAAO,OAAO;AAH/C,wBAGgD"}
1
+ {"version":3,"file":"assistant-action-bar.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-action-bar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAW5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAqC/D,QAAA,MAAM,kBAAkB,EAAE,EA4BzB,CAAC;AAgNF,QAAA,MAAM,OAAO;;;;;;;;yBAnMQ,MAAM,GAAG,SAAS;;;;;;;CA4MtC,CAAC;wBAKG,OAAO,kBAAkB,GAAG,OAAO,OAAO;AAH/C,wBAGgD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/assistant-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport {\n AudioLinesIcon,\n CheckIcon,\n CopyIcon,\n RefreshCwIcon,\n StopCircleIcon,\n ThumbsDownIcon,\n ThumbsUpIcon,\n} from \"lucide-react\";\nimport { ActionBarPrimitive, MessagePrimitive } from \"../primitives\";\nimport {\n TooltipIconButton,\n TooltipIconButtonProps,\n} from \"./base/tooltip-icon-button\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { useThread } from \"../context\";\n\nconst useAllowCopy = (ensureCapability = false) => {\n const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();\n const copySupported = useThread((t) => t.capabilities.unstable_copy);\n return allowCopy && (!ensureCapability || copySupported);\n};\n\nconst useAllowSpeak = (ensureCapability = false) => {\n const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();\n const speechSupported = useThread((t) => t.capabilities.speech);\n return allowSpeak && (!ensureCapability || speechSupported);\n};\n\nconst useAllowReload = (ensureCapability = false) => {\n const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();\n const reloadSupported = useThread((t) => t.capabilities.reload);\n return allowReload && (!ensureCapability || reloadSupported);\n};\n\nconst useAllowFeedbackPositive = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackPositive = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackPositive && (!ensureCapability || feedbackSupported);\n};\n\nconst useAllowFeedbackNegative = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackNegative = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackNegative && (!ensureCapability || feedbackSupported);\n};\n\nconst AssistantActionBar: FC = () => {\n const allowCopy = useAllowCopy(true);\n const allowReload = useAllowReload(true);\n const allowSpeak = useAllowSpeak(true);\n const allowFeedbackPositive = useAllowFeedbackPositive(true);\n const allowFeedbackNegative = useAllowFeedbackNegative(true);\n if (\n !allowCopy &&\n !allowReload &&\n !allowSpeak &&\n !allowFeedbackPositive &&\n !allowFeedbackNegative\n )\n return null;\n\n return (\n <AssistantActionBarRoot\n hideWhenRunning\n autohide=\"not-last\"\n autohideFloat=\"single-branch\"\n >\n {allowSpeak && <AssistantActionBarSpeechControl />}\n {allowCopy && <AssistantActionBarCopy />}\n {allowReload && <AssistantActionBarReload />}\n {allowFeedbackPositive && <AssistantActionBarFeedbackPositive />}\n {allowFeedbackNegative && <AssistantActionBarFeedbackNegative />}\n </AssistantActionBarRoot>\n );\n};\n\nAssistantActionBar.displayName = \"AssistantActionBar\";\n\nconst AssistantActionBarRoot = withDefaults(ActionBarPrimitive.Root, {\n className: \"aui-assistant-action-bar-root\",\n});\n\nAssistantActionBarRoot.displayName = \"AssistantActionBarRoot\";\n\nnamespace AssistantActionBarCopy {\n export type Element = ActionBarPrimitive.Copy.Element;\n export type Props = Partial<TooltipIconButtonProps> & {\n copiedDuration?: number | undefined;\n };\n}\n\nconst AssistantActionBarCopy = forwardRef<\n AssistantActionBarCopy.Element,\n AssistantActionBarCopy.Props\n>(({ copiedDuration, ...props }, ref) => {\n const {\n strings: {\n assistantMessage: { copy: { tooltip = \"Copy\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <ActionBarPrimitive.Copy copiedDuration={copiedDuration} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? (\n <>\n <MessagePrimitive.If copied>\n <CheckIcon />\n </MessagePrimitive.If>\n <MessagePrimitive.If copied={false}>\n <CopyIcon />\n </MessagePrimitive.If>\n </>\n )}\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n );\n});\n\nAssistantActionBarCopy.displayName = \"AssistantActionBarCopy\";\n\nconst AssistantActionBarSpeechControl: FC = () => {\n return (\n <>\n <MessagePrimitive.If speaking={false}>\n <AssistantActionBarSpeak />\n </MessagePrimitive.If>\n <MessagePrimitive.If speaking>\n <AssistantActionBarStopSpeaking />\n </MessagePrimitive.If>\n </>\n );\n};\n\nnamespace AssistantActionBarSpeak {\n export type Element = ActionBarPrimitive.Speak.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarSpeak = forwardRef<\n AssistantActionBarSpeak.Element,\n AssistantActionBarSpeak.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { speak: { tooltip = \"Read aloud\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.Speak disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <AudioLinesIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Speak>\n );\n});\n\nAssistantActionBarSpeak.displayName = \"AssistantActionBarSpeak\";\n\nnamespace AssistantActionBarStopSpeaking {\n export type Element = ActionBarPrimitive.StopSpeaking.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarStopSpeaking = forwardRef<\n AssistantActionBarStopSpeaking.Element,\n AssistantActionBarStopSpeaking.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n speak: { stop: { tooltip: stopTooltip = \"Stop\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.StopSpeaking disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={stopTooltip} {...props} ref={ref}>\n {props.children ?? <StopCircleIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.StopSpeaking>\n );\n});\n\nAssistantActionBarStopSpeaking.displayName = \"AssistantActionBarStopSpeaking\";\n\nnamespace AssistantActionBarReload {\n export type Element = ActionBarPrimitive.Reload.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarReload = forwardRef<\n AssistantActionBarReload.Element,\n AssistantActionBarReload.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { reload: { tooltip = \"Refresh\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowReload = useAllowReload();\n return (\n <ActionBarPrimitive.Reload disabled={!allowReload} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <RefreshCwIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n});\n\nAssistantActionBarReload.displayName = \"AssistantActionBarReload\";\n\nnamespace AssistantActionBarFeedbackPositive {\n export type Element = ActionBarPrimitive.FeedbackPositive.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarFeedbackPositive = forwardRef<\n AssistantActionBarFeedbackPositive.Element,\n AssistantActionBarFeedbackPositive.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { positive: { tooltip = \"Good response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackPositive = useAllowFeedbackPositive();\n return (\n <ActionBarPrimitive.FeedbackPositive\n disabled={!allowFeedbackPositive}\n className=\"aui-assistant-action-bar-feedback-positive\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsUpIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackPositive>\n );\n});\n\nAssistantActionBarFeedbackPositive.displayName =\n \"AssistantActionBarFeedbackPositive\";\n\nnamespace AssistantActionBarFeedbackNegative {\n export type Element = ActionBarPrimitive.FeedbackNegative.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarFeedbackNegative = forwardRef<\n AssistantActionBarFeedbackNegative.Element,\n AssistantActionBarFeedbackNegative.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { negative: { tooltip = \"Bad response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackNegative = useAllowFeedbackNegative();\n return (\n <ActionBarPrimitive.FeedbackNegative\n disabled={!allowFeedbackNegative}\n className=\"aui-assistant-action-bar-feedback-negative\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsDownIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackNegative>\n );\n});\n\nAssistantActionBarFeedbackNegative.displayName =\n \"AssistantActionBarFeedbackNegative\";\n\nconst exports = {\n Root: AssistantActionBarRoot,\n Reload: AssistantActionBarReload,\n Copy: AssistantActionBarCopy,\n Speak: AssistantActionBarSpeak,\n StopSpeaking: AssistantActionBarStopSpeaking,\n SpeechControl: AssistantActionBarSpeechControl,\n FeedbackPositive: AssistantActionBarFeedbackPositive,\n FeedbackNegative: AssistantActionBarFeedbackNegative,\n};\n\nexport default Object.assign(\n AssistantActionBar,\n exports,\n) as typeof AssistantActionBar & typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoC;AACpC,0BAQO;AACP,wBAAqD;AACrD,iCAGO;AACP,0BAA6B;AAC7B,2BAAgC;AAChC,qBAA0B;AAkDtB;AAhDJ,IAAM,eAAe,CAAC,mBAAmB,UAAU;AACjD,QAAM,EAAE,kBAAkB,EAAE,YAAY,KAAK,IAAI,CAAC,EAAE,QAAI,sCAAgB;AACxE,QAAM,oBAAgB,0BAAU,CAAC,MAAM,EAAE,aAAa,aAAa;AACnE,SAAO,cAAc,CAAC,oBAAoB;AAC5C;AAEA,IAAM,gBAAgB,CAAC,mBAAmB,UAAU;AAClD,QAAM,EAAE,kBAAkB,EAAE,aAAa,KAAK,IAAI,CAAC,EAAE,QAAI,sCAAgB;AACzE,QAAM,sBAAkB,0BAAU,CAAC,MAAM,EAAE,aAAa,MAAM;AAC9D,SAAO,eAAe,CAAC,oBAAoB;AAC7C;AAEA,IAAM,iBAAiB,CAAC,mBAAmB,UAAU;AACnD,QAAM,EAAE,kBAAkB,EAAE,cAAc,KAAK,IAAI,CAAC,EAAE,QAAI,sCAAgB;AAC1E,QAAM,sBAAkB,0BAAU,CAAC,MAAM,EAAE,aAAa,MAAM;AAC9D,SAAO,gBAAgB,CAAC,oBAAoB;AAC9C;AAEA,IAAM,2BAA2B,CAAC,mBAAmB,UAAU;AAC7D,QAAM,EAAE,kBAAkB,EAAE,wBAAwB,KAAK,IAAI,CAAC,EAAE,QAC9D,sCAAgB;AAClB,QAAM,w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AE,UAAU,eAAe,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,MAC/D,IAAI,CAAC;AAAA,IACP,IAAI,CAAC;AAAA,EACP,QAAI,sCAAgB;AACpB,QAAM,wBAAwB,yBAAyB;AACvD,SACE;AAAA,IAAC,qCAAmB;AAAA,IAAnB;AAAA,MACC,UAAU,CAAC;AAAA,MACX,WAAU;AAAA,MACV,SAAO;AAAA,MAEP,sDAAC,gDAAkB,SAAmB,GAAG,OAAO,KAC7C,gBAAM,YAAY,4CAAC,sCAAe,GACrC;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,mCAAmC,cACjC;AAEF,IAAMA,WAAU;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,kBAAkB;AACpB;AAEA,IAAO,+BAAQ,OAAO;AAAA,EACpB;AAAA,EACAA;AACF;","names":["exports"]}
1
+ {"version":3,"sources":["../../src/ui/assistant-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport {\n AudioLinesIcon,\n CheckIcon,\n CopyIcon,\n RefreshCwIcon,\n StopCircleIcon,\n ThumbsDownIcon,\n ThumbsUpIcon,\n} from \"lucide-react\";\nimport { ActionBarPrimitive, MessagePrimitive } from \"../primitives\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { useThread } from \"../context\";\n\nconst useAllowCopy = (ensureCapability = false) => {\n const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();\n const copySupported = useThread((t) => t.capabilities.unstable_copy);\n return allowCopy && (!ensureCapability || copySupported);\n};\n\nconst useAllowSpeak = (ensureCapability = false) => {\n const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();\n const speechSupported = useThread((t) => t.capabilities.speech);\n return allowSpeak && (!ensureCapability || speechSupported);\n};\n\nconst useAllowReload = (ensureCapability = false) => {\n const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();\n const reloadSupported = useThread((t) => t.capabilities.reload);\n return allowReload && (!ensureCapability || reloadSupported);\n};\n\nconst useAllowFeedbackPositive = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackPositive = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackPositive && (!ensureCapability || feedbackSupported);\n};\n\nconst useAllowFeedbackNegative = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackNegative = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackNegative && (!ensureCapability || feedbackSupported);\n};\n\nconst AssistantActionBar: FC = () => {\n const allowCopy = useAllowCopy(true);\n const allowReload = useAllowReload(true);\n const allowSpeak = useAllowSpeak(true);\n const allowFeedbackPositive = useAllowFeedbackPositive(true);\n const allowFeedbackNegative = useAllowFeedbackNegative(true);\n if (\n !allowCopy &&\n !allowReload &&\n !allowSpeak &&\n !allowFeedbackPositive &&\n !allowFeedbackNegative\n )\n return null;\n\n return (\n <AssistantActionBarRoot\n hideWhenRunning\n autohide=\"not-last\"\n autohideFloat=\"single-branch\"\n >\n {allowSpeak && <AssistantActionBarSpeechControl />}\n {allowCopy && <AssistantActionBarCopy />}\n {allowReload && <AssistantActionBarReload />}\n {allowFeedbackPositive && <AssistantActionBarFeedbackPositive />}\n {allowFeedbackNegative && <AssistantActionBarFeedbackNegative />}\n </AssistantActionBarRoot>\n );\n};\n\nAssistantActionBar.displayName = \"AssistantActionBar\";\n\nconst AssistantActionBarRoot = withDefaults(ActionBarPrimitive.Root, {\n className: \"aui-assistant-action-bar-root\",\n});\n\nAssistantActionBarRoot.displayName = \"AssistantActionBarRoot\";\n\nnamespace AssistantActionBarCopy {\n export type Element = ActionBarPrimitive.Copy.Element;\n export type Props = Partial<TooltipIconButton.Props> & {\n copiedDuration?: number | undefined;\n };\n}\n\nconst AssistantActionBarCopy = forwardRef<\n AssistantActionBarCopy.Element,\n AssistantActionBarCopy.Props\n>(({ copiedDuration, ...props }, ref) => {\n const {\n strings: {\n assistantMessage: { copy: { tooltip = \"Copy\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <ActionBarPrimitive.Copy copiedDuration={copiedDuration} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? (\n <>\n <MessagePrimitive.If copied>\n <CheckIcon />\n </MessagePrimitive.If>\n <MessagePrimitive.If copied={false}>\n <CopyIcon />\n </MessagePrimitive.If>\n </>\n )}\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n );\n});\n\nAssistantActionBarCopy.displayName = \"AssistantActionBarCopy\";\n\nconst AssistantActionBarSpeechControl: FC = () => {\n return (\n <>\n <MessagePrimitive.If speaking={false}>\n <AssistantActionBarSpeak />\n </MessagePrimitive.If>\n <MessagePrimitive.If speaking>\n <AssistantActionBarStopSpeaking />\n </MessagePrimitive.If>\n </>\n );\n};\n\nnamespace AssistantActionBarSpeak {\n export type Element = ActionBarPrimitive.Speak.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarSpeak = forwardRef<\n AssistantActionBarSpeak.Element,\n AssistantActionBarSpeak.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { speak: { tooltip = \"Read aloud\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.Speak disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <AudioLinesIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Speak>\n );\n});\n\nAssistantActionBarSpeak.displayName = \"AssistantActionBarSpeak\";\n\nnamespace AssistantActionBarStopSpeaking {\n export type Element = ActionBarPrimitive.StopSpeaking.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarStopSpeaking = forwardRef<\n AssistantActionBarStopSpeaking.Element,\n AssistantActionBarStopSpeaking.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n speak: { stop: { tooltip: stopTooltip = \"Stop\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.StopSpeaking disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={stopTooltip} {...props} ref={ref}>\n {props.children ?? <StopCircleIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.StopSpeaking>\n );\n});\n\nAssistantActionBarStopSpeaking.displayName = \"AssistantActionBarStopSpeaking\";\n\nnamespace AssistantActionBarReload {\n export type Element = ActionBarPrimitive.Reload.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarReload = forwardRef<\n AssistantActionBarReload.Element,\n AssistantActionBarReload.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { reload: { tooltip = \"Refresh\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowReload = useAllowReload();\n return (\n <ActionBarPrimitive.Reload disabled={!allowReload} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <RefreshCwIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n});\n\nAssistantActionBarReload.displayName = \"AssistantActionBarReload\";\n\nnamespace AssistantActionBarFeedbackPositive {\n export type Element = ActionBarPrimitive.FeedbackPositive.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarFeedbackPositive = forwardRef<\n AssistantActionBarFeedbackPositive.Element,\n AssistantActionBarFeedbackPositive.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { positive: { tooltip = \"Good response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackPositive = useAllowFeedbackPositive();\n return (\n <ActionBarPrimitive.FeedbackPositive\n disabled={!allowFeedbackPositive}\n className=\"aui-assistant-action-bar-feedback-positive\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsUpIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackPositive>\n );\n});\n\nAssistantActionBarFeedbackPositive.displayName =\n \"AssistantActionBarFeedbackPositive\";\n\nnamespace AssistantActionBarFeedbackNegative {\n export type Element = ActionBarPrimitive.FeedbackNegative.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarFeedbackNegative = forwardRef<\n AssistantActionBarFeedbackNegative.Element,\n AssistantActionBarFeedbackNegative.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { negative: { tooltip = \"Bad response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackNegative = useAllowFeedbackNegative();\n return (\n <ActionBarPrimitive.FeedbackNegative\n disabled={!allowFeedbackNegative}\n className=\"aui-assistant-action-bar-feedback-negative\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsDownIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackNegative>\n );\n});\n\nAssistantActionBarFeedbackNegative.displayName =\n \"AssistantActionBarFeedbackNegative\";\n\nconst exports = {\n Root: AssistantActionBarRoot,\n Reload: AssistantActionBarReload,\n Copy: AssistantActionBarCopy,\n Speak: AssistantActionBarSpeak,\n StopSpeaking: AssistantActionBarStopSpeaking,\n SpeechControl: AssistantActionBarSpeechControl,\n FeedbackPositive: AssistantActionBarFeedbackPositive,\n FeedbackNegative: AssistantActionBarFeedbackNegative,\n};\n\nexport default Object.assign(\n AssistantActionBar,\n exports,\n) as typeof AssistantActionBar & typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoC;AACpC,0BAQO;AACP,wBAAqD;AACrD,i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C;AAEF,IAAMA,WAAU;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,kBAAkB;AACpB;AAEA,IAAO,+BAAQ,OAAO;AAAA,EACpB;AAAA,EACAA;AACF;","names":["exports"]}
@@ -12,9 +12,7 @@ import {
12
12
  ThumbsUpIcon
13
13
  } from "lucide-react";
14
14
  import { ActionBarPrimitive, MessagePrimitive } from "../primitives/index.mjs";
15
- import {
16
- TooltipIconButton
17
- } from "./base/tooltip-icon-button.mjs";
15
+ import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
18
16
  import { withDefaults } from "./utils/withDefaults.mjs";
19
17
  import { useThreadConfig } from "./thread-config.mjs";
20
18
  import { useThread } from "../context/index.mjs";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/assistant-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport {\n AudioLinesIcon,\n CheckIcon,\n CopyIcon,\n RefreshCwIcon,\n StopCircleIcon,\n ThumbsDownIcon,\n ThumbsUpIcon,\n} from \"lucide-react\";\nimport { ActionBarPrimitive, MessagePrimitive } from \"../primitives\";\nimport {\n TooltipIconButton,\n TooltipIconButtonProps,\n} from \"./base/tooltip-icon-button\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { useThread } from \"../context\";\n\nconst useAllowCopy = (ensureCapability = false) => {\n const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();\n const copySupported = useThread((t) => t.capabilities.unstable_copy);\n return allowCopy && (!ensureCapability || copySupported);\n};\n\nconst useAllowSpeak = (ensureCapability = false) => {\n const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();\n const speechSupported = useThread((t) => t.capabilities.speech);\n return allowSpeak && (!ensureCapability || speechSupported);\n};\n\nconst useAllowReload = (ensureCapability = false) => {\n const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();\n const reloadSupported = useThread((t) => t.capabilities.reload);\n return allowReload && (!ensureCapability || reloadSupported);\n};\n\nconst useAllowFeedbackPositive = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackPositive = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackPositive && (!ensureCapability || feedbackSupported);\n};\n\nconst useAllowFeedbackNegative = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackNegative = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackNegative && (!ensureCapability || feedbackSupported);\n};\n\nconst AssistantActionBar: FC = () => {\n const allowCopy = useAllowCopy(true);\n const allowReload = useAllowReload(true);\n const allowSpeak = useAllowSpeak(true);\n const allowFeedbackPositive = useAllowFeedbackPositive(true);\n const allowFeedbackNegative = useAllowFeedbackNegative(true);\n if (\n !allowCopy &&\n !allowReload &&\n !allowSpeak &&\n !allowFeedbackPositive &&\n !allowFeedbackNegative\n )\n return null;\n\n return (\n <AssistantActionBarRoot\n hideWhenRunning\n autohide=\"not-last\"\n autohideFloat=\"single-branch\"\n >\n {allowSpeak && <AssistantActionBarSpeechControl />}\n {allowCopy && <AssistantActionBarCopy />}\n {allowReload && <AssistantActionBarReload />}\n {allowFeedbackPositive && <AssistantActionBarFeedbackPositive />}\n {allowFeedbackNegative && <AssistantActionBarFeedbackNegative />}\n </AssistantActionBarRoot>\n );\n};\n\nAssistantActionBar.displayName = \"AssistantActionBar\";\n\nconst AssistantActionBarRoot = withDefaults(ActionBarPrimitive.Root, {\n className: \"aui-assistant-action-bar-root\",\n});\n\nAssistantActionBarRoot.displayName = \"AssistantActionBarRoot\";\n\nnamespace AssistantActionBarCopy {\n export type Element = ActionBarPrimitive.Copy.Element;\n export type Props = Partial<TooltipIconButtonProps> & {\n copiedDuration?: number | undefined;\n };\n}\n\nconst AssistantActionBarCopy = forwardRef<\n AssistantActionBarCopy.Element,\n AssistantActionBarCopy.Props\n>(({ copiedDuration, ...props }, ref) => {\n const {\n strings: {\n assistantMessage: { copy: { tooltip = \"Copy\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <ActionBarPrimitive.Copy copiedDuration={copiedDuration} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? (\n <>\n <MessagePrimitive.If copied>\n <CheckIcon />\n </MessagePrimitive.If>\n <MessagePrimitive.If copied={false}>\n <CopyIcon />\n </MessagePrimitive.If>\n </>\n )}\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n );\n});\n\nAssistantActionBarCopy.displayName = \"AssistantActionBarCopy\";\n\nconst AssistantActionBarSpeechControl: FC = () => {\n return (\n <>\n <MessagePrimitive.If speaking={false}>\n <AssistantActionBarSpeak />\n </MessagePrimitive.If>\n <MessagePrimitive.If speaking>\n <AssistantActionBarStopSpeaking />\n </MessagePrimitive.If>\n </>\n );\n};\n\nnamespace AssistantActionBarSpeak {\n export type Element = ActionBarPrimitive.Speak.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarSpeak = forwardRef<\n AssistantActionBarSpeak.Element,\n AssistantActionBarSpeak.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { speak: { tooltip = \"Read aloud\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.Speak disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <AudioLinesIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Speak>\n );\n});\n\nAssistantActionBarSpeak.displayName = \"AssistantActionBarSpeak\";\n\nnamespace AssistantActionBarStopSpeaking {\n export type Element = ActionBarPrimitive.StopSpeaking.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarStopSpeaking = forwardRef<\n AssistantActionBarStopSpeaking.Element,\n AssistantActionBarStopSpeaking.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n speak: { stop: { tooltip: stopTooltip = \"Stop\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.StopSpeaking disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={stopTooltip} {...props} ref={ref}>\n {props.children ?? <StopCircleIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.StopSpeaking>\n );\n});\n\nAssistantActionBarStopSpeaking.displayName = \"AssistantActionBarStopSpeaking\";\n\nnamespace AssistantActionBarReload {\n export type Element = ActionBarPrimitive.Reload.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarReload = forwardRef<\n AssistantActionBarReload.Element,\n AssistantActionBarReload.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { reload: { tooltip = \"Refresh\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowReload = useAllowReload();\n return (\n <ActionBarPrimitive.Reload disabled={!allowReload} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <RefreshCwIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n});\n\nAssistantActionBarReload.displayName = \"AssistantActionBarReload\";\n\nnamespace AssistantActionBarFeedbackPositive {\n export type Element = ActionBarPrimitive.FeedbackPositive.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarFeedbackPositive = forwardRef<\n AssistantActionBarFeedbackPositive.Element,\n AssistantActionBarFeedbackPositive.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { positive: { tooltip = \"Good response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackPositive = useAllowFeedbackPositive();\n return (\n <ActionBarPrimitive.FeedbackPositive\n disabled={!allowFeedbackPositive}\n className=\"aui-assistant-action-bar-feedback-positive\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsUpIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackPositive>\n );\n});\n\nAssistantActionBarFeedbackPositive.displayName =\n \"AssistantActionBarFeedbackPositive\";\n\nnamespace AssistantActionBarFeedbackNegative {\n export type Element = ActionBarPrimitive.FeedbackNegative.Element;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantActionBarFeedbackNegative = forwardRef<\n AssistantActionBarFeedbackNegative.Element,\n AssistantActionBarFeedbackNegative.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { negative: { tooltip = \"Bad response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackNegative = useAllowFeedbackNegative();\n return (\n <ActionBarPrimitive.FeedbackNegative\n disabled={!allowFeedbackNegative}\n className=\"aui-assistant-action-bar-feedback-negative\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsDownIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackNegative>\n );\n});\n\nAssistantActionBarFeedbackNegative.displayName =\n \"AssistantActionBarFeedbackNegative\";\n\nconst exports = {\n Root: AssistantActionBarRoot,\n Reload: AssistantActionBarReload,\n Copy: AssistantActionBarCopy,\n Speak: AssistantActionBarSpeak,\n StopSpeaking: AssistantActionBarStopSpeaking,\n SpeechControl: AssistantActionBarSpeechControl,\n FeedbackPositive: AssistantActionBarFeedbackPositive,\n FeedbackNegative: AssistantActionBarFeedbackNegative,\n};\n\nexport default Object.assign(\n AssistantActionBar,\n exports,\n) as typeof AssistantActionBar & typeof exports;\n"],"mappings":";;;AAEA,SAAS,kBAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB,wBAAwB;AACrD;A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EACF;AAEJ,CAAC;AAED,mCAAmC,cACjC;AAEF,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,kBAAkB;AACpB;AAEA,IAAO,+BAAQ,OAAO;AAAA,EACpB;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/ui/assistant-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type FC } from \"react\";\nimport {\n AudioLinesIcon,\n CheckIcon,\n CopyIcon,\n RefreshCwIcon,\n StopCircleIcon,\n ThumbsDownIcon,\n ThumbsUpIcon,\n} from \"lucide-react\";\nimport { ActionBarPrimitive, MessagePrimitive } from \"../primitives\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { useThread } from \"../context\";\n\nconst useAllowCopy = (ensureCapability = false) => {\n const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();\n const copySupported = useThread((t) => t.capabilities.unstable_copy);\n return allowCopy && (!ensureCapability || copySupported);\n};\n\nconst useAllowSpeak = (ensureCapability = false) => {\n const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();\n const speechSupported = useThread((t) => t.capabilities.speech);\n return allowSpeak && (!ensureCapability || speechSupported);\n};\n\nconst useAllowReload = (ensureCapability = false) => {\n const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();\n const reloadSupported = useThread((t) => t.capabilities.reload);\n return allowReload && (!ensureCapability || reloadSupported);\n};\n\nconst useAllowFeedbackPositive = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackPositive = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackPositive && (!ensureCapability || feedbackSupported);\n};\n\nconst useAllowFeedbackNegative = (ensureCapability = false) => {\n const { assistantMessage: { allowFeedbackNegative = true } = {} } =\n useThreadConfig();\n const feedbackSupported = useThread((t) => t.capabilities.feedback);\n return allowFeedbackNegative && (!ensureCapability || feedbackSupported);\n};\n\nconst AssistantActionBar: FC = () => {\n const allowCopy = useAllowCopy(true);\n const allowReload = useAllowReload(true);\n const allowSpeak = useAllowSpeak(true);\n const allowFeedbackPositive = useAllowFeedbackPositive(true);\n const allowFeedbackNegative = useAllowFeedbackNegative(true);\n if (\n !allowCopy &&\n !allowReload &&\n !allowSpeak &&\n !allowFeedbackPositive &&\n !allowFeedbackNegative\n )\n return null;\n\n return (\n <AssistantActionBarRoot\n hideWhenRunning\n autohide=\"not-last\"\n autohideFloat=\"single-branch\"\n >\n {allowSpeak && <AssistantActionBarSpeechControl />}\n {allowCopy && <AssistantActionBarCopy />}\n {allowReload && <AssistantActionBarReload />}\n {allowFeedbackPositive && <AssistantActionBarFeedbackPositive />}\n {allowFeedbackNegative && <AssistantActionBarFeedbackNegative />}\n </AssistantActionBarRoot>\n );\n};\n\nAssistantActionBar.displayName = \"AssistantActionBar\";\n\nconst AssistantActionBarRoot = withDefaults(ActionBarPrimitive.Root, {\n className: \"aui-assistant-action-bar-root\",\n});\n\nAssistantActionBarRoot.displayName = \"AssistantActionBarRoot\";\n\nnamespace AssistantActionBarCopy {\n export type Element = ActionBarPrimitive.Copy.Element;\n export type Props = Partial<TooltipIconButton.Props> & {\n copiedDuration?: number | undefined;\n };\n}\n\nconst AssistantActionBarCopy = forwardRef<\n AssistantActionBarCopy.Element,\n AssistantActionBarCopy.Props\n>(({ copiedDuration, ...props }, ref) => {\n const {\n strings: {\n assistantMessage: { copy: { tooltip = \"Copy\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <ActionBarPrimitive.Copy copiedDuration={copiedDuration} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? (\n <>\n <MessagePrimitive.If copied>\n <CheckIcon />\n </MessagePrimitive.If>\n <MessagePrimitive.If copied={false}>\n <CopyIcon />\n </MessagePrimitive.If>\n </>\n )}\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n );\n});\n\nAssistantActionBarCopy.displayName = \"AssistantActionBarCopy\";\n\nconst AssistantActionBarSpeechControl: FC = () => {\n return (\n <>\n <MessagePrimitive.If speaking={false}>\n <AssistantActionBarSpeak />\n </MessagePrimitive.If>\n <MessagePrimitive.If speaking>\n <AssistantActionBarStopSpeaking />\n </MessagePrimitive.If>\n </>\n );\n};\n\nnamespace AssistantActionBarSpeak {\n export type Element = ActionBarPrimitive.Speak.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarSpeak = forwardRef<\n AssistantActionBarSpeak.Element,\n AssistantActionBarSpeak.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { speak: { tooltip = \"Read aloud\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.Speak disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <AudioLinesIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Speak>\n );\n});\n\nAssistantActionBarSpeak.displayName = \"AssistantActionBarSpeak\";\n\nnamespace AssistantActionBarStopSpeaking {\n export type Element = ActionBarPrimitive.StopSpeaking.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarStopSpeaking = forwardRef<\n AssistantActionBarStopSpeaking.Element,\n AssistantActionBarStopSpeaking.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n speak: { stop: { tooltip: stopTooltip = \"Stop\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowSpeak = useAllowSpeak();\n\n return (\n <ActionBarPrimitive.StopSpeaking disabled={!allowSpeak} asChild>\n <TooltipIconButton tooltip={stopTooltip} {...props} ref={ref}>\n {props.children ?? <StopCircleIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.StopSpeaking>\n );\n});\n\nAssistantActionBarStopSpeaking.displayName = \"AssistantActionBarStopSpeaking\";\n\nnamespace AssistantActionBarReload {\n export type Element = ActionBarPrimitive.Reload.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarReload = forwardRef<\n AssistantActionBarReload.Element,\n AssistantActionBarReload.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: { reload: { tooltip = \"Refresh\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n const allowReload = useAllowReload();\n return (\n <ActionBarPrimitive.Reload disabled={!allowReload} asChild>\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <RefreshCwIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n});\n\nAssistantActionBarReload.displayName = \"AssistantActionBarReload\";\n\nnamespace AssistantActionBarFeedbackPositive {\n export type Element = ActionBarPrimitive.FeedbackPositive.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarFeedbackPositive = forwardRef<\n AssistantActionBarFeedbackPositive.Element,\n AssistantActionBarFeedbackPositive.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { positive: { tooltip = \"Good response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackPositive = useAllowFeedbackPositive();\n return (\n <ActionBarPrimitive.FeedbackPositive\n disabled={!allowFeedbackPositive}\n className=\"aui-assistant-action-bar-feedback-positive\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsUpIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackPositive>\n );\n});\n\nAssistantActionBarFeedbackPositive.displayName =\n \"AssistantActionBarFeedbackPositive\";\n\nnamespace AssistantActionBarFeedbackNegative {\n export type Element = ActionBarPrimitive.FeedbackNegative.Element;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantActionBarFeedbackNegative = forwardRef<\n AssistantActionBarFeedbackNegative.Element,\n AssistantActionBarFeedbackNegative.Props\n>((props, ref) => {\n const {\n strings: {\n assistantMessage: {\n feedback: { negative: { tooltip = \"Bad response\" } = {} } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const allowFeedbackNegative = useAllowFeedbackNegative();\n return (\n <ActionBarPrimitive.FeedbackNegative\n disabled={!allowFeedbackNegative}\n className=\"aui-assistant-action-bar-feedback-negative\"\n asChild\n >\n <TooltipIconButton tooltip={tooltip} {...props} ref={ref}>\n {props.children ?? <ThumbsDownIcon />}\n </TooltipIconButton>\n </ActionBarPrimitive.FeedbackNegative>\n );\n});\n\nAssistantActionBarFeedbackNegative.displayName =\n \"AssistantActionBarFeedbackNegative\";\n\nconst exports = {\n Root: AssistantActionBarRoot,\n Reload: AssistantActionBarReload,\n Copy: AssistantActionBarCopy,\n Speak: AssistantActionBarSpeak,\n StopSpeaking: AssistantActionBarStopSpeaking,\n SpeechControl: AssistantActionBarSpeechControl,\n FeedbackPositive: AssistantActionBarFeedbackPositive,\n FeedbackNegative: AssistantActionBarFeedbackNegative,\n};\n\nexport default Object.assign(\n AssistantActionBar,\n exports,\n) as typeof AssistantActionBar & typeof exports;\n"],"mappings":";;;AAEA,SAAS,kBAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB,wBAAwB;AACrD,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAkDtB,SA2CM,UAtCW,KALjB;AAhDJ,IAAM,eAAe,CAAC,mBAAmB,UAAU;AACjD,QAAM,EAAE,kBAAkB,EAAE,YAAY,KAAK,IAAI,CAAC,EAAE,IAAI,gBAAgB;AACxE,QAAM,gBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,aAAa;AACnE,SAAO,cAAc,CAAC,oBA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ssistantModalPrimitive } from "../primitives";
3
- import { TooltipIconButtonProps } from "./base/tooltip-icon-button";
3
+ import { TooltipIconButton } from "./base/tooltip-icon-button";
4
4
  import { ThreadConfig, ThreadConfigProviderProps } from "./thread-config";
5
5
  declare const AssistantModal: FC<ThreadConfig>;
6
6
  declare namespace AssistantModalRoot {
@@ -9,11 +9,11 @@ declare namespace AssistantModalRoot {
9
9
  declare const AssistantModalRoot: FC<AssistantModalRoot.Props>;
10
10
  declare const exports: {
11
11
  Root: FC<AssistantModalRoot.Props>;
12
- Trigger: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & import("react").RefAttributes<HTMLButtonElement>>;
12
+ Trigger: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
13
13
  Content: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<import("@radix-ui/react-popover").PopoverContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
14
14
  dissmissOnInteractOutside?: boolean | undefined;
15
15
  } & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
16
- Button: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & {
16
+ Button: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & {
17
17
  "data-state"?: "open" | "closed";
18
18
  } & import("react").RefAttributes<HTMLButtonElement>>;
19
19
  Anchor: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<import("@radix-ui/react-popover").PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-modal.d.ts","sourceRoot":"","sources":["../../src/ui/assistant-modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAc,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,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["../../src/ui/assistant-modal.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, forwardRef } from \"react\";\nimport { BotIcon, ChevronDownIcon } from \"lucide-react\";\n\nimport { AssistantModalPrimitive } from \"../primitives\";\nimport Thread from \"./thread\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport {\n TooltipIconButton,\n TooltipIconButtonProps,\n} from \"./base/tooltip-icon-button\";\nimport {\n ThreadConfig,\n ThreadConfigProvider,\n ThreadConfigProviderProps,\n useThreadConfig,\n} from \"./thread-config\";\n\nconst AssistantModal: FC<ThreadConfig> = (config) => {\n return (\n <AssistantModalRoot config={config}>\n <AssistantModalTrigger />\n <AssistantModalContent>\n <Thread />\n </AssistantModalContent>\n </AssistantModalRoot>\n );\n};\n\nAssistantModal.displayName = \"AssistantModal\";\n\nnamespace AssistantModalRoot {\n export type Props = AssistantModalPrimitive.Root.Props &\n ThreadConfigProviderProps;\n}\n\nconst AssistantModalRoot: FC<AssistantModalRoot.Props> = ({\n config,\n ...props\n}) => {\n return (\n <ThreadConfigProvider config={config}>\n <AssistantModalPrimitive.Root {...props} />\n </ThreadConfigProvider>\n );\n};\n\nAssistantModalRoot.displayName = \"AssistantModalRoot\";\n\nnamespace AssistantModalTrigger {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantModalTrigger = forwardRef<\n AssistantModalTrigger.Element,\n AssistantModalTrigger.Props\n>((props, ref) => {\n return (\n <AssistantModalAnchor>\n <AssistantModalPrimitive.Trigger asChild>\n <AssistantModalButton {...props} ref={ref} />\n </AssistantModalPrimitive.Trigger>\n </AssistantModalAnchor>\n );\n});\n\nAssistantModalTrigger.displayName = \"AssistantModalTrigger\";\n\nconst AssistantModalAnchor = withDefaults(AssistantModalPrimitive.Anchor, {\n className: \"aui-root aui-modal-anchor\",\n});\n\nAssistantModalAnchor.displayName = \"AssistantModalAnchor\";\n\nconst ModalButtonStyled = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-modal-button\",\n});\n\nnamespace AssistantModalButton {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButtonProps> & {\n \"data-state\"?: \"open\" | \"closed\";\n };\n}\n\nconst AssistantModalButton = forwardRef<\n AssistantModalButton.Element,\n AssistantModalButton.Props\n>(({ \"data-state\": state, ...rest }, ref) => {\n const {\n strings: {\n assistantModal: {\n open: {\n button: { tooltip: openTooltip = \"Close Assistant\" } = {},\n } = {},\n closed: {\n button: { tooltip: closedTooltip = \"Open Assistant\" } = {},\n } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const tooltip = state === \"open\" ? openTooltip : closedTooltip;\n\n return (\n <ModalButtonStyled\n side=\"left\"\n tooltip={tooltip}\n data-state={state}\n {...rest}\n ref={ref}\n >\n {rest.children ?? (\n <>\n <BotIcon\n data-state={state}\n className=\"aui-modal-button-closed-icon\"\n />\n <ChevronDownIcon\n data-state={state}\n className=\"aui-modal-button-open-icon\"\n />\n </>\n )}\n </ModalButtonStyled>\n );\n});\n\nAssistantModalButton.displayName = \"AssistantModalButton\";\n\nconst AssistantModalContent = withDefaults(AssistantModalPrimitive.Content, {\n className: \"aui-root aui-modal-content\",\n sideOffset: 16,\n});\n\nAssistantModalContent.displayName = \"AssistantModalContent\";\n\nconst exports = {\n Root: AssistantModalRoot,\n Trigger: AssistantModalTrigger,\n Content: AssistantModalContent,\n Button: AssistantModalButton,\n Anchor: AssistantModalAnchor,\n};\n\nexport default Object.assign(AssistantModal, exports) as typeof AssistantModal &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoC;AACpC,0BAAyC;AAEzC,wBAAwC;AACxC,oBAAmB;AACnB,0BAA6B;AAC7B,iCAGO;AACP,2BAKO;AAIH;AAFJ,IAAM,iBAAmC,CAAC,WAAW;AACnD,SACE,6CAAC,sBAAmB,QAClB;AAAA,gDAAC,yBAAsB;AAAA,IACvB,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cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,4BAAwB,kCAAa,0CAAwB,SAAS;AAAA,EAC1E,WAAW;AAAA,EACX,YAAY;AACd,CAAC;AAED,sBAAsB,cAAc;AAEpC,IAAMC,WAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAEA,IAAO,0BAAQ,OAAO,OAAO,gBAAgBA,QAAO;","names":["Thread","exports"]}
1
+ {"version":3,"sources":["../../src/ui/assistant-modal.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, forwardRef } from \"react\";\nimport { BotIcon, ChevronDownIcon } from \"lucide-react\";\n\nimport { AssistantModalPrimitive } from \"../primitives\";\nimport Thread from \"./thread\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport {\n ThreadConfig,\n ThreadConfigProvider,\n ThreadConfigProviderProps,\n useThreadConfig,\n} from \"./thread-config\";\n\nconst AssistantModal: FC<ThreadConfig> = (config) => {\n return (\n <AssistantModalRoot config={config}>\n <AssistantModalTrigger />\n <AssistantModalContent>\n <Thread />\n </AssistantModalContent>\n </AssistantModalRoot>\n );\n};\n\nAssistantModal.displayName = \"AssistantModal\";\n\nnamespace AssistantModalRoot {\n export type Props = AssistantModalPrimitive.Root.Props &\n ThreadConfigProviderProps;\n}\n\nconst AssistantModalRoot: FC<AssistantModalRoot.Props> = ({\n config,\n ...props\n}) => {\n return (\n <ThreadConfigProvider config={config}>\n <AssistantModalPrimitive.Root {...props} />\n </ThreadConfigProvider>\n );\n};\n\nAssistantModalRoot.displayName = \"AssistantModalRoot\";\n\nnamespace AssistantModalTrigger {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantModalTrigger = forwardRef<\n AssistantModalTrigger.Element,\n AssistantModalTrigger.Props\n>((props, ref) => {\n return (\n <AssistantModalAnchor>\n <AssistantModalPrimitive.Trigger asChild>\n <AssistantModalButton {...props} ref={ref} />\n </AssistantModalPrimitive.Trigger>\n </AssistantModalAnchor>\n );\n});\n\nAssistantModalTrigger.displayName = \"AssistantModalTrigger\";\n\nconst AssistantModalAnchor = withDefaults(AssistantModalPrimitive.Anchor, {\n className: \"aui-root aui-modal-anchor\",\n});\n\nAssistantModalAnchor.displayName = \"AssistantModalAnchor\";\n\nconst ModalButtonStyled = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-modal-button\",\n});\n\nnamespace AssistantModalButton {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props> & {\n \"data-state\"?: \"open\" | \"closed\";\n };\n}\n\nconst AssistantModalButton = forwardRef<\n AssistantModalButton.Element,\n AssistantModalButton.Props\n>(({ \"data-state\": state, ...rest }, ref) => {\n const {\n strings: {\n assistantModal: {\n open: {\n button: { tooltip: openTooltip = \"Close Assistant\" } = {},\n } = {},\n closed: {\n button: { tooltip: closedTooltip = \"Open Assistant\" } = {},\n } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const tooltip = state === \"open\" ? openTooltip : closedTooltip;\n\n return (\n <ModalButtonStyled\n side=\"left\"\n tooltip={tooltip}\n data-state={state}\n {...rest}\n ref={ref}\n >\n {rest.children ?? (\n <>\n <BotIcon\n data-state={state}\n className=\"aui-modal-button-closed-icon\"\n />\n <ChevronDownIcon\n data-state={state}\n className=\"aui-modal-button-open-icon\"\n />\n </>\n )}\n </ModalButtonStyled>\n );\n});\n\nAssistantModalButton.displayName = \"AssistantModalButton\";\n\nconst AssistantModalContent = withDefaults(AssistantModalPrimitive.Content, {\n className: \"aui-root aui-modal-content\",\n sideOffset: 16,\n});\n\nAssistantModalContent.displayName = \"AssistantModalContent\";\n\nconst exports = {\n Root: AssistantModalRoot,\n Trigger: AssistantModalTrigger,\n Content: AssistantModalContent,\n Button: AssistantModalButton,\n Anchor: AssistantModalAnchor,\n};\n\nexport default Object.assign(AssistantModal, exports) as typeof AssistantModal &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoC;AACpC,0BAAyC;AAEzC,wBAAwC;AACxC,oBAAmB;AACnB,0BAA6B;AAC7B,iCAAkC;AAClC,2BAKO;AAIH;AAFJ,IAAM,iBAAmC,CAAC,WAAW;AACnD,SACE,6CAAC,sBAAmB,QAClB;AAAA,gDAAC,yBAAsB;AAAA,IACvB,4CAAC,yBACC,sDAAC,cAAAA,SAAA,EAAO,GACV;AAAA,KACF;AAEJ;AAEA,eAAe,cAAc;AAO7B,IAAM,qBAAmD,CAAC;AAAA,EACxD;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,4CAAC,6CAAqB,QACpB,sDAAC,0CAAwB,MAAxB,EAA8B,GAAG,OAAO,GAC3C;AAEJ;AAEA,mBAAmB,cAAc;AAOjC,IAAM,4BAAwB,yBAG5B,CAAC,OAAO,QAAQ;AAChB,SACE,4CAAC,wBACC,sDAAC,0CAAwB,SAAxB,EAAgC,SAAO,MACtC,sDAAC,wBAAsB,GAAG,OAAO,KAAU,GAC7C,GACF;AAEJ,CAAC;AAED,sBAAsB,cAAc;AAEpC,IAAM,2BAAuB,kCAAa,0CAAwB,QAAQ;AAAA,EACxE,WAAW;AACb,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,wBAAoB,kCAAa,8CAAmB;AAAA,EACxD,SAAS;AAAA,EACT,WAAW;AACb,CAAC;AASD,IAAM,2BAAuB,yBAG3B,CAAC,EAAE,cAAc,OAAO,GAAG,KAAK,GAAG,QAAQ;AAC3C,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,gBAAgB;AAAA,QACd,MAAM;AAAA,UACJ,QAAQ,EAAE,SAAS,cAAc,kBAAkB,IAAI,CAAC;AAAA,QAC1D,IAAI,CAAC;AAAA,QACL,QAAQ;AAAA,UACN,QAAQ,EAAE,SAAS,gBAAgB,iBAAiB,IAAI,CAAC;AAAA,QAC3D,IAAI,CAAC;AAAA,MACP,IAAI,CAAC;AAAA,IACP,IAAI,CAAC;AAAA,EACP,QAAI,sCAAgB;AACpB,QAAM,UAAU,UAAU,SAAS,cAAc;AAEjD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACX,GAAG;AAAA,MACJ;AAAA,MAEC,eAAK,YACJ,4EACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,4BAAwB,kCAAa,0CAAwB,SAAS;AAAA,EAC1E,WAAW;AAAA,EACX,YAAY;AACd,CAAC;AAED,sBAAsB,cAAc;AAEpC,IAAMC,WAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAEA,IAAO,0BAAQ,OAAO,OAAO,gBAAgBA,QAAO;","names":["Thread","exports"]}
@@ -6,9 +6,7 @@ import { BotIcon, ChevronDownIcon } from "lucide-react";
6
6
  import { AssistantModalPrimitive } from "../primitives/index.mjs";
7
7
  import Thread from "./thread.mjs";
8
8
  import { withDefaults } from "./utils/withDefaults.mjs";
9
- import {
10
- TooltipIconButton
11
- } from "./base/tooltip-icon-button.mjs";
9
+ import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
12
10
  import {
13
11
  ThreadConfigProvider,
14
12
  useThreadConfig
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/assistant-modal.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, forwardRef } from \"react\";\nimport { BotIcon, ChevronDownIcon } from \"lucide-react\";\n\nimport { AssistantModalPrimitive } from \"../primitives\";\nimport Thread from \"./thread\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport {\n TooltipIconButton,\n TooltipIconButtonProps,\n} from \"./base/tooltip-icon-button\";\nimport {\n ThreadConfig,\n ThreadConfigProvider,\n ThreadConfigProviderProps,\n useThreadConfig,\n} from \"./thread-config\";\n\nconst AssistantModal: FC<ThreadConfig> = (config) => {\n return (\n <AssistantModalRoot config={config}>\n <AssistantModalTrigger />\n <AssistantModalContent>\n <Thread />\n </AssistantModalContent>\n </AssistantModalRoot>\n );\n};\n\nAssistantModal.displayName = \"AssistantModal\";\n\nnamespace AssistantModalRoot {\n export type Props = AssistantModalPrimitive.Root.Props &\n ThreadConfigProviderProps;\n}\n\nconst AssistantModalRoot: FC<AssistantModalRoot.Props> = ({\n config,\n ...props\n}) => {\n return (\n <ThreadConfigProvider config={config}>\n <AssistantModalPrimitive.Root {...props} />\n </ThreadConfigProvider>\n );\n};\n\nAssistantModalRoot.displayName = \"AssistantModalRoot\";\n\nnamespace AssistantModalTrigger {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AssistantModalTrigger = forwardRef<\n AssistantModalTrigger.Element,\n AssistantModalTrigger.Props\n>((props, ref) => {\n return (\n <AssistantModalAnchor>\n <AssistantModalPrimitive.Trigger asChild>\n <AssistantModalButton {...props} ref={ref} />\n </AssistantModalPrimitive.Trigger>\n </AssistantModalAnchor>\n );\n});\n\nAssistantModalTrigger.displayName = \"AssistantModalTrigger\";\n\nconst AssistantModalAnchor = withDefaults(AssistantModalPrimitive.Anchor, {\n className: \"aui-root aui-modal-anchor\",\n});\n\nAssistantModalAnchor.displayName = \"AssistantModalAnchor\";\n\nconst ModalButtonStyled = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-modal-button\",\n});\n\nnamespace AssistantModalButton {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButtonProps> & {\n \"data-state\"?: \"open\" | \"closed\";\n };\n}\n\nconst AssistantModalButton = forwardRef<\n AssistantModalButton.Element,\n AssistantModalButton.Props\n>(({ \"data-state\": state, ...rest }, ref) => {\n const {\n strings: {\n assistantModal: {\n open: {\n button: { tooltip: openTooltip = \"Close Assistant\" } = {},\n } = {},\n closed: {\n button: { tooltip: closedTooltip = \"Open Assistant\" } = {},\n } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const tooltip = state === \"open\" ? openTooltip : closedTooltip;\n\n return (\n <ModalButtonStyled\n side=\"left\"\n tooltip={tooltip}\n data-state={state}\n {...rest}\n ref={ref}\n >\n {rest.children ?? (\n <>\n <BotIcon\n data-state={state}\n className=\"aui-modal-button-closed-icon\"\n />\n <ChevronDownIcon\n data-state={state}\n className=\"aui-modal-button-open-icon\"\n />\n </>\n )}\n </ModalButtonStyled>\n );\n});\n\nAssistantModalButton.displayName = \"AssistantModalButton\";\n\nconst AssistantModalContent = withDefaults(AssistantModalPrimitive.Content, {\n className: \"aui-root aui-modal-content\",\n sideOffset: 16,\n});\n\nAssistantModalContent.displayName = \"AssistantModalContent\";\n\nconst exports = {\n Root: AssistantModalRoot,\n Trigger: AssistantModalTrigger,\n Content: AssistantModalContent,\n Button: AssistantModalButton,\n Anchor: AssistantModalAnchor,\n};\n\nexport default Object.assign(AssistantModal, exports) as typeof AssistantModal &\n typeof exports;\n"],"mappings":";;;AAEA,SAAkB,kBAAkB;AACpC,SAAS,SAAS,uBAAuB;AAEzC,SAAS,+BAA+B;AACxC,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AAIH,SA8FI,UA7FF,KADF;AAFJ,IAAM,iBAAmC,CAAC,WAAW;AAC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ACJ,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,wBAAwB,aAAa,wBAAwB,SAAS;AAAA,EAC1E,WAAW;AAAA,EACX,YAAY;AACd,CAAC;AAED,sBAAsB,cAAc;AAEpC,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAEA,IAAO,0BAAQ,OAAO,OAAO,gBAAgB,OAAO;","names":[]}
1
+ {"version":3,"sources":["../../src/ui/assistant-modal.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, forwardRef } from \"react\";\nimport { BotIcon, ChevronDownIcon } from \"lucide-react\";\n\nimport { AssistantModalPrimitive } from \"../primitives\";\nimport Thread from \"./thread\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport {\n ThreadConfig,\n ThreadConfigProvider,\n ThreadConfigProviderProps,\n useThreadConfig,\n} from \"./thread-config\";\n\nconst AssistantModal: FC<ThreadConfig> = (config) => {\n return (\n <AssistantModalRoot config={config}>\n <AssistantModalTrigger />\n <AssistantModalContent>\n <Thread />\n </AssistantModalContent>\n </AssistantModalRoot>\n );\n};\n\nAssistantModal.displayName = \"AssistantModal\";\n\nnamespace AssistantModalRoot {\n export type Props = AssistantModalPrimitive.Root.Props &\n ThreadConfigProviderProps;\n}\n\nconst AssistantModalRoot: FC<AssistantModalRoot.Props> = ({\n config,\n ...props\n}) => {\n return (\n <ThreadConfigProvider config={config}>\n <AssistantModalPrimitive.Root {...props} />\n </ThreadConfigProvider>\n );\n};\n\nAssistantModalRoot.displayName = \"AssistantModalRoot\";\n\nnamespace AssistantModalTrigger {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AssistantModalTrigger = forwardRef<\n AssistantModalTrigger.Element,\n AssistantModalTrigger.Props\n>((props, ref) => {\n return (\n <AssistantModalAnchor>\n <AssistantModalPrimitive.Trigger asChild>\n <AssistantModalButton {...props} ref={ref} />\n </AssistantModalPrimitive.Trigger>\n </AssistantModalAnchor>\n );\n});\n\nAssistantModalTrigger.displayName = \"AssistantModalTrigger\";\n\nconst AssistantModalAnchor = withDefaults(AssistantModalPrimitive.Anchor, {\n className: \"aui-root aui-modal-anchor\",\n});\n\nAssistantModalAnchor.displayName = \"AssistantModalAnchor\";\n\nconst ModalButtonStyled = withDefaults(TooltipIconButton, {\n variant: \"default\",\n className: \"aui-modal-button\",\n});\n\nnamespace AssistantModalButton {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props> & {\n \"data-state\"?: \"open\" | \"closed\";\n };\n}\n\nconst AssistantModalButton = forwardRef<\n AssistantModalButton.Element,\n AssistantModalButton.Props\n>(({ \"data-state\": state, ...rest }, ref) => {\n const {\n strings: {\n assistantModal: {\n open: {\n button: { tooltip: openTooltip = \"Close Assistant\" } = {},\n } = {},\n closed: {\n button: { tooltip: closedTooltip = \"Open Assistant\" } = {},\n } = {},\n } = {},\n } = {},\n } = useThreadConfig();\n const tooltip = state === \"open\" ? openTooltip : closedTooltip;\n\n return (\n <ModalButtonStyled\n side=\"left\"\n tooltip={tooltip}\n data-state={state}\n {...rest}\n ref={ref}\n >\n {rest.children ?? (\n <>\n <BotIcon\n data-state={state}\n className=\"aui-modal-button-closed-icon\"\n />\n <ChevronDownIcon\n data-state={state}\n className=\"aui-modal-button-open-icon\"\n />\n </>\n )}\n </ModalButtonStyled>\n );\n});\n\nAssistantModalButton.displayName = \"AssistantModalButton\";\n\nconst AssistantModalContent = withDefaults(AssistantModalPrimitive.Content, {\n className: \"aui-root aui-modal-content\",\n sideOffset: 16,\n});\n\nAssistantModalContent.displayName = \"AssistantModalContent\";\n\nconst exports = {\n Root: AssistantModalRoot,\n Trigger: AssistantModalTrigger,\n Content: AssistantModalContent,\n Button: AssistantModalButton,\n Anchor: AssistantModalAnchor,\n};\n\nexport default Object.assign(AssistantModal, exports) as typeof AssistantModal &\n typeof exports;\n"],"mappings":";;;AAEA,SAAkB,kBAAkB;AACpC,SAAS,SAAS,uBAAuB;AAEzC,SAAS,+BAA+B;AACxC,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC;AAAA,EAEE;AAAA,EAEA;AAAA,OACK;AAIH,SA8FI,UA7FF,KADF;AAFJ,IAAM,iBAAmC,CAAC,WAAW;AACnD,SACE,qBAAC,sBAAmB,QAClB;AAAA,wBAAC,yBAAsB;AAAA,IACvB,oBAAC,yBACC,8BAAC,UAAO,GACV;AAAA,KACF;AAEJ;AAEA,eAAe,cAAc;AAO7B,IAAM,qBAAmD,CAAC;AAAA,EACxD;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,oBAAC,wBAAqB,QACpB,8BAAC,wBAAwB,MAAxB,EAA8B,GAAG,OAAO,GAC3C;AAEJ;AAEA,mBAAmB,cAAc;AAOjC,IAAM,wBAAwB,WAG5B,CAAC,OAAO,QAAQ;AAChB,SACE,oBAAC,wBACC,8BAAC,wBAAwB,SAAxB,EAAgC,SAAO,MACtC,8BAAC,wBAAsB,GAAG,OAAO,KAAU,GAC7C,GACF;AAEJ,CAAC;AAED,sBAAsB,cAAc;AAEpC,IAAM,uBAAuB,aAAa,wBAAwB,QAAQ;AAAA,EACxE,WAAW;AACb,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,oBAAoB,aAAa,mBAAmB;AAAA,EACxD,SAAS;AAAA,EACT,WAAW;AACb,CAAC;AASD,IAAM,uBAAuB,WAG3B,CAAC,EAAE,cAAc,OAAO,GAAG,KAAK,GAAG,QAAQ;AAC3C,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,gBAAgB;AAAA,QACd,MAAM;AAAA,UACJ,QAAQ,EAAE,SAAS,cAAc,kBAAkB,IAAI,CAAC;AAAA,QAC1D,IAAI,CAAC;AAAA,QACL,QAAQ;AAAA,UACN,QAAQ,EAAE,SAAS,gBAAgB,iBAAiB,IAAI,CAAC;AAAA,QAC3D,IAAI,CAAC;AAAA,MACP,IAAI,CAAC;AAAA,IACP,IAAI,CAAC;AAAA,EACP,IAAI,gBAAgB;AACpB,QAAM,UAAU,UAAU,SAAS,cAAc;AAEjD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACX,GAAG;AAAA,MACJ;AAAA,MAEC,eAAK,YACJ,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ,WAAU;AAAA;AAAA,QACZ;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAEnC,IAAM,wBAAwB,aAAa,wBAAwB,SAAS;AAAA,EAC1E,WAAW;AAAA,EACX,YAAY;AACd,CAAC;AAED,sBAAsB,cAAc;AAEpC,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAEA,IAAO,0BAAQ,OAAO,OAAO,gBAAgB,OAAO;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { type FC } from "react";
2
- import { TooltipIconButtonProps } from "./base/tooltip-icon-button";
2
+ import { TooltipIconButton } from "./base/tooltip-icon-button";
3
3
  declare const AttachmentUI: FC;
4
4
  declare const exports: {
5
5
  Root: import("react").ForwardRefExoticComponent<Partial<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -7,7 +7,7 @@ declare const exports: {
7
7
  } & {
8
8
  asChild?: boolean;
9
9
  }, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">> & import("react").RefAttributes<HTMLDivElement>>;
10
- Remove: import("react").ForwardRefExoticComponent<Partial<TooltipIconButtonProps> & import("react").RefAttributes<HTMLButtonElement>>;
10
+ Remove: import("react").ForwardRefExoticComponent<Partial<TooltipIconButton.Props> & import("react").RefAttributes<HTMLButtonElement>>;
11
11
  };
12
12
  declare const _default: typeof AttachmentUI & typeof exports;
13
13
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-ui.d.ts","sourceRoot":"","sources":["../../src/ui/attachment-ui.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAIf,OAAO,EAEL,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAiHpC,QAAA,MAAM,YAAY,EAAE,EAqCnB,CAAC;AAoCF,QAAA,MAAM,OAAO;;;;;;;CAGZ,CAAC;wBAEqD,OAAO,YAAY,GACxE,OAAO,OAAO;AADhB,wBACiB"}
1
+ {"version":3,"file":"attachment-ui.d.ts","sourceRoot":"","sources":["../../src/ui/attachment-ui.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAiH/D,QAAA,MAAM,YAAY,EAAE,EAqCnB,CAAC;AAoCF,QAAA,MAAM,OAAO;;;;;;;CAGZ,CAAC;wBAEqD,OAAO,YAAY,GACxE,OAAO,OAAO;AADhB,wBACiB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/attachment-ui.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n PropsWithChildren,\n useEffect,\n useState,\n type FC,\n} from \"react\";\nimport { CircleXIcon, FileIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport {\n TooltipIconButton,\n TooltipIconButtonProps,\n} from \"./base/tooltip-icon-button\";\nimport { AttachmentPrimitive } from \"../primitives\";\nimport { useAttachment } from \"../context/react/AttachmentContext\";\nimport {\n AvatarImage,\n AvatarRoot,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"./base\";\nimport { Dialog, DialogTrigger, DialogContent } from \"./base/dialog\";\nimport { AvatarFallback } from \"@radix-ui/react-avatar\";\nimport { useShallow } from \"zustand/shallow\";\nimport { DialogTitle } from \"@radix-ui/react-dialog\";\n\nconst AttachmentRoot = withDefaults(AttachmentPrimitive.Root, {\n className: \"aui-attachment-root\",\n});\n\nAttachmentRoot.displayName = \"AttachmentRoot\";\n\nconst useFileSrc = (file: File | undefined) => {\n const [src, setSrc] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n if (!file) {\n setSrc(undefined);\n return;\n }\n\n const objectUrl = URL.createObjectURL(file);\n setSrc(objectUrl);\n\n return () => {\n URL.revokeObjectURL(objectUrl);\n };\n }, [file]);\n\n return src;\n};\n\nconst useAttachmentSrc = () => {\n const { file, src } = useAttachment(\n useShallow((a): { file?: File; src?: string } => {\n if (a.type !== \"image\") return {};\n if (a.file) return { file: a.file };\n const src = a.content?.filter((c) => c.type === \"image\")[0]?.image;\n if (!src) return {};\n return { src };\n }),\n );\n\n return useFileSrc(file) ?? src;\n};\n\ntype AttachmentPreviewProps = {\n src: string;\n};\n\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n const [isLoaded, setIsLoaded] = useState(false);\n\n return (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={src}\n style={{\n width: \"auto\",\n height: \"auto\",\n maxWidth: \"75dvh\",\n maxHeight: \"75dvh\",\n display: isLoaded ? \"block\" : \"none\",\n overflow: \"clip\",\n }}\n onLoad={() => setIsLoaded(true)}\n alt=\"Image Preview\"\n />\n );\n};\n\nconst AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {\n const src = useAttachmentSrc();\n\n if (!src) return children;\n\n return (\n <Dialog>\n <DialogTrigger className=\"aui-attachment-preview-trigger\" asChild>\n {children}\n </DialogTrigger>\n <DialogContent>\n <DialogTitle className=\"aui-sr-only\">\n Image Attachment Preview\n </DialogTitle>\n <AttachmentPreview src={src} />\n </DialogContent>\n </Dialog>\n );\n};\n\nconst AttachmentThumb: FC = () => {\n const isImage = useAttachment((a) => a.type === \"image\");\n const src = useAttachmentSrc();\n return (\n <AvatarRoot className=\"aui-attachment-thumb\">\n <AvatarFallback delayMs={isImage ? 200 : 0}>\n <FileIcon />\n </AvatarFallback>\n <AvatarImage src={src}></AvatarImage>\n </AvatarRoot>\n );\n};\n\nconst AttachmentUI: FC = () => {\n const canRemove = useAttachment((a) => a.source !== \"message\");\n const typeLabel = useAttachment((a) => {\n const type = a.type;\n switch (type) {\n case \"image\":\n return \"Image\";\n case \"document\":\n return \"Document\";\n case \"file\":\n return \"File\";\n default:\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);\n }\n });\n return (\n <Tooltip>\n <AttachmentPreviewDialog>\n <TooltipTrigger asChild>\n <AttachmentRoot>\n <AttachmentThumb />\n <div className=\"aui-attachment-text\">\n <p className=\"aui-attachment-name\">\n <AttachmentPrimitive.Name />\n </p>\n <p className=\"aui-attachment-type\">{typeLabel}</p>\n </div>\n {canRemove && <AttachmentRemove />}\n </AttachmentRoot>\n </TooltipTrigger>\n </AttachmentPreviewDialog>\n <TooltipContent side=\"top\">\n <AttachmentPrimitive.Name />\n </TooltipContent>\n </Tooltip>\n );\n};\n\nAttachmentUI.displayName = \"Attachment\";\n\nnamespace AttachmentRemove {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AttachmentRemove = forwardRef<\n AttachmentRemove.Element,\n AttachmentRemove.Props\n>((props, ref) => {\n const {\n strings: {\n composer: { removeAttachment: { tooltip = \"Remove file\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <AttachmentPrimitive.Remove asChild>\n <TooltipIconButton\n tooltip={tooltip}\n className=\"aui-attachment-remove\"\n side=\"top\"\n {...props}\n ref={ref}\n >\n {props.children ?? <CircleXIcon />}\n </TooltipIconButton>\n </AttachmentPrimitive.Remove>\n );\n});\n\nAttachmentRemove.displayName = \"AttachmentRemove\";\n\nconst exports = {\n Root: AttachmentRoot,\n Remove: AttachmentRemove,\n};\n\nexport default Object.assign(AttachmentUI, exports) as typeof AttachmentUI &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAMO;AACP,0BAAsC;AACtC,0BAA6B;AAC7B,2BAAgC;AAChC,iCAGO;AACP,wBAAoC;AACpC,+BAA8B;AAC9B,kBAMO;AACP,oBAAqD;AACrD,0BAA+B;AAC/B,qBAA2B;AAC3B,0BAA4B;AAmDxB;AAAA;AAAA;AAAA;AAjDJ,IAAM,qBAAiB,kCAAa,sCAAoB,MAAM;AAAA,EAC5D,WAAW;AACb,CAAC;AAED,eAAe,cAAc;AAE7B,IAAM,aAAa,CAAC,SAA2B;AAC7C,QAAM,CAAC,KAAK,MAAM,QAAI,uBAA6B,MAAS;AAE5D,8BAAU,MAAM;AACd,QAAI,CAAC,MAAM;AACT,aAAO,MAAS;AAChB;AAAA,IACF;AAEA,UAAM,YAAY,IAAI,gBAAgB,IAAI;AAC1C,WAAO,SAAS;AAEhB,WAAO,MAAM;AACX,UAAI,gBAAgB,SAAS;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;AAEA,IAAM,mBAAmB,MAAM;AAC7B,QAAM,EAAE,MAAM,IAAI,QAAI;AAAA,QACpB,2BAAW,CAAC,MAAqC;AAC/C,UAAI,EAAE,SAAS,QAAS,QAAO,CAAC;AAChC,UAAI,EAAE,KAAM,QAAO,EAAE,MAAM,EAAE,KAAK;AA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AAO,OAAO,cAAcA,QAAO;","names":["src","exports"]}
1
+ {"version":3,"sources":["../../src/ui/attachment-ui.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n PropsWithChildren,\n useEffect,\n useState,\n type FC,\n} from \"react\";\nimport { CircleXIcon, FileIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { AttachmentPrimitive } from \"../primitives\";\nimport { useAttachment } from \"../context/react/AttachmentContext\";\nimport {\n AvatarImage,\n AvatarRoot,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"./base\";\nimport { Dialog, DialogTrigger, DialogContent } from \"./base/dialog\";\nimport { AvatarFallback } from \"@radix-ui/react-avatar\";\nimport { useShallow } from \"zustand/shallow\";\nimport { DialogTitle } from \"@radix-ui/react-dialog\";\n\nconst AttachmentRoot = withDefaults(AttachmentPrimitive.Root, {\n className: \"aui-attachment-root\",\n});\n\nAttachmentRoot.displayName = \"AttachmentRoot\";\n\nconst useFileSrc = (file: File | undefined) => {\n const [src, setSrc] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n if (!file) {\n setSrc(undefined);\n return;\n }\n\n const objectUrl = URL.createObjectURL(file);\n setSrc(objectUrl);\n\n return () => {\n URL.revokeObjectURL(objectUrl);\n };\n }, [file]);\n\n return src;\n};\n\nconst useAttachmentSrc = () => {\n const { file, src } = useAttachment(\n useShallow((a): { file?: File; src?: string } => {\n if (a.type !== \"image\") return {};\n if (a.file) return { file: a.file };\n const src = a.content?.filter((c) => c.type === \"image\")[0]?.image;\n if (!src) return {};\n return { src };\n }),\n );\n\n return useFileSrc(file) ?? src;\n};\n\ntype AttachmentPreviewProps = {\n src: string;\n};\n\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n const [isLoaded, setIsLoaded] = useState(false);\n\n return (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={src}\n style={{\n width: \"auto\",\n height: \"auto\",\n maxWidth: \"75dvh\",\n maxHeight: \"75dvh\",\n display: isLoaded ? \"block\" : \"none\",\n overflow: \"clip\",\n }}\n onLoad={() => setIsLoaded(true)}\n alt=\"Image Preview\"\n />\n );\n};\n\nconst AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {\n const src = useAttachmentSrc();\n\n if (!src) return children;\n\n return (\n <Dialog>\n <DialogTrigger className=\"aui-attachment-preview-trigger\" asChild>\n {children}\n </DialogTrigger>\n <DialogContent>\n <DialogTitle className=\"aui-sr-only\">\n Image Attachment Preview\n </DialogTitle>\n <AttachmentPreview src={src} />\n </DialogContent>\n </Dialog>\n );\n};\n\nconst AttachmentThumb: FC = () => {\n const isImage = useAttachment((a) => a.type === \"image\");\n const src = useAttachmentSrc();\n return (\n <AvatarRoot className=\"aui-attachment-thumb\">\n <AvatarFallback delayMs={isImage ? 200 : 0}>\n <FileIcon />\n </AvatarFallback>\n <AvatarImage src={src}></AvatarImage>\n </AvatarRoot>\n );\n};\n\nconst AttachmentUI: FC = () => {\n const canRemove = useAttachment((a) => a.source !== \"message\");\n const typeLabel = useAttachment((a) => {\n const type = a.type;\n switch (type) {\n case \"image\":\n return \"Image\";\n case \"document\":\n return \"Document\";\n case \"file\":\n return \"File\";\n default:\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);\n }\n });\n return (\n <Tooltip>\n <AttachmentPreviewDialog>\n <TooltipTrigger asChild>\n <AttachmentRoot>\n <AttachmentThumb />\n <div className=\"aui-attachment-text\">\n <p className=\"aui-attachment-name\">\n <AttachmentPrimitive.Name />\n </p>\n <p className=\"aui-attachment-type\">{typeLabel}</p>\n </div>\n {canRemove && <AttachmentRemove />}\n </AttachmentRoot>\n </TooltipTrigger>\n </AttachmentPreviewDialog>\n <TooltipContent side=\"top\">\n <AttachmentPrimitive.Name />\n </TooltipContent>\n </Tooltip>\n );\n};\n\nAttachmentUI.displayName = \"Attachment\";\n\nnamespace AttachmentRemove {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AttachmentRemove = forwardRef<\n AttachmentRemove.Element,\n AttachmentRemove.Props\n>((props, ref) => {\n const {\n strings: {\n composer: { removeAttachment: { tooltip = \"Remove file\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <AttachmentPrimitive.Remove asChild>\n <TooltipIconButton\n tooltip={tooltip}\n className=\"aui-attachment-remove\"\n side=\"top\"\n {...props}\n ref={ref}\n >\n {props.children ?? <CircleXIcon />}\n </TooltipIconButton>\n </AttachmentPrimitive.Remove>\n );\n});\n\nAttachmentRemove.displayName = \"AttachmentRemove\";\n\nconst exports = {\n Root: AttachmentRoot,\n Remove: AttachmentRemove,\n};\n\nexport default Object.assign(AttachmentUI, exports) as typeof AttachmentUI &\n typeof exports;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAMO;AACP,0BAAsC;AACtC,0BAA6B;AAC7B,2BAAgC;AAChC,iCAAkC;AAClC,wBAAoC;AACpC,+BAA8B;AAC9B,kBAMO;AACP,oBAAqD;AACrD,0BAA+B;AAC/B,qBAA2B;AAC3B,0BAA4B;AAmDxB;AAAA;AAAA;AAAA;AAjDJ,IAAM,qBAAiB,kCAAa,sCAAoB,MAAM;AAAA,EAC5D,WAAW;AACb,CAAC;AAED,eAAe,cAAc;AAE7B,IAAM,aAAa,CAAC,SAA2B;AAC7C,QAAM,CAAC,KAAK,MAAM,QAAI,uBAA6B,MAAS;AAE5D,8BAAU,MAAM;AACd,QAAI,CAAC,MAAM;AACT,aAAO,MAAS;AAChB;AAAA,IACF;AAEA,UAAM,YAAY,IAAI,gBAAgB,IAAI;AAC1C,WAAO,SAAS;AAEhB,WAAO,MAAM;AACX,UAAI,gBAAgB,SAAS;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;A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GAAG;AAAA,MACJ;AAAA,MAEC,gBAAM,YAAY,4CAAC,mCAAY;AAAA;AAAA,EAClC,GACF;AAEJ,CAAC;AAED,iBAAiB,cAAc;AAE/B,IAAMC,WAAU;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AACV;AAEA,IAAO,wBAAQ,OAAO,OAAO,cAAcA,QAAO;","names":["src","exports"]}
@@ -9,9 +9,7 @@ import {
9
9
  import { CircleXIcon, FileIcon } from "lucide-react";
10
10
  import { withDefaults } from "./utils/withDefaults.mjs";
11
11
  import { useThreadConfig } from "./thread-config.mjs";
12
- import {
13
- TooltipIconButton
14
- } from "./base/tooltip-icon-button.mjs";
12
+ import { TooltipIconButton } from "./base/tooltip-icon-button.mjs";
15
13
  import { AttachmentPrimitive } from "../primitives/index.mjs";
16
14
  import { useAttachment } from "../context/react/AttachmentContext.mjs";
17
15
  import {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/attachment-ui.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n PropsWithChildren,\n useEffect,\n useState,\n type FC,\n} from \"react\";\nimport { CircleXIcon, FileIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport {\n TooltipIconButton,\n TooltipIconButtonProps,\n} from \"./base/tooltip-icon-button\";\nimport { AttachmentPrimitive } from \"../primitives\";\nimport { useAttachment } from \"../context/react/AttachmentContext\";\nimport {\n AvatarImage,\n AvatarRoot,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"./base\";\nimport { Dialog, DialogTrigger, DialogContent } from \"./base/dialog\";\nimport { AvatarFallback } from \"@radix-ui/react-avatar\";\nimport { useShallow } from \"zustand/shallow\";\nimport { DialogTitle } from \"@radix-ui/react-dialog\";\n\nconst AttachmentRoot = withDefaults(AttachmentPrimitive.Root, {\n className: \"aui-attachment-root\",\n});\n\nAttachmentRoot.displayName = \"AttachmentRoot\";\n\nconst useFileSrc = (file: File | undefined) => {\n const [src, setSrc] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n if (!file) {\n setSrc(undefined);\n return;\n }\n\n const objectUrl = URL.createObjectURL(file);\n setSrc(objectUrl);\n\n return () => {\n URL.revokeObjectURL(objectUrl);\n };\n }, [file]);\n\n return src;\n};\n\nconst useAttachmentSrc = () => {\n const { file, src } = useAttachment(\n useShallow((a): { file?: File; src?: string } => {\n if (a.type !== \"image\") return {};\n if (a.file) return { file: a.file };\n const src = a.content?.filter((c) => c.type === \"image\")[0]?.image;\n if (!src) return {};\n return { src };\n }),\n );\n\n return useFileSrc(file) ?? src;\n};\n\ntype AttachmentPreviewProps = {\n src: string;\n};\n\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n const [isLoaded, setIsLoaded] = useState(false);\n\n return (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={src}\n style={{\n width: \"auto\",\n height: \"auto\",\n maxWidth: \"75dvh\",\n maxHeight: \"75dvh\",\n display: isLoaded ? \"block\" : \"none\",\n overflow: \"clip\",\n }}\n onLoad={() => setIsLoaded(true)}\n alt=\"Image Preview\"\n />\n );\n};\n\nconst AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {\n const src = useAttachmentSrc();\n\n if (!src) return children;\n\n return (\n <Dialog>\n <DialogTrigger className=\"aui-attachment-preview-trigger\" asChild>\n {children}\n </DialogTrigger>\n <DialogContent>\n <DialogTitle className=\"aui-sr-only\">\n Image Attachment Preview\n </DialogTitle>\n <AttachmentPreview src={src} />\n </DialogContent>\n </Dialog>\n );\n};\n\nconst AttachmentThumb: FC = () => {\n const isImage = useAttachment((a) => a.type === \"image\");\n const src = useAttachmentSrc();\n return (\n <AvatarRoot className=\"aui-attachment-thumb\">\n <AvatarFallback delayMs={isImage ? 200 : 0}>\n <FileIcon />\n </AvatarFallback>\n <AvatarImage src={src}></AvatarImage>\n </AvatarRoot>\n );\n};\n\nconst AttachmentUI: FC = () => {\n const canRemove = useAttachment((a) => a.source !== \"message\");\n const typeLabel = useAttachment((a) => {\n const type = a.type;\n switch (type) {\n case \"image\":\n return \"Image\";\n case \"document\":\n return \"Document\";\n case \"file\":\n return \"File\";\n default:\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);\n }\n });\n return (\n <Tooltip>\n <AttachmentPreviewDialog>\n <TooltipTrigger asChild>\n <AttachmentRoot>\n <AttachmentThumb />\n <div className=\"aui-attachment-text\">\n <p className=\"aui-attachment-name\">\n <AttachmentPrimitive.Name />\n </p>\n <p className=\"aui-attachment-type\">{typeLabel}</p>\n </div>\n {canRemove && <AttachmentRemove />}\n </AttachmentRoot>\n </TooltipTrigger>\n </AttachmentPreviewDialog>\n <TooltipContent side=\"top\">\n <AttachmentPrimitive.Name />\n </TooltipContent>\n </Tooltip>\n );\n};\n\nAttachmentUI.displayName = \"Attachment\";\n\nnamespace AttachmentRemove {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButtonProps>;\n}\n\nconst AttachmentRemove = forwardRef<\n AttachmentRemove.Element,\n AttachmentRemove.Props\n>((props, ref) => {\n const {\n strings: {\n composer: { removeAttachment: { tooltip = \"Remove file\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <AttachmentPrimitive.Remove asChild>\n <TooltipIconButton\n tooltip={tooltip}\n className=\"aui-attachment-remove\"\n side=\"top\"\n {...props}\n ref={ref}\n >\n {props.children ?? <CircleXIcon />}\n </TooltipIconButton>\n </AttachmentPrimitive.Remove>\n );\n});\n\nAttachmentRemove.displayName = \"AttachmentRemove\";\n\nconst exports = {\n Root: AttachmentRoot,\n Remove: AttachmentRemove,\n};\n\nexport default Object.assign(AttachmentUI, exports) as typeof AttachmentUI &\n typeof exports;\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,gBAAgB;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC;AAAA,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AgB;AAAA,MACjB,qBAAC,SAAI,WAAU,uBACb;AAAA,4BAAC,OAAE,WAAU,uBACX,8BAAC,oBAAoB,MAApB,EAAyB,GAC5B;AAAA,QACA,oBAAC,OAAE,WAAU,uBAAuB,qBAAU;AAAA,SAChD;AAAA,MACC,aAAa,oBAAC,oBAAiB;AAAA,OAClC,GACF,GACF;AAAA,IACA,oBAAC,kBAAe,MAAK,OACnB,8BAAC,oBAAoB,MAApB,EAAyB,GAC5B;AAAA,KACF;AAEJ;AAEA,aAAa,cAAc;AAO3B,IAAM,mBAAmB,WAGvB,CAAC,OAAO,QAAQ;AAChB,QAAM;AAAA,IACJ,SAAS;AAAA,MACP,UAAU,EAAE,kBAAkB,EAAE,UAAU,cAAc,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,IACtE,IAAI,CAAC;AAAA,EACP,IAAI,gBAAgB;AAEpB,SACE,oBAAC,oBAAoB,QAApB,EAA2B,SAAO,MACjC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAU;AAAA,MACV,MAAK;AAAA,MACJ,GAAG;AAAA,MACJ;AAAA,MAEC,gBAAM,YAAY,oBAAC,eAAY;AAAA;AAAA,EAClC,GACF;AAEJ,CAAC;AAED,iBAAiB,cAAc;AAE/B,IAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AACV;AAEA,IAAO,wBAAQ,OAAO,OAAO,cAAc,OAAO;","names":["src"]}
1
+ {"version":3,"sources":["../../src/ui/attachment-ui.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n PropsWithChildren,\n useEffect,\n useState,\n type FC,\n} from \"react\";\nimport { CircleXIcon, FileIcon } from \"lucide-react\";\nimport { withDefaults } from \"./utils/withDefaults\";\nimport { useThreadConfig } from \"./thread-config\";\nimport { TooltipIconButton } from \"./base/tooltip-icon-button\";\nimport { AttachmentPrimitive } from \"../primitives\";\nimport { useAttachment } from \"../context/react/AttachmentContext\";\nimport {\n AvatarImage,\n AvatarRoot,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"./base\";\nimport { Dialog, DialogTrigger, DialogContent } from \"./base/dialog\";\nimport { AvatarFallback } from \"@radix-ui/react-avatar\";\nimport { useShallow } from \"zustand/shallow\";\nimport { DialogTitle } from \"@radix-ui/react-dialog\";\n\nconst AttachmentRoot = withDefaults(AttachmentPrimitive.Root, {\n className: \"aui-attachment-root\",\n});\n\nAttachmentRoot.displayName = \"AttachmentRoot\";\n\nconst useFileSrc = (file: File | undefined) => {\n const [src, setSrc] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n if (!file) {\n setSrc(undefined);\n return;\n }\n\n const objectUrl = URL.createObjectURL(file);\n setSrc(objectUrl);\n\n return () => {\n URL.revokeObjectURL(objectUrl);\n };\n }, [file]);\n\n return src;\n};\n\nconst useAttachmentSrc = () => {\n const { file, src } = useAttachment(\n useShallow((a): { file?: File; src?: string } => {\n if (a.type !== \"image\") return {};\n if (a.file) return { file: a.file };\n const src = a.content?.filter((c) => c.type === \"image\")[0]?.image;\n if (!src) return {};\n return { src };\n }),\n );\n\n return useFileSrc(file) ?? src;\n};\n\ntype AttachmentPreviewProps = {\n src: string;\n};\n\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n const [isLoaded, setIsLoaded] = useState(false);\n\n return (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={src}\n style={{\n width: \"auto\",\n height: \"auto\",\n maxWidth: \"75dvh\",\n maxHeight: \"75dvh\",\n display: isLoaded ? \"block\" : \"none\",\n overflow: \"clip\",\n }}\n onLoad={() => setIsLoaded(true)}\n alt=\"Image Preview\"\n />\n );\n};\n\nconst AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {\n const src = useAttachmentSrc();\n\n if (!src) return children;\n\n return (\n <Dialog>\n <DialogTrigger className=\"aui-attachment-preview-trigger\" asChild>\n {children}\n </DialogTrigger>\n <DialogContent>\n <DialogTitle className=\"aui-sr-only\">\n Image Attachment Preview\n </DialogTitle>\n <AttachmentPreview src={src} />\n </DialogContent>\n </Dialog>\n );\n};\n\nconst AttachmentThumb: FC = () => {\n const isImage = useAttachment((a) => a.type === \"image\");\n const src = useAttachmentSrc();\n return (\n <AvatarRoot className=\"aui-attachment-thumb\">\n <AvatarFallback delayMs={isImage ? 200 : 0}>\n <FileIcon />\n </AvatarFallback>\n <AvatarImage src={src}></AvatarImage>\n </AvatarRoot>\n );\n};\n\nconst AttachmentUI: FC = () => {\n const canRemove = useAttachment((a) => a.source !== \"message\");\n const typeLabel = useAttachment((a) => {\n const type = a.type;\n switch (type) {\n case \"image\":\n return \"Image\";\n case \"document\":\n return \"Document\";\n case \"file\":\n return \"File\";\n default:\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);\n }\n });\n return (\n <Tooltip>\n <AttachmentPreviewDialog>\n <TooltipTrigger asChild>\n <AttachmentRoot>\n <AttachmentThumb />\n <div className=\"aui-attachment-text\">\n <p className=\"aui-attachment-name\">\n <AttachmentPrimitive.Name />\n </p>\n <p className=\"aui-attachment-type\">{typeLabel}</p>\n </div>\n {canRemove && <AttachmentRemove />}\n </AttachmentRoot>\n </TooltipTrigger>\n </AttachmentPreviewDialog>\n <TooltipContent side=\"top\">\n <AttachmentPrimitive.Name />\n </TooltipContent>\n </Tooltip>\n );\n};\n\nAttachmentUI.displayName = \"Attachment\";\n\nnamespace AttachmentRemove {\n export type Element = HTMLButtonElement;\n export type Props = Partial<TooltipIconButton.Props>;\n}\n\nconst AttachmentRemove = forwardRef<\n AttachmentRemove.Element,\n AttachmentRemove.Props\n>((props, ref) => {\n const {\n strings: {\n composer: { removeAttachment: { tooltip = \"Remove file\" } = {} } = {},\n } = {},\n } = useThreadConfig();\n\n return (\n <AttachmentPrimitive.Remove asChild>\n <TooltipIconButton\n tooltip={tooltip}\n className=\"aui-attachment-remove\"\n side=\"top\"\n {...props}\n ref={ref}\n >\n {props.children ?? <CircleXIcon />}\n </TooltipIconButton>\n </AttachmentPrimitive.Remove>\n );\n});\n\nAttachmentRemove.displayName = \"AttachmentRemove\";\n\nconst exports = {\n Root: AttachmentRoot,\n Remove: AttachmentRemove,\n};\n\nexport default Object.assign(AttachmentUI, exports) as typeof AttachmentUI &\n typeof exports;\n"],"mappings":";;;AAEA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,gBAAgB;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAQ,eAAe,qBAAqB;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAmDxB,cA0BE,YA1BF;AAjDJ,IAAM,iBAAiB,aAAa,oBAAoB,MAAM;AAAA,EAC5D,WAAW;AACb,CAAC;AAED,eAAe,cAAc;AAE7B,IAAM,aAAa,CAAC,SAA2B;AAC7C,QAAM,CAAC,KAAK,MAAM,IAAI,SAA6B,MAAS;AAE5D,YAAU,MAAM;AACd,QAAI,CAAC,MAAM;AACT,aAAO,MAAS;AAChB;AAAA,IACF;AAEA,UAAM,YAAY,IAAI,gBAAgB,IAAI;AAC1C,WAAO,SAAS;AAEhB,WAAO,MAAM;AACX,UAAI,gBAAgB,SAAS;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SAAO;AACT;AAEA,IAAM,mBAAmB,MAAM;AAC7B,QAAM,EAAE,MAAM,IAAI,IAAI;AAAA,IACpB,WAAW,CAAC,MAAqC;AAC/C,UAAI,EAAE,SAAS,QAAS,QAAO,CAAC;AAChC,UAAI,EAAE,KAAM,QAAO,EAAE,MAAM,EAAE,KAAK;AAClC,YAAMA,OAAM,EAAE,SAAS,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,EAA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vatarRoot, AvatarImage, AvatarFallback, type AvatarProps, } from "./avatar";
2
2
  export { Button, buttonVariants, type ButtonProps } from "./button";
3
3
  export { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip";
4
- export { TooltipIconButton, type TooltipIconButtonProps, } from "./tooltip-icon-button";
4
+ export { TooltipIconButton } from "./tooltip-icon-button";
5
5
  export { CircleStopIcon } from "./CircleStopIcon";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ui/base/index.ts"],"sourcesContent":["export {\n Avatar,\n AvatarRoot,\n AvatarImage,\n AvatarFallback,\n type AvatarProps,\n} from \"./avatar\";\n\nexport { Button, buttonVariants, type ButtonProps } from \"./button\";\n\nexport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\n\nexport {\n TooltipIconButton,\n type TooltipIconButtonProps,\n} from \"./tooltip-icon-button\";\n\nexport { CircleStopIcon } from \"./CircleStopIcon\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAMO;AAEP,oBAAyD;AAEzD,qBAAwD;AAExD,iCAGO;AAEP,4BAA+B;","names":[]}
1
+ {"version":3,"sources":["../../../src/ui/base/index.ts"],"sourcesContent":["export {\n Avatar,\n AvatarRoot,\n AvatarImage,\n AvatarFallback,\n type AvatarProps,\n} from \"./avatar\";\n\nexport { Button, buttonVariants, type ButtonProps } from \"./button\";\n\nexport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\n\nexport { TooltipIconButton } from \"./tooltip-icon-button\";\n\nexport { CircleStopIcon } from \"./CircleStopIcon\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAMO;AAEP,oBAAyD;AAEzD,qBAAwD;AAExD,iCAAkC;AAElC,4BAA+B;","names":[]}
@@ -7,9 +7,7 @@ import {
7
7
  } from "./avatar.mjs";
8
8
  import { Button, buttonVariants } from "./button.mjs";
9
9
  import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.mjs";
10
- import {
11
- TooltipIconButton
12
- } from "./tooltip-icon-button.mjs";
10
+ import { TooltipIconButton } from "./tooltip-icon-button.mjs";
13
11
  import { CircleStopIcon } from "./CircleStopIcon.mjs";
14
12
  export {
15
13
  Avatar,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ui/base/index.ts"],"sourcesContent":["export {\n Avatar,\n AvatarRoot,\n AvatarImage,\n AvatarFallback,\n type AvatarProps,\n} from \"./avatar\";\n\nexport { Button, buttonVariants, type ButtonProps } from \"./button\";\n\nexport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\n\nexport {\n TooltipIconButton,\n type TooltipIconButtonProps,\n} from \"./tooltip-icon-button\";\n\nexport { CircleStopIcon } from \"./CircleStopIcon\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,QAAQ,sBAAwC;AAEzD,SAAS,SAAS,gBAAgB,sBAAsB;AAExD;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../../../src/ui/base/index.ts"],"sourcesContent":["export {\n Avatar,\n AvatarRoot,\n AvatarImage,\n AvatarFallback,\n type AvatarProps,\n} from \"./avatar\";\n\nexport { Button, buttonVariants, type ButtonProps } from \"./button\";\n\nexport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\n\nexport { TooltipIconButton } from \"./tooltip-icon-button\";\n\nexport { CircleStopIcon } from \"./CircleStopIcon\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,QAAQ,sBAAwC;AAEzD,SAAS,SAAS,gBAAgB,sBAAsB;AAExD,SAAS,yBAAyB;AAElC,SAAS,sBAAsB;","names":[]}
@@ -1,8 +1,10 @@
1
1
  import { ButtonProps } from "./button";
2
- export type TooltipIconButtonProps = ButtonProps & {
3
- tooltip: string;
4
- side?: "top" | "bottom" | "left" | "right";
5
- };
2
+ export declare namespace TooltipIconButton {
3
+ type Props = ButtonProps & {
4
+ tooltip: string;
5
+ side?: "top" | "bottom" | "left" | "right";
6
+ };
7
+ }
6
8
  export declare const TooltipIconButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
7
9
  ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
8
10
  } & {
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-icon-button.d.ts","sourceRoot":"","sources":["../../../src/ui/base/tooltip-icon-button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,WAAW,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;aAJnB,MAAM;WACR,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO;qDAkB1C,CAAC"}
1
+ {"version":3,"file":"tooltip-icon-button.d.ts","sourceRoot":"","sources":["../../../src/ui/base/tooltip-icon-button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,WAAW,EAAE,MAAM,UAAU,CAAC;AAE/C,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,KAAK,GAAG,WAAW,GAAG;QAChC,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;KAC5C,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB;;;;;;;;aALjB,MAAM;WACR,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO;qDAmB5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ui/base/tooltip-icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\nimport { Button, ButtonProps } from \"./button\";\n\nexport type TooltipIconButtonProps = ButtonProps & {\n tooltip: string;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n};\n\nexport const TooltipIconButton = forwardRef<\n HTMLButtonElement,\n TooltipIconButtonProps\n>(({ children, tooltip, side = \"bottom\", ...rest }, ref) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" {...rest} ref={ref}>\n {children}\n <span className=\"aui-sr-only\">{tooltip}</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent side={side}>{tooltip}</TooltipContent>\n </Tooltip>\n );\n});\n\nTooltipIconButton.displayName = \"TooltipIconButton\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2B;AAC3B,qBAAwD;AACxD,oBAAoC;AAc5B;AAPD,IAAM,wBAAoB,yBAG/B,CAAC,EAAE,UAAU,SAAS,OAAO,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC1D,SACE,6CAAC,0BACC;AAAA,gDAAC,iCAAe,SAAO,MACrB,uDAAC,wBAAO,SAAQ,SAAQ,MAAK,QAAQ,GAAG,MAAM,KAC3C;AAAA;AAAA,MACD,4CAAC,UAAK,WAAU,eAAe,mBAAQ;AAAA,OACzC,GACF;AAAA,IACA,4CAAC,iCAAe,MAAa,mBAAQ;AAAA,KACvC;AAEJ,CAAC;AAED,kBAAkB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/ui/base/tooltip-icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\nimport { Button, ButtonProps } from \"./button\";\n\nexport namespace TooltipIconButton {\n export type Props = ButtonProps & {\n tooltip: string;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n };\n}\n\nexport const TooltipIconButton = forwardRef<\n HTMLButtonElement,\n TooltipIconButton.Props\n>(({ children, tooltip, side = \"bottom\", ...rest }, ref) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" {...rest} ref={ref}>\n {children}\n <span className=\"aui-sr-only\">{tooltip}</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent side={side}>{tooltip}</TooltipContent>\n </Tooltip>\n );\n});\n\nTooltipIconButton.displayName = \"TooltipIconButton\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2B;AAC3B,qBAAwD;AACxD,oBAAoC;AAgB5B;AAPD,IAAM,wBAAoB,yBAG/B,CAAC,EAAE,UAAU,SAAS,OAAO,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC1D,SACE,6CAAC,0BACC;AAAA,gDAAC,iCAAe,SAAO,MACrB,uDAAC,wBAAO,SAAQ,SAAQ,MAAK,QAAQ,GAAG,MAAM,KAC3C;AAAA;AAAA,MACD,4CAAC,UAAK,WAAU,eAAe,mBAAQ;AAAA,OACzC,GACF;AAAA,IACA,4CAAC,iCAAe,MAAa,mBAAQ;AAAA,KACvC;AAEJ,CAAC;AAED,kBAAkB,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ui/base/tooltip-icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\nimport { Button, ButtonProps } from \"./button\";\n\nexport type TooltipIconButtonProps = ButtonProps & {\n tooltip: string;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n};\n\nexport const TooltipIconButton = forwardRef<\n HTMLButtonElement,\n TooltipIconButtonProps\n>(({ children, tooltip, side = \"bottom\", ...rest }, ref) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" {...rest} ref={ref}>\n {children}\n <span className=\"aui-sr-only\">{tooltip}</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent side={side}>{tooltip}</TooltipContent>\n </Tooltip>\n );\n});\n\nTooltipIconButton.displayName = \"TooltipIconButton\";\n"],"mappings":";;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,cAA2B;AAc5B,SAEE,KAFF;AAPD,IAAM,oBAAoB,WAG/B,CAAC,EAAE,UAAU,SAAS,OAAO,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC1D,SACE,qBAAC,WACC;AAAA,wBAAC,kBAAe,SAAO,MACrB,+BAAC,UAAO,SAAQ,SAAQ,MAAK,QAAQ,GAAG,MAAM,KAC3C;AAAA;AAAA,MACD,oBAAC,UAAK,WAAU,eAAe,mBAAQ;AAAA,OACzC,GACF;AAAA,IACA,oBAAC,kBAAe,MAAa,mBAAQ;AAAA,KACvC;AAEJ,CAAC;AAED,kBAAkB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/ui/base/tooltip-icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./tooltip\";\nimport { Button, ButtonProps } from \"./button\";\n\nexport namespace TooltipIconButton {\n export type Props = ButtonProps & {\n tooltip: string;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n };\n}\n\nexport const TooltipIconButton = forwardRef<\n HTMLButtonElement,\n TooltipIconButton.Props\n>(({ children, tooltip, side = \"bottom\", ...rest }, ref) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" {...rest} ref={ref}>\n {children}\n <span className=\"aui-sr-only\">{tooltip}</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent side={side}>{tooltip}</TooltipContent>\n </Tooltip>\n );\n});\n\nTooltipIconButton.displayName = \"TooltipIconButton\";\n"],"mappings":";;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,cAA2B;AAgB5B,SAEE,KAFF;AAPD,IAAM,oBAAoB,WAG/B,CAAC,EAAE,UAAU,SAAS,OAAO,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC1D,SACE,qBAAC,WACC;AAAA,wBAAC,kBAAe,SAAO,MACrB,+BAAC,UAAO,SAAQ,SAAQ,MAAK,QAAQ,GAAG,MAAM,KAC3C;AAAA;AAAA,MACD,oBAAC,UAAK,WAAU,eAAe,mBAAQ;AAAA,OACzC,GACF;AAAA,IACA,oBAAC,kBAAe,MAAa,mBAAQ;AAAA,KACvC;AAEJ,CAAC;AAED,kBAAkB,cAAc;","names":[]}