@duro-app/ui 5.26.0 → 5.27.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.
Files changed (43) hide show
  1. package/dist/components/CodeBlock/CodeBlock.d.ts +1 -1
  2. package/dist/components/CodeBlock/CodeBlock.d.ts.map +1 -1
  3. package/dist/components/CodeBlock/CodeBlock.meta.d.ts.map +1 -1
  4. package/dist/components/CodeBlock/CodeBlock.stories.d.ts +8 -0
  5. package/dist/components/CodeBlock/CodeBlock.stories.d.ts.map +1 -1
  6. package/dist/components/CodeBlock/DiffRows.d.ts +15 -0
  7. package/dist/components/CodeBlock/DiffRows.d.ts.map +1 -0
  8. package/dist/components/CodeBlock/diffRoles.d.ts +18 -0
  9. package/dist/components/CodeBlock/diffRoles.d.ts.map +1 -1
  10. package/dist/components/CodeBlock/styles.css.d.ts +43 -0
  11. package/dist/components/CodeBlock/styles.css.d.ts.map +1 -1
  12. package/dist/components/CodeBlock/types.d.ts +22 -0
  13. package/dist/components/CodeBlock/types.d.ts.map +1 -1
  14. package/dist/components/Textarea/Textarea.d.ts +7 -1
  15. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  16. package/dist/components/Textarea/Textarea.stories.d.ts +6 -0
  17. package/dist/components/Textarea/Textarea.stories.d.ts.map +1 -1
  18. package/dist/components/Textarea/styles.css.d.ts +3 -0
  19. package/dist/components/Textarea/styles.css.d.ts.map +1 -1
  20. package/dist/components/Textarea/useFileDrop.d.ts +9 -0
  21. package/dist/components/Textarea/useFileDrop.d.ts.map +1 -0
  22. package/dist/index.css +1 -1
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2141 -1978
  26. package/dist/index.js.map +1 -1
  27. package/package.json +2 -2
  28. package/src/components/CodeBlock/CodeBlock.meta.ts +2 -1
  29. package/src/components/CodeBlock/CodeBlock.native.tsx +12 -1
  30. package/src/components/CodeBlock/CodeBlock.stories.tsx +98 -0
  31. package/src/components/CodeBlock/CodeBlock.tsx +28 -10
  32. package/src/components/CodeBlock/DiffRows.tsx +101 -0
  33. package/src/components/CodeBlock/diffRoles.ts +42 -0
  34. package/src/components/CodeBlock/styles.css.ts +41 -0
  35. package/src/components/CodeBlock/types.ts +24 -0
  36. package/src/components/Textarea/Textarea.meta.ts +1 -1
  37. package/src/components/Textarea/Textarea.stories.tsx +41 -0
  38. package/src/components/Textarea/Textarea.tsx +21 -0
  39. package/src/components/Textarea/styles.css.ts +3 -0
  40. package/src/components/Textarea/useFileDrop.native.ts +6 -0
  41. package/src/components/Textarea/useFileDrop.ts +46 -0
  42. package/src/index.native.ts +1 -0
  43. package/src/index.ts +1 -0
@@ -7,5 +7,5 @@ export type { CodeBlockProps } from './types';
7
7
  * confirms ("Copied") on the button and through a polite LiveRegion. Inside
8
8
  * `Prose`, pass it as the Markdown renderer's `pre`.
9
9
  */
10
- export declare function CodeBlock({ children, language, copyLabel, copiedLabel, copiedDuration, onCopyError, }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function CodeBlock({ children, language, copyLabel, copiedLabel, copiedDuration, onCopyError, lineAction, renderAfterLine, }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
11
11
  //# sourceMappingURL=CodeBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAI3C,YAAY,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,WAAW,EACX,cAAqB,EACrB,WAAW,GACZ,EAAE,cAAc,2CA4DhB"}
1
+ {"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAK3C,YAAY,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,WAAW,EACX,cAAqB,EACrB,WAAW,EACX,UAAU,EACV,eAAe,GAChB,EAAE,cAAc,2CA2EhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.meta.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/CodeBlock.meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAEpD,eAAO,MAAM,IAAI,EAAE,aA0BlB,CAAA"}
1
+ {"version":3,"file":"CodeBlock.meta.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/CodeBlock.meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAEpD,eAAO,MAAM,IAAI,EAAE,aA2BlB,CAAA"}
@@ -74,4 +74,12 @@ export declare const CopyRefusedWithoutHandler: Story;
74
74
  export declare const Diff: Story;
75
75
  /** Diff's checks: each line carries its role, the language is exposed, copy keeps the raw text. */
76
76
  export declare const DiffChecks: Story;
77
+ /**
78
+ * `lineAction` puts a button beside each line inside a hunk (a review
79
+ * comment, say), and `renderAfterLine` shows content under a line, full
80
+ * width. The gutter is one tab stop: Up and Down move between its buttons.
81
+ */
82
+ export declare const DiffLineActions: Story;
83
+ /** DiffLineActions' checks: one tab stop, arrows move, the line handed over is numbered, copy keeps the diff. */
84
+ export declare const DiffLineActionsChecks: Story;
77
85
  //# sourceMappingURL=CodeBlock.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.stories.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/CodeBlock.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,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,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,cAAc,EAAE,MAAM,CAAA;IACtB,iEAAiE;IACjE,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACtC;AAKD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBqB,CAAA;AAE/B,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAYlC;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,KAAU,CAAA;AAEnC,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,EAAE,KAO9B,CAAA;AAED,yEAAyE;AACzE,eAAO,MAAM,eAAe,EAAE,KAS7B,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,qBAAqB,EAAE,KAUnC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAqBrC,CAAA;AAED,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,KAsBhC,CAAA;AAED,kEAAkE;AAClE,eAAO,MAAM,WAAW,EAAE,KAezB,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,yBAAyB,EAAE,KAsBvC,CAAA;AAID,0FAA0F;AAC1F,eAAO,MAAM,IAAI,EAAE,KAOlB,CAAA;AAED,mGAAmG;AACnG,eAAO,MAAM,UAAU,EAAE,KAkCxB,CAAA;AAeD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,KAkB7B,CAAA;AAED,iHAAiH;AACjH,eAAO,MAAM,qBAAqB,EAAE,KAoDnC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { DiffLineInfo } from './diffRoles';
3
+ import { CodeBlockLineAction } from './types';
4
+ /**
5
+ * A diff as rows rather than one `pre`, for when lines carry an action or
6
+ * content under them (a pre holds text only). Each row is a gutter and the
7
+ * line; content after a line spans the row. The gutter is one tab stop: the
8
+ * active line's button takes Tab, Up and Down move between the buttons.
9
+ */
10
+ export declare function DiffRows({ text, lineAction, renderAfterLine, }: {
11
+ text: string;
12
+ lineAction?: CodeBlockLineAction;
13
+ renderAfterLine?: (line: DiffLineInfo) => ReactNode;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ //# sourceMappingURL=DiffRows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffRows.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/DiffRows.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAEd,OAAO,EAAkC,KAAK,YAAY,EAAoB,MAAM,aAAa,CAAA;AAEjG,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAWhD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,UAAU,EACV,eAAe,GAChB,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,SAAS,CAAA;CACpD,2CA+DA"}
@@ -11,4 +11,22 @@ export declare function diffLineRole(line: string): DiffLineRole;
11
11
  export declare function splitDiffLines(text: string): DiffLine[];
12
12
  /** The text content of a node: strings, numbers and the elements around them. */
13
13
  export declare function textOf(node: ReactNode): string;
14
+ /** One line of a diff as a line action or after-line content sees it. */
15
+ export interface DiffLineInfo {
16
+ /** The line's position in the diff text, from 0. */
17
+ index: number;
18
+ role: DiffLineRole;
19
+ /** The line without its newline. */
20
+ text: string;
21
+ /** Its line number in the old file: removed and context lines inside a hunk, else null. */
22
+ oldLine: number | null;
23
+ /** Its line number in the new file: added and context lines inside a hunk, else null. */
24
+ newLine: number | null;
25
+ }
26
+ /**
27
+ * Numbers a diff's lines from its hunk headers (`@@ -12,4 +12,6 @@`). Lines
28
+ * before the first hunk (file headers) and the headers themselves have no
29
+ * line numbers.
30
+ */
31
+ export declare function numberDiffLines(lines: readonly DiffLine[]): DiffLineInfo[];
14
32
  //# sourceMappingURL=diffRoles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diffRoles.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/diffRoles.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAA;AAE9D,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnE,MAAM,WAAW,QAAQ;IACvB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAMvD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CASvD;AAED,iFAAiF;AACjF,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAO9C"}
1
+ {"version":3,"file":"diffRoles.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/diffRoles.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAA;AAE9D,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnE,MAAM,WAAW,QAAQ;IACvB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAMvD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CASvD;AAED,iFAAiF;AACjF,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAO9C;AAED,yEAAyE;AACzE,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,YAAY,CAAA;IAClB,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,2FAA2F;IAC3F,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,yFAAyF;IACzF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,YAAY,EAAE,CAoB1E"}
@@ -50,6 +50,49 @@ export declare const styles: Readonly<{
50
50
  readonly backgroundColor: css.StyleXClassNameFor<"backgroundColor", string>;
51
51
  readonly color: css.StyleXClassNameFor<"color", string>;
52
52
  }>;
53
+ readonly rows: Readonly<{
54
+ readonly display: css.StyleXClassNameFor<"display", "flex">;
55
+ readonly flexDirection: css.StyleXClassNameFor<"flexDirection", "column">;
56
+ readonly paddingTop: css.StyleXClassNameFor<"paddingTop", string>;
57
+ readonly paddingBottom: css.StyleXClassNameFor<"paddingBottom", string>;
58
+ readonly overflowX: css.StyleXClassNameFor<"overflowX", "auto">;
59
+ readonly color: css.StyleXClassNameFor<"color", string>;
60
+ }>;
61
+ readonly row: Readonly<{
62
+ readonly display: css.StyleXClassNameFor<"display", "flex">;
63
+ readonly alignItems: css.StyleXClassNameFor<"alignItems", "center">;
64
+ readonly minWidth: css.StyleXClassNameFor<"minWidth", "max-content">;
65
+ }>;
66
+ readonly gutter: Readonly<{
67
+ readonly display: css.StyleXClassNameFor<"display", "flex">;
68
+ readonly justifyContent: css.StyleXClassNameFor<"justifyContent", "center">;
69
+ readonly flexShrink: css.StyleXClassNameFor<"flexShrink", 0>;
70
+ readonly width: css.StyleXClassNameFor<"width", string>;
71
+ }>;
72
+ readonly rowText: Readonly<{
73
+ readonly whiteSpace: css.StyleXClassNameFor<"whiteSpace", "pre">;
74
+ readonly paddingRight: css.StyleXClassNameFor<"paddingRight", string>;
75
+ }>;
76
+ readonly lineAction: Readonly<{
77
+ readonly width: css.StyleXClassNameFor<"width", string>;
78
+ readonly height: css.StyleXClassNameFor<"height", string>;
79
+ readonly padding: css.StyleXClassNameFor<"padding", 0>;
80
+ readonly borderWidth: css.StyleXClassNameFor<"borderWidth", 0>;
81
+ readonly borderRadius: css.StyleXClassNameFor<"borderRadius", string>;
82
+ readonly backgroundColor: css.StyleXClassNameFor<"backgroundColor", string>;
83
+ readonly color: css.StyleXClassNameFor<"color", string>;
84
+ readonly font: css.StyleXClassNameFor<"font", "inherit">;
85
+ readonly cursor: css.StyleXClassNameFor<"cursor", "pointer">;
86
+ readonly outlineWidth: css.StyleXClassNameFor<"outlineWidth", string | 0>;
87
+ readonly outlineStyle: css.StyleXClassNameFor<"outlineStyle", "none" | "solid">;
88
+ readonly outlineColor: css.StyleXClassNameFor<"outlineColor", string>;
89
+ }>;
90
+ readonly after: Readonly<{
91
+ readonly paddingTop: css.StyleXClassNameFor<"paddingTop", string>;
92
+ readonly paddingBottom: css.StyleXClassNameFor<"paddingBottom", string>;
93
+ readonly paddingLeft: css.StyleXClassNameFor<"paddingLeft", string>;
94
+ readonly paddingRight: css.StyleXClassNameFor<"paddingRight", string>;
95
+ }>;
53
96
  readonly scroll: Readonly<{
54
97
  readonly paddingTop: css.StyleXClassNameFor<"paddingTop", string>;
55
98
  readonly paddingBottom: css.StyleXClassNameFor<"paddingBottom", string>;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/styles.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAKpC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DjB,CAAA"}
1
+ {"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/styles.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAMpC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmGjB,CAAA"}
@@ -1,4 +1,14 @@
1
1
  import { ReactNode } from 'react';
2
+ import { DiffLineInfo } from './diffRoles';
3
+ export type { DiffLineInfo } from './diffRoles';
4
+ /** An action offered on diff lines (comment on a line, link to it). */
5
+ export interface CodeBlockLineAction {
6
+ /** The button's accessible name for a line ("Comment on line 12"), from your text catalog. */
7
+ label: (line: DiffLineInfo) => string;
8
+ onAction: (line: DiffLineInfo) => void;
9
+ /** Which lines offer it. Default: every line inside a hunk (one with a line number). */
10
+ available?: (line: DiffLineInfo) => boolean;
11
+ }
2
12
  export interface CodeBlockProps {
3
13
  /**
4
14
  * The code: text, or the `<code>` element a Markdown renderer produced
@@ -25,5 +35,17 @@ export interface CodeBlockProps {
25
35
  copiedDuration?: number;
26
36
  /** Called when the clipboard refuses the write (an insecure context, a denied permission). */
27
37
  onCopyError?: (error: unknown) => void;
38
+ /**
39
+ * With `language="diff"`: a button in a gutter beside each line it is
40
+ * available on. The gutter is one tab stop; Up and Down move between its
41
+ * buttons.
42
+ */
43
+ lineAction?: CodeBlockLineAction;
44
+ /**
45
+ * With `language="diff"`: content shown under a line, full width (a comment
46
+ * thread, an editor). Return null for lines with nothing under them. What
47
+ * is copied stays the diff text.
48
+ */
49
+ renderAfterLine?: (line: DiffLineInfo) => ReactNode;
28
50
  }
29
51
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACvC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/CodeBlock/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AAE7C,YAAY,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AAE7C,uEAAuE;AACvE,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,KAAK,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,CAAA;IACrC,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;IACtC,wFAAwF;IACxF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAA;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,SAAS,CAAA;CACpD"}
@@ -28,8 +28,14 @@ interface TextareaBaseProps {
28
28
  * navigation of a list driven by this field. */
29
29
  onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
30
30
  onKeyUp?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
31
+ /**
32
+ * Web: files pasted into the field or dropped on it (a screenshot, a log).
33
+ * The field shows the drop ring while files are dragged over it. Text
34
+ * pastes and drops stay text. Native: never called; attach with FileTrigger.
35
+ */
36
+ onFiles?: (files: readonly File[]) => void;
31
37
  ref?: React.Ref<HTMLTextAreaElement>;
32
38
  }
33
- export declare function Textarea({ variant, name, placeholder, required, rows, autoGrow, maxRows, role, 'aria-controls': ariaControls, 'aria-expanded': ariaExpanded, 'aria-activedescendant': ariaActiveDescendant, 'aria-autocomplete': ariaAutocomplete, 'aria-haspopup': ariaHasPopup, value, defaultValue, disabled, autoFocus, onChange, onBlur, onFocus, onKeyDown, onKeyUp, ref, }: TextareaProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function Textarea({ variant, name, placeholder, required, rows, autoGrow, maxRows, role, 'aria-controls': ariaControls, 'aria-expanded': ariaExpanded, 'aria-activedescendant': ariaActiveDescendant, 'aria-autocomplete': ariaAutocomplete, 'aria-haspopup': ariaHasPopup, value, defaultValue, disabled, autoFocus, onChange, onBlur, onFocus, onKeyDown, onKeyUp, onFiles, ref, }: TextareaProps): import("react/jsx-runtime").JSX.Element;
34
40
  export {};
35
41
  //# sourceMappingURL=Textarea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAGA,OAAO,K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AM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IAC9D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IAC5D;qDACiD;IACjD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IACjE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IAC/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,KAAK,IAAI,CAAA;IAC1C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;CACrC;AAED,wBAAgB,QAAQ,CAAC,EACvB,OAAmB,EACnB,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,IAAQ,EACR,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,eAAe,EAAE,YAAY,EAC7B,eAAe,EAAE,YAAY,EAC7B,uBAAuB,EAAE,oBAAoB,EAC7C,mBAAmB,EAAE,gBAAgB,EACrC,eAAe,EAAE,YAAY,EAC7B,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,GAAG,GACJ,EAAE,aAAa,2CA2Ef"}
@@ -11,4 +11,10 @@ export declare const CustomRows: Story;
11
11
  export declare const AllVariants: Story;
12
12
  export declare const AutoGrow: Story;
13
13
  export declare const AnchoredListbox: Story;
14
+ /**
15
+ * `onFiles` (web): a file pasted into the field or dropped on it goes to
16
+ * `onFiles`; while files are dragged over it the field shows the drop ring.
17
+ * Pasted text stays text.
18
+ */
19
+ export declare const PasteAndDropFiles: Story;
14
20
  //# sourceMappingURL=Textarea.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AAIpD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AAKnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAc/B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAA;AAEtC,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAc5B,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAA;AAMD,eAAO,MAAM,WAAW,EAAE,KAezB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAgCtB,CAAA;AAmED,eAAO,MAAM,eAAe,EAAE,KAgC7B,CAAA"}
1
+ {"version":3,"file":"Textarea.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AAIpD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AAKnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAc/B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAA;AAEtC,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAc5B,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAA;AAMD,eAAO,MAAM,WAAW,EAAE,KAezB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAgCtB,CAAA;AAmED,eAAO,MAAM,eAAe,EAAE,KAgC7B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAkC/B,CAAA"}
@@ -30,5 +30,8 @@ export declare const styles: Readonly<{
30
30
  readonly error: Readonly<{
31
31
  readonly borderColor: css.StyleXClassNameFor<"borderColor", string>;
32
32
  }>;
33
+ readonly dropOver: Readonly<{
34
+ readonly boxShadow: css.StyleXClassNameFor<"boxShadow", string>;
35
+ }>;
33
36
  }>;
34
37
  //# sourceMappingURL=styles.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/styles.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAOpC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDjB,CAAA"}
1
+ {"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/styles.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AAQpC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDjB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * Files dropped on the field go to `onFiles`, and `over` says files are
4
+ * being dragged over it (for the drop ring). A listener on the element:
5
+ * react-strict-dom passes no drag events through. Text drags stay the
6
+ * browser's.
7
+ */
8
+ export declare function useFileDrop(ref: RefObject<HTMLTextAreaElement | null>, onFiles: ((files: readonly File[]) => void) | undefined): boolean;
9
+ //# sourceMappingURL=useFileDrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFileDrop.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/useFileDrop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAA;AAKzD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,EAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,KAAK,IAAI,CAAC,GAAG,SAAS,GACtD,OAAO,CA+BT"}