@schemavaults/ui 0.112.1 → 0.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/components/ui/accordion/accordion.d.ts +1 -1
  2. package/dist/components/ui/agent-chat-messages/agent-chat-announcement.d.ts +18 -0
  3. package/dist/components/ui/agent-chat-messages/agent-chat-announcement.js +42 -0
  4. package/dist/components/ui/agent-chat-messages/agent-chat-announcement.js.map +1 -0
  5. package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.d.ts +35 -0
  6. package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.js +37 -0
  7. package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.js.map +1 -0
  8. package/dist/components/ui/agent-chat-messages/agent-chat-artifact.d.ts +52 -0
  9. package/dist/components/ui/agent-chat-messages/agent-chat-artifact.js +75 -0
  10. package/dist/components/ui/agent-chat-messages/agent-chat-artifact.js.map +1 -0
  11. package/dist/components/ui/agent-chat-messages/agent-chat-bubble.d.ts +22 -0
  12. package/dist/components/ui/agent-chat-messages/agent-chat-bubble.js +23 -0
  13. package/dist/components/ui/agent-chat-messages/agent-chat-bubble.js.map +1 -0
  14. package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.d.ts +20 -0
  15. package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.js +33 -0
  16. package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.js.map +1 -0
  17. package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.d.ts +18 -0
  18. package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.js +29 -0
  19. package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.js.map +1 -0
  20. package/dist/components/ui/agent-chat-messages/agent-chat-image.d.ts +103 -0
  21. package/dist/components/ui/agent-chat-messages/agent-chat-image.js +92 -0
  22. package/dist/components/ui/agent-chat-messages/agent-chat-image.js.map +1 -0
  23. package/dist/components/ui/agent-chat-messages/agent-chat-message-row.d.ts +24 -0
  24. package/dist/components/ui/agent-chat-messages/agent-chat-message-row.js +29 -0
  25. package/dist/components/ui/agent-chat-messages/agent-chat-message-row.js.map +1 -0
  26. package/dist/components/ui/agent-chat-messages/agent-chat-messages.d.ts +1 -67
  27. package/dist/components/ui/agent-chat-messages/agent-chat-messages.js +47 -136
  28. package/dist/components/ui/agent-chat-messages/agent-chat-messages.js.map +1 -1
  29. package/dist/components/ui/agent-chat-messages/agent-chat-motion.d.ts +44 -0
  30. package/dist/components/ui/agent-chat-messages/agent-chat-motion.js +19 -0
  31. package/dist/components/ui/agent-chat-messages/agent-chat-motion.js.map +1 -0
  32. package/dist/components/ui/agent-chat-messages/agent-typing-indicator.d.ts +14 -0
  33. package/dist/components/ui/agent-chat-messages/agent-typing-indicator.js +13 -0
  34. package/dist/components/ui/agent-chat-messages/agent-typing-indicator.js.map +1 -0
  35. package/dist/components/ui/agent-chat-messages/index.d.ts +14 -0
  36. package/dist/components/ui/agent-chat-messages/index.js +7 -0
  37. package/dist/components/ui/agent-chat-messages/index.js.map +1 -1
  38. package/dist/components/ui/agent-chat-messages/use-image-load-state.d.ts +13 -0
  39. package/dist/components/ui/agent-chat-messages/use-image-load-state.js +29 -0
  40. package/dist/components/ui/agent-chat-messages/use-image-load-state.js.map +1 -0
  41. package/dist/components/ui/attachment-card/attachment-card.d.ts +2 -2
  42. package/dist/components/ui/badge/badge.d.ts +1 -1
  43. package/dist/components/ui/blockquote/blockquote.d.ts +1 -1
  44. package/dist/components/ui/breadcrumb/breadcrumb.d.ts +1 -1
  45. package/dist/components/ui/button/button.d.ts +1 -1
  46. package/dist/components/ui/chip/chip.d.ts +1 -1
  47. package/dist/components/ui/code-block/code-block.d.ts +1 -1
  48. package/dist/components/ui/collapsible/collapsible-variants.d.ts +3 -3
  49. package/dist/components/ui/floating-action-button/floating-action-button.d.ts +1 -1
  50. package/dist/components/ui/json-viewer/json-viewer.d.ts +1 -1
  51. package/dist/components/ui/number-ticker/number-ticker.d.ts +1 -1
  52. package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.d.ts +118 -0
  53. package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.js +155 -0
  54. package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.js.map +1 -0
  55. package/dist/components/ui/prompt-input/prompt-input-variants.js +3 -1
  56. package/dist/components/ui/prompt-input/prompt-input-variants.js.map +1 -1
  57. package/dist/components/ui/prompt-input/prompt-input.d.ts +22 -1
  58. package/dist/components/ui/prompt-input/prompt-input.js +44 -9
  59. package/dist/components/ui/prompt-input/prompt-input.js.map +1 -1
  60. package/dist/components/ui/scroll-progress/scroll-progress.d.ts +1 -1
  61. package/dist/components/ui/scroll-to-top/scroll-to-top.d.ts +1 -1
  62. package/dist/components/ui/secret-reveal/secret-reveal.d.ts +1 -1
  63. package/dist/components/ui/snippet/snippet.d.ts +1 -1
  64. package/dist/components/ui/toggle/toggle.d.ts +1 -1
  65. package/dist/components/ui/toolbar/toolbar.d.ts +1 -1
  66. package/package.json +1 -1
@@ -1,2 +1,16 @@
1
1
  export * from "./agent-chat-messages";
2
2
  export type * from "./agent-chat-messages";
3
+ export * from "./agent-chat-bubble";
4
+ export type * from "./agent-chat-bubble";
5
+ export * from "./agent-typing-indicator";
6
+ export type * from "./agent-typing-indicator";
7
+ export * from "./agent-chat-announcement";
8
+ export type * from "./agent-chat-announcement";
9
+ export * from "./agent-chat-hil-message";
10
+ export type * from "./agent-chat-hil-message";
11
+ export * from "./agent-chat-artifact-message";
12
+ export type * from "./agent-chat-artifact-message";
13
+ export * from "./agent-chat-image";
14
+ export type * from "./agent-chat-image";
15
+ export * from "./agent-chat-artifact";
16
+ export type * from "./agent-chat-artifact";
@@ -1,2 +1,9 @@
1
1
  export * from "./agent-chat-messages";
2
+ export * from "./agent-chat-bubble";
3
+ export * from "./agent-typing-indicator";
4
+ export * from "./agent-chat-announcement";
5
+ export * from "./agent-chat-hil-message";
6
+ export * from "./agent-chat-artifact-message";
7
+ export * from "./agent-chat-image";
8
+ export * from "./agent-chat-artifact";
2
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAGtC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,0BAA0B,CAAC;AAGzC,cAAc,+BAA+B,CAAC;AAG9C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export type ImageLoadStatus = "loading" | "loaded" | "error";
2
+ export interface ImageLoadState {
3
+ status: ImageLoadStatus;
4
+ onLoad: () => void;
5
+ onError: () => void;
6
+ /** Ref for the `<img>`, catching an image that loaded before `onLoad` was attached. */
7
+ imgRef: (node: HTMLImageElement | null) => void;
8
+ }
9
+ /**
10
+ * Tracks whether `src` has loaded. The settled state remembers which source
11
+ * it settled for, so a new `src` reads as loading again without an effect.
12
+ */
13
+ export declare function useImageLoadState(src: string): ImageLoadState;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ /** Internal: load tracking shared by `AgentChatImage` and its viewer. */
3
+ import { useCallback, useState } from "react";
4
+ /**
5
+ * Tracks whether `src` has loaded. The settled state remembers which source
6
+ * it settled for, so a new `src` reads as loading again without an effect.
7
+ */
8
+ export function useImageLoadState(src) {
9
+ const [settled, setSettled] = useState(null);
10
+ const onLoad = useCallback(() => {
11
+ setSettled({ src, status: "loaded" });
12
+ }, [src]);
13
+ const onError = useCallback(() => {
14
+ setSettled({ src, status: "error" });
15
+ }, [src]);
16
+ // A cached image, or one that finished before hydration, may never fire
17
+ // `load` at a handler attached after the fact.
18
+ const imgRef = useCallback((node) => {
19
+ if (node?.complete && node.naturalWidth > 0)
20
+ onLoad();
21
+ }, [onLoad]);
22
+ return {
23
+ status: settled?.src === src ? settled.status : "loading",
24
+ onLoad,
25
+ onError,
26
+ imgRef,
27
+ };
28
+ }
29
+ //# sourceMappingURL=use-image-load-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-image-load-state.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/use-image-load-state.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,yEAAyE;AAEzE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAY9C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAG5B,IAAI,CAAC,CAAC;IAEhB,MAAM,MAAM,GAAG,WAAW,CAAC,GAAS,EAAE;QACpC,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACV,MAAM,OAAO,GAAG,WAAW,CAAC,GAAS,EAAE;QACrC,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,wEAAwE;IACxE,+CAA+C;IAC/C,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,IAA6B,EAAQ,EAAE;QACtC,IAAI,IAAI,EAAE,QAAQ,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC;YAAE,MAAM,EAAE,CAAC;IACxD,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;QACzD,MAAM;QACN,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -9,10 +9,10 @@ export type AttachmentCardStatusId = (typeof attachmentCardStatusIds)[number];
9
9
  export declare const attachmentCardFileKindIds: readonly ["image", "video", "audio", "text", "code", "archive", "spreadsheet", "json", "pdf", "generic"];
10
10
  export type AttachmentCardFileKindId = (typeof attachmentCardFileKindIds)[number];
11
11
  export declare const attachmentCardVariants: (props?: ({
12
- variant?: "default" | "outline" | "ghost" | "muted" | null | undefined;
12
+ variant?: "default" | "outline" | "muted" | "ghost" | null | undefined;
13
13
  size?: "sm" | "lg" | "md" | null | undefined;
14
14
  interactive?: boolean | null | undefined;
15
- status?: "error" | "idle" | "uploading" | "complete" | null | undefined;
15
+ status?: "error" | "complete" | "idle" | "uploading" | null | undefined;
16
16
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
17
17
  /**
18
18
  * Infer the file kind (used for icon + colour) from an explicit `fileType`
@@ -1,7 +1,7 @@
1
1
  import type { ComponentProps } from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
4
+ variant?: "default" | "outline" | "destructive" | "secondary" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, asChild, ...props }: ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
7
7
  asChild?: boolean;
@@ -7,7 +7,7 @@ export type BlockquoteEmphasisId = (typeof blockquoteEmphasisIds)[number];
7
7
  export declare const blockquoteSizeIds: readonly ["sm", "default", "lg"];
8
8
  export type BlockquoteSizeId = (typeof blockquoteSizeIds)[number];
9
9
  export declare const blockquoteVariants: (props?: ({
10
- variant?: "default" | "warning" | "primary" | "accent" | "success" | "danger" | "muted" | null | undefined;
10
+ variant?: "default" | "warning" | "primary" | "muted" | "accent" | "success" | "danger" | null | undefined;
11
11
  emphasis?: "border" | "ghost" | "card" | "pull" | null | undefined;
12
12
  size?: "sm" | "default" | "lg" | null | undefined;
13
13
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -3,7 +3,7 @@ import { type VariantProps } from "class-variance-authority";
3
3
  import { type BreadcrumbSeparatorVariant, type BreadcrumbSize, type BreadcrumbVariant } from "./breadcrumb-variants";
4
4
  declare const breadcrumbListVariants: (props?: ({
5
5
  size?: "sm" | "default" | "lg" | null | undefined;
6
- variant?: "default" | "primary" | "ghost" | "muted" | null | undefined;
6
+ variant?: "default" | "primary" | "muted" | "ghost" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  export interface BreadcrumbProps extends ComponentPropsWithoutRef<"nav"> {
9
9
  separator?: BreadcrumbSeparatorVariant;
@@ -3,7 +3,7 @@ import type { ReactElement, ButtonHTMLAttributes } from "react";
3
3
  export declare const buttonVariantIds: ["default", "destructive", "outline", "secondary", "ghost", "link"];
4
4
  export type ButtonVariantId = (typeof buttonVariantIds)[number];
5
5
  export declare const buttonVariants: (props?: ({
6
- variant?: "default" | "link" | "destructive" | "outline" | "ghost" | "secondary" | null | undefined;
6
+ variant?: "default" | "link" | "outline" | "destructive" | "ghost" | "secondary" | null | undefined;
7
7
  size?: "sm" | "default" | "lg" | "icon" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import { type ComponentProps, type MouseEvent, type ReactElement, type ReactNode } from "react";
3
3
  import { chipSizeIds, chipVariantIds, type ChipSize, type ChipVariant } from "./chip-variants";
4
4
  declare const chipVariants: (props?: ({
5
- variant?: "default" | "warning" | "destructive" | "primary" | "outline" | "success" | "secondary" | null | undefined;
5
+ variant?: "default" | "outline" | "warning" | "destructive" | "primary" | "success" | "secondary" | null | undefined;
6
6
  size?: "sm" | "default" | "lg" | null | undefined;
7
7
  disabled?: boolean | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import { type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
3
3
  import { type CodeBlockSize, type CodeBlockVariant, codeBlockSizeIds, codeBlockVariantIds } from "./code-block-variants";
4
4
  declare const codeBlockVariants: (props?: ({
5
- variant?: "default" | "subtle" | "terminal" | "contrast" | null | undefined;
5
+ variant?: "default" | "terminal" | "subtle" | "contrast" | null | undefined;
6
6
  size?: "sm" | "lg" | "md" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  export interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "title">, VariantProps<typeof codeBlockVariants> {
@@ -3,14 +3,14 @@ export type CollapsibleVariantId = (typeof collapsibleVariantIds)[number];
3
3
  export declare const collapsibleSizeIds: readonly ["sm", "md", "lg"];
4
4
  export type CollapsibleSizeId = (typeof collapsibleSizeIds)[number];
5
5
  export declare const collapsibleRootVariants: (props?: ({
6
- variant?: "default" | "primary" | "outline" | "ghost" | "subtle" | null | undefined;
6
+ variant?: "default" | "outline" | "primary" | "ghost" | "subtle" | null | undefined;
7
7
  size?: "sm" | "lg" | "md" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  export declare const collapsibleTriggerVariants: (props?: ({
10
- variant?: "default" | "primary" | "outline" | "ghost" | "subtle" | null | undefined;
10
+ variant?: "default" | "outline" | "primary" | "ghost" | "subtle" | null | undefined;
11
11
  size?: "sm" | "lg" | "md" | null | undefined;
12
12
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
13
  export declare const collapsibleContentInnerVariants: (props?: ({
14
- variant?: "default" | "primary" | "outline" | "ghost" | "subtle" | null | undefined;
14
+ variant?: "default" | "outline" | "primary" | "ghost" | "subtle" | null | undefined;
15
15
  size?: "sm" | "lg" | "md" | null | undefined;
16
16
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -7,7 +7,7 @@ export type FloatingActionButtonSizeId = (typeof floatingActionButtonSizeIds)[nu
7
7
  export declare const floatingActionButtonPositionIds: ["bottom-right", "bottom-left", "top-right", "top-left", "static"];
8
8
  export type FloatingActionButtonPositionId = (typeof floatingActionButtonPositionIds)[number];
9
9
  declare const floatingActionButtonVariants: (props?: ({
10
- variant?: "destructive" | "primary" | "outline" | "secondary" | "brand" | null | undefined;
10
+ variant?: "outline" | "destructive" | "primary" | "secondary" | "brand" | null | undefined;
11
11
  size?: "sm" | "default" | "lg" | null | undefined;
12
12
  extended?: boolean | null | undefined;
13
13
  position?: "static" | "bottom-right" | "bottom-left" | "top-right" | "top-left" | null | undefined;
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
2
2
  import { type HTMLAttributes, type ReactElement, type Ref } from "react";
3
3
  import { type JsonViewerSize, type JsonViewerVariant, jsonViewerSizeIds, jsonViewerVariantIds } from "./json-viewer-variants";
4
4
  declare const jsonViewerVariants: (props?: ({
5
- variant?: "default" | "subtle" | "terminal" | "contrast" | null | undefined;
5
+ variant?: "default" | "terminal" | "subtle" | "contrast" | null | undefined;
6
6
  size?: "sm" | "lg" | "md" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  type JsonPrimitive = string | number | boolean | null;
@@ -1,7 +1,7 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
2
  import { type ComponentProps, type ReactElement, type Ref } from "react";
3
3
  declare const numberTickerVariants: (props?: ({
4
- variant?: "default" | "warning" | "destructive" | "primary" | "success" | "muted" | null | undefined;
4
+ variant?: "default" | "warning" | "destructive" | "primary" | "muted" | "success" | null | undefined;
5
5
  size?: "sm" | "default" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  export type NumberTickerEase = "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Auto-resize for `<PromptInputTextarea>`, kept free of React and of a real
3
+ * DOM so it can be unit tested: a test stands in for the `<textarea>` and
4
+ * supplies the `scrollHeight` and computed style that only a browser can lay
5
+ * out.
6
+ *
7
+ * Heights are border-box heights — what the textarea measures on the page —
8
+ * unless a name says otherwise.
9
+ */
10
+ /** The parts of a `<textarea>` the sizing reads and writes. */
11
+ export interface PromptInputTextareaSizingTarget {
12
+ readonly style: {
13
+ height: string;
14
+ minHeight: string;
15
+ overflowY: string;
16
+ };
17
+ /** Content plus padding, as `HTMLElement.scrollHeight` reports it. */
18
+ readonly scrollHeight: number;
19
+ /** Padding-box height, as `HTMLElement.clientHeight` reports it. */
20
+ readonly clientHeight: number;
21
+ /** Border-box height, as `HTMLElement.offsetHeight` reports it. */
22
+ readonly offsetHeight: number;
23
+ }
24
+ /**
25
+ * The computed style properties the sizing reads. Live, the way
26
+ * `getComputedStyle` returns them: the sizing clears its own inline
27
+ * `min-height` before it reads `minHeight`, to see the stylesheet's.
28
+ */
29
+ export type PromptInputTextareaComputedStyle = Pick<CSSStyleDeclaration, "boxSizing" | "lineHeight" | "fontSize" | "minHeight" | "paddingTop" | "paddingBottom" | "borderTopWidth" | "borderBottomWidth">;
30
+ /** What the sizing remembers about one textarea between runs. */
31
+ export interface PromptInputTextareaSizingState {
32
+ /**
33
+ * The inline `height` as the sizing last wrote or saw it. Any other value
34
+ * was set by someone else: in practice the user dragging the resize
35
+ * handle, which the browser applies as an inline `height`.
36
+ */
37
+ lastInlineHeight: string | null;
38
+ /** The height the user last dragged the textarea to, if they have. */
39
+ userHeightPx: number | null;
40
+ /**
41
+ * The inline `min-height` the sizing last wrote, or null if it has none
42
+ * in place. Only that value is ever cleared, never a consumer's own.
43
+ */
44
+ lastInlineMinHeight: string | null;
45
+ }
46
+ export type PromptInputTextareaRowsMinHeightOptions = Pick<PromptInputTextareaSizingOptions, "rows" | "resizable">;
47
+ export interface PromptInputTextareaSizingOptions {
48
+ /** Fewest lines of text to show. */
49
+ rows: number;
50
+ /** Where auto-grow stops and the textarea starts scrolling. */
51
+ maxHeightPx: number;
52
+ /** Keep the height the user drags the textarea to as its floor. */
53
+ resizable: boolean;
54
+ }
55
+ /**
56
+ * The computed line height in pixels. `normal` depends on the font, so it
57
+ * falls back to the usual 1.2 × font size.
58
+ */
59
+ export declare function resolveLineHeightPx(lineHeight: string, fontSize: string): number;
60
+ /**
61
+ * The height that shows `rows` lines of text: the floor `rows` puts under
62
+ * auto-resize. One row needs no floor of its own, because even an empty
63
+ * textarea measures a line tall.
64
+ */
65
+ export declare function rowsMinHeightPx(rows: number, style: PromptInputTextareaComputedStyle): number;
66
+ /**
67
+ * While the textarea is resizable, make the `rows` floor a CSS minimum, so
68
+ * the browser stops a drag of the resize handle there rather than at the
69
+ * size's `min-h-*`. The inline style is written only when the floor is taller
70
+ * than the stylesheet's own minimum, which it would otherwise override.
71
+ * Without `resizable` nothing can be dragged, and the textarea has no inline
72
+ * `min-height` from the sizing.
73
+ *
74
+ * Run whenever anything the floor depends on changes: `rows`, `resizable`,
75
+ * or the font, line height and padding that come with the size.
76
+ */
77
+ export declare function syncPromptInputTextareaRowsMinHeight(target: PromptInputTextareaSizingTarget, style: PromptInputTextareaComputedStyle, { rows, resizable }: PromptInputTextareaRowsMinHeightOptions, state: PromptInputTextareaSizingState): void;
78
+ export interface PromptInputTextareaHeightInput {
79
+ /**
80
+ * The height the content needs, measured with the textarea collapsed, so
81
+ * it already respects any CSS `min-height`.
82
+ */
83
+ contentHeightPx: number;
84
+ /** The floor from `rows`. */
85
+ rowsMinHeightPx: number;
86
+ /** The height the user dragged the textarea to, or null. */
87
+ userHeightPx: number | null;
88
+ /** Where auto-grow stops and the textarea starts scrolling. */
89
+ maxHeightPx: number;
90
+ }
91
+ export interface PromptInputTextareaHeight {
92
+ heightPx: number;
93
+ overflowY: "auto" | "hidden";
94
+ }
95
+ /**
96
+ * Grow with the content between a floor and a cap. The floor is `rows`, or
97
+ * the user's dragged height if that is taller; the cap is `maxHeightPx`, or
98
+ * the floor if that is taller. Past the cap the textarea scrolls.
99
+ */
100
+ export declare function computePromptInputTextareaHeight({ contentHeightPx, rowsMinHeightPx, userHeightPx, maxHeightPx, }: PromptInputTextareaHeightInput): PromptInputTextareaHeight;
101
+ /**
102
+ * Notice an inline height someone else gave the textarea since the sizing
103
+ * last touched it, and remember it as the user's dragged height. Returns
104
+ * whether there was one. While resizable, the textarea's inline `min-height`
105
+ * has already stopped the drag at the `rows` floor.
106
+ */
107
+ export declare function capturePromptInputTextareaUserResize(target: PromptInputTextareaSizingTarget, state: PromptInputTextareaSizingState): boolean;
108
+ /**
109
+ * Run while the user drags the resize handle: remember the new height, and
110
+ * show a scrollbar if it hides some of the content. The next value change
111
+ * sizes the textarea from the content again.
112
+ */
113
+ export declare function syncPromptInputTextareaUserResize(target: PromptInputTextareaSizingTarget, state: PromptInputTextareaSizingState): void;
114
+ /**
115
+ * Size the textarea to its content, and keep its `rows` minimum in step.
116
+ * Run whenever the value changes.
117
+ */
118
+ export declare function sizePromptInputTextarea(target: PromptInputTextareaSizingTarget, style: PromptInputTextareaComputedStyle, { rows, maxHeightPx, resizable }: PromptInputTextareaSizingOptions, state: PromptInputTextareaSizingState): void;
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Auto-resize for `<PromptInputTextarea>`, kept free of React and of a real
3
+ * DOM so it can be unit tested: a test stands in for the `<textarea>` and
4
+ * supplies the `scrollHeight` and computed style that only a browser can lay
5
+ * out.
6
+ *
7
+ * Heights are border-box heights — what the textarea measures on the page —
8
+ * unless a name says otherwise.
9
+ */
10
+ function px(value) {
11
+ const parsed = Number.parseFloat(value);
12
+ return Number.isFinite(parsed) ? parsed : 0;
13
+ }
14
+ /**
15
+ * The computed line height in pixels. `normal` depends on the font, so it
16
+ * falls back to the usual 1.2 × font size.
17
+ */
18
+ export function resolveLineHeightPx(lineHeight, fontSize) {
19
+ if (lineHeight.endsWith("px"))
20
+ return px(lineHeight);
21
+ const multiplier = Number.parseFloat(lineHeight);
22
+ return (Number.isFinite(multiplier) ? multiplier : 1.2) * px(fontSize);
23
+ }
24
+ function verticalPaddingPx(style) {
25
+ return px(style.paddingTop) + px(style.paddingBottom);
26
+ }
27
+ function verticalBorderPx(style) {
28
+ return px(style.borderTopWidth) + px(style.borderBottomWidth);
29
+ }
30
+ /**
31
+ * The height that shows `rows` lines of text: the floor `rows` puts under
32
+ * auto-resize. One row needs no floor of its own, because even an empty
33
+ * textarea measures a line tall.
34
+ */
35
+ export function rowsMinHeightPx(rows, style) {
36
+ if (!Number.isFinite(rows) || rows <= 1)
37
+ return 0;
38
+ return (rows * resolveLineHeightPx(style.lineHeight, style.fontSize) +
39
+ verticalPaddingPx(style) +
40
+ verticalBorderPx(style));
41
+ }
42
+ /** Convert a border-box height to what `style.height`/`min-height` take. */
43
+ function styleHeightPx(borderBoxHeightPx, style) {
44
+ return style.boxSizing === "content-box"
45
+ ? borderBoxHeightPx - verticalPaddingPx(style) - verticalBorderPx(style)
46
+ : borderBoxHeightPx;
47
+ }
48
+ /**
49
+ * While the textarea is resizable, make the `rows` floor a CSS minimum, so
50
+ * the browser stops a drag of the resize handle there rather than at the
51
+ * size's `min-h-*`. The inline style is written only when the floor is taller
52
+ * than the stylesheet's own minimum, which it would otherwise override.
53
+ * Without `resizable` nothing can be dragged, and the textarea has no inline
54
+ * `min-height` from the sizing.
55
+ *
56
+ * Run whenever anything the floor depends on changes: `rows`, `resizable`,
57
+ * or the font, line height and padding that come with the size.
58
+ */
59
+ export function syncPromptInputTextareaRowsMinHeight(target, style, { rows, resizable }, state) {
60
+ // Clear our own minimum, so `style.minHeight` reports the stylesheet's.
61
+ if (state.lastInlineMinHeight !== null &&
62
+ target.style.minHeight === state.lastInlineMinHeight) {
63
+ target.style.minHeight = "";
64
+ }
65
+ state.lastInlineMinHeight = null;
66
+ if (!resizable)
67
+ return;
68
+ const floorPx = rowsMinHeightPx(rows, style);
69
+ if (floorPx === 0)
70
+ return;
71
+ const floorStylePx = styleHeightPx(floorPx, style);
72
+ const cssMinHeight = style.minHeight;
73
+ let minHeight = `${floorStylePx}px`;
74
+ if (cssMinHeight.endsWith("px")) {
75
+ // The stylesheet's minimum already holds the floor: leave it in charge.
76
+ if (px(cssMinHeight) >= floorStylePx)
77
+ return;
78
+ }
79
+ else if (cssMinHeight.endsWith("%") || cssMinHeight.startsWith("calc(")) {
80
+ // Not comparable in pixels here; let the browser take the larger.
81
+ minHeight = `max(${minHeight}, ${cssMinHeight})`;
82
+ }
83
+ target.style.minHeight = minHeight;
84
+ // Read back: the browser normalizes what was written.
85
+ state.lastInlineMinHeight = target.style.minHeight;
86
+ }
87
+ /**
88
+ * Grow with the content between a floor and a cap. The floor is `rows`, or
89
+ * the user's dragged height if that is taller; the cap is `maxHeightPx`, or
90
+ * the floor if that is taller. Past the cap the textarea scrolls.
91
+ */
92
+ export function computePromptInputTextareaHeight({ contentHeightPx, rowsMinHeightPx, userHeightPx, maxHeightPx, }) {
93
+ const floorPx = Math.max(rowsMinHeightPx, userHeightPx ?? 0);
94
+ const capPx = Math.max(maxHeightPx, floorPx);
95
+ return {
96
+ heightPx: Math.min(Math.max(contentHeightPx, floorPx), capPx),
97
+ overflowY: contentHeightPx > capPx ? "auto" : "hidden",
98
+ };
99
+ }
100
+ /**
101
+ * Notice an inline height someone else gave the textarea since the sizing
102
+ * last touched it, and remember it as the user's dragged height. Returns
103
+ * whether there was one. While resizable, the textarea's inline `min-height`
104
+ * has already stopped the drag at the `rows` floor.
105
+ */
106
+ export function capturePromptInputTextareaUserResize(target, state) {
107
+ const inlineHeight = target.style.height;
108
+ if (state.lastInlineHeight === null ||
109
+ inlineHeight === state.lastInlineHeight) {
110
+ return false;
111
+ }
112
+ state.lastInlineHeight = inlineHeight;
113
+ // Measured rather than parsed, so CSS min/max-height clamping is included.
114
+ state.userHeightPx = target.offsetHeight;
115
+ return true;
116
+ }
117
+ /**
118
+ * Run while the user drags the resize handle: remember the new height, and
119
+ * show a scrollbar if it hides some of the content. The next value change
120
+ * sizes the textarea from the content again.
121
+ */
122
+ export function syncPromptInputTextareaUserResize(target, state) {
123
+ if (!capturePromptInputTextareaUserResize(target, state))
124
+ return;
125
+ target.style.overflowY =
126
+ target.scrollHeight > target.clientHeight ? "auto" : "hidden";
127
+ }
128
+ /**
129
+ * Size the textarea to its content, and keep its `rows` minimum in step.
130
+ * Run whenever the value changes.
131
+ */
132
+ export function sizePromptInputTextarea(target, style, { rows, maxHeightPx, resizable }, state) {
133
+ // A drag the resize observer has not reported yet still counts.
134
+ if (resizable) {
135
+ capturePromptInputTextareaUserResize(target, state);
136
+ }
137
+ else {
138
+ state.userHeightPx = null;
139
+ }
140
+ syncPromptInputTextareaRowsMinHeight(target, style, { rows, resizable }, state);
141
+ // Collapse first, so scrollHeight reports what the content needs rather
142
+ // than the current height.
143
+ target.style.height = "0px";
144
+ const { heightPx, overflowY } = computePromptInputTextareaHeight({
145
+ contentHeightPx: target.scrollHeight + verticalBorderPx(style),
146
+ rowsMinHeightPx: rowsMinHeightPx(rows, style),
147
+ userHeightPx: state.userHeightPx,
148
+ maxHeightPx,
149
+ });
150
+ target.style.height = `${styleHeightPx(heightPx, style)}px`;
151
+ target.style.overflowY = overflowY;
152
+ // Read back: the browser normalizes what was written.
153
+ state.lastInlineHeight = target.style.height;
154
+ }
155
+ //# sourceMappingURL=prompt-input-textarea-sizing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-input-textarea-sizing.js","sourceRoot":"","sources":["../../../../src/components/ui/prompt-input/prompt-input-textarea-sizing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6DH,SAAS,EAAE,CAAC,KAAa;IACvB,MAAM,MAAM,GAAW,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,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U,uBAAuB,CACrC,MAAuC,EACvC,KAAuC,EACvC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAoC,EAClE,KAAqC;IAErC,gEAAgE;IAChE,IAAI,SAAS,EAAE,CAAC;QACd,oCAAoC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,oCAAoC,CAClC,MAAM,EACN,KAAK,EACL,EAAE,IAAI,EAAE,SAAS,EAAE,EACnB,KAAK,CACN,CAAC;IAEF,wEAAwE;IACxE,2BAA2B;IAC3B,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,gCAAgC,CAAC;QAC/D,eAAe,EAAE,MAAM,CAAC,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAC;QAC9D,eAAe,EAAE,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC;QAC7C,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC;IAC5D,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACnC,sDAAsD;IACtD,KAAK,CAAC,gBAAgB,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;AAC/C,CAAC"}
@@ -6,7 +6,9 @@ export const promptInputVariantIds = [
6
6
  "ghost",
7
7
  ];
8
8
  export const promptInputSizeIds = ["sm", "default", "lg"];
9
- export const promptInputVariants = cva("group/prompt-input relative flex w-full flex-col overflow-hidden ring-offset-background transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-60", {
9
+ // `shrink-0`: `overflow-hidden` drops the form's automatic minimum height, so
10
+ // without it a flex column could squeeze the form and clip its toolbar.
11
+ export const promptInputVariants = cva("group/prompt-input relative flex w-full shrink-0 flex-col overflow-hidden ring-offset-background transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-60", {
10
12
  variants: {
11
13
  variant: {
12
14
  default: "rounded-md border border-input bg-background",
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-input-variants.js","sourceRoot":"","sources":["../../../../src/components/ui/prompt-input/prompt-input-variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;CAC6B,CAAC;AAGvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAsC,CAAC;AAG/F,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CACpC,yPAAyP,EACzP;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,8CAA8C;YACvD,QAAQ,EACN,yDAAyD;YAC3D,MAAM,EACJ,+CAA+C;YACjD,KAAK,EACH,gFAAgF;SACtC;QAC9C,IAAI,EAAE;YACJ,EAAE,EAAE,SAAS;YACb,OAAO,EAAE,SAAS;YAClB,EAAE,EAAE,WAAW;SAC0B;KAC5C;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAIF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,EAAE,EAAE,uCAAuC;IAC3C,OAAO,EAAE,yCAAyC;IAClD,EAAE,EAAE,uCAAuC;CACF,CAAC;AAE5C,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,EAAE,EAAE,wBAAwB;IAC5B,OAAO,EAAE,wBAAwB;IACjC,EAAE,EAAE,0BAA0B;CACW,CAAC"}
1
+ {"version":3,"file":"prompt-input-variants.js","sourceRoot":"","sources":["../../../../src/components/ui/prompt-input/prompt-input-variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;CAC6B,CAAC;AAGvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAsC,CAAC;AAG/F,8EAA8E;AAC9E,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CACpC,kQAAkQ,EAClQ;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,8CAA8C;YACvD,QAAQ,EACN,yDAAyD;YAC3D,MAAM,EACJ,+CAA+C;YACjD,KAAK,EACH,gFAAgF;SACtC;QAC9C,IAAI,EAAE;YACJ,EAAE,EAAE,SAAS;YACb,OAAO,EAAE,SAAS;YAClB,EAAE,EAAE,WAAW;SAC0B;KAC5C;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAIF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,EAAE,EAAE,uCAAuC;IAC3C,OAAO,EAAE,yCAAyC;IAClD,EAAE,EAAE,uCAAuC;CACF,CAAC;AAE5C,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,EAAE,EAAE,wBAAwB;IAC5B,OAAO,EAAE,wBAAwB;IACjC,EAAE,EAAE,0BAA0B;CACW,CAAC"}
@@ -63,8 +63,29 @@ export interface PromptInputTextareaProps extends Omit<TextareaHTMLAttributes<HT
63
63
  * textarea starts scrolling internally. Default: 240.
64
64
  */
65
65
  maxHeightPx?: number;
66
+ /**
67
+ * Fewest lines of text to show. Auto-resize never shrinks the textarea
68
+ * below this many rows, nor below the size's `min-h-*`. Default: 1.
69
+ */
70
+ rows?: number;
71
+ /**
72
+ * Let the user drag the textarea's bottom edge to resize it. The height
73
+ * they choose becomes its new floor: it stays through typing and after
74
+ * the value is cleared, and the textarea still grows with its content
75
+ * above it, up to `maxHeightPx` or the chosen height, whichever is
76
+ * taller. Dragging it smaller lowers the floor, but the drag stops at
77
+ * `rows`: the textarea gets an inline `min-height` for it, unless its CSS
78
+ * `min-height` is already taller. Default: false.
79
+ */
80
+ resizable?: boolean;
81
+ /**
82
+ * Grow and shrink the textarea with its content. Set to false for a plain
83
+ * textarea whose height comes only from `rows`, CSS and — with
84
+ * `resizable` — the user's drag. Default: true.
85
+ */
86
+ autoResize?: boolean;
66
87
  }
67
- declare function PromptInputTextarea({ className, submitOnEnter, maxHeightPx, onKeyDown, rows, ref: forwardedRef, ...props }: PromptInputTextareaProps & {
88
+ declare function PromptInputTextarea({ className, submitOnEnter, maxHeightPx, resizable, autoResize, onKeyDown, rows, ref: forwardedRef, ...props }: PromptInputTextareaProps & {
68
89
  ref?: Ref<HTMLTextAreaElement>;
69
90
  }): ReactElement;
70
91
  declare namespace PromptInputTextarea {