@vvedantb/ui 0.4.0-rc.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React 19 UI for web apps: one JavaScript entry (primitives, shell pieces, app helpers, native tokens), design-token CSS, shared Tailwind v4 CSS and a Tailwind preset.",
|
|
6
6
|
"type": "module",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
2
|
import { IconPaperclip, IconPlus } from "@tabler/icons-react";
|
|
3
3
|
import { Button } from "../../ui/button";
|
|
4
4
|
import {
|
|
@@ -9,6 +9,10 @@ import {
|
|
|
9
9
|
DropdownMenuTrigger,
|
|
10
10
|
} from "../../ui/dropdown-menu";
|
|
11
11
|
|
|
12
|
+
export type InputActionsMenuContentProps = ComponentPropsWithoutRef<
|
|
13
|
+
typeof DropdownMenuContent
|
|
14
|
+
>;
|
|
15
|
+
|
|
12
16
|
export type InputActionsProps = {
|
|
13
17
|
showFileUpload?: boolean;
|
|
14
18
|
onAttachFile?: () => void;
|
|
@@ -16,6 +20,11 @@ export type InputActionsProps = {
|
|
|
16
20
|
/** Extra menu rows after the attach row, such as a skill picker and a connection item. Include your own separators. */
|
|
17
21
|
extra?: ReactNode;
|
|
18
22
|
attachLabel?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Props merged onto the menu content. Defaults: `align="start"`, `side="top"`,
|
|
25
|
+
* `collisionPadding={12}`. Your keys win. A `className` replaces the default size classes.
|
|
26
|
+
*/
|
|
27
|
+
menuContentProps?: InputActionsMenuContentProps;
|
|
19
28
|
};
|
|
20
29
|
|
|
21
30
|
export function InputActions({
|
|
@@ -24,6 +33,7 @@ export function InputActions({
|
|
|
24
33
|
compact = false,
|
|
25
34
|
extra,
|
|
26
35
|
attachLabel = "Attach file",
|
|
36
|
+
menuContentProps,
|
|
27
37
|
}: InputActionsProps) {
|
|
28
38
|
return (
|
|
29
39
|
<DropdownMenu>
|
|
@@ -41,9 +51,11 @@ export function InputActions({
|
|
|
41
51
|
</DropdownMenuTrigger>
|
|
42
52
|
<DropdownMenuContent
|
|
43
53
|
aria-label="Tool options"
|
|
54
|
+
align="start"
|
|
44
55
|
side="top"
|
|
45
56
|
collisionPadding={12}
|
|
46
57
|
className="max-h-[min(24rem,calc(100dvh-6rem))] max-w-[min(20rem,calc(100vw-1.5rem))] overflow-y-auto"
|
|
58
|
+
{...menuContentProps}
|
|
47
59
|
>
|
|
48
60
|
{showFileUpload ? (
|
|
49
61
|
<>
|
|
@@ -23,7 +23,7 @@ import { SpeechInput } from "../../ai-elements/speech-input";
|
|
|
23
23
|
import { chatInputContainerClass } from "../../ui/surface-classes";
|
|
24
24
|
import { ComposerSlashMenu } from "./ComposerSlashMenu";
|
|
25
25
|
import { FadePresence } from "./FadePresence";
|
|
26
|
-
import { InputActions } from "./InputActions";
|
|
26
|
+
import { InputActions, type InputActionsProps } from "./InputActions";
|
|
27
27
|
import { motionFast } from "./motion";
|
|
28
28
|
import type { ComposerSlashItem } from "./composerSlashItems";
|
|
29
29
|
import { useComposerCompact } from "./useComposerCompact";
|
|
@@ -90,6 +90,8 @@ export type InputAreaProps = {
|
|
|
90
90
|
chips?: ReactNode;
|
|
91
91
|
/** Extra rows in the plus menu after the attach row. Include your own separators. */
|
|
92
92
|
plusMenuExtra?: ReactNode;
|
|
93
|
+
/** Props merged onto the plus-menu dropdown content, such as `align`, `side` or `sideOffset`. Defaults: `align="start"`, `side="top"`. */
|
|
94
|
+
plusMenuContentProps?: InputActionsProps["menuContentProps"];
|
|
93
95
|
|
|
94
96
|
/** Items for the `/` menu. Omit to turn the menu off. */
|
|
95
97
|
slashItems?: ComposerSlashItem[];
|
|
@@ -141,6 +143,7 @@ export function InputArea({
|
|
|
141
143
|
attachments,
|
|
142
144
|
chips,
|
|
143
145
|
plusMenuExtra,
|
|
146
|
+
plusMenuContentProps,
|
|
144
147
|
slashItems,
|
|
145
148
|
onSlashSelect,
|
|
146
149
|
renderSlashItem,
|
|
@@ -244,6 +247,7 @@ export function InputArea({
|
|
|
244
247
|
onAttachFile={openFilePicker}
|
|
245
248
|
compact={compact}
|
|
246
249
|
extra={plusMenuExtra}
|
|
250
|
+
menuContentProps={plusMenuContentProps}
|
|
247
251
|
/>
|
|
248
252
|
);
|
|
249
253
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../utils/cn";
|
|
2
3
|
import { Label } from "./label";
|
|
3
4
|
import { Switch } from "./switch";
|
|
4
5
|
|
|
@@ -11,6 +12,7 @@ interface LabeledSwitchRowProps {
|
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
icon?: ReactNode;
|
|
13
14
|
trailing?: ReactNode;
|
|
15
|
+
className?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export function LabeledSwitchRow({
|
|
@@ -22,9 +24,10 @@ export function LabeledSwitchRow({
|
|
|
22
24
|
disabled,
|
|
23
25
|
icon,
|
|
24
26
|
trailing,
|
|
27
|
+
className,
|
|
25
28
|
}: LabeledSwitchRowProps) {
|
|
26
29
|
return (
|
|
27
|
-
<div className="flex items-center justify-between gap-3 max-sm:flex-wrap">
|
|
30
|
+
<div className={cn("flex items-center justify-between gap-3 max-sm:flex-wrap", className)}>
|
|
28
31
|
<div className="flex min-w-0 items-start gap-2">
|
|
29
32
|
{icon ? (
|
|
30
33
|
<span className="mt-0.5 shrink-0 text-muted-foreground">{icon}</span>
|