@open-elements/ui 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/components/delete-confirm-dialog.d.ts +14 -0
- package/dist/components/delete-confirm-dialog.d.ts.map +1 -0
- package/dist/components/delete-confirm-dialog.js +22 -0
- package/dist/components/delete-confirm-dialog.js.map +1 -0
- package/dist/components/detail-field.d.ts +21 -0
- package/dist/components/detail-field.d.ts.map +1 -0
- package/dist/components/detail-field.js +47 -0
- package/dist/components/detail-field.js.map +1 -0
- package/dist/components/markdown-editor.d.ts +3 -0
- package/dist/components/markdown-editor.d.ts.map +1 -0
- package/dist/components/markdown-editor.js +77 -0
- package/dist/components/markdown-editor.js.map +1 -0
- package/dist/components/markdown-view.d.ts +3 -0
- package/dist/components/markdown-view.d.ts.map +1 -0
- package/dist/components/markdown-view.js +46 -0
- package/dist/components/markdown-view.js.map +1 -0
- package/dist/components/user-avatar.d.ts +3 -0
- package/dist/components/user-avatar.d.ts.map +1 -0
- package/dist/components/user-avatar.js +38 -0
- package/dist/components/user-avatar.js.map +1 -0
- package/dist/components/user-multi-select.d.ts +3 -0
- package/dist/components/user-multi-select.d.ts.map +1 -0
- package/dist/components/user-multi-select.js +46 -0
- package/dist/components/user-multi-select.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +16 -4
- package/src/components/__tests__/markdown-editor.test.tsx +35 -0
- package/src/components/__tests__/markdown-view.test.tsx +32 -0
- package/src/components/__tests__/user-avatar.test.tsx +68 -0
- package/src/components/__tests__/user-multi-select.test.tsx +97 -0
- package/src/components/delete-confirm-dialog.tsx +80 -0
- package/src/components/detail-field.tsx +156 -0
- package/src/components/markdown-editor.tsx +143 -0
- package/src/components/markdown-view.tsx +49 -0
- package/src/components/user-avatar.tsx +60 -0
- package/src/components/user-multi-select.tsx +134 -0
- package/src/index.ts +20 -0
- package/src/types/index.ts +36 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEditor, EditorContent, type Editor } from "@tiptap/react";
|
|
4
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
5
|
+
import Link from "@tiptap/extension-link";
|
|
6
|
+
import Placeholder from "@tiptap/extension-placeholder";
|
|
7
|
+
import { Markdown } from "tiptap-markdown";
|
|
8
|
+
import { Bold, Italic, Strikethrough, Link as LinkIcon, Unlink } from "lucide-react";
|
|
9
|
+
import { useEffect, useCallback } from "react";
|
|
10
|
+
import { cn } from "../lib/utils.ts";
|
|
11
|
+
import type { MarkdownEditorProps } from "../types/index.ts";
|
|
12
|
+
|
|
13
|
+
function ToolbarButton({
|
|
14
|
+
active,
|
|
15
|
+
disabled,
|
|
16
|
+
onClick,
|
|
17
|
+
children,
|
|
18
|
+
title,
|
|
19
|
+
}: {
|
|
20
|
+
readonly active?: boolean;
|
|
21
|
+
readonly disabled?: boolean;
|
|
22
|
+
readonly onClick: () => void;
|
|
23
|
+
readonly children: React.ReactNode;
|
|
24
|
+
readonly title: string;
|
|
25
|
+
}) {
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
title={title}
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
onClick={onClick}
|
|
32
|
+
className={cn(
|
|
33
|
+
"rounded p-1.5 transition-colors",
|
|
34
|
+
active
|
|
35
|
+
? "bg-oe-dark/10 text-oe-dark"
|
|
36
|
+
: "text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
37
|
+
disabled && "cursor-not-allowed opacity-40",
|
|
38
|
+
)}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</button>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function Toolbar({ editor }: { readonly editor: Editor | null }) {
|
|
46
|
+
const setLink = useCallback(() => {
|
|
47
|
+
if (!editor) return;
|
|
48
|
+
const previousUrl = editor.getAttributes("link").href ?? "";
|
|
49
|
+
const url = window.prompt("URL", previousUrl);
|
|
50
|
+
if (url === null) return;
|
|
51
|
+
if (url === "") {
|
|
52
|
+
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
|
56
|
+
}, [editor]);
|
|
57
|
+
|
|
58
|
+
if (!editor) return null;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className="flex items-center gap-0.5 border-b px-2 py-1.5">
|
|
62
|
+
<ToolbarButton
|
|
63
|
+
title="Bold"
|
|
64
|
+
active={editor.isActive("bold")}
|
|
65
|
+
onClick={() => editor.chain().focus().toggleBold().run()}
|
|
66
|
+
>
|
|
67
|
+
<Bold className="h-4 w-4" />
|
|
68
|
+
</ToolbarButton>
|
|
69
|
+
<ToolbarButton
|
|
70
|
+
title="Italic"
|
|
71
|
+
active={editor.isActive("italic")}
|
|
72
|
+
onClick={() => editor.chain().focus().toggleItalic().run()}
|
|
73
|
+
>
|
|
74
|
+
<Italic className="h-4 w-4" />
|
|
75
|
+
</ToolbarButton>
|
|
76
|
+
<ToolbarButton
|
|
77
|
+
title="Strikethrough"
|
|
78
|
+
active={editor.isActive("strike")}
|
|
79
|
+
onClick={() => editor.chain().focus().toggleStrike().run()}
|
|
80
|
+
>
|
|
81
|
+
<Strikethrough className="h-4 w-4" />
|
|
82
|
+
</ToolbarButton>
|
|
83
|
+
<div className="bg-border mx-1 h-5 w-px" />
|
|
84
|
+
<ToolbarButton title="Link" active={editor.isActive("link")} onClick={setLink}>
|
|
85
|
+
<LinkIcon className="h-4 w-4" />
|
|
86
|
+
</ToolbarButton>
|
|
87
|
+
{editor.isActive("link") && (
|
|
88
|
+
<ToolbarButton title="Remove link" onClick={() => editor.chain().focus().unsetLink().run()}>
|
|
89
|
+
<Unlink className="h-4 w-4" />
|
|
90
|
+
</ToolbarButton>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function MarkdownEditor({ value, onChange, placeholder }: MarkdownEditorProps) {
|
|
97
|
+
const editor = useEditor({
|
|
98
|
+
extensions: [
|
|
99
|
+
StarterKit.configure({
|
|
100
|
+
heading: false,
|
|
101
|
+
codeBlock: false,
|
|
102
|
+
blockquote: false,
|
|
103
|
+
horizontalRule: false,
|
|
104
|
+
bulletList: false,
|
|
105
|
+
orderedList: false,
|
|
106
|
+
listItem: false,
|
|
107
|
+
}),
|
|
108
|
+
Link.configure({
|
|
109
|
+
openOnClick: false,
|
|
110
|
+
HTMLAttributes: { class: "text-blue-600 underline" },
|
|
111
|
+
}),
|
|
112
|
+
Placeholder.configure({ placeholder: placeholder ?? "" }),
|
|
113
|
+
Markdown,
|
|
114
|
+
],
|
|
115
|
+
content: value,
|
|
116
|
+
immediatelyRender: false,
|
|
117
|
+
onUpdate: ({ editor: ed }) => {
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
+
onChange((ed.storage as any).markdown.getMarkdown());
|
|
120
|
+
},
|
|
121
|
+
editorProps: {
|
|
122
|
+
attributes: {
|
|
123
|
+
class: "prose prose-sm max-w-none px-3 py-2 min-h-[120px] outline-none",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!editor) return;
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
131
|
+
const currentMarkdown = (editor.storage as any).markdown.getMarkdown();
|
|
132
|
+
if (value !== currentMarkdown) {
|
|
133
|
+
editor.commands.setContent(value);
|
|
134
|
+
}
|
|
135
|
+
}, [value, editor]);
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<div className="bg-background rounded-md border">
|
|
139
|
+
<Toolbar editor={editor} />
|
|
140
|
+
<EditorContent editor={editor} />
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useEditor, EditorContent } from "@tiptap/react";
|
|
5
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
6
|
+
import Link from "@tiptap/extension-link";
|
|
7
|
+
import { Markdown } from "tiptap-markdown";
|
|
8
|
+
import type { MarkdownViewProps } from "../types/index.ts";
|
|
9
|
+
|
|
10
|
+
export function MarkdownView({ content }: MarkdownViewProps) {
|
|
11
|
+
const editor = useEditor({
|
|
12
|
+
extensions: [
|
|
13
|
+
StarterKit.configure({
|
|
14
|
+
heading: false,
|
|
15
|
+
codeBlock: false,
|
|
16
|
+
blockquote: false,
|
|
17
|
+
horizontalRule: false,
|
|
18
|
+
bulletList: false,
|
|
19
|
+
orderedList: false,
|
|
20
|
+
listItem: false,
|
|
21
|
+
}),
|
|
22
|
+
Link.configure({
|
|
23
|
+
openOnClick: true,
|
|
24
|
+
HTMLAttributes: {
|
|
25
|
+
class: "text-blue-600 underline",
|
|
26
|
+
target: "_blank",
|
|
27
|
+
rel: "noopener noreferrer",
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
Markdown,
|
|
31
|
+
],
|
|
32
|
+
content,
|
|
33
|
+
immediatelyRender: false,
|
|
34
|
+
editable: false,
|
|
35
|
+
editorProps: {
|
|
36
|
+
attributes: {
|
|
37
|
+
class: "prose prose-sm max-w-none",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (editor) {
|
|
44
|
+
editor.commands.setContent(content);
|
|
45
|
+
}
|
|
46
|
+
}, [content, editor]);
|
|
47
|
+
|
|
48
|
+
return <EditorContent editor={editor} />;
|
|
49
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils.ts";
|
|
4
|
+
import type { UserAvatarProps } from "../types/index.ts";
|
|
5
|
+
|
|
6
|
+
function getInitials(name: string): string {
|
|
7
|
+
return name
|
|
8
|
+
.split(" ")
|
|
9
|
+
.map((part) => part[0])
|
|
10
|
+
.filter(Boolean)
|
|
11
|
+
.slice(0, 2)
|
|
12
|
+
.join("")
|
|
13
|
+
.toUpperCase();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const AVATAR_COLORS = [
|
|
17
|
+
"bg-blue-500",
|
|
18
|
+
"bg-green-500",
|
|
19
|
+
"bg-purple-500",
|
|
20
|
+
"bg-orange-500",
|
|
21
|
+
"bg-pink-500",
|
|
22
|
+
"bg-teal-500",
|
|
23
|
+
"bg-indigo-500",
|
|
24
|
+
"bg-red-500",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
function getColorForUser(id: string): string {
|
|
28
|
+
let hash = 0;
|
|
29
|
+
for (let i = 0; i < id.length; i++) {
|
|
30
|
+
hash = id.charCodeAt(i) + ((hash << 5) - hash);
|
|
31
|
+
}
|
|
32
|
+
return AVATAR_COLORS[Math.abs(hash) % AVATAR_COLORS.length];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function UserAvatar({ user, size = "sm" }: UserAvatarProps) {
|
|
36
|
+
const sizeClasses = size === "sm" ? "h-6 w-6 text-[10px]" : "h-8 w-8 text-xs";
|
|
37
|
+
const imgSizeClasses = size === "sm" ? "h-6 w-6" : "h-8 w-8";
|
|
38
|
+
|
|
39
|
+
if (user.avatarUrl) {
|
|
40
|
+
return (
|
|
41
|
+
<img
|
|
42
|
+
src={user.avatarUrl}
|
|
43
|
+
alt={user.name}
|
|
44
|
+
className={cn("shrink-0 rounded-full object-cover", imgSizeClasses)}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<span
|
|
51
|
+
className={cn(
|
|
52
|
+
"inline-flex shrink-0 items-center justify-center rounded-full font-medium text-white",
|
|
53
|
+
getColorForUser(user.id),
|
|
54
|
+
sizeClasses,
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
{getInitials(user.name)}
|
|
58
|
+
</span>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Check, ChevronsUpDown, X } from "lucide-react";
|
|
5
|
+
import { Button } from "./button.tsx";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover.tsx";
|
|
7
|
+
import { cn } from "../lib/utils.ts";
|
|
8
|
+
import { UserAvatar } from "./user-avatar.tsx";
|
|
9
|
+
import type { UserMultiSelectProps } from "../types/index.ts";
|
|
10
|
+
|
|
11
|
+
export function UserMultiSelect({
|
|
12
|
+
users,
|
|
13
|
+
selectedIds,
|
|
14
|
+
onChange,
|
|
15
|
+
disabledIds = [],
|
|
16
|
+
translations,
|
|
17
|
+
}: UserMultiSelectProps) {
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const [search, setSearch] = useState("");
|
|
20
|
+
|
|
21
|
+
const toggle = (id: string) => {
|
|
22
|
+
if (disabledIds.includes(id)) return;
|
|
23
|
+
if (selectedIds.includes(id)) {
|
|
24
|
+
onChange(selectedIds.filter((s) => s !== id));
|
|
25
|
+
} else {
|
|
26
|
+
onChange([...selectedIds, id]);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const selectedUsers = users.filter((u) => selectedIds.includes(u.id));
|
|
31
|
+
const filteredUsers = search
|
|
32
|
+
? users.filter(
|
|
33
|
+
(u) =>
|
|
34
|
+
u.name.toLowerCase().includes(search.toLowerCase()) ||
|
|
35
|
+
u.email.toLowerCase().includes(search.toLowerCase()),
|
|
36
|
+
)
|
|
37
|
+
: users;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
41
|
+
<PopoverTrigger asChild>
|
|
42
|
+
<Button
|
|
43
|
+
variant="outline"
|
|
44
|
+
role="combobox"
|
|
45
|
+
aria-expanded={open}
|
|
46
|
+
className="h-auto min-h-[40px] w-full justify-between"
|
|
47
|
+
type="button"
|
|
48
|
+
>
|
|
49
|
+
<div className="flex flex-wrap gap-1.5 overflow-hidden">
|
|
50
|
+
{selectedUsers.length > 0 ? (
|
|
51
|
+
selectedUsers.map((user) => {
|
|
52
|
+
const isDisabled = disabledIds.includes(user.id);
|
|
53
|
+
return (
|
|
54
|
+
<span
|
|
55
|
+
key={user.id}
|
|
56
|
+
className="bg-muted inline-flex items-center gap-1.5 rounded-full py-0.5 pr-2 pl-1 text-xs font-medium"
|
|
57
|
+
>
|
|
58
|
+
<UserAvatar user={user} size="sm" />
|
|
59
|
+
<span className="max-w-[120px] truncate">{user.name}</span>
|
|
60
|
+
{!isDisabled && (
|
|
61
|
+
<span
|
|
62
|
+
role="button"
|
|
63
|
+
tabIndex={0}
|
|
64
|
+
onClick={(e) => {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
toggle(user.id);
|
|
68
|
+
}}
|
|
69
|
+
onKeyDown={(e) => {
|
|
70
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
toggle(user.id);
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
className="text-muted-foreground hover:text-foreground ml-0.5 cursor-pointer"
|
|
77
|
+
>
|
|
78
|
+
<X className="h-3 w-3" />
|
|
79
|
+
</span>
|
|
80
|
+
)}
|
|
81
|
+
</span>
|
|
82
|
+
);
|
|
83
|
+
})
|
|
84
|
+
) : (
|
|
85
|
+
<span className="text-muted-foreground">{translations.placeholder}</span>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
89
|
+
</Button>
|
|
90
|
+
</PopoverTrigger>
|
|
91
|
+
<PopoverContent className="w-[320px] p-0" align="start">
|
|
92
|
+
<div className="border-b p-2">
|
|
93
|
+
<input
|
|
94
|
+
type="text"
|
|
95
|
+
placeholder={translations.searchPlaceholder}
|
|
96
|
+
value={search}
|
|
97
|
+
onChange={(e) => setSearch(e.target.value)}
|
|
98
|
+
className="placeholder:text-muted-foreground w-full rounded-md border-0 bg-transparent px-2 py-1.5 text-sm outline-none"
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
<div className="max-h-[300px] overflow-y-auto p-1">
|
|
102
|
+
{filteredUsers.map((user) => {
|
|
103
|
+
const isSelected = selectedIds.includes(user.id);
|
|
104
|
+
const isDisabled = disabledIds.includes(user.id);
|
|
105
|
+
return (
|
|
106
|
+
<button
|
|
107
|
+
key={user.id}
|
|
108
|
+
type="button"
|
|
109
|
+
onClick={() => toggle(user.id)}
|
|
110
|
+
disabled={isDisabled}
|
|
111
|
+
className={cn(
|
|
112
|
+
"hover:bg-accent flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",
|
|
113
|
+
isDisabled && "cursor-not-allowed opacity-60",
|
|
114
|
+
)}
|
|
115
|
+
>
|
|
116
|
+
<Check
|
|
117
|
+
className={cn("h-4 w-4 shrink-0", isSelected ? "opacity-100" : "opacity-0")}
|
|
118
|
+
/>
|
|
119
|
+
<UserAvatar user={user} size="md" />
|
|
120
|
+
<div className="flex flex-col items-start overflow-hidden">
|
|
121
|
+
<span className="truncate font-medium">{user.name}</span>
|
|
122
|
+
<span className="text-muted-foreground truncate text-xs">{user.email}</span>
|
|
123
|
+
</div>
|
|
124
|
+
</button>
|
|
125
|
+
);
|
|
126
|
+
})}
|
|
127
|
+
{filteredUsers.length === 0 && (
|
|
128
|
+
<p className="text-muted-foreground py-4 text-center text-sm">{translations.empty}</p>
|
|
129
|
+
)}
|
|
130
|
+
</div>
|
|
131
|
+
</PopoverContent>
|
|
132
|
+
</Popover>
|
|
133
|
+
);
|
|
134
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -120,6 +120,10 @@ export {
|
|
|
120
120
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./components/tooltip.tsx";
|
|
121
121
|
|
|
122
122
|
// App-level components
|
|
123
|
+
export { DeleteConfirmDialog } from "./components/delete-confirm-dialog.tsx";
|
|
124
|
+
export type { DeleteConfirmDialogProps } from "./components/delete-confirm-dialog.tsx";
|
|
125
|
+
export { DetailField } from "./components/detail-field.tsx";
|
|
126
|
+
export type { DetailFieldProps, DetailFieldTranslations } from "./components/detail-field.tsx";
|
|
123
127
|
export { LanguageSwitch } from "./components/language-switch.tsx";
|
|
124
128
|
export { HealthStatus } from "./components/health-status.tsx";
|
|
125
129
|
export type { HealthStatusProps, HealthStatusTranslations } from "./components/health-status.tsx";
|
|
@@ -143,8 +147,24 @@ export type {
|
|
|
143
147
|
UserSectionTranslations,
|
|
144
148
|
} from "./components/sidebar.tsx";
|
|
145
149
|
|
|
150
|
+
// Markdown components
|
|
151
|
+
export { MarkdownEditor } from "./components/markdown-editor.tsx";
|
|
152
|
+
export { MarkdownView } from "./components/markdown-view.tsx";
|
|
153
|
+
|
|
154
|
+
// User components
|
|
155
|
+
export { UserAvatar } from "./components/user-avatar.tsx";
|
|
156
|
+
export { UserMultiSelect } from "./components/user-multi-select.tsx";
|
|
157
|
+
|
|
146
158
|
// Types
|
|
147
159
|
export type { TagDto } from "./types/index.ts";
|
|
160
|
+
export type {
|
|
161
|
+
UserOption,
|
|
162
|
+
UserAvatarProps,
|
|
163
|
+
UserMultiSelectProps,
|
|
164
|
+
UserMultiSelectTranslations,
|
|
165
|
+
MarkdownEditorProps,
|
|
166
|
+
MarkdownViewProps,
|
|
167
|
+
} from "./types/index.ts";
|
|
148
168
|
|
|
149
169
|
// Utilities
|
|
150
170
|
export { cn } from "./lib/utils.ts";
|
package/src/types/index.ts
CHANGED
|
@@ -27,3 +27,39 @@ export interface TagMultiSelectProps {
|
|
|
27
27
|
readonly loadTags: () => Promise<TagOption[]>;
|
|
28
28
|
readonly translations: TagMultiSelectTranslations;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
export interface UserOption {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly email: string;
|
|
35
|
+
readonly avatarUrl?: string | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface UserAvatarProps {
|
|
39
|
+
readonly user: UserOption;
|
|
40
|
+
readonly size?: "sm" | "md";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface UserMultiSelectTranslations {
|
|
44
|
+
readonly placeholder: string;
|
|
45
|
+
readonly searchPlaceholder: string;
|
|
46
|
+
readonly empty: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface UserMultiSelectProps {
|
|
50
|
+
readonly users: readonly UserOption[];
|
|
51
|
+
readonly selectedIds: readonly string[];
|
|
52
|
+
readonly onChange: (ids: string[]) => void;
|
|
53
|
+
readonly disabledIds?: readonly string[];
|
|
54
|
+
readonly translations: UserMultiSelectTranslations;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface MarkdownEditorProps {
|
|
58
|
+
readonly value: string;
|
|
59
|
+
readonly onChange: (value: string) => void;
|
|
60
|
+
readonly placeholder?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface MarkdownViewProps {
|
|
64
|
+
readonly content: string;
|
|
65
|
+
}
|