@gridui/composer 0.0.0-stage → 1.0.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/README.md CHANGED
@@ -1,3 +1,8 @@
1
- # Temporary Holding Version
1
+ # @gridui/composer
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Dashboard family. Public API: `AttachmentItem`, `AttachmentList`, `AttachmentListProps`, `Composer`, `ComposerProps`.
4
+
5
+ Import components from `@gridui/composer` and load `@gridui/composer/styles.css` after Theme.
6
+ Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
7
+
8
+ See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Composer
4
+ * @namespace AttachmentList
5
+ * @description Attachment List
6
+ */
7
+ import type { AttachmentItem } from "../shared/types";
8
+ import { type ComponentPropsWithRef, type FC } from "react";
9
+ export type AttachmentListProps = Omit<ComponentPropsWithRef<"ul">, "children"> & {
10
+ readonly items: readonly AttachmentItem[];
11
+ readonly label: string;
12
+ readonly removeLabel: (item: AttachmentItem) => string;
13
+ readonly onRemove?: (id: string) => void;
14
+ readonly disabled?: boolean;
15
+ };
16
+ export declare const AttachmentList: FC<AttachmentListProps>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Composer
4
+ * @namespace AttachmentList
5
+ * @description Style
6
+ */
7
+ export declare const attachmentListStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ export declare const attachmentStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
9
+ export declare const attachmentCopyStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
10
+ export declare const attachmentMetaStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Composer
4
+ * @namespace Composer
5
+ * @description Composer
6
+ */
7
+ import type { AttachmentItem } from "../shared/types";
8
+ import { type ButtonProps, type ButtonVariants } from "@gridui/button";
9
+ import { type TextareaProps } from "@gridui/input";
10
+ import { type ComponentPropsWithRef, type FC, type ReactNode } from "react";
11
+ export type ComposerProps = Omit<ComponentPropsWithRef<"div">, "children" | "onSubmit"> & {
12
+ readonly value: string;
13
+ readonly onValueChange: (value: string) => void;
14
+ readonly onSubmit: (value: string) => void;
15
+ readonly onStop?: () => void;
16
+ readonly busy?: boolean;
17
+ readonly editableWhileBusy?: boolean;
18
+ readonly submitWhileBusy?: boolean;
19
+ readonly submitShortcut?: "modifier-enter" | "enter";
20
+ readonly layout?: "stacked" | "inline";
21
+ readonly textareaProps?: Omit<TextareaProps, "value" | "defaultValue" | "onValueChange" | "disabled" | "readOnly" | "placeholder">;
22
+ readonly submitButtonProps?: Omit<ButtonProps, "children" | "onClick" | "disabled" | "loading" | "type" | "aria-label"> & ButtonVariants;
23
+ readonly submitContent?: ReactNode;
24
+ readonly disabled?: boolean;
25
+ readonly readOnly?: boolean;
26
+ readonly placeholder?: string;
27
+ readonly attachments?: readonly AttachmentItem[];
28
+ readonly onRemoveAttachment?: (id: string) => void;
29
+ readonly onFiles?: (files: readonly File[]) => void;
30
+ readonly accept?: string;
31
+ readonly tools?: ReactNode;
32
+ readonly notice?: ReactNode;
33
+ readonly labels: {
34
+ readonly input: string;
35
+ readonly submit: string;
36
+ readonly stop: string;
37
+ readonly attach: string;
38
+ readonly attachments: string;
39
+ readonly removeAttachment: (item: AttachmentItem) => string;
40
+ };
41
+ };
42
+ export declare const Composer: FC<ComposerProps>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Composer
4
+ * @namespace Composer
5
+ * @description Style
6
+ */
7
+ export declare const composerStyles: (props?: ({
8
+ layout?: "inline" | "stacked" | null | undefined;
9
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
+ export declare const composerActionsStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Composer
4
+ * @namespace Root
5
+ * @description Index
6
+ */
7
+ export type { AttachmentListProps } from "./attachment-list/attachment-list";
8
+ export { AttachmentList } from "./attachment-list/attachment-list";
9
+ export type { ComposerProps } from "./composer/composer";
10
+ export { Composer } from "./composer/composer";
11
+ export type { AttachmentItem } from "./shared/types";
package/dist/index.js ADDED
@@ -0,0 +1,300 @@
1
+ // src/attachment-list/style.ts
2
+ import { cva } from "class-variance-authority";
3
+ var attachmentListStyles = cva("m-0 flex min-w-0 list-none flex-col p-0 focus:min-h-11");
4
+ var attachmentStyles = cva("flex min-w-0 flex-wrap items-center gap-gridui-8 border-b border-border py-gridui-8 data-[state=error]:text-danger-foreground");
5
+ var attachmentCopyStyles = cva("flex min-w-0 flex-1 flex-col wrap-anywhere");
6
+ var attachmentMetaStyles = cva("text-muted type-caption");
7
+
8
+ // src/attachment-list/attachment-list.tsx
9
+ import { Button } from "@gridui/button";
10
+ import { cn } from "@gridui/style-utils";
11
+ import { useLayoutEffect, useRef } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var AttachmentList = (props) => {
14
+ const {
15
+ items,
16
+ label,
17
+ removeLabel,
18
+ onRemove,
19
+ disabled = false,
20
+ className,
21
+ ref,
22
+ ...restProps
23
+ } = props;
24
+ const buttons = useRef(/* @__PURE__ */ new Map());
25
+ const pending = useRef(null);
26
+ const list = useRef(null);
27
+ useLayoutEffect(() => {
28
+ const removed = pending.current;
29
+ if (removed && !items.some((item) => {
30
+ return item.id === removed.id;
31
+ })) {
32
+ const next = items[Math.min(removed.index, items.length - 1)];
33
+ (next ? buttons.current.get(next.id) : list.current)?.focus();
34
+ pending.current = null;
35
+ }
36
+ }, [items]);
37
+ return /* @__PURE__ */ jsx(
38
+ "ul",
39
+ {
40
+ ...restProps,
41
+ ref: (element) => {
42
+ list.current = element;
43
+ if (typeof ref === "function") {
44
+ return ref(element);
45
+ }
46
+ if (ref) {
47
+ ref.current = element;
48
+ }
49
+ },
50
+ "aria-label": label,
51
+ tabIndex: -1,
52
+ className: cn(attachmentListStyles(), className),
53
+ children: items.map((item, index) => {
54
+ return /* @__PURE__ */ jsxs(
55
+ "li",
56
+ {
57
+ className: attachmentStyles(),
58
+ "data-state": item.state,
59
+ children: [
60
+ /* @__PURE__ */ jsxs(
61
+ "div",
62
+ {
63
+ className: attachmentCopyStyles(),
64
+ children: [
65
+ /* @__PURE__ */ jsx("span", { children: item.name }),
66
+ /* @__PURE__ */ jsx(
67
+ "span",
68
+ {
69
+ className: attachmentMetaStyles(),
70
+ children: item.description
71
+ }
72
+ ),
73
+ /* @__PURE__ */ jsx(
74
+ "span",
75
+ {
76
+ className: attachmentMetaStyles(),
77
+ children: item.stateLabel
78
+ }
79
+ )
80
+ ]
81
+ }
82
+ ),
83
+ onRemove && /* @__PURE__ */ jsx(
84
+ Button,
85
+ {
86
+ ref: (element) => {
87
+ if (element) {
88
+ buttons.current.set(item.id, element);
89
+ } else {
90
+ buttons.current.delete(item.id);
91
+ }
92
+ },
93
+ variant: "quiet",
94
+ layout: "icon",
95
+ "aria-label": removeLabel(item),
96
+ title: removeLabel(item),
97
+ disabled,
98
+ onClick: () => {
99
+ pending.current = {
100
+ id: item.id,
101
+ index
102
+ };
103
+ onRemove(item.id);
104
+ },
105
+ children: /* @__PURE__ */ jsx(
106
+ "span",
107
+ {
108
+ "aria-hidden": "true",
109
+ children: "\xD7"
110
+ }
111
+ )
112
+ }
113
+ )
114
+ ]
115
+ },
116
+ item.id
117
+ );
118
+ })
119
+ }
120
+ );
121
+ };
122
+
123
+ // src/composer/style.ts
124
+ import { cva as cva2 } from "class-variance-authority";
125
+ var composerStyles = cva2("min-w-0 gap-gridui-8 border border-border bg-background p-gridui-16 text-foreground", {
126
+ variants: {
127
+ layout: {
128
+ stacked: "flex flex-col",
129
+ inline: "grid grid-cols-[minmax(0,1fr)_auto] items-end"
130
+ }
131
+ },
132
+ defaultVariants: {
133
+ layout: "stacked"
134
+ }
135
+ });
136
+ var composerActionsStyles = cva2("flex flex-wrap items-center justify-end gap-gridui-8");
137
+
138
+ // src/composer/composer.tsx
139
+ import { Button as Button2 } from "@gridui/button";
140
+ import { FilePicker } from "@gridui/file-picker";
141
+ import { Textarea } from "@gridui/input";
142
+ import { cn as cn2 } from "@gridui/style-utils";
143
+ import { useId, useRef as useRef2 } from "react";
144
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
145
+ var Composer = (props) => {
146
+ const {
147
+ value,
148
+ onValueChange,
149
+ onSubmit,
150
+ onStop,
151
+ busy = false,
152
+ editableWhileBusy = false,
153
+ submitWhileBusy = false,
154
+ submitShortcut = "modifier-enter",
155
+ layout = "stacked",
156
+ textareaProps,
157
+ submitButtonProps,
158
+ submitContent,
159
+ disabled = false,
160
+ readOnly = false,
161
+ placeholder,
162
+ attachments = [],
163
+ onRemoveAttachment,
164
+ onFiles,
165
+ accept = "",
166
+ tools,
167
+ notice,
168
+ labels,
169
+ className,
170
+ ...restProps
171
+ } = props;
172
+ const id = useId();
173
+ const isComposing = useRef2(false);
174
+ const inputDisabled = disabled || busy && !editableWhileBusy;
175
+ const editingDisabled = inputDisabled || readOnly;
176
+ const hasContent = value.trim().length > 0 || attachments.length > 0;
177
+ const attachmentsReady = attachments.every((item) => {
178
+ return item.state === "ready";
179
+ });
180
+ const canSubmit = !disabled && !readOnly && (!busy || submitWhileBusy) && hasContent && attachmentsReady;
181
+ const submit = () => {
182
+ if (canSubmit) {
183
+ onSubmit(value);
184
+ }
185
+ };
186
+ const handleKeyDown = (event) => {
187
+ textareaProps?.onKeyDown?.(event);
188
+ if (event.defaultPrevented || event.nativeEvent.isComposing || isComposing.current) {
189
+ return;
190
+ }
191
+ let isSubmitShortcut = false;
192
+ if (submitShortcut === "enter") {
193
+ isSubmitShortcut = event.key === "Enter" && !event.shiftKey;
194
+ } else {
195
+ isSubmitShortcut = event.key === "Enter" && (event.ctrlKey || event.metaKey);
196
+ }
197
+ if (isSubmitShortcut) {
198
+ event.preventDefault();
199
+ submit();
200
+ }
201
+ };
202
+ return /* @__PURE__ */ jsxs2(
203
+ "div",
204
+ {
205
+ ...restProps,
206
+ className: cn2(composerStyles({ layout }), className),
207
+ children: [
208
+ /* @__PURE__ */ jsx2(
209
+ AttachmentList,
210
+ {
211
+ className: cn2(
212
+ layout === "inline" && "col-span-full",
213
+ layout === "inline" && attachments.length === 0 && !onRemoveAttachment && "hidden"
214
+ ),
215
+ items: attachments,
216
+ label: labels.attachments,
217
+ removeLabel: labels.removeAttachment,
218
+ ...onRemoveAttachment ? { onRemove: onRemoveAttachment } : {},
219
+ disabled: editingDisabled
220
+ }
221
+ ),
222
+ /* @__PURE__ */ jsx2(
223
+ Textarea,
224
+ {
225
+ autoSize: true,
226
+ maxHeight: 240,
227
+ ...textareaProps,
228
+ "aria-label": labels.input,
229
+ value,
230
+ onValueChange,
231
+ placeholder,
232
+ disabled: inputDisabled,
233
+ readOnly,
234
+ onCompositionStart: (event) => {
235
+ isComposing.current = true;
236
+ textareaProps?.onCompositionStart?.(event);
237
+ },
238
+ onCompositionEnd: (event) => {
239
+ isComposing.current = false;
240
+ textareaProps?.onCompositionEnd?.(event);
241
+ },
242
+ onKeyDown: handleKeyDown
243
+ }
244
+ ),
245
+ /* @__PURE__ */ jsxs2(
246
+ "div",
247
+ {
248
+ className: composerActionsStyles(),
249
+ children: [
250
+ onFiles && /* @__PURE__ */ jsx2(
251
+ FilePicker,
252
+ {
253
+ inputId: id,
254
+ label: labels.attach,
255
+ action: labels.attach,
256
+ accept,
257
+ multiple: true,
258
+ onFiles,
259
+ disabled: editingDisabled
260
+ }
261
+ ),
262
+ tools,
263
+ busy && !submitWhileBusy ? /* @__PURE__ */ jsx2(
264
+ Button2,
265
+ {
266
+ variant: "secondary",
267
+ onClick: onStop,
268
+ disabled: disabled || !onStop,
269
+ children: labels.stop
270
+ }
271
+ ) : /* @__PURE__ */ jsx2(
272
+ Button2,
273
+ {
274
+ ...submitButtonProps,
275
+ type: "button",
276
+ "aria-label": labels.submit,
277
+ onClick: submit,
278
+ disabled: !canSubmit,
279
+ children: submitContent ?? labels.submit
280
+ }
281
+ )
282
+ ]
283
+ }
284
+ ),
285
+ notice && /* @__PURE__ */ jsx2(
286
+ "div",
287
+ {
288
+ className: layout === "inline" ? "col-span-full" : void 0,
289
+ children: notice
290
+ }
291
+ )
292
+ ]
293
+ }
294
+ );
295
+ };
296
+ export {
297
+ AttachmentList,
298
+ Composer
299
+ };
300
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/attachment-list/style.ts", "../src/attachment-list/attachment-list.tsx", "../src/composer/style.ts", "../src/composer/composer.tsx"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Composer\n * @namespace AttachmentList\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const attachmentListStyles = cva(\"m-0 flex min-w-0 list-none flex-col p-0 focus:min-h-11\");\n\nexport const attachmentStyles = cva(\"flex min-w-0 flex-wrap items-center gap-gridui-8 border-b border-border py-gridui-8 data-[state=error]:text-danger-foreground\");\n\nexport const attachmentCopyStyles = cva(\"flex min-w-0 flex-1 flex-col wrap-anywhere\");\n\nexport const attachmentMetaStyles = cva(\"text-muted type-caption\");\n", "/**\n * @author WMXPY\n * @package Composer\n * @namespace AttachmentList\n * @description Attachment List\n */\n\nimport type { AttachmentItem } from \"../shared/types\";\nimport { attachmentCopyStyles, attachmentListStyles, attachmentMetaStyles, attachmentStyles } from \"./style\";\nimport { Button } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type ComponentPropsWithRef, type FC, useLayoutEffect, useRef } from \"react\";\n\nexport type AttachmentListProps = Omit<ComponentPropsWithRef<\"ul\">, \"children\"> & {\n readonly items: readonly AttachmentItem[];\n readonly label: string;\n readonly removeLabel: (item: AttachmentItem) => string;\n readonly onRemove?: (id: string) => void;\n readonly disabled?: boolean;\n};\n\nexport const AttachmentList: FC<AttachmentListProps> = (props: AttachmentListProps) => {\n const {\n items,\n label,\n removeLabel,\n onRemove,\n disabled = false,\n className,\n ref,\n ...restProps\n } = props;\n const buttons = useRef(new Map<string, HTMLButtonElement>());\n const pending = useRef<{\n id: string;\n index: number;\n } | null>(null);\n const list = useRef<HTMLUListElement | null>(null);\n useLayoutEffect(() => {\n const removed = pending.current;\n if (removed && !items.some(item => {\n return item.id === removed.id;\n })) {\n const next = items[Math.min(removed.index, items.length - 1)];\n (next ? buttons.current.get(next.id) : list.current)?.focus();\n pending.current = null;\n }\n }, [items]);\n return (<ul\n {...restProps}\n ref={element => {\n list.current = element;\n if (typeof ref === \"function\") {\n return ref(element);\n }\n if (ref) {\n ref.current = element;\n }\n }}\n aria-label={label}\n tabIndex={-1}\n className={cn(attachmentListStyles(), className)}\n >\n {items.map((item, index) => {\n return (<li\n key={item.id}\n className={attachmentStyles()}\n data-state={item.state}\n >\n <div\n className={attachmentCopyStyles()}\n >\n <span>\n {item.name}\n </span>\n <span\n className={attachmentMetaStyles()}\n >\n {item.description}\n </span>\n <span\n className={attachmentMetaStyles()}\n >\n {item.stateLabel}\n </span>\n </div>\n {onRemove && (<Button\n ref={element => {\n if (element) {\n buttons.current.set(item.id, element);\n } else {\n buttons.current.delete(item.id);\n }\n }}\n variant=\"quiet\"\n layout=\"icon\"\n aria-label={removeLabel(item)}\n title={removeLabel(item)}\n disabled={disabled}\n onClick={() => {\n pending.current = {\n id: item.id,\n index,\n };\n onRemove(item.id);\n }}\n >\n <span\n aria-hidden=\"true\"\n >\n \u00D7\n </span>\n </Button>)}\n </li>);\n })}\n </ul>);\n};\n", "/**\n * @author WMXPY\n * @package Composer\n * @namespace Composer\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const composerStyles = cva(\"min-w-0 gap-gridui-8 border border-border bg-background p-gridui-16 text-foreground\", {\n variants: {\n layout: {\n stacked: \"flex flex-col\",\n inline: \"grid grid-cols-[minmax(0,1fr)_auto] items-end\",\n },\n },\n defaultVariants: {\n layout: \"stacked\",\n },\n});\n\nexport const composerActionsStyles = cva(\"flex flex-wrap items-center justify-end gap-gridui-8\");\n", "/**\n * @author WMXPY\n * @package Composer\n * @namespace Composer\n * @description Composer\n */\n\nimport { AttachmentList } from \"../attachment-list/attachment-list\";\nimport type { AttachmentItem } from \"../shared/types\";\nimport { composerActionsStyles, composerStyles } from \"./style\";\nimport { Button, type ButtonProps, type ButtonVariants } from \"@gridui/button\";\nimport { FilePicker } from \"@gridui/file-picker\";\nimport { Textarea, type TextareaProps } from \"@gridui/input\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type ComponentPropsWithRef, type FC, type KeyboardEvent, type ReactNode, useId, useRef } from \"react\";\n\nexport type ComposerProps = Omit<ComponentPropsWithRef<\"div\">, \"children\" | \"onSubmit\"> & {\n readonly value: string;\n readonly onValueChange: (value: string) => void;\n readonly onSubmit: (value: string) => void;\n readonly onStop?: () => void;\n readonly busy?: boolean;\n readonly editableWhileBusy?: boolean;\n readonly submitWhileBusy?: boolean;\n readonly submitShortcut?: \"modifier-enter\" | \"enter\";\n readonly layout?: \"stacked\" | \"inline\";\n readonly textareaProps?: Omit<TextareaProps, \"value\" | \"defaultValue\" | \"onValueChange\" | \"disabled\" | \"readOnly\" | \"placeholder\">;\n readonly submitButtonProps?: Omit<ButtonProps, \"children\" | \"onClick\" | \"disabled\" | \"loading\" | \"type\" | \"aria-label\"> & ButtonVariants;\n readonly submitContent?: ReactNode;\n readonly disabled?: boolean;\n readonly readOnly?: boolean;\n readonly placeholder?: string;\n readonly attachments?: readonly AttachmentItem[];\n readonly onRemoveAttachment?: (id: string) => void;\n readonly onFiles?: (files: readonly File[]) => void;\n readonly accept?: string;\n readonly tools?: ReactNode;\n readonly notice?: ReactNode;\n readonly labels: {\n readonly input: string;\n readonly submit: string;\n readonly stop: string;\n readonly attach: string;\n readonly attachments: string;\n readonly removeAttachment: (item: AttachmentItem) => string;\n };\n};\n\nexport const Composer: FC<ComposerProps> = (props: ComposerProps) => {\n const {\n value,\n onValueChange,\n onSubmit,\n onStop,\n busy = false,\n editableWhileBusy = false,\n submitWhileBusy = false,\n submitShortcut = \"modifier-enter\",\n layout = \"stacked\",\n textareaProps,\n submitButtonProps,\n submitContent,\n disabled = false,\n readOnly = false,\n placeholder,\n attachments = [],\n onRemoveAttachment,\n onFiles,\n accept = \"\",\n tools,\n notice,\n labels,\n className,\n ...restProps\n } = props;\n const id = useId();\n const isComposing = useRef(false);\n const inputDisabled = disabled || (busy && !editableWhileBusy);\n const editingDisabled = inputDisabled || readOnly;\n const hasContent = value.trim().length > 0 || attachments.length > 0;\n const attachmentsReady = attachments.every(item => {\n return item.state === \"ready\";\n });\n const canSubmit = !disabled && !readOnly && (!busy || submitWhileBusy) && hasContent && attachmentsReady;\n const submit = () => {\n if (canSubmit) {\n onSubmit(value);\n }\n };\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n textareaProps?.onKeyDown?.(event);\n if (event.defaultPrevented || event.nativeEvent.isComposing || isComposing.current) {\n return;\n }\n let isSubmitShortcut = false;\n if (submitShortcut === \"enter\") {\n isSubmitShortcut = event.key === \"Enter\" && !event.shiftKey;\n } else {\n isSubmitShortcut = event.key === \"Enter\" && (event.ctrlKey || event.metaKey);\n }\n if (isSubmitShortcut) {\n event.preventDefault();\n submit();\n }\n };\n return (<div\n {...restProps}\n className={cn(composerStyles({ layout }), className)}\n >\n <AttachmentList\n className={cn(\n layout === \"inline\" && \"col-span-full\",\n layout === \"inline\" && attachments.length === 0 && !onRemoveAttachment && \"hidden\",\n )}\n items={attachments}\n label={labels.attachments}\n removeLabel={labels.removeAttachment}\n {...(onRemoveAttachment ? { onRemove: onRemoveAttachment } : {})}\n disabled={editingDisabled}\n />\n <Textarea\n autoSize\n maxHeight={240}\n {...textareaProps}\n aria-label={labels.input}\n value={value}\n onValueChange={onValueChange}\n placeholder={placeholder}\n disabled={inputDisabled}\n readOnly={readOnly}\n onCompositionStart={event => {\n isComposing.current = true;\n textareaProps?.onCompositionStart?.(event);\n }}\n onCompositionEnd={event => {\n isComposing.current = false;\n textareaProps?.onCompositionEnd?.(event);\n }}\n onKeyDown={handleKeyDown}\n />\n <div\n className={composerActionsStyles()}\n >\n {onFiles && (<FilePicker\n inputId={id}\n label={labels.attach}\n action={labels.attach}\n accept={accept}\n multiple\n onFiles={onFiles}\n disabled={editingDisabled}\n />)}\n {tools}\n {busy && !submitWhileBusy ? (<Button\n variant=\"secondary\"\n onClick={onStop}\n disabled={disabled || !onStop}\n >\n {labels.stop}\n </Button>)\n : (<Button\n {...submitButtonProps}\n type=\"button\"\n aria-label={labels.submit}\n onClick={submit}\n disabled={!canSubmit}\n >\n {submitContent ?? labels.submit}\n </Button>)}\n </div>\n {notice && (<div\n className={layout === \"inline\" ? \"col-span-full\" : undefined}\n >\n {notice}\n </div>)}\n </div>);\n};\n"],
5
+ "mappings": ";AAOA,SAAS,WAAW;AAEb,IAAM,uBAAuB,IAAI,wDAAwD;AAEzF,IAAM,mBAAmB,IAAI,+HAA+H;AAE5J,IAAM,uBAAuB,IAAI,4CAA4C;AAE7E,IAAM,uBAAuB,IAAI,yBAAyB;;;ACNjE,SAAS,cAAc;AACvB,SAAS,UAAU;AACnB,SAA8C,iBAAiB,cAAc;AA0D7D,SAGI,KAHJ;AAhDT,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACP,IAAI;AACJ,QAAM,UAAU,OAAO,oBAAI,IAA+B,CAAC;AAC3D,QAAM,UAAU,OAGN,IAAI;AACd,QAAM,OAAO,OAAgC,IAAI;AACjD,kBAAgB,MAAM;AAClB,UAAM,UAAU,QAAQ;AACxB,QAAI,WAAW,CAAC,MAAM,KAAK,UAAQ;AAC/B,a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", "jsxs"]
7
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Composer
4
+ * @namespace Shared
5
+ * @description Types
6
+ */
7
+ export type AttachmentItem = {
8
+ readonly id: string;
9
+ readonly name: string;
10
+ readonly state: "ready" | "pending" | "error";
11
+ readonly stateLabel: string;
12
+ readonly description?: string;
13
+ };
@@ -0,0 +1,112 @@
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
+ @layer theme, base, components, utilities;
4
+ @layer theme {
5
+ :root, :host {
6
+ --spacing: 0.25rem;
7
+ }
8
+ }
9
+ @layer utilities {
10
+ .col-span-full {
11
+ grid-column: 1 / -1;
12
+ }
13
+ .m-0 {
14
+ margin: 0px;
15
+ }
16
+ .flex {
17
+ display: flex;
18
+ }
19
+ .grid {
20
+ display: grid;
21
+ }
22
+ .hidden {
23
+ display: none;
24
+ }
25
+ .inline {
26
+ display: inline;
27
+ }
28
+ .min-w-0 {
29
+ min-width: 0px;
30
+ }
31
+ .flex-1 {
32
+ flex: 1;
33
+ }
34
+ .list-none {
35
+ list-style-type: none;
36
+ }
37
+ .grid-cols-\[minmax\(0\,1fr\)_auto\] {
38
+ grid-template-columns: minmax(0,1fr) auto;
39
+ }
40
+ .flex-col {
41
+ flex-direction: column;
42
+ }
43
+ .flex-wrap {
44
+ flex-wrap: wrap;
45
+ }
46
+ .items-center {
47
+ align-items: center;
48
+ }
49
+ .items-end {
50
+ align-items: flex-end;
51
+ }
52
+ .justify-end {
53
+ justify-content: flex-end;
54
+ }
55
+ .gap-gridui-8 {
56
+ gap: var(--gridui-space-8);
57
+ }
58
+ .border {
59
+ border-style: var(--tw-border-style);
60
+ border-width: 1px;
61
+ }
62
+ .border-b {
63
+ border-bottom-style: var(--tw-border-style);
64
+ border-bottom-width: 1px;
65
+ }
66
+ .border-border {
67
+ border-color: var(--gridui-border);
68
+ }
69
+ .bg-background {
70
+ background-color: var(--gridui-background);
71
+ }
72
+ .p-0 {
73
+ padding: 0px;
74
+ }
75
+ .p-gridui-16 {
76
+ padding: var(--gridui-space-16);
77
+ }
78
+ .py-gridui-8 {
79
+ padding-block: var(--gridui-space-8);
80
+ }
81
+ .type-caption {
82
+ font: var(--gridui-type-caption);
83
+ letter-spacing: normal;
84
+ }
85
+ .wrap-anywhere {
86
+ overflow-wrap: anywhere;
87
+ }
88
+ .text-foreground {
89
+ color: var(--gridui-foreground);
90
+ }
91
+ .text-muted {
92
+ color: var(--gridui-muted);
93
+ }
94
+ .focus\:min-h-11:focus {
95
+ min-height: calc(var(--spacing) * 11);
96
+ }
97
+ .data-\[state\=error\]\:text-danger-foreground[data-state="error"] {
98
+ color: var(--gridui-danger-foreground);
99
+ }
100
+ }
101
+ @property --tw-border-style {
102
+ syntax: "*";
103
+ inherits: false;
104
+ initial-value: solid;
105
+ }
106
+ @layer properties {
107
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
108
+ *, ::before, ::after, ::backdrop {
109
+ --tw-border-style: solid;
110
+ }
111
+ }
112
+ }
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@gridui/composer",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "GridUI React composer",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "sideEffects": [
12
+ "**/*.css"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./styles.css": "./dist/styles.css"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "peerDependencies": {
25
+ "react": "^19.2.0",
26
+ "react-dom": "^19.2.0"
27
+ },
28
+ "dependencies": {
29
+ "@gridui/button": "^2.1.1",
30
+ "@gridui/file-picker": "^1.0.0",
31
+ "@gridui/input": "^1.0.0",
32
+ "@gridui/style-utils": "^2.1.2",
33
+ "@gridui/theme": "^2.1.2",
34
+ "class-variance-authority": "0.7.1"
35
+ },
36
+ "devDependencies": {
37
+ "@gridui-internal/configuration": "0.0.0",
38
+ "@jest/globals": "30.5.2",
39
+ "@types/jest": "30.0.0",
40
+ "@types/node": "26.6.5",
41
+ "@types/react": "19.3.0",
42
+ "@types/react-dom": "19.3.0",
43
+ "jest": "30.5.2",
44
+ "react": "19.3.1",
45
+ "react-dom": "19.3.1",
46
+ "typescript": "6.0.3"
47
+ },
48
+ "scripts": {
49
+ "build": "node ../../scripts/compilation/package.ts",
50
+ "compile": "tsc --project tsconfig.json",
51
+ "test": "jest --passWithNoTests",
52
+ "coverage": "jest --coverage --passWithNoTests"
53
+ }
6
54
  }