@monkey-mini-app/ui 0.1.1 → 0.1.5
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 +12 -6
- package/dist/globals.css +1 -1
- package/dist/index.js +12 -2
- package/dist/manifest.json +6 -6
- package/dist/runtime.js +9 -0
- package/dist/sdk.js +158 -0
- package/dist/src/blocks/activity-feed.tsx +7 -0
- package/dist/src/blocks/app-shell.tsx +1 -0
- package/dist/src/blocks/attachment-gallery.tsx +7 -0
- package/dist/src/blocks/bar-chart.tsx +11 -0
- package/dist/src/blocks/comment-thread.tsx +7 -0
- package/dist/src/blocks/dashboard-shell.tsx +109 -0
- package/dist/src/blocks/description-list.tsx +7 -0
- package/dist/src/blocks/detail-panel.tsx +1 -0
- package/dist/src/blocks/donut-chart.tsx +7 -0
- package/dist/src/blocks/env-badge.tsx +7 -0
- package/dist/src/blocks/env-table.tsx +316 -0
- package/dist/src/blocks/file-tree.tsx +7 -0
- package/dist/src/blocks/filter-bar.tsx +1 -0
- package/dist/src/blocks/form-sheet.tsx +160 -0
- package/dist/src/blocks/gauge.tsx +7 -0
- package/dist/src/blocks/list-detail.tsx +121 -0
- package/dist/src/blocks/notification-center.tsx +7 -0
- package/dist/src/blocks/page-header.tsx +1 -0
- package/dist/src/blocks/progress-ring.tsx +7 -0
- package/dist/src/blocks/radar-chart.tsx +7 -0
- package/dist/src/blocks/request-inspector.tsx +7 -0
- package/dist/src/blocks/reveal.tsx +56 -0
- package/dist/src/blocks/run-timeline.tsx +7 -0
- package/dist/src/blocks/scrollspy.tsx +7 -0
- package/dist/src/blocks/settings-split.tsx +154 -0
- package/dist/src/blocks/severity-chip.tsx +7 -0
- package/dist/src/blocks/sparkline.tsx +7 -0
- package/dist/src/blocks/stat-card.tsx +1 -0
- package/dist/src/blocks/status-badge.tsx +1 -0
- package/dist/src/blocks/table-page.tsx +83 -0
- package/dist/src/blocks/terminal.tsx +21 -3
- package/dist/src/blocks/test-step-list.tsx +7 -0
- package/dist/src/blocks/trend-card.tsx +7 -0
- package/dist/src/blocks/wizard-shell.tsx +132 -0
- package/dist/src/cdn-modules.d.ts +5 -0
- package/dist/src/components/accordion.tsx +7 -0
- package/dist/src/components/alert-dialog.tsx +7 -0
- package/dist/src/components/alert.tsx +7 -0
- package/dist/src/components/aspect-ratio.tsx +4 -0
- package/dist/src/components/attachment.tsx +4 -0
- package/dist/src/components/avatar.tsx +4 -0
- package/dist/src/components/badge.tsx +7 -0
- package/dist/src/components/breadcrumb.tsx +4 -0
- package/dist/src/components/bubble.tsx +4 -0
- package/dist/src/components/button-group.tsx +6 -0
- package/dist/src/components/button.tsx +7 -0
- package/dist/src/components/calendar.tsx +4 -0
- package/dist/src/components/card.tsx +8 -1
- package/dist/src/components/chart.tsx +7 -0
- package/dist/src/components/checkbox.tsx +5 -0
- package/dist/src/components/collapsible.tsx +4 -0
- package/dist/src/components/combobox.tsx +4 -0
- package/dist/src/components/command.tsx +6 -0
- package/dist/src/components/context-menu.tsx +4 -0
- package/dist/src/components/dialog.tsx +21 -0
- package/dist/src/components/drawer.tsx +4 -0
- package/dist/src/components/dropdown-menu.tsx +7 -0
- package/dist/src/components/empty.tsx +7 -0
- package/dist/src/components/field.tsx +6 -0
- package/dist/src/components/hover-card.tsx +4 -0
- package/dist/src/components/input-group.tsx +4 -0
- package/dist/src/components/input.tsx +7 -0
- package/dist/src/components/item.tsx +4 -0
- package/dist/src/components/kbd.tsx +4 -0
- package/dist/src/components/label.tsx +7 -0
- package/dist/src/components/marker.tsx +4 -0
- package/dist/src/components/menubar.tsx +4 -0
- package/dist/src/components/message-scroller.tsx +4 -0
- package/dist/src/components/message.tsx +4 -0
- package/dist/src/components/native-select.tsx +4 -0
- package/dist/src/components/navigation-menu.tsx +4 -0
- package/dist/src/components/pagination.tsx +4 -0
- package/dist/src/components/popover.tsx +7 -0
- package/dist/src/components/progress.tsx +7 -0
- package/dist/src/components/questionnaire.tsx +4 -0
- package/dist/src/components/radio-group.tsx +4 -0
- package/dist/src/components/resizable.tsx +7 -0
- package/dist/src/components/scroll-area.tsx +4 -0
- package/dist/src/components/select.tsx +7 -0
- package/dist/src/components/separator.tsx +5 -0
- package/dist/src/components/sheet.tsx +22 -0
- package/dist/src/components/sidebar.tsx +4 -0
- package/dist/src/components/skeleton.tsx +7 -0
- package/dist/src/components/slider.tsx +4 -0
- package/dist/src/components/spinner.tsx +6 -0
- package/dist/src/components/switch.tsx +7 -0
- package/dist/src/components/table.tsx +7 -0
- package/dist/src/components/tabs.tsx +7 -0
- package/dist/src/components/textarea.tsx +7 -0
- package/dist/src/components/toast.tsx +7 -0
- package/dist/src/components/toggle-group.tsx +4 -0
- package/dist/src/components/toggle.tsx +4 -0
- package/dist/src/components/tooltip.tsx +7 -0
- package/dist/src/composites/autocomplete.tsx +7 -0
- package/dist/src/composites/cascader.tsx +7 -0
- package/dist/src/composites/color-picker.tsx +7 -0
- package/dist/src/composites/confirm-dialog.tsx +7 -0
- package/dist/src/composites/copyable.tsx +9 -1
- package/dist/src/composites/currency-input.tsx +7 -0
- package/dist/src/composites/date-picker.tsx +7 -0
- package/dist/src/composites/date-range-picker.tsx +4 -0
- package/dist/src/composites/date-time-picker.tsx +7 -0
- package/dist/src/composites/date-time-range-picker.tsx +7 -0
- package/dist/src/composites/duration-input.tsx +7 -0
- package/dist/src/composites/mini-calendar.tsx +7 -0
- package/dist/src/composites/number-field.tsx +7 -0
- package/dist/src/composites/password-field.tsx +7 -0
- package/dist/src/composites/phone-input.tsx +7 -0
- package/dist/src/composites/rating.tsx +7 -0
- package/dist/src/composites/relative-date-picker.tsx +7 -0
- package/dist/src/composites/search-input.tsx +7 -0
- package/dist/src/composites/slider-range.tsx +7 -0
- package/dist/src/composites/tag-input.tsx +7 -0
- package/dist/src/composites/time-picker.tsx +11 -1
- package/dist/src/composites/time-range-picker.tsx +7 -0
- package/dist/src/composites/timezone-select.tsx +7 -0
- package/dist/src/composites/transfer.tsx +7 -0
- package/dist/src/composites/user-picker.tsx +7 -0
- package/dist/src/hooks/use-html-dark.ts +37 -0
- package/dist/src/hooks/use-mobile.ts +3 -0
- package/dist/src/i18n/en.ts +109 -2
- package/dist/src/i18n/zh.ts +99 -2
- package/dist/src/index.ts +147 -134
- package/dist/src/lib/clipboard.ts +10 -0
- package/dist/src/lib/illustrations.tsx +2 -2
- package/dist/src/products/code-block.tsx +35 -18
- package/dist/src/products/code-editor.tsx +156 -24
- package/dist/src/products/commit-graph.tsx +644 -0
- package/dist/src/products/data-grid.tsx +2 -1
- package/dist/src/products/diff-viewer.tsx +104 -8
- package/dist/src/products/event-calendar.tsx +28 -823
- package/dist/src/products/file-dropzone.tsx +7 -0
- package/dist/src/products/full-calendar/animations.ts +38 -0
- package/dist/src/products/full-calendar/calendar-body.tsx +77 -0
- package/dist/src/products/full-calendar/constants.ts +10 -0
- package/dist/src/products/full-calendar/contexts/calendar-context.tsx +255 -0
- package/dist/src/products/full-calendar/contexts/dnd-context.tsx +157 -0
- package/dist/src/products/full-calendar/dialogs/add-edit-event-dialog.tsx +187 -0
- package/dist/src/products/full-calendar/dialogs/delete-event-dialog.tsx +39 -0
- package/dist/src/products/full-calendar/dialogs/event-details-dialog.tsx +100 -0
- package/dist/src/products/full-calendar/dialogs/events-list-dialog.tsx +87 -0
- package/dist/src/products/full-calendar/dnd/draggable-event.tsx +45 -0
- package/dist/src/products/full-calendar/dnd/droppable-area.tsx +45 -0
- package/dist/src/products/full-calendar/dnd/resizable-event.tsx +179 -0
- package/dist/src/products/full-calendar/header/calendar-header.tsx +65 -0
- package/dist/src/products/full-calendar/header/date-navigator.tsx +110 -0
- package/dist/src/products/full-calendar/header/filter.tsx +58 -0
- package/dist/src/products/full-calendar/header/today-button.tsx +45 -0
- package/dist/src/products/full-calendar/header/user-select.tsx +64 -0
- package/dist/src/products/full-calendar/header/view-tabs.tsx +36 -0
- package/dist/src/products/full-calendar/helpers.ts +453 -0
- package/dist/src/products/full-calendar/hooks/use-time-range-create.ts +152 -0
- package/dist/src/products/full-calendar/hooks.ts +70 -0
- package/dist/src/products/full-calendar/interfaces.ts +23 -0
- package/dist/src/products/full-calendar/settings/settings.tsx +80 -0
- package/dist/src/products/full-calendar/shims/avatar-group.tsx +16 -0
- package/dist/src/products/full-calendar/shims/day-picker.tsx +1 -0
- package/dist/src/products/full-calendar/shims/motion.tsx +97 -0
- package/dist/src/products/full-calendar/shims/next-themes.ts +6 -0
- package/dist/src/products/full-calendar/shims/re-resizable.tsx +25 -0
- package/dist/src/products/full-calendar/shims/sonner.ts +4 -0
- package/dist/src/products/full-calendar/types.ts +8 -0
- package/dist/src/products/full-calendar/views/agenda-view/agenda-events.tsx +140 -0
- package/dist/src/products/full-calendar/views/month-view/calendar-month-view.tsx +69 -0
- package/dist/src/products/full-calendar/views/month-view/day-cell.tsx +201 -0
- package/dist/src/products/full-calendar/views/month-view/event-bullet.tsx +40 -0
- package/dist/src/products/full-calendar/views/month-view/month-event-badge.tsx +143 -0
- package/dist/src/products/full-calendar/views/week-and-day-view/calendar-day-view.tsx +295 -0
- package/dist/src/products/full-calendar/views/week-and-day-view/calendar-time-line.tsx +35 -0
- package/dist/src/products/full-calendar/views/week-and-day-view/calendar-week-view.tsx +253 -0
- package/dist/src/products/full-calendar/views/week-and-day-view/day-view-multi-day-events-row.tsx +73 -0
- package/dist/src/products/full-calendar/views/week-and-day-view/event-block.tsx +114 -0
- package/dist/src/products/full-calendar/views/week-and-day-view/render-grouped-events.tsx +49 -0
- package/dist/src/products/full-calendar/views/week-and-day-view/week-view-multi-day-events-row.tsx +143 -0
- package/dist/src/products/full-calendar/views/year-view/calendar-year-view.tsx +161 -0
- package/dist/src/products/gantt.tsx +7 -0
- package/dist/src/products/jira-wiki.tsx +1 -0
- package/dist/src/products/jql-input.tsx +340 -37
- package/dist/src/products/json-viewer.tsx +7 -0
- package/dist/src/products/kanban-issue-panel.tsx +7 -0
- package/dist/src/products/kanban.tsx +1 -0
- package/dist/src/products/log-viewer.tsx +390 -18
- package/dist/src/products/markdown-editor.tsx +21 -6
- package/dist/src/products/markdown.tsx +7 -0
- package/dist/src/products/rich-text-editor.tsx +65 -59
- package/dist/src/products/sortable-list.tsx +7 -0
- package/dist/src/products/stepper.tsx +219 -70
- package/dist/src/products/timeline.tsx +7 -0
- package/dist/src/products/tree-view.tsx +7 -0
- package/dist/src/sdk/app-error-boundary.tsx +240 -0
- package/dist/src/sdk/app-id.ts +7 -0
- package/dist/src/sdk/use-app.ts +126 -0
- package/dist/src/styles/globals.css +1 -0
- package/dist/vendors/lodash.js +20 -0
- package/dist/vendors/motion.js +12 -0
- package/package.json +20 -19
- package/dist/src/products/jql-language.ts +0 -70
|
@@ -8,6 +8,10 @@ import { Button } from "@monkey-mini-app/ui/components/button"
|
|
|
8
8
|
import { Input } from "@monkey-mini-app/ui/components/input"
|
|
9
9
|
import { Textarea } from "@monkey-mini-app/ui/components/textarea"
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @family Form
|
|
13
|
+
* @when Search/url/amount fields with adornments; keep validation in `NumberField` etc.
|
|
14
|
+
*/
|
|
11
15
|
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
12
16
|
return (
|
|
13
17
|
<div
|
|
@@ -3,6 +3,13 @@ import { Input as InputPrimitive } from "@base-ui/react/input"
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Single-line text input.
|
|
8
|
+
* @when Plain text. Numbers → `NumberField`; secrets → `PasswordField`; search → `SearchInput`.
|
|
9
|
+
* @example
|
|
10
|
+
* <Input value={v} onChange={(e) => set(e.target.value)} placeholder="名称" />
|
|
11
|
+
* @family Form
|
|
12
|
+
*/
|
|
6
13
|
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
7
14
|
return (
|
|
8
15
|
<InputPrimitive
|
|
@@ -4,6 +4,13 @@ import * as React from "react"
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Accessible field label.
|
|
9
|
+
* @when Always bind `htmlFor` — bare text labels are not accessible.
|
|
10
|
+
* @example
|
|
11
|
+
* <Label htmlFor="name">名称</Label>
|
|
12
|
+
* @family Form
|
|
13
|
+
*/
|
|
7
14
|
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
8
15
|
return (
|
|
9
16
|
<label
|
|
@@ -22,6 +22,10 @@ import {
|
|
|
22
22
|
} from "@monkey-mini-app/ui/components/dropdown-menu"
|
|
23
23
|
import { CheckIcon } from "lucide-react"
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @family Navigation
|
|
27
|
+
* @when Rarely right for a panel-width mini-app — prefer `Tabs` / `DropdownMenu`.
|
|
28
|
+
*/
|
|
25
29
|
function Menubar({ className, ...props }: MenubarPrimitive.Props) {
|
|
26
30
|
return (
|
|
27
31
|
<MenubarPrimitive
|
|
@@ -16,6 +16,10 @@ function MessageScrollerProvider(
|
|
|
16
16
|
return <MessageScrollerPrimitive.Provider {...props} />
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @family Realtime
|
|
21
|
+
* @when Streaming chat output. Logs by timestamp → `LogViewer`.
|
|
22
|
+
*/
|
|
19
23
|
function MessageScroller({
|
|
20
24
|
className,
|
|
21
25
|
...props
|
|
@@ -7,6 +7,10 @@ type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
|
|
|
7
7
|
size?: "sm" | "default"
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @family Form
|
|
12
|
+
* @when Short option lists where a plain select is enough and `Select` is overkill.
|
|
13
|
+
*/
|
|
10
14
|
function NativeSelect({
|
|
11
15
|
className,
|
|
12
16
|
size = "default",
|
|
@@ -4,6 +4,10 @@ import { cva } from "class-variance-authority"
|
|
|
4
4
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
5
5
|
import { ChevronDownIcon } from "lucide-react"
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @family Navigation
|
|
9
|
+
* @when Not for mini-apps with one screen — use `Tabs` or `AppShell` sidebar.
|
|
10
|
+
*/
|
|
7
11
|
function NavigationMenu({
|
|
8
12
|
align = "start",
|
|
9
13
|
className,
|
|
@@ -7,6 +7,10 @@ import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
|
7
7
|
import { Button } from "@monkey-mini-app/ui/components/button"
|
|
8
8
|
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react"
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @family Navigation
|
|
12
|
+
* @when Only when you page by hand; `DataGrid` does this itself.
|
|
13
|
+
*/
|
|
10
14
|
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
11
15
|
return (
|
|
12
16
|
<nav
|
|
@@ -3,6 +3,13 @@ import { Popover as PopoverPrimitive } from "@base-ui/react/popover"
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Anchored floating panel.
|
|
8
|
+
* @when Small editor/filter anchored to a control. Menus of commands → `DropdownMenu`.
|
|
9
|
+
* @example
|
|
10
|
+
* <Popover><PopoverTrigger asChild><Button>筛选</Button></PopoverTrigger><PopoverContent>…</PopoverContent></Popover>
|
|
11
|
+
* @family Surface
|
|
12
|
+
*/
|
|
6
13
|
function Popover({ ...props }: PopoverPrimitive.Root.Props) {
|
|
7
14
|
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
8
15
|
}
|
|
@@ -4,6 +4,13 @@ import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Linear determinate progress bar.
|
|
9
|
+
* @when Full-width scan/import progress. Compact circle → `ProgressRing`.
|
|
10
|
+
* @example
|
|
11
|
+
* <Progress value={scan.progress} />
|
|
12
|
+
* @family Feedback & status
|
|
13
|
+
*/
|
|
7
14
|
function Progress({
|
|
8
15
|
className,
|
|
9
16
|
children,
|
|
@@ -8,6 +8,10 @@ import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
|
8
8
|
import { buttonVariants, type Button } from "@monkey-mini-app/ui/components/button"
|
|
9
9
|
import { CheckIcon } from "lucide-react"
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @family Form
|
|
13
|
+
* @when Structured ask-the-user blocks; you persist the answers.
|
|
14
|
+
*/
|
|
11
15
|
function Questionnaire({
|
|
12
16
|
className,
|
|
13
17
|
...props
|
|
@@ -3,6 +3,10 @@ import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group"
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @family Form
|
|
8
|
+
* @when 2–5 mutually exclusive options. Many options → `Select`.
|
|
9
|
+
*/
|
|
6
10
|
function RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {
|
|
7
11
|
return (
|
|
8
12
|
<RadioGroupPrimitive
|
|
@@ -4,6 +4,13 @@ import * as ResizablePrimitive from "react-resizable-panels"
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Draggable split panes.
|
|
9
|
+
* @family Layout & structure
|
|
10
|
+
* @when Master-detail or editor + preview inside the app body.
|
|
11
|
+
* @example
|
|
12
|
+
* <ResizablePanelGroup orientation="horizontal"><ResizablePanel>list</ResizablePanel><ResizableHandle /><ResizablePanel>detail</ResizablePanel></ResizablePanelGroup>
|
|
13
|
+
*/
|
|
7
14
|
function ResizablePanelGroup({
|
|
8
15
|
className,
|
|
9
16
|
...props
|
|
@@ -2,6 +2,10 @@ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @family Layout & structure
|
|
7
|
+
* @when A bounded panel (list in a card). Whole-page scroll → plain div.
|
|
8
|
+
*/
|
|
5
9
|
function ScrollArea({
|
|
6
10
|
className,
|
|
7
11
|
children,
|
|
@@ -6,6 +6,13 @@ import { Select as SelectPrimitive } from "@base-ui/react/select"
|
|
|
6
6
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
7
7
|
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Dropdown single-choice from a fixed list.
|
|
11
|
+
* @when Closed set of options (searchable/large → `Autocomplete` or `DataGrid` filter).
|
|
12
|
+
* @example
|
|
13
|
+
* <Select value={v} onValueChange={set}><SelectTrigger><SelectValue placeholder="选择" /></SelectTrigger><SelectContent><SelectItem value="a">A</SelectItem></SelectContent></Select>
|
|
14
|
+
* @family Form
|
|
15
|
+
*/
|
|
9
16
|
const Select = SelectPrimitive.Root
|
|
10
17
|
|
|
11
18
|
function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
|
|
@@ -2,6 +2,11 @@ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Horizontal/vertical rule.
|
|
7
|
+
* @when Grouping inside panels.
|
|
8
|
+
* @family Layout & structure
|
|
9
|
+
*/
|
|
5
10
|
function Separator({
|
|
6
11
|
className,
|
|
7
12
|
orientation = "horizontal",
|
|
@@ -5,6 +5,13 @@ import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
|
5
5
|
import { Button } from "@monkey-mini-app/ui/components/button"
|
|
6
6
|
import { XIcon } from "lucide-react"
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Slide-in side panel.
|
|
10
|
+
* @when Detail/edit panel that keeps the list visible — the usual master-detail pattern. Size it with `width` on `SheetContent`: the panel carries its own `data-[side=right]:sm:max-w-sm` / `data-[side=left]:sm:max-w-sm`, so a `max-w-*` in `className` loses at ≥sm (inline style or `!max-w-*` also work).
|
|
11
|
+
* @example
|
|
12
|
+
* <Sheet open={open} onOpenChange={setOpen}><SheetContent side="right"><SheetHeader><SheetTitle>详情</SheetTitle></SheetHeader>…</SheetContent></Sheet>
|
|
13
|
+
* @family Surface
|
|
14
|
+
*/
|
|
8
15
|
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
|
|
9
16
|
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
10
17
|
}
|
|
@@ -39,17 +46,32 @@ function SheetContent({
|
|
|
39
46
|
children,
|
|
40
47
|
side = "right",
|
|
41
48
|
showCloseButton = true,
|
|
49
|
+
width,
|
|
50
|
+
style,
|
|
42
51
|
...props
|
|
43
52
|
}: SheetPrimitive.Popup.Props & {
|
|
44
53
|
side?: "top" | "right" | "bottom" | "left"
|
|
45
54
|
showCloseButton?: boolean
|
|
55
|
+
/**
|
|
56
|
+
* Panel width — a number is px. Applied as inline `maxWidth` on purpose: the base class
|
|
57
|
+
* already caps the sheet at `sm:max-w-sm` through a variant selector, which outranks a
|
|
58
|
+
* `max-w-*` utility the caller passes in `className`, so a prop is the only honest door.
|
|
59
|
+
*/
|
|
60
|
+
width?: string | number
|
|
46
61
|
}) {
|
|
62
|
+
const maxWidth =
|
|
63
|
+
width == null
|
|
64
|
+
? undefined
|
|
65
|
+
: typeof width === "number"
|
|
66
|
+
? `${width}px`
|
|
67
|
+
: width
|
|
47
68
|
return (
|
|
48
69
|
<SheetPortal>
|
|
49
70
|
<SheetOverlay />
|
|
50
71
|
<SheetPrimitive.Popup
|
|
51
72
|
data-slot="sheet-content"
|
|
52
73
|
data-side={side}
|
|
74
|
+
style={maxWidth == null ? style : { ...style, maxWidth }}
|
|
53
75
|
className={cn(
|
|
54
76
|
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
|
|
55
77
|
className
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Pulse placeholder block.
|
|
5
|
+
* @when First paint while `call()` is pending — match the real layout's size.
|
|
6
|
+
* @example
|
|
7
|
+
* <div className="flex flex-col gap-2">{[0,1,2].map((i) => <Skeleton key={i} className="h-16 w-full" />)}</div>
|
|
8
|
+
* @family Feedback & status
|
|
9
|
+
*/
|
|
3
10
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
4
11
|
return (
|
|
5
12
|
<div
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
2
2
|
import { Loader2Icon } from "lucide-react"
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @family Feedback & status
|
|
6
|
+
* @when Inside a button while `call()` is pending. Known % → `Progress`.
|
|
7
|
+
* @example
|
|
8
|
+
* <Button disabled><Spinner /> 保存中</Button>
|
|
9
|
+
*/
|
|
4
10
|
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
|
|
5
11
|
return (
|
|
6
12
|
<Loader2Icon data-slot="spinner" role="status" aria-label="Loading" className={cn("size-4 animate-spin", className)} {...props} />
|
|
@@ -4,6 +4,13 @@ import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Boolean toggle.
|
|
9
|
+
* @when Immediate on/off settings (submit-on-toggle).
|
|
10
|
+
* @example
|
|
11
|
+
* <Switch checked={on} onCheckedChange={set} />
|
|
12
|
+
* @family Form
|
|
13
|
+
*/
|
|
7
14
|
function Switch({
|
|
8
15
|
className,
|
|
9
16
|
size = "default",
|
|
@@ -2,6 +2,13 @@ import * as React from "react"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Raw HTML table primitives.
|
|
7
|
+
* @when Only when you need full control of cells. Otherwise use `DataGrid` (sorting/filter/paging/CSV built in).
|
|
8
|
+
* @example
|
|
9
|
+
* <Table><TableHeader><TableRow><TableHead>列</TableHead></TableRow></TableHeader><TableBody><TableRow><TableCell>v</TableCell></TableRow></TableBody></Table>
|
|
10
|
+
* @family Data & tables
|
|
11
|
+
*/
|
|
5
12
|
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
|
6
13
|
return (
|
|
7
14
|
<div
|
|
@@ -5,6 +5,13 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Switch between views in one page.
|
|
10
|
+
* @when Board vs table, or settings sections. Navigation between routes/pages → keep it in your own state.
|
|
11
|
+
* @example
|
|
12
|
+
* <Tabs value={v} onValueChange={set}><TabsList><TabsTrigger value="a">A</TabsTrigger></TabsList><TabsContent value="a">…</TabsContent></Tabs>
|
|
13
|
+
* @family Navigation
|
|
14
|
+
*/
|
|
8
15
|
function Tabs({
|
|
9
16
|
className,
|
|
10
17
|
orientation = "horizontal",
|
|
@@ -2,6 +2,13 @@ import * as React from "react"
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Multi-line text input.
|
|
7
|
+
* @when Notes/prompts. Code → `CodeEditor`; markdown → `MarkdownEditor`.
|
|
8
|
+
* @example
|
|
9
|
+
* <Textarea rows={4} value={v} onChange={(e) => set(e.target.value)} />
|
|
10
|
+
* @family Form
|
|
11
|
+
*/
|
|
5
12
|
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
6
13
|
return (
|
|
7
14
|
<textarea
|
|
@@ -30,6 +30,13 @@ function ToastViewport({ className, ...props }: ToastPrimitive.Viewport.Props) {
|
|
|
30
30
|
)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Transient notification (provider + viewport + `toast()`).
|
|
35
|
+
* @when Confirm/save failures. The host already mounts the provider — call `toast(...)`.
|
|
36
|
+
* @example
|
|
37
|
+
* toast({ title: "已保存", description: "2 条更新" })
|
|
38
|
+
* @family Feedback & status
|
|
39
|
+
*/
|
|
33
40
|
function Toast({ className, ...props }: ToastPrimitive.Root.Props) {
|
|
34
41
|
return (
|
|
35
42
|
<ToastPrimitive.Root
|
|
@@ -20,6 +20,10 @@ const ToggleGroupContext = React.createContext<
|
|
|
20
20
|
orientation: "horizontal",
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @family Form
|
|
25
|
+
* @when Multiple independent on/off buttons; exclusive selection → `Tabs`/`ButtonGroup`.
|
|
26
|
+
*/
|
|
23
27
|
function ToggleGroup({
|
|
24
28
|
className,
|
|
25
29
|
variant,
|
|
@@ -17,6 +17,13 @@ function TooltipProvider({
|
|
|
17
17
|
)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Hover/focus hint on an icon or truncated label.
|
|
22
|
+
* @when Explaining an icon-only button. Never put an action in it.
|
|
23
|
+
* @example
|
|
24
|
+
* <Tooltip><TooltipTrigger asChild><Button size="icon" aria-label="刷新"><Icon.RefreshCw /></Button></TooltipTrigger><TooltipContent>刷新</TooltipContent></Tooltip>
|
|
25
|
+
* @family Surface
|
|
26
|
+
*/
|
|
20
27
|
function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
|
|
21
28
|
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
22
29
|
}
|
|
@@ -4,6 +4,13 @@ import * as React from "react"
|
|
|
4
4
|
|
|
5
5
|
import { Input } from "@monkey-mini-app/ui/components/input"
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Text input with filtered suggestions.
|
|
9
|
+
* @when Free text allowed but known values should be suggested. Strict pick-list → `Select`.
|
|
10
|
+
* @example
|
|
11
|
+
* <Autocomplete options={["main", "develop"]} onChange={(v) => set(v)} />
|
|
12
|
+
* @family Form
|
|
13
|
+
*/
|
|
7
14
|
export function Autocomplete({
|
|
8
15
|
value,
|
|
9
16
|
onChange,
|
|
@@ -4,6 +4,13 @@ import { NativeSelect, NativeSelectOption } from "@monkey-mini-app/ui/components
|
|
|
4
4
|
|
|
5
5
|
export type CascaderNode = { value: string; label: string; children?: CascaderNode[] }
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Multi-level drill-down picker.
|
|
9
|
+
* @when Hierarchical codes (region → site → line). Flat tree → `TreeView`.
|
|
10
|
+
* @example
|
|
11
|
+
* <Cascader options={[{ label: "华东", value: "cn", children: [{ label: "上海", value: "sha" }] }]} onChange={(v) => set(v)} />
|
|
12
|
+
* @family Form
|
|
13
|
+
*/
|
|
7
14
|
export function Cascader({
|
|
8
15
|
options,
|
|
9
16
|
value = [],
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Swatch + hex colour input.
|
|
5
|
+
* @when Theme/label colour config. Never for secrets.
|
|
6
|
+
* @example
|
|
7
|
+
* <ColorPicker value={c} onChange={(v) => set(v)} />
|
|
8
|
+
* @family Form
|
|
9
|
+
*/
|
|
3
10
|
export function ColorPicker({
|
|
4
11
|
value = "#111111",
|
|
5
12
|
onChange,
|
|
@@ -12,6 +12,13 @@ import {
|
|
|
12
12
|
} from "@monkey-mini-app/ui/components/alert-dialog"
|
|
13
13
|
import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Controlled yes/no dialog with loading-safe confirm.
|
|
17
|
+
* @when Any destructive action. Needs a form inside → compose `Dialog` yourself.
|
|
18
|
+
* @example
|
|
19
|
+
* <ConfirmDialog open={open} title="删除这条?" onConfirm={remove} onOpenChange={setOpen} />
|
|
20
|
+
* @family Surface
|
|
21
|
+
*/
|
|
15
22
|
export function ConfirmDialog({
|
|
16
23
|
open,
|
|
17
24
|
onOpenChange,
|
|
@@ -10,7 +10,15 @@ import {
|
|
|
10
10
|
InputGroupInput,
|
|
11
11
|
} from "@monkey-mini-app/ui/components/input-group"
|
|
12
12
|
import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
13
|
+
import { writeClipboard } from "@monkey-mini-app/ui/lib/clipboard"
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Inline text with a copy button.
|
|
17
|
+
* @when IDs, hashes, URLs, tokens the user pastes elsewhere.
|
|
18
|
+
* @example
|
|
19
|
+
* <Copyable value="i_1724918400" />
|
|
20
|
+
* @family Discovery & inspect
|
|
21
|
+
*/
|
|
14
22
|
export function Copyable({ value }: { value: string }) {
|
|
15
23
|
const t = useLabels("copyable")
|
|
16
24
|
const [copied, setCopied] = React.useState(false)
|
|
@@ -24,7 +32,7 @@ export function Copyable({ value }: { value: string }) {
|
|
|
24
32
|
type="button"
|
|
25
33
|
aria-label={t.copy}
|
|
26
34
|
onClick={async () => {
|
|
27
|
-
await
|
|
35
|
+
if (!(await writeClipboard(value))) return
|
|
28
36
|
setCopied(true)
|
|
29
37
|
window.setTimeout(() => setCopied(false), 1200)
|
|
30
38
|
}}
|
|
@@ -7,6 +7,13 @@ import {
|
|
|
7
7
|
InputGroupText,
|
|
8
8
|
} from "@monkey-mini-app/ui/components/input-group"
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Amount input with grouping + currency prefix.
|
|
12
|
+
* @when Money fields; keeps the raw string out of your state.
|
|
13
|
+
* @example
|
|
14
|
+
* <CurrencyInput currency="CNY" onChange={(v) => set(v)} />
|
|
15
|
+
* @family Form
|
|
16
|
+
*/
|
|
10
17
|
export function CurrencyInput({
|
|
11
18
|
value,
|
|
12
19
|
onChange,
|
|
@@ -23,6 +23,13 @@ export type DatePickerProps = {
|
|
|
23
23
|
className?: string
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Single calendar date (day precision).
|
|
28
|
+
* @when Filtering or storing one day. With a clock → `DateTimePicker`.
|
|
29
|
+
* @example
|
|
30
|
+
* <DatePicker value={d} onChange={(v) => set(v)} />
|
|
31
|
+
* @family Calendar & date
|
|
32
|
+
*/
|
|
26
33
|
export function DatePicker({
|
|
27
34
|
value,
|
|
28
35
|
onChange,
|
|
@@ -5,6 +5,9 @@ import { format, isSameMonth, isSameYear, type Locale } from "date-fns"
|
|
|
5
5
|
import type { DateRange } from "react-day-picker"
|
|
6
6
|
import { ChevronDown } from "lucide-react"
|
|
7
7
|
|
|
8
|
+
// Re-exported so mini-app authors (bare `@monkey-mini-app/ui` only) can type the value.
|
|
9
|
+
export type { DateRange }
|
|
10
|
+
|
|
8
11
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
9
12
|
import { useDateLocale, useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
10
13
|
import { Button } from "@monkey-mini-app/ui/components/button"
|
|
@@ -41,6 +44,7 @@ function rangeLabel(value: DateRange, locale: Locale) {
|
|
|
41
44
|
* @when Filters needing from/to calendar days
|
|
42
45
|
* @example
|
|
43
46
|
* <DateRangePicker value={range} onChange={setRange} />
|
|
47
|
+
* @family Calendar & date
|
|
44
48
|
*/
|
|
45
49
|
export function DateRangePicker({
|
|
46
50
|
value,
|
|
@@ -32,6 +32,13 @@ export type DateTimePickerProps = {
|
|
|
32
32
|
className?: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Date + time, optional timezone.
|
|
37
|
+
* @when Scheduling moments, not days.
|
|
38
|
+
* @example
|
|
39
|
+
* <DateTimePicker value={d} onChange={(v) => set(v)} />
|
|
40
|
+
* @family Calendar & date
|
|
41
|
+
*/
|
|
35
42
|
export function DateTimePicker({
|
|
36
43
|
value,
|
|
37
44
|
onChange,
|
|
@@ -7,6 +7,13 @@ import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
|
7
7
|
|
|
8
8
|
export type DateTimeRange = { start?: Date; end?: Date }
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* From/to moments, all-day toggle.
|
|
12
|
+
* @when Run windows, on-call shifts.
|
|
13
|
+
* @example
|
|
14
|
+
* <DateTimeRangePicker onChange={(r) => set(r)} />
|
|
15
|
+
* @family Calendar & date
|
|
16
|
+
*/
|
|
10
17
|
export function DateTimeRangePicker({
|
|
11
18
|
value,
|
|
12
19
|
onChange,
|
|
@@ -81,6 +81,13 @@ function Segment({
|
|
|
81
81
|
)
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Duration text field (e.g. `1h30m`) with minutes.
|
|
86
|
+
* @when Timeouts/estimates where you store minutes but type human units.
|
|
87
|
+
* @example
|
|
88
|
+
* <DurationInput value="45m" onChange={(v, min) => set(min)} />
|
|
89
|
+
* @family Calendar & date
|
|
90
|
+
*/
|
|
84
91
|
export function DurationInput({
|
|
85
92
|
value,
|
|
86
93
|
onChange,
|