@monkey-mini-app/ui 0.1.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/components.json +23 -0
- package/dist/globals.css +2 -0
- package/dist/index.js +138 -0
- package/dist/manifest.json +11 -0
- package/dist/src/blocks/activity-feed.tsx +9 -0
- package/dist/src/blocks/app-shell.tsx +37 -0
- package/dist/src/blocks/attachment-gallery.tsx +30 -0
- package/dist/src/blocks/bar-chart.tsx +33 -0
- package/dist/src/blocks/comment-thread.tsx +30 -0
- package/dist/src/blocks/description-list.tsx +16 -0
- package/dist/src/blocks/detail-panel.tsx +43 -0
- package/dist/src/blocks/donut-chart.tsx +38 -0
- package/dist/src/blocks/env-badge.tsx +23 -0
- package/dist/src/blocks/file-tree.tsx +5 -0
- package/dist/src/blocks/filter-bar.tsx +21 -0
- package/dist/src/blocks/gauge.tsx +13 -0
- package/dist/src/blocks/notification-center.tsx +22 -0
- package/dist/src/blocks/page-header.tsx +30 -0
- package/dist/src/blocks/progress-ring.tsx +25 -0
- package/dist/src/blocks/radar-chart.tsx +31 -0
- package/dist/src/blocks/request-inspector.tsx +34 -0
- package/dist/src/blocks/run-timeline.tsx +5 -0
- package/dist/src/blocks/scrollspy.tsx +42 -0
- package/dist/src/blocks/severity-chip.tsx +27 -0
- package/dist/src/blocks/sparkline.tsx +19 -0
- package/dist/src/blocks/stat-card.tsx +49 -0
- package/dist/src/blocks/status-badge.tsx +39 -0
- package/dist/src/blocks/terminal.tsx +10 -0
- package/dist/src/blocks/test-step-list.tsx +19 -0
- package/dist/src/blocks/trend-card.tsx +51 -0
- package/dist/src/components/accordion.tsx +72 -0
- package/dist/src/components/alert-dialog.tsx +185 -0
- package/dist/src/components/alert.tsx +76 -0
- package/dist/src/components/aspect-ratio.tsx +22 -0
- package/dist/src/components/attachment.tsx +207 -0
- package/dist/src/components/avatar.tsx +107 -0
- package/dist/src/components/badge.tsx +52 -0
- package/dist/src/components/breadcrumb.tsx +125 -0
- package/dist/src/components/bubble.tsx +128 -0
- package/dist/src/components/button-group.tsx +87 -0
- package/dist/src/components/button.tsx +58 -0
- package/dist/src/components/calendar.tsx +221 -0
- package/dist/src/components/card.tsx +103 -0
- package/dist/src/components/chart.tsx +371 -0
- package/dist/src/components/checkbox.tsx +29 -0
- package/dist/src/components/collapsible.tsx +19 -0
- package/dist/src/components/combobox.tsx +295 -0
- package/dist/src/components/command.tsx +196 -0
- package/dist/src/components/context-menu.tsx +271 -0
- package/dist/src/components/dialog.tsx +158 -0
- package/dist/src/components/drawer.tsx +226 -0
- package/dist/src/components/dropdown-menu.tsx +268 -0
- package/dist/src/components/empty.tsx +123 -0
- package/dist/src/components/field.tsx +236 -0
- package/dist/src/components/hover-card.tsx +49 -0
- package/dist/src/components/input-group.tsx +158 -0
- package/dist/src/components/input.tsx +20 -0
- package/dist/src/components/item.tsx +201 -0
- package/dist/src/components/kbd.tsx +26 -0
- package/dist/src/components/label.tsx +20 -0
- package/dist/src/components/marker.tsx +71 -0
- package/dist/src/components/menubar.tsx +280 -0
- package/dist/src/components/message-scroller.tsx +129 -0
- package/dist/src/components/message.tsx +92 -0
- package/dist/src/components/native-select.tsx +61 -0
- package/dist/src/components/navigation-menu.tsx +168 -0
- package/dist/src/components/pagination.tsx +135 -0
- package/dist/src/components/popover.tsx +88 -0
- package/dist/src/components/progress.tsx +83 -0
- package/dist/src/components/questionnaire.tsx +329 -0
- package/dist/src/components/radio-group.tsx +36 -0
- package/dist/src/components/resizable.tsx +50 -0
- package/dist/src/components/scroll-area.tsx +52 -0
- package/dist/src/components/select.tsx +201 -0
- package/dist/src/components/separator.tsx +23 -0
- package/dist/src/components/sheet.tsx +136 -0
- package/dist/src/components/sidebar.tsx +721 -0
- package/dist/src/components/skeleton.tsx +13 -0
- package/dist/src/components/slider.tsx +52 -0
- package/dist/src/components/spinner.tsx +10 -0
- package/dist/src/components/switch.tsx +32 -0
- package/dist/src/components/table.tsx +114 -0
- package/dist/src/components/tabs.tsx +82 -0
- package/dist/src/components/textarea.tsx +18 -0
- package/dist/src/components/toast.tsx +234 -0
- package/dist/src/components/toggle-group.tsx +89 -0
- package/dist/src/components/toggle.tsx +43 -0
- package/dist/src/components/tooltip.tsx +66 -0
- package/dist/src/composites/autocomplete.tsx +55 -0
- package/dist/src/composites/cascader.tsx +46 -0
- package/dist/src/composites/color-picker.tsx +19 -0
- package/dist/src/composites/confirm-dialog.tsx +56 -0
- package/dist/src/composites/copyable.tsx +37 -0
- package/dist/src/composites/currency-input.tsx +31 -0
- package/dist/src/composites/date-chrome.tsx +157 -0
- package/dist/src/composites/date-picker.tsx +91 -0
- package/dist/src/composites/date-range-picker.tsx +96 -0
- package/dist/src/composites/date-time-picker.tsx +115 -0
- package/dist/src/composites/date-time-range-picker.tsx +51 -0
- package/dist/src/composites/duration-input.tsx +122 -0
- package/dist/src/composites/mini-calendar.tsx +24 -0
- package/dist/src/composites/number-field.tsx +53 -0
- package/dist/src/composites/password-field.tsx +44 -0
- package/dist/src/composites/phone-input.tsx +22 -0
- package/dist/src/composites/rating.tsx +39 -0
- package/dist/src/composites/relative-date-picker.tsx +62 -0
- package/dist/src/composites/search-input.tsx +49 -0
- package/dist/src/composites/slider-range.tsx +30 -0
- package/dist/src/composites/tag-input.tsx +56 -0
- package/dist/src/composites/time-picker.tsx +199 -0
- package/dist/src/composites/time-range-picker.tsx +25 -0
- package/dist/src/composites/timezone-select.tsx +251 -0
- package/dist/src/composites/transfer.tsx +52 -0
- package/dist/src/composites/user-picker.tsx +40 -0
- package/dist/src/hooks/use-mobile.ts +19 -0
- package/dist/src/i18n/context.tsx +72 -0
- package/dist/src/i18n/en.ts +168 -0
- package/dist/src/i18n/zh.ts +160 -0
- package/dist/src/index.ts +134 -0
- package/dist/src/lib/icons.tsx +16 -0
- package/dist/src/lib/illustrations.tsx +573 -0
- package/dist/src/lib/utils.ts +6 -0
- package/dist/src/products/cells.tsx +18 -0
- package/dist/src/products/code-block.tsx +75 -0
- package/dist/src/products/code-editor.tsx +49 -0
- package/dist/src/products/column-meta.d.ts +9 -0
- package/dist/src/products/data-grid.tsx +689 -0
- package/dist/src/products/diff-viewer.tsx +129 -0
- package/dist/src/products/event-calendar.tsx +845 -0
- package/dist/src/products/export-csv.ts +25 -0
- package/dist/src/products/file-dropzone.tsx +41 -0
- package/dist/src/products/gantt.tsx +41 -0
- package/dist/src/products/jira-wiki-parse.ts +197 -0
- package/dist/src/products/jira-wiki.tsx +285 -0
- package/dist/src/products/jql-input.tsx +62 -0
- package/dist/src/products/jql-language.ts +70 -0
- package/dist/src/products/json-viewer.tsx +37 -0
- package/dist/src/products/kanban-issue-panel.tsx +98 -0
- package/dist/src/products/kanban.tsx +245 -0
- package/dist/src/products/log-viewer.tsx +33 -0
- package/dist/src/products/markdown-editor.tsx +63 -0
- package/dist/src/products/markdown.tsx +26 -0
- package/dist/src/products/rich-text-editor.tsx +84 -0
- package/dist/src/products/sortable-list.tsx +61 -0
- package/dist/src/products/stepper.tsx +89 -0
- package/dist/src/products/timeline.tsx +32 -0
- package/dist/src/products/tree-view.tsx +56 -0
- package/dist/src/styles/globals.css +352 -0
- package/package.json +100 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
5
|
+
import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
8
|
+
import {
|
|
9
|
+
DropdownMenu,
|
|
10
|
+
DropdownMenuContent,
|
|
11
|
+
DropdownMenuGroup,
|
|
12
|
+
DropdownMenuItem,
|
|
13
|
+
DropdownMenuLabel,
|
|
14
|
+
DropdownMenuPortal,
|
|
15
|
+
DropdownMenuRadioGroup,
|
|
16
|
+
DropdownMenuSeparator,
|
|
17
|
+
DropdownMenuShortcut,
|
|
18
|
+
DropdownMenuSub,
|
|
19
|
+
DropdownMenuSubContent,
|
|
20
|
+
DropdownMenuSubTrigger,
|
|
21
|
+
DropdownMenuTrigger,
|
|
22
|
+
} from "@monkey-mini-app/ui/components/dropdown-menu"
|
|
23
|
+
import { CheckIcon } from "lucide-react"
|
|
24
|
+
|
|
25
|
+
function Menubar({ className, ...props }: MenubarPrimitive.Props) {
|
|
26
|
+
return (
|
|
27
|
+
<MenubarPrimitive
|
|
28
|
+
data-slot="menubar"
|
|
29
|
+
className={cn(
|
|
30
|
+
"flex h-8 items-center gap-0.5 rounded-lg border p-[3px]",
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
|
|
39
|
+
return <DropdownMenu data-slot="menubar-menu" {...props} />
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function MenubarGroup({
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<typeof DropdownMenuGroup>) {
|
|
45
|
+
return <DropdownMenuGroup data-slot="menubar-group" {...props} />
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function MenubarPortal({
|
|
49
|
+
...props
|
|
50
|
+
}: React.ComponentProps<typeof DropdownMenuPortal>) {
|
|
51
|
+
return <DropdownMenuPortal data-slot="menubar-portal" {...props} />
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function MenubarTrigger({
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}: React.ComponentProps<typeof DropdownMenuTrigger>) {
|
|
58
|
+
return (
|
|
59
|
+
<DropdownMenuTrigger
|
|
60
|
+
data-slot="menubar-trigger"
|
|
61
|
+
className={cn(
|
|
62
|
+
"flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function MenubarContent({
|
|
71
|
+
className,
|
|
72
|
+
align = "start",
|
|
73
|
+
alignOffset = -4,
|
|
74
|
+
sideOffset = 8,
|
|
75
|
+
...props
|
|
76
|
+
}: React.ComponentProps<typeof DropdownMenuContent>) {
|
|
77
|
+
return (
|
|
78
|
+
<DropdownMenuContent
|
|
79
|
+
data-slot="menubar-content"
|
|
80
|
+
align={align}
|
|
81
|
+
alignOffset={alignOffset}
|
|
82
|
+
sideOffset={sideOffset}
|
|
83
|
+
className={cn("min-w-36 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95", className )}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function MenubarItem({
|
|
90
|
+
className,
|
|
91
|
+
inset,
|
|
92
|
+
variant = "default",
|
|
93
|
+
...props
|
|
94
|
+
}: React.ComponentProps<typeof DropdownMenuItem>) {
|
|
95
|
+
return (
|
|
96
|
+
<DropdownMenuItem
|
|
97
|
+
data-slot="menubar-item"
|
|
98
|
+
data-inset={inset}
|
|
99
|
+
data-variant={variant}
|
|
100
|
+
className={cn(
|
|
101
|
+
"group/menubar-item gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
|
|
102
|
+
className
|
|
103
|
+
)}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function MenubarCheckboxItem({
|
|
110
|
+
className,
|
|
111
|
+
children,
|
|
112
|
+
checked,
|
|
113
|
+
inset,
|
|
114
|
+
...props
|
|
115
|
+
}: MenuPrimitive.CheckboxItem.Props & {
|
|
116
|
+
inset?: boolean
|
|
117
|
+
}) {
|
|
118
|
+
return (
|
|
119
|
+
<MenuPrimitive.CheckboxItem
|
|
120
|
+
data-slot="menubar-checkbox-item"
|
|
121
|
+
data-inset={inset}
|
|
122
|
+
className={cn(
|
|
123
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
checked={checked}
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
129
|
+
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
130
|
+
<MenuPrimitive.CheckboxItemIndicator>
|
|
131
|
+
<CheckIcon
|
|
132
|
+
/>
|
|
133
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
134
|
+
</span>
|
|
135
|
+
{children}
|
|
136
|
+
</MenuPrimitive.CheckboxItem>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function MenubarRadioGroup({
|
|
141
|
+
...props
|
|
142
|
+
}: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
|
|
143
|
+
return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function MenubarRadioItem({
|
|
147
|
+
className,
|
|
148
|
+
children,
|
|
149
|
+
inset,
|
|
150
|
+
...props
|
|
151
|
+
}: MenuPrimitive.RadioItem.Props & {
|
|
152
|
+
inset?: boolean
|
|
153
|
+
}) {
|
|
154
|
+
return (
|
|
155
|
+
<MenuPrimitive.RadioItem
|
|
156
|
+
data-slot="menubar-radio-item"
|
|
157
|
+
data-inset={inset}
|
|
158
|
+
className={cn(
|
|
159
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
160
|
+
className
|
|
161
|
+
)}
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
|
|
165
|
+
<MenuPrimitive.RadioItemIndicator>
|
|
166
|
+
<CheckIcon
|
|
167
|
+
/>
|
|
168
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
169
|
+
</span>
|
|
170
|
+
{children}
|
|
171
|
+
</MenuPrimitive.RadioItem>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function MenubarLabel({
|
|
176
|
+
className,
|
|
177
|
+
inset,
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<typeof DropdownMenuLabel> & {
|
|
180
|
+
inset?: boolean
|
|
181
|
+
}) {
|
|
182
|
+
return (
|
|
183
|
+
<DropdownMenuLabel
|
|
184
|
+
data-slot="menubar-label"
|
|
185
|
+
data-inset={inset}
|
|
186
|
+
className={cn(
|
|
187
|
+
"px-1.5 py-1 text-sm font-medium data-inset:pl-7",
|
|
188
|
+
className
|
|
189
|
+
)}
|
|
190
|
+
{...props}
|
|
191
|
+
/>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function MenubarSeparator({
|
|
196
|
+
className,
|
|
197
|
+
...props
|
|
198
|
+
}: React.ComponentProps<typeof DropdownMenuSeparator>) {
|
|
199
|
+
return (
|
|
200
|
+
<DropdownMenuSeparator
|
|
201
|
+
data-slot="menubar-separator"
|
|
202
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
203
|
+
{...props}
|
|
204
|
+
/>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function MenubarShortcut({
|
|
209
|
+
className,
|
|
210
|
+
...props
|
|
211
|
+
}: React.ComponentProps<typeof DropdownMenuShortcut>) {
|
|
212
|
+
return (
|
|
213
|
+
<DropdownMenuShortcut
|
|
214
|
+
data-slot="menubar-shortcut"
|
|
215
|
+
className={cn(
|
|
216
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground",
|
|
217
|
+
className
|
|
218
|
+
)}
|
|
219
|
+
{...props}
|
|
220
|
+
/>
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function MenubarSub({
|
|
225
|
+
...props
|
|
226
|
+
}: React.ComponentProps<typeof DropdownMenuSub>) {
|
|
227
|
+
return <DropdownMenuSub data-slot="menubar-sub" {...props} />
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function MenubarSubTrigger({
|
|
231
|
+
className,
|
|
232
|
+
inset,
|
|
233
|
+
...props
|
|
234
|
+
}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
|
|
235
|
+
inset?: boolean
|
|
236
|
+
}) {
|
|
237
|
+
return (
|
|
238
|
+
<DropdownMenuSubTrigger
|
|
239
|
+
data-slot="menubar-sub-trigger"
|
|
240
|
+
data-inset={inset}
|
|
241
|
+
className={cn(
|
|
242
|
+
"gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
243
|
+
className
|
|
244
|
+
)}
|
|
245
|
+
{...props}
|
|
246
|
+
/>
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function MenubarSubContent({
|
|
251
|
+
className,
|
|
252
|
+
...props
|
|
253
|
+
}: React.ComponentProps<typeof DropdownMenuSubContent>) {
|
|
254
|
+
return (
|
|
255
|
+
<DropdownMenuSubContent
|
|
256
|
+
data-slot="menubar-sub-content"
|
|
257
|
+
className={cn("min-w-32 rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
258
|
+
{...props}
|
|
259
|
+
/>
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export {
|
|
264
|
+
Menubar,
|
|
265
|
+
MenubarPortal,
|
|
266
|
+
MenubarMenu,
|
|
267
|
+
MenubarTrigger,
|
|
268
|
+
MenubarContent,
|
|
269
|
+
MenubarGroup,
|
|
270
|
+
MenubarSeparator,
|
|
271
|
+
MenubarLabel,
|
|
272
|
+
MenubarItem,
|
|
273
|
+
MenubarShortcut,
|
|
274
|
+
MenubarCheckboxItem,
|
|
275
|
+
MenubarRadioGroup,
|
|
276
|
+
MenubarRadioItem,
|
|
277
|
+
MenubarSub,
|
|
278
|
+
MenubarSubTrigger,
|
|
279
|
+
MenubarSubContent,
|
|
280
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import {
|
|
3
|
+
MessageScroller as MessageScrollerPrimitive,
|
|
4
|
+
useMessageScroller,
|
|
5
|
+
useMessageScrollerScrollable,
|
|
6
|
+
useMessageScrollerVisibility,
|
|
7
|
+
} from "@shadcn/react/message-scroller"
|
|
8
|
+
|
|
9
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
10
|
+
import { Button } from "@monkey-mini-app/ui/components/button"
|
|
11
|
+
import { ArrowDownIcon } from "lucide-react"
|
|
12
|
+
|
|
13
|
+
function MessageScrollerProvider(
|
|
14
|
+
props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>
|
|
15
|
+
) {
|
|
16
|
+
return <MessageScrollerPrimitive.Provider {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function MessageScroller({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
|
|
23
|
+
return (
|
|
24
|
+
<MessageScrollerPrimitive.Root
|
|
25
|
+
data-slot="message-scroller"
|
|
26
|
+
className={cn(
|
|
27
|
+
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function MessageScrollerViewport({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
|
|
39
|
+
return (
|
|
40
|
+
<MessageScrollerPrimitive.Viewport
|
|
41
|
+
data-slot="message-scroller-viewport"
|
|
42
|
+
className={cn(
|
|
43
|
+
"size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function MessageScrollerContent({
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
|
|
55
|
+
return (
|
|
56
|
+
<MessageScrollerPrimitive.Content
|
|
57
|
+
data-slot="message-scroller-content"
|
|
58
|
+
className={cn("flex h-max min-h-full flex-col gap-6", className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function MessageScrollerItem({
|
|
65
|
+
className,
|
|
66
|
+
scrollAnchor = false,
|
|
67
|
+
...props
|
|
68
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
|
|
69
|
+
return (
|
|
70
|
+
<MessageScrollerPrimitive.Item
|
|
71
|
+
data-slot="message-scroller-item"
|
|
72
|
+
scrollAnchor={scrollAnchor}
|
|
73
|
+
className={cn(
|
|
74
|
+
"min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
75
|
+
className
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function MessageScrollerButton({
|
|
83
|
+
direction = "end",
|
|
84
|
+
className,
|
|
85
|
+
children,
|
|
86
|
+
render,
|
|
87
|
+
variant = "secondary",
|
|
88
|
+
size = "icon-sm",
|
|
89
|
+
...props
|
|
90
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
|
|
91
|
+
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
|
92
|
+
return (
|
|
93
|
+
<MessageScrollerPrimitive.Button
|
|
94
|
+
data-slot="message-scroller-button"
|
|
95
|
+
data-direction={direction}
|
|
96
|
+
data-variant={variant}
|
|
97
|
+
data-size={size}
|
|
98
|
+
direction={direction}
|
|
99
|
+
className={cn(
|
|
100
|
+
"absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
101
|
+
className
|
|
102
|
+
)}
|
|
103
|
+
render={render ?? <Button variant={variant} size={size} />}
|
|
104
|
+
{...props}
|
|
105
|
+
>
|
|
106
|
+
{children ?? (
|
|
107
|
+
<>
|
|
108
|
+
<ArrowDownIcon
|
|
109
|
+
/>
|
|
110
|
+
<span className="sr-only">
|
|
111
|
+
{direction === "end" ? "Scroll to end" : "Scroll to start"}
|
|
112
|
+
</span>
|
|
113
|
+
</>
|
|
114
|
+
)}
|
|
115
|
+
</MessageScrollerPrimitive.Button>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
MessageScrollerProvider,
|
|
121
|
+
MessageScroller,
|
|
122
|
+
MessageScrollerViewport,
|
|
123
|
+
MessageScrollerContent,
|
|
124
|
+
MessageScrollerItem,
|
|
125
|
+
MessageScrollerButton,
|
|
126
|
+
useMessageScroller,
|
|
127
|
+
useMessageScrollerScrollable,
|
|
128
|
+
useMessageScrollerVisibility,
|
|
129
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
|
+
|
|
5
|
+
function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="message-group"
|
|
9
|
+
className={cn("flex min-w-0 flex-col gap-2", className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function Message({
|
|
16
|
+
className,
|
|
17
|
+
align = "start",
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
data-slot="message"
|
|
23
|
+
data-align={align}
|
|
24
|
+
className={cn(
|
|
25
|
+
"group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
data-slot="message-avatar"
|
|
37
|
+
className={cn(
|
|
38
|
+
"flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
data-slot="message-content"
|
|
50
|
+
className={cn(
|
|
51
|
+
"flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
data-slot="message-header"
|
|
63
|
+
className={cn(
|
|
64
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot="message-footer"
|
|
76
|
+
className={cn(
|
|
77
|
+
"flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
MessageGroup,
|
|
87
|
+
Message,
|
|
88
|
+
MessageAvatar,
|
|
89
|
+
MessageContent,
|
|
90
|
+
MessageFooter,
|
|
91
|
+
MessageHeader,
|
|
92
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
|
|
7
|
+
size?: "sm" | "default"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function NativeSelect({
|
|
11
|
+
className,
|
|
12
|
+
size = "default",
|
|
13
|
+
...props
|
|
14
|
+
}: NativeSelectProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={cn(
|
|
18
|
+
"group/native-select relative w-fit has-[select:disabled]:opacity-50",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
data-slot="native-select-wrapper"
|
|
22
|
+
data-size={size}
|
|
23
|
+
>
|
|
24
|
+
<select
|
|
25
|
+
data-slot="native-select"
|
|
26
|
+
data-size={size}
|
|
27
|
+
className="h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
<ChevronDownIcon className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none" aria-hidden="true" data-slot="native-select-icon" />
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function NativeSelectOption({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<"option">) {
|
|
39
|
+
return (
|
|
40
|
+
<option
|
|
41
|
+
data-slot="native-select-option"
|
|
42
|
+
className={cn("bg-[Canvas] text-[CanvasText]", className)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function NativeSelectOptGroup({
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<"optgroup">) {
|
|
52
|
+
return (
|
|
53
|
+
<optgroup
|
|
54
|
+
data-slot="native-select-optgroup"
|
|
55
|
+
className={cn("bg-[Canvas] text-[CanvasText]", className)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }
|