@codemation/ui 0.2.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 (41) hide show
  1. package/.turbo/turbo-build.log +19 -0
  2. package/.turbo/turbo-lint.log +4 -0
  3. package/.turbo/turbo-typecheck.log +4 -0
  4. package/CHANGELOG.md +25 -0
  5. package/LICENSE +37 -0
  6. package/dist/index.cjs +845 -0
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.d.cts +417 -0
  9. package/dist/index.d.ts +417 -0
  10. package/dist/index.js +749 -0
  11. package/dist/index.js.map +1 -0
  12. package/package.json +71 -0
  13. package/src/components/StatusPill.tsx +33 -0
  14. package/src/components/composite/CodemationDialog.tsx +137 -0
  15. package/src/components/composite/JsonMonacoEditor.tsx +75 -0
  16. package/src/components/reui/tree/Tree.tsx +35 -0
  17. package/src/components/reui/tree/TreeContext.ts +21 -0
  18. package/src/components/reui/tree/TreeDragLine.tsx +28 -0
  19. package/src/components/reui/tree/TreeItem.tsx +51 -0
  20. package/src/components/reui/tree/TreeItemLabel.tsx +58 -0
  21. package/src/components/ui/badge.tsx +40 -0
  22. package/src/components/ui/button.tsx +64 -0
  23. package/src/components/ui/collapsible.tsx +26 -0
  24. package/src/components/ui/dialog.tsx +137 -0
  25. package/src/components/ui/dropdown-menu.tsx +239 -0
  26. package/src/components/ui/input.tsx +20 -0
  27. package/src/components/ui/label.tsx +18 -0
  28. package/src/components/ui/select.tsx +171 -0
  29. package/src/components/ui/switch.tsx +29 -0
  30. package/src/components/ui/tabs.tsx +76 -0
  31. package/src/components/ui/textarea.tsx +18 -0
  32. package/src/index.ts +76 -0
  33. package/src/lib/cn.ts +6 -0
  34. package/src/lucide-icons.d.ts +46 -0
  35. package/test/StatusPill.test.tsx +26 -0
  36. package/test/primitives.test.tsx +707 -0
  37. package/test/setup.ts +7 -0
  38. package/test/ui-components.test.tsx +208 -0
  39. package/tsconfig.json +11 -0
  40. package/tsdown.config.ts +10 -0
  41. package/vitest.ui.config.ts +40 -0
@@ -0,0 +1,417 @@
1
+ import { ClassValue } from "clsx";
2
+ import * as React from "react";
3
+ import { ButtonHTMLAttributes, HTMLAttributes } from "react";
4
+ import { VariantProps } from "class-variance-authority";
5
+ import { Collapsible as Collapsible$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Label as Label$1, Select as Select$1, Switch as Switch$1, Tabs as Tabs$1 } from "radix-ui";
6
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
7
+ import * as class_variance_authority_types0 from "class-variance-authority/types";
8
+ import { ItemInstance } from "@headless-tree/core";
9
+
10
+ //#region src/lib/cn.d.ts
11
+ declare function cn(...inputs: ClassValue[]): string;
12
+ //#endregion
13
+ //#region src/components/ui/badge.d.ts
14
+ declare const badgeVariants: (props?: ({
15
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
16
+ } & class_variance_authority_types0.ClassProp) | undefined) => string;
17
+ declare function Badge({
18
+ className,
19
+ variant,
20
+ asChild,
21
+ ...props
22
+ }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
23
+ asChild?: boolean;
24
+ }): react_jsx_runtime0.JSX.Element;
25
+ //#endregion
26
+ //#region src/components/ui/input.d.ts
27
+ declare function Input({
28
+ className,
29
+ type,
30
+ ...props
31
+ }: React.ComponentProps<"input">): react_jsx_runtime0.JSX.Element;
32
+ //#endregion
33
+ //#region src/components/ui/label.d.ts
34
+ declare function Label({
35
+ className,
36
+ ...props
37
+ }: React.ComponentProps<typeof Label$1.Root>): react_jsx_runtime0.JSX.Element;
38
+ //#endregion
39
+ //#region src/components/ui/switch.d.ts
40
+ declare function Switch({
41
+ className,
42
+ ...props
43
+ }: React.ComponentProps<typeof Switch$1.Root>): react_jsx_runtime0.JSX.Element;
44
+ //#endregion
45
+ //#region src/components/ui/button.d.ts
46
+ declare const buttonVariants: (props?: ({
47
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
48
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
49
+ } & class_variance_authority_types0.ClassProp) | undefined) => string;
50
+ declare function Button({
51
+ className,
52
+ variant,
53
+ size,
54
+ asChild,
55
+ ...props
56
+ }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
57
+ asChild?: boolean;
58
+ }): react_jsx_runtime0.JSX.Element;
59
+ //#endregion
60
+ //#region src/components/ui/collapsible.d.ts
61
+ declare function Collapsible(props: React.ComponentProps<typeof Collapsible$1.Root>): react_jsx_runtime0.JSX.Element;
62
+ declare function CollapsibleTrigger(props: React.ComponentProps<typeof Collapsible$1.Trigger>): react_jsx_runtime0.JSX.Element;
63
+ declare function CollapsibleContent({
64
+ className,
65
+ ...props
66
+ }: React.ComponentProps<typeof Collapsible$1.Content>): react_jsx_runtime0.JSX.Element;
67
+ //#endregion
68
+ //#region src/components/ui/dialog.d.ts
69
+ declare function Dialog({
70
+ ...props
71
+ }: React.ComponentProps<typeof Dialog$1.Root>): react_jsx_runtime0.JSX.Element;
72
+ declare function DialogTrigger({
73
+ ...props
74
+ }: React.ComponentProps<typeof Dialog$1.Trigger>): react_jsx_runtime0.JSX.Element;
75
+ declare function DialogPortal({
76
+ ...props
77
+ }: React.ComponentProps<typeof Dialog$1.Portal>): react_jsx_runtime0.JSX.Element;
78
+ declare function DialogClose({
79
+ ...props
80
+ }: React.ComponentProps<typeof Dialog$1.Close>): react_jsx_runtime0.JSX.Element;
81
+ declare function DialogOverlay({
82
+ className,
83
+ ...props
84
+ }: React.ComponentProps<typeof Dialog$1.Overlay>): react_jsx_runtime0.JSX.Element;
85
+ declare function DialogContent({
86
+ className,
87
+ children,
88
+ showCloseButton,
89
+ ...props
90
+ }: React.ComponentProps<typeof Dialog$1.Content> & {
91
+ showCloseButton?: boolean;
92
+ }): react_jsx_runtime0.JSX.Element;
93
+ declare function DialogHeader({
94
+ className,
95
+ ...props
96
+ }: React.ComponentProps<"div">): react_jsx_runtime0.JSX.Element;
97
+ declare function DialogFooter({
98
+ className,
99
+ showCloseButton,
100
+ children,
101
+ ...props
102
+ }: React.ComponentProps<"div"> & {
103
+ showCloseButton?: boolean;
104
+ }): react_jsx_runtime0.JSX.Element;
105
+ declare function DialogTitle({
106
+ className,
107
+ ...props
108
+ }: React.ComponentProps<typeof Dialog$1.Title>): react_jsx_runtime0.JSX.Element;
109
+ declare function DialogDescription({
110
+ className,
111
+ ...props
112
+ }: React.ComponentProps<typeof Dialog$1.Description>): react_jsx_runtime0.JSX.Element;
113
+ //#endregion
114
+ //#region src/components/ui/dropdown-menu.d.ts
115
+ declare function DropdownMenu({
116
+ ...props
117
+ }: React.ComponentProps<typeof DropdownMenu$1.Root>): react_jsx_runtime0.JSX.Element;
118
+ declare function DropdownMenuPortal({
119
+ ...props
120
+ }: React.ComponentProps<typeof DropdownMenu$1.Portal>): react_jsx_runtime0.JSX.Element;
121
+ declare function DropdownMenuTrigger({
122
+ ...props
123
+ }: React.ComponentProps<typeof DropdownMenu$1.Trigger>): react_jsx_runtime0.JSX.Element;
124
+ declare function DropdownMenuContent({
125
+ className,
126
+ align,
127
+ sideOffset,
128
+ ...props
129
+ }: React.ComponentProps<typeof DropdownMenu$1.Content>): react_jsx_runtime0.JSX.Element;
130
+ declare function DropdownMenuGroup({
131
+ ...props
132
+ }: React.ComponentProps<typeof DropdownMenu$1.Group>): react_jsx_runtime0.JSX.Element;
133
+ declare function DropdownMenuItem({
134
+ className,
135
+ inset,
136
+ variant,
137
+ ...props
138
+ }: React.ComponentProps<typeof DropdownMenu$1.Item> & {
139
+ inset?: boolean;
140
+ variant?: "default" | "destructive";
141
+ }): react_jsx_runtime0.JSX.Element;
142
+ declare function DropdownMenuCheckboxItem({
143
+ className,
144
+ children,
145
+ checked,
146
+ inset,
147
+ ...props
148
+ }: React.ComponentProps<typeof DropdownMenu$1.CheckboxItem> & {
149
+ inset?: boolean;
150
+ }): react_jsx_runtime0.JSX.Element;
151
+ declare function DropdownMenuRadioGroup({
152
+ ...props
153
+ }: React.ComponentProps<typeof DropdownMenu$1.RadioGroup>): react_jsx_runtime0.JSX.Element;
154
+ declare function DropdownMenuRadioItem({
155
+ className,
156
+ children,
157
+ inset,
158
+ ...props
159
+ }: React.ComponentProps<typeof DropdownMenu$1.RadioItem> & {
160
+ inset?: boolean;
161
+ }): react_jsx_runtime0.JSX.Element;
162
+ declare function DropdownMenuLabel({
163
+ className,
164
+ inset,
165
+ ...props
166
+ }: React.ComponentProps<typeof DropdownMenu$1.Label> & {
167
+ inset?: boolean;
168
+ }): react_jsx_runtime0.JSX.Element;
169
+ declare function DropdownMenuSeparator({
170
+ className,
171
+ ...props
172
+ }: React.ComponentProps<typeof DropdownMenu$1.Separator>): react_jsx_runtime0.JSX.Element;
173
+ declare function DropdownMenuShortcut({
174
+ className,
175
+ ...props
176
+ }: React.ComponentProps<"span">): react_jsx_runtime0.JSX.Element;
177
+ declare function DropdownMenuSub({
178
+ ...props
179
+ }: React.ComponentProps<typeof DropdownMenu$1.Sub>): react_jsx_runtime0.JSX.Element;
180
+ declare function DropdownMenuSubTrigger({
181
+ className,
182
+ inset,
183
+ children,
184
+ ...props
185
+ }: React.ComponentProps<typeof DropdownMenu$1.SubTrigger> & {
186
+ inset?: boolean;
187
+ }): react_jsx_runtime0.JSX.Element;
188
+ declare function DropdownMenuSubContent({
189
+ className,
190
+ ...props
191
+ }: React.ComponentProps<typeof DropdownMenu$1.SubContent>): react_jsx_runtime0.JSX.Element;
192
+ //#endregion
193
+ //#region src/components/ui/select.d.ts
194
+ declare function Select({
195
+ ...props
196
+ }: React.ComponentProps<typeof Select$1.Root>): react_jsx_runtime0.JSX.Element;
197
+ declare function SelectGroup({
198
+ className,
199
+ ...props
200
+ }: React.ComponentProps<typeof Select$1.Group>): react_jsx_runtime0.JSX.Element;
201
+ declare function SelectValue({
202
+ ...props
203
+ }: React.ComponentProps<typeof Select$1.Value>): react_jsx_runtime0.JSX.Element;
204
+ declare function SelectTrigger({
205
+ className,
206
+ size,
207
+ children,
208
+ ...props
209
+ }: React.ComponentProps<typeof Select$1.Trigger> & {
210
+ size?: "sm" | "default";
211
+ }): react_jsx_runtime0.JSX.Element;
212
+ declare function SelectContent({
213
+ className,
214
+ children,
215
+ position,
216
+ align,
217
+ ...props
218
+ }: React.ComponentProps<typeof Select$1.Content>): react_jsx_runtime0.JSX.Element;
219
+ declare function SelectLabel({
220
+ className,
221
+ ...props
222
+ }: React.ComponentProps<typeof Select$1.Label>): react_jsx_runtime0.JSX.Element;
223
+ declare function SelectItem({
224
+ className,
225
+ children,
226
+ ...props
227
+ }: React.ComponentProps<typeof Select$1.Item>): react_jsx_runtime0.JSX.Element;
228
+ declare function SelectSeparator({
229
+ className,
230
+ ...props
231
+ }: React.ComponentProps<typeof Select$1.Separator>): react_jsx_runtime0.JSX.Element;
232
+ declare function SelectScrollUpButton({
233
+ className,
234
+ ...props
235
+ }: React.ComponentProps<typeof Select$1.ScrollUpButton>): react_jsx_runtime0.JSX.Element;
236
+ declare function SelectScrollDownButton({
237
+ className,
238
+ ...props
239
+ }: React.ComponentProps<typeof Select$1.ScrollDownButton>): react_jsx_runtime0.JSX.Element;
240
+ //#endregion
241
+ //#region src/components/ui/tabs.d.ts
242
+ declare function Tabs({
243
+ className,
244
+ orientation,
245
+ ...props
246
+ }: React.ComponentProps<typeof Tabs$1.Root>): react_jsx_runtime0.JSX.Element;
247
+ declare const tabsListVariants: (props?: ({
248
+ variant?: "default" | "line" | null | undefined;
249
+ } & class_variance_authority_types0.ClassProp) | undefined) => string;
250
+ declare function TabsList({
251
+ className,
252
+ variant,
253
+ ...props
254
+ }: React.ComponentProps<typeof Tabs$1.List> & VariantProps<typeof tabsListVariants>): react_jsx_runtime0.JSX.Element;
255
+ declare function TabsTrigger({
256
+ className,
257
+ ...props
258
+ }: React.ComponentProps<typeof Tabs$1.Trigger>): react_jsx_runtime0.JSX.Element;
259
+ declare function TabsContent({
260
+ className,
261
+ ...props
262
+ }: React.ComponentProps<typeof Tabs$1.Content>): react_jsx_runtime0.JSX.Element;
263
+ //#endregion
264
+ //#region src/components/ui/textarea.d.ts
265
+ declare function Textarea({
266
+ className,
267
+ ...props
268
+ }: React.ComponentProps<"textarea">): react_jsx_runtime0.JSX.Element;
269
+ //#endregion
270
+ //#region src/components/reui/tree/TreeContext.d.ts
271
+ type ToggleIconType = "chevron" | "plus-minus";
272
+ type TreeContextValue<T = unknown> = {
273
+ indent: number;
274
+ currentItem?: ItemInstance<T>;
275
+ tree?: {
276
+ getContainerProps?: () => Record<string, unknown>;
277
+ getDragLineStyle?: () => Record<string, unknown> | null;
278
+ };
279
+ toggleIconType?: ToggleIconType;
280
+ };
281
+ declare const TreeContext: React.Context<TreeContextValue<unknown>>;
282
+ //#endregion
283
+ //#region src/components/reui/tree/Tree.d.ts
284
+ type TreeProps = HTMLAttributes<HTMLDivElement> & {
285
+ indent?: number;
286
+ tree?: {
287
+ getContainerProps?: () => Record<string, unknown>;
288
+ };
289
+ toggleIconType?: ToggleIconType;
290
+ asChild?: boolean;
291
+ };
292
+ declare function Tree(args: Readonly<TreeProps>): react_jsx_runtime0.JSX.Element;
293
+ //#endregion
294
+ //#region src/components/reui/tree/TreeDragLine.d.ts
295
+ declare function TreeDragLine(args: Readonly<HTMLAttributes<HTMLDivElement>>): react_jsx_runtime0.JSX.Element | null;
296
+ //#endregion
297
+ //#region src/components/reui/tree/TreeItem.d.ts
298
+ type TreeItemProps<T = unknown> = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "indent"> & {
299
+ item: ItemInstance<T>;
300
+ indent?: number;
301
+ asChild?: boolean;
302
+ };
303
+ declare function TreeItem<T = unknown>(args: Readonly<TreeItemProps<T>>): react_jsx_runtime0.JSX.Element;
304
+ //#endregion
305
+ //#region src/components/reui/tree/TreeItemLabel.d.ts
306
+ type TreeItemLabelProps = HTMLAttributes<HTMLSpanElement> & {
307
+ item?: {
308
+ isFolder: () => boolean;
309
+ isExpanded: () => boolean;
310
+ getItemName: () => string;
311
+ };
312
+ asChild?: boolean;
313
+ };
314
+ declare function TreeItemLabel(args: Readonly<TreeItemLabelProps>): react_jsx_runtime0.JSX.Element | null;
315
+ //#endregion
316
+ //#region src/components/composite/CodemationDialog.d.ts
317
+ declare const maxWidthBySize: {
318
+ readonly narrow: "sm:max-w-lg";
319
+ readonly wide: "sm:max-w-2xl";
320
+ readonly full: "sm:max-w-[min(92vw,960px)]";
321
+ };
322
+ type CodemationDialogSize = keyof typeof maxWidthBySize;
323
+ type CodemationDialogRootProps = Readonly<{
324
+ children: React.ReactNode;
325
+ onClose: () => void;
326
+ /** Root `data-testid` (applied to the dialog panel). */
327
+ testId?: string;
328
+ /** `dialog` (default) or `alertdialog` for confirmations. */
329
+ role?: "dialog" | "alertdialog";
330
+ /** Max width preset; default `wide`. */
331
+ size?: CodemationDialogSize;
332
+ /** Extra classes on the Radix panel (e.g. `max-h-[min(90vh,640px)]`). */
333
+ contentClassName?: string;
334
+ /** Corner X to dismiss (Radix); default false — use `<CodemationDialog.Actions>` for explicit buttons. */
335
+ showCloseButton?: boolean;
336
+ }>;
337
+ declare function CodemationDialogRoot({
338
+ children,
339
+ onClose,
340
+ testId,
341
+ role,
342
+ size,
343
+ contentClassName,
344
+ showCloseButton
345
+ }: CodemationDialogRootProps): react_jsx_runtime0.JSX.Element;
346
+ type CodemationDialogTitleProps = Readonly<{
347
+ children: React.ReactNode;
348
+ className?: string;
349
+ }>;
350
+ /**
351
+ * Do not set `id` on the underlying Radix `DialogTitle` — the dialog root assigns `titleId`
352
+ * in context; overriding `id` breaks `aria-labelledby` and Radix dev warnings.
353
+ */
354
+ declare function CodemationDialogTitle({
355
+ children,
356
+ className
357
+ }: CodemationDialogTitleProps): react_jsx_runtime0.JSX.Element;
358
+ type CodemationDialogContentProps = Readonly<{
359
+ children: React.ReactNode;
360
+ className?: string;
361
+ }>;
362
+ declare function CodemationDialogContent({
363
+ children,
364
+ className
365
+ }: CodemationDialogContentProps): react_jsx_runtime0.JSX.Element;
366
+ type CodemationDialogActionsProps = Readonly<{
367
+ children: React.ReactNode;
368
+ /** Toolbar directly under the title (e.g. filters). Default is footer actions. */
369
+ position?: "top" | "bottom";
370
+ /** Flex alignment for the button row. */
371
+ align?: "start" | "end" | "between";
372
+ className?: string;
373
+ }>;
374
+ declare function CodemationDialogActions({
375
+ children,
376
+ position,
377
+ align,
378
+ className
379
+ }: CodemationDialogActionsProps): react_jsx_runtime0.JSX.Element;
380
+ type CodemationDialogCompound = typeof CodemationDialogRoot & {
381
+ Title: typeof CodemationDialogTitle;
382
+ Content: typeof CodemationDialogContent;
383
+ Actions: typeof CodemationDialogActions;
384
+ };
385
+ declare const CodemationDialog: CodemationDialogCompound;
386
+ //#endregion
387
+ //#region src/components/composite/JsonMonacoEditor.d.ts
388
+ /**
389
+ * Monaco-based JSON editor with a mirrored, visually hidden `<textarea>` that carries the same value.
390
+ * Tests and automation can drive `data-testid` on that textarea because Monaco's surface is not a reliable
391
+ * DOM target for `fireEvent.change` / user typing simulation.
392
+ */
393
+ declare function JsonMonacoEditor(args: Readonly<{
394
+ path: string;
395
+ value: string;
396
+ onChange: (value: string | undefined) => void;
397
+ /** Shown below the editor region when set. */
398
+ error?: string | null;
399
+ /** Passed to the hidden textarea for stable test selectors. */
400
+ testId?: string;
401
+ }>): react_jsx_runtime0.JSX.Element;
402
+ //#endregion
403
+ //#region src/components/StatusPill.d.ts
404
+ type StatusKind = "success" | "warning" | "danger" | "neutral" | "info";
405
+ interface StatusPillProps {
406
+ status: StatusKind;
407
+ children?: React.ReactNode;
408
+ className?: string;
409
+ }
410
+ declare function StatusPill({
411
+ status,
412
+ children,
413
+ className
414
+ }: StatusPillProps): react_jsx_runtime0.JSX.Element;
415
+ //#endregion
416
+ export { Badge, Button, CodemationDialog, type CodemationDialogActionsProps, type CodemationDialogCompound, type CodemationDialogContentProps, type CodemationDialogRootProps, type CodemationDialogSize, type CodemationDialogTitleProps, Collapsible, CollapsibleContent, CollapsibleTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, JsonMonacoEditor, Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type StatusKind, StatusPill, type StatusPillProps, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToggleIconType, Tree, TreeContext, type TreeContextValue, TreeDragLine, TreeItem, TreeItemLabel, badgeVariants, buttonVariants, cn, tabsListVariants };
417
+ //# sourceMappingURL=index.d.ts.map