@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,329 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Questionnaire as QuestionnairePrimitive } from "@shadcn/react/questionnaire"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
7
|
+
import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
8
|
+
import { buttonVariants, type Button } from "@monkey-mini-app/ui/components/button"
|
|
9
|
+
import { CheckIcon } from "lucide-react"
|
|
10
|
+
|
|
11
|
+
function Questionnaire({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Root>) {
|
|
15
|
+
return (
|
|
16
|
+
<QuestionnairePrimitive.Root
|
|
17
|
+
data-slot="questionnaire"
|
|
18
|
+
className={cn("flex w-full min-w-0 flex-col gap-4", className)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function QuestionnaireProgress({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Progress>) {
|
|
28
|
+
return (
|
|
29
|
+
<QuestionnairePrimitive.Progress
|
|
30
|
+
data-slot="questionnaire-progress"
|
|
31
|
+
className={cn(
|
|
32
|
+
"min-h-[1lh] w-fit min-w-[14ch] text-xs font-medium text-muted-foreground tabular-nums",
|
|
33
|
+
className
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function QuestionnaireItem({
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Item>) {
|
|
44
|
+
return (
|
|
45
|
+
<QuestionnairePrimitive.Item
|
|
46
|
+
data-slot="questionnaire-item"
|
|
47
|
+
className={cn(
|
|
48
|
+
"flex min-w-0 flex-col gap-4 border-0 p-0 outline-none",
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function QuestionnaireTitle({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Title>) {
|
|
60
|
+
return (
|
|
61
|
+
<QuestionnairePrimitive.Title
|
|
62
|
+
data-slot="questionnaire-title"
|
|
63
|
+
className={cn(
|
|
64
|
+
"font-heading text-base leading-snug font-medium text-pretty [&:not(:has(~[data-slot=questionnaire-description]))]:mb-4",
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function QuestionnaireDescription({
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Description>) {
|
|
76
|
+
return (
|
|
77
|
+
<QuestionnairePrimitive.Description
|
|
78
|
+
data-slot="questionnaire-description"
|
|
79
|
+
className={cn("text-sm text-pretty text-muted-foreground", className)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function QuestionnaireChoices({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Choices>) {
|
|
89
|
+
return (
|
|
90
|
+
<QuestionnairePrimitive.Choices
|
|
91
|
+
data-slot="questionnaire-choices"
|
|
92
|
+
className={cn(
|
|
93
|
+
"group/questionnaire-choices grid min-w-0 gap-2",
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function QuestionnaireChoice({
|
|
102
|
+
children,
|
|
103
|
+
className,
|
|
104
|
+
...props
|
|
105
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Choice>) {
|
|
106
|
+
return (
|
|
107
|
+
<QuestionnairePrimitive.Choice
|
|
108
|
+
data-slot="questionnaire-choice"
|
|
109
|
+
className={cn(
|
|
110
|
+
"group/questionnaire-choice relative flex min-h-11 cursor-pointer items-start gap-2.5 rounded-lg border border-input bg-transparent px-3 py-2.5 text-start text-sm transition-colors outline-none select-none hover:bg-muted/50 has-[>input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring/50 data-invalid:border-destructive dark:bg-input/20 data-checked:border-primary/40 data-checked:bg-muted dark:data-checked:bg-muted",
|
|
111
|
+
"data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
112
|
+
className
|
|
113
|
+
)}
|
|
114
|
+
{...props}
|
|
115
|
+
>
|
|
116
|
+
<QuestionnairePrimitive.ChoiceInput
|
|
117
|
+
data-slot="questionnaire-choice-input"
|
|
118
|
+
className="absolute inset-0 z-10 size-full cursor-pointer opacity-0"
|
|
119
|
+
/>
|
|
120
|
+
<span
|
|
121
|
+
aria-hidden="true"
|
|
122
|
+
data-slot="questionnaire-choice-indicator"
|
|
123
|
+
className="pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[type=radio]/questionnaire-choice:rounded-full group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:bg-input/30 dark:group-data-checked/questionnaire-choice:bg-primary"
|
|
124
|
+
>
|
|
125
|
+
<span
|
|
126
|
+
data-slot="questionnaire-choice-indicator-dot"
|
|
127
|
+
className="hidden size-2 rounded-full bg-primary-foreground group-data-[type=checkbox]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"
|
|
128
|
+
/>
|
|
129
|
+
<CheckIcon data-slot="questionnaire-choice-indicator-check" className="hidden size-3.5 group-data-[type=radio]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block" />
|
|
130
|
+
</span>
|
|
131
|
+
<QuestionnairePrimitive.ChoiceLabel
|
|
132
|
+
data-slot="questionnaire-choice-label"
|
|
133
|
+
className="flex min-w-0 flex-1 flex-col gap-0.5 leading-snug"
|
|
134
|
+
>
|
|
135
|
+
{children}
|
|
136
|
+
</QuestionnairePrimitive.ChoiceLabel>
|
|
137
|
+
<QuestionnairePrimitive.ChoiceShortcut
|
|
138
|
+
data-slot="questionnaire-choice-shortcut"
|
|
139
|
+
className="pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-md border border-input bg-background font-mono text-[0.625rem] leading-none font-medium text-muted-foreground group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[shortcut]/questionnaire-choice:inline-flex"
|
|
140
|
+
/>
|
|
141
|
+
</QuestionnairePrimitive.Choice>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function QuestionnaireChoiceDescription({
|
|
146
|
+
className,
|
|
147
|
+
...props
|
|
148
|
+
}: React.ComponentProps<"span">) {
|
|
149
|
+
return (
|
|
150
|
+
<span
|
|
151
|
+
data-slot="questionnaire-choice-description"
|
|
152
|
+
className={cn("text-muted-foreground", className)}
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function QuestionnaireInput({
|
|
159
|
+
className,
|
|
160
|
+
...props
|
|
161
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Input>) {
|
|
162
|
+
return (
|
|
163
|
+
<div
|
|
164
|
+
data-slot="questionnaire-input-wrapper"
|
|
165
|
+
className="group/questionnaire-input relative w-full min-w-0"
|
|
166
|
+
>
|
|
167
|
+
<QuestionnairePrimitive.Input
|
|
168
|
+
data-slot="questionnaire-input"
|
|
169
|
+
className={cn(
|
|
170
|
+
"h-8 min-h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow,background-color] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 sm:min-h-0 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
171
|
+
"selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground",
|
|
172
|
+
className
|
|
173
|
+
)}
|
|
174
|
+
{...props}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function QuestionnaireError({
|
|
181
|
+
className,
|
|
182
|
+
...props
|
|
183
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Error>) {
|
|
184
|
+
return (
|
|
185
|
+
<QuestionnairePrimitive.Error
|
|
186
|
+
data-slot="questionnaire-error"
|
|
187
|
+
className={cn("mt-2 text-sm text-destructive", className)}
|
|
188
|
+
{...props}
|
|
189
|
+
/>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function QuestionnaireActions({
|
|
194
|
+
className,
|
|
195
|
+
...props
|
|
196
|
+
}: React.ComponentProps<"div">) {
|
|
197
|
+
return (
|
|
198
|
+
<div
|
|
199
|
+
data-slot="questionnaire-actions"
|
|
200
|
+
className={cn(
|
|
201
|
+
"grid min-h-11 w-full grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:min-h-8",
|
|
202
|
+
className
|
|
203
|
+
)}
|
|
204
|
+
{...props}
|
|
205
|
+
/>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function QuestionnairePrevious({
|
|
210
|
+
children,
|
|
211
|
+
className,
|
|
212
|
+
size = "default",
|
|
213
|
+
variant = "outline",
|
|
214
|
+
...props
|
|
215
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Previous> &
|
|
216
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
217
|
+
const t = useLabels("questionnaire")
|
|
218
|
+
return (
|
|
219
|
+
<QuestionnairePrimitive.Previous
|
|
220
|
+
data-slot="questionnaire-previous"
|
|
221
|
+
data-size={size}
|
|
222
|
+
data-variant={variant}
|
|
223
|
+
className={cn(
|
|
224
|
+
buttonVariants({ size, variant }),
|
|
225
|
+
"col-start-1 row-start-1 min-h-11 justify-self-start sm:min-h-0",
|
|
226
|
+
className
|
|
227
|
+
)}
|
|
228
|
+
{...props}
|
|
229
|
+
>
|
|
230
|
+
{children ?? t.previous}
|
|
231
|
+
</QuestionnairePrimitive.Previous>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function QuestionnaireSkip({
|
|
236
|
+
children,
|
|
237
|
+
className,
|
|
238
|
+
size = "default",
|
|
239
|
+
variant = "outline",
|
|
240
|
+
...props
|
|
241
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Skip> &
|
|
242
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
243
|
+
const t = useLabels("questionnaire")
|
|
244
|
+
return (
|
|
245
|
+
<QuestionnairePrimitive.Skip
|
|
246
|
+
data-slot="questionnaire-skip"
|
|
247
|
+
data-size={size}
|
|
248
|
+
data-variant={variant}
|
|
249
|
+
className={cn(
|
|
250
|
+
buttonVariants({ size, variant }),
|
|
251
|
+
"col-start-2 row-start-1 min-h-11 justify-self-end sm:min-h-0",
|
|
252
|
+
className
|
|
253
|
+
)}
|
|
254
|
+
{...props}
|
|
255
|
+
>
|
|
256
|
+
{children ?? t.skip}
|
|
257
|
+
</QuestionnairePrimitive.Skip>
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function QuestionnaireNext({
|
|
262
|
+
children,
|
|
263
|
+
className,
|
|
264
|
+
size = "default",
|
|
265
|
+
variant = "default",
|
|
266
|
+
...props
|
|
267
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Next> &
|
|
268
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
269
|
+
const t = useLabels("questionnaire")
|
|
270
|
+
return (
|
|
271
|
+
<QuestionnairePrimitive.Next
|
|
272
|
+
data-slot="questionnaire-next"
|
|
273
|
+
data-size={size}
|
|
274
|
+
data-variant={variant}
|
|
275
|
+
className={cn(
|
|
276
|
+
buttonVariants({ size, variant }),
|
|
277
|
+
"col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0",
|
|
278
|
+
className
|
|
279
|
+
)}
|
|
280
|
+
{...props}
|
|
281
|
+
>
|
|
282
|
+
{children ?? t.next}
|
|
283
|
+
</QuestionnairePrimitive.Next>
|
|
284
|
+
)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function QuestionnaireSubmit({
|
|
288
|
+
children,
|
|
289
|
+
className,
|
|
290
|
+
size = "default",
|
|
291
|
+
variant = "default",
|
|
292
|
+
...props
|
|
293
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Submit> &
|
|
294
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
295
|
+
const t = useLabels("questionnaire")
|
|
296
|
+
return (
|
|
297
|
+
<QuestionnairePrimitive.Submit
|
|
298
|
+
data-slot="questionnaire-submit"
|
|
299
|
+
data-size={size}
|
|
300
|
+
data-variant={variant}
|
|
301
|
+
className={cn(
|
|
302
|
+
buttonVariants({ size, variant }),
|
|
303
|
+
"col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0",
|
|
304
|
+
className
|
|
305
|
+
)}
|
|
306
|
+
{...props}
|
|
307
|
+
>
|
|
308
|
+
{children ?? t.submit}
|
|
309
|
+
</QuestionnairePrimitive.Submit>
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export {
|
|
314
|
+
Questionnaire,
|
|
315
|
+
QuestionnaireActions,
|
|
316
|
+
QuestionnaireChoice,
|
|
317
|
+
QuestionnaireChoiceDescription,
|
|
318
|
+
QuestionnaireChoices,
|
|
319
|
+
QuestionnaireDescription,
|
|
320
|
+
QuestionnaireError,
|
|
321
|
+
QuestionnaireInput,
|
|
322
|
+
QuestionnaireItem,
|
|
323
|
+
QuestionnaireNext,
|
|
324
|
+
QuestionnairePrevious,
|
|
325
|
+
QuestionnaireProgress,
|
|
326
|
+
QuestionnaireSkip,
|
|
327
|
+
QuestionnaireSubmit,
|
|
328
|
+
QuestionnaireTitle,
|
|
329
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Radio as RadioPrimitive } from "@base-ui/react/radio"
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
5
|
+
|
|
6
|
+
function RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {
|
|
7
|
+
return (
|
|
8
|
+
<RadioGroupPrimitive
|
|
9
|
+
data-slot="radio-group"
|
|
10
|
+
className={cn("grid w-full gap-2", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function RadioGroupItem({ className, ...props }: RadioPrimitive.Root.Props) {
|
|
17
|
+
return (
|
|
18
|
+
<RadioPrimitive.Root
|
|
19
|
+
data-slot="radio-group-item"
|
|
20
|
+
className={cn(
|
|
21
|
+
"group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
<RadioPrimitive.Indicator
|
|
27
|
+
data-slot="radio-group-indicator"
|
|
28
|
+
className="flex size-4 items-center justify-center"
|
|
29
|
+
>
|
|
30
|
+
<span className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" />
|
|
31
|
+
</RadioPrimitive.Indicator>
|
|
32
|
+
</RadioPrimitive.Root>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { RadioGroup, RadioGroupItem }
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as ResizablePrimitive from "react-resizable-panels"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
6
|
+
|
|
7
|
+
function ResizablePanelGroup({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: ResizablePrimitive.GroupProps) {
|
|
11
|
+
return (
|
|
12
|
+
<ResizablePrimitive.Group
|
|
13
|
+
data-slot="resizable-panel-group"
|
|
14
|
+
className={cn(
|
|
15
|
+
"flex h-full w-full aria-[orientation=vertical]:flex-col",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
|
|
24
|
+
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function ResizableHandle({
|
|
28
|
+
withHandle,
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: ResizablePrimitive.SeparatorProps & {
|
|
32
|
+
withHandle?: boolean
|
|
33
|
+
}) {
|
|
34
|
+
return (
|
|
35
|
+
<ResizablePrimitive.Separator
|
|
36
|
+
data-slot="resizable-handle"
|
|
37
|
+
className={cn(
|
|
38
|
+
"relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{withHandle && (
|
|
44
|
+
<div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />
|
|
45
|
+
)}
|
|
46
|
+
</ResizablePrimitive.Separator>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
|
+
|
|
5
|
+
function ScrollArea({
|
|
6
|
+
className,
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}: ScrollAreaPrimitive.Root.Props) {
|
|
10
|
+
return (
|
|
11
|
+
<ScrollAreaPrimitive.Root
|
|
12
|
+
data-slot="scroll-area"
|
|
13
|
+
className={cn("relative", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<ScrollAreaPrimitive.Viewport
|
|
17
|
+
data-slot="scroll-area-viewport"
|
|
18
|
+
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</ScrollAreaPrimitive.Viewport>
|
|
22
|
+
<ScrollBar />
|
|
23
|
+
<ScrollAreaPrimitive.Corner />
|
|
24
|
+
</ScrollAreaPrimitive.Root>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ScrollBar({
|
|
29
|
+
className,
|
|
30
|
+
orientation = "vertical",
|
|
31
|
+
...props
|
|
32
|
+
}: ScrollAreaPrimitive.Scrollbar.Props) {
|
|
33
|
+
return (
|
|
34
|
+
<ScrollAreaPrimitive.Scrollbar
|
|
35
|
+
data-slot="scroll-area-scrollbar"
|
|
36
|
+
data-orientation={orientation}
|
|
37
|
+
orientation={orientation}
|
|
38
|
+
className={cn(
|
|
39
|
+
"flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<ScrollAreaPrimitive.Thumb
|
|
45
|
+
data-slot="scroll-area-thumb"
|
|
46
|
+
className="relative flex-1 rounded-full bg-border"
|
|
47
|
+
/>
|
|
48
|
+
</ScrollAreaPrimitive.Scrollbar>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { ScrollArea, ScrollBar }
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
7
|
+
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
|
|
8
|
+
|
|
9
|
+
const Select = SelectPrimitive.Root
|
|
10
|
+
|
|
11
|
+
function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
|
|
12
|
+
return (
|
|
13
|
+
<SelectPrimitive.Group
|
|
14
|
+
data-slot="select-group"
|
|
15
|
+
className={cn("scroll-my-1 p-1", className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
|
|
22
|
+
return (
|
|
23
|
+
<SelectPrimitive.Value
|
|
24
|
+
data-slot="select-value"
|
|
25
|
+
className={cn("flex flex-1 text-left", className)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function SelectTrigger({
|
|
32
|
+
className,
|
|
33
|
+
size = "default",
|
|
34
|
+
children,
|
|
35
|
+
...props
|
|
36
|
+
}: SelectPrimitive.Trigger.Props & {
|
|
37
|
+
size?: "sm" | "default"
|
|
38
|
+
}) {
|
|
39
|
+
return (
|
|
40
|
+
<SelectPrimitive.Trigger
|
|
41
|
+
data-slot="select-trigger"
|
|
42
|
+
data-size={size}
|
|
43
|
+
className={cn(
|
|
44
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
<SelectPrimitive.Icon
|
|
51
|
+
render={
|
|
52
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
53
|
+
}
|
|
54
|
+
/>
|
|
55
|
+
</SelectPrimitive.Trigger>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function SelectContent({
|
|
60
|
+
className,
|
|
61
|
+
children,
|
|
62
|
+
side = "bottom",
|
|
63
|
+
sideOffset = 4,
|
|
64
|
+
align = "center",
|
|
65
|
+
alignOffset = 0,
|
|
66
|
+
alignItemWithTrigger = true,
|
|
67
|
+
...props
|
|
68
|
+
}: SelectPrimitive.Popup.Props &
|
|
69
|
+
Pick<
|
|
70
|
+
SelectPrimitive.Positioner.Props,
|
|
71
|
+
"align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger"
|
|
72
|
+
>) {
|
|
73
|
+
return (
|
|
74
|
+
<SelectPrimitive.Portal>
|
|
75
|
+
<SelectPrimitive.Positioner
|
|
76
|
+
side={side}
|
|
77
|
+
sideOffset={sideOffset}
|
|
78
|
+
align={align}
|
|
79
|
+
alignOffset={alignOffset}
|
|
80
|
+
alignItemWithTrigger={alignItemWithTrigger}
|
|
81
|
+
className="isolate z-50"
|
|
82
|
+
>
|
|
83
|
+
<SelectPrimitive.Popup
|
|
84
|
+
data-slot="select-content"
|
|
85
|
+
data-align-trigger={alignItemWithTrigger}
|
|
86
|
+
className={cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none 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 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
87
|
+
{...props}
|
|
88
|
+
>
|
|
89
|
+
<SelectScrollUpButton />
|
|
90
|
+
<SelectPrimitive.List>{children}</SelectPrimitive.List>
|
|
91
|
+
<SelectScrollDownButton />
|
|
92
|
+
</SelectPrimitive.Popup>
|
|
93
|
+
</SelectPrimitive.Positioner>
|
|
94
|
+
</SelectPrimitive.Portal>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function SelectLabel({
|
|
99
|
+
className,
|
|
100
|
+
...props
|
|
101
|
+
}: SelectPrimitive.GroupLabel.Props) {
|
|
102
|
+
return (
|
|
103
|
+
<SelectPrimitive.GroupLabel
|
|
104
|
+
data-slot="select-label"
|
|
105
|
+
className={cn("px-1.5 py-1 text-xs text-muted-foreground", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function SelectItem({
|
|
112
|
+
className,
|
|
113
|
+
children,
|
|
114
|
+
...props
|
|
115
|
+
}: SelectPrimitive.Item.Props) {
|
|
116
|
+
return (
|
|
117
|
+
<SelectPrimitive.Item
|
|
118
|
+
data-slot="select-item"
|
|
119
|
+
className={cn(
|
|
120
|
+
"relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
121
|
+
className
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
>
|
|
125
|
+
<SelectPrimitive.ItemText className="flex flex-1 shrink-0 gap-2 whitespace-nowrap">
|
|
126
|
+
{children}
|
|
127
|
+
</SelectPrimitive.ItemText>
|
|
128
|
+
<SelectPrimitive.ItemIndicator
|
|
129
|
+
render={
|
|
130
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
<CheckIcon className="pointer-events-none" />
|
|
134
|
+
</SelectPrimitive.ItemIndicator>
|
|
135
|
+
</SelectPrimitive.Item>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function SelectSeparator({
|
|
140
|
+
className,
|
|
141
|
+
...props
|
|
142
|
+
}: SelectPrimitive.Separator.Props) {
|
|
143
|
+
return (
|
|
144
|
+
<SelectPrimitive.Separator
|
|
145
|
+
data-slot="select-separator"
|
|
146
|
+
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
|
|
147
|
+
{...props}
|
|
148
|
+
/>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function SelectScrollUpButton({
|
|
153
|
+
className,
|
|
154
|
+
...props
|
|
155
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {
|
|
156
|
+
return (
|
|
157
|
+
<SelectPrimitive.ScrollUpArrow
|
|
158
|
+
data-slot="select-scroll-up-button"
|
|
159
|
+
className={cn(
|
|
160
|
+
"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
161
|
+
className
|
|
162
|
+
)}
|
|
163
|
+
{...props}
|
|
164
|
+
>
|
|
165
|
+
<ChevronUpIcon
|
|
166
|
+
/>
|
|
167
|
+
</SelectPrimitive.ScrollUpArrow>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function SelectScrollDownButton({
|
|
172
|
+
className,
|
|
173
|
+
...props
|
|
174
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {
|
|
175
|
+
return (
|
|
176
|
+
<SelectPrimitive.ScrollDownArrow
|
|
177
|
+
data-slot="select-scroll-down-button"
|
|
178
|
+
className={cn(
|
|
179
|
+
"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
180
|
+
className
|
|
181
|
+
)}
|
|
182
|
+
{...props}
|
|
183
|
+
>
|
|
184
|
+
<ChevronDownIcon
|
|
185
|
+
/>
|
|
186
|
+
</SelectPrimitive.ScrollDownArrow>
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export {
|
|
191
|
+
Select,
|
|
192
|
+
SelectContent,
|
|
193
|
+
SelectGroup,
|
|
194
|
+
SelectItem,
|
|
195
|
+
SelectLabel,
|
|
196
|
+
SelectScrollDownButton,
|
|
197
|
+
SelectScrollUpButton,
|
|
198
|
+
SelectSeparator,
|
|
199
|
+
SelectTrigger,
|
|
200
|
+
SelectValue,
|
|
201
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
|
+
|
|
5
|
+
function Separator({
|
|
6
|
+
className,
|
|
7
|
+
orientation = "horizontal",
|
|
8
|
+
...props
|
|
9
|
+
}: SeparatorPrimitive.Props) {
|
|
10
|
+
return (
|
|
11
|
+
<SeparatorPrimitive
|
|
12
|
+
data-slot="separator"
|
|
13
|
+
orientation={orientation}
|
|
14
|
+
className={cn(
|
|
15
|
+
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { Separator }
|