@monkey-mini-app/ui 0.1.0 → 0.1.4
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 +58 -0
- 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 +15 -1
- 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 +19 -2
- 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 +29 -6
- 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 +20 -2
- package/dist/src/blocks/radar-chart.tsx +18 -1
- 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 +12 -3
- 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 +7 -7
- package/dist/vendors/lodash.js +20 -0
- package/dist/vendors/motion.js +12 -0
- package/package.json +23 -19
- package/dist/src/products/jql-language.ts +0 -70
|
@@ -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,
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
import { Calendar } from "@monkey-mini-app/ui/components/calendar"
|
|
4
4
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Compact month grid, day cell only.
|
|
8
|
+
* @when Inside a popover or sidebar. Full page with events → `EventCalendar`.
|
|
9
|
+
* @example
|
|
10
|
+
* <MiniCalendar value={d} onChange={(v) => set(v)} />
|
|
11
|
+
* @family Calendar & date
|
|
12
|
+
*/
|
|
6
13
|
export function MiniCalendar({
|
|
7
14
|
value,
|
|
8
15
|
onChange,
|
|
@@ -5,6 +5,13 @@ import { Input } from "@monkey-mini-app/ui/components/input"
|
|
|
5
5
|
import { Minus, Plus } from "lucide-react"
|
|
6
6
|
import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Numeric input with min/max/step + steppers.
|
|
10
|
+
* @when Any number the user edits — keeps NaN out of your state.
|
|
11
|
+
* @example
|
|
12
|
+
* <NumberField min={0} max={100} value={n} onChange={(v) => set(v)} />
|
|
13
|
+
* @family Form
|
|
14
|
+
*/
|
|
8
15
|
export function NumberField({
|
|
9
16
|
value = 0,
|
|
10
17
|
onChange,
|
|
@@ -11,6 +11,13 @@ import {
|
|
|
11
11
|
} from "@monkey-mini-app/ui/components/input-group"
|
|
12
12
|
import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Secret input with reveal toggle.
|
|
16
|
+
* @when Typing a token/password into your own state. **Never** persist it to storage.
|
|
17
|
+
* @example
|
|
18
|
+
* <PasswordField value={p} onChange={(v) => set(v)} />
|
|
19
|
+
* @family Form
|
|
20
|
+
*/
|
|
14
21
|
export function PasswordField({
|
|
15
22
|
value,
|
|
16
23
|
onChange,
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { Input } from "@monkey-mini-app/ui/components/input"
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Phone number input with formatting.
|
|
7
|
+
* @when CN/mobile numbers.
|
|
8
|
+
* @example
|
|
9
|
+
* <PhoneInput value={t} onChange={(v) => set(v)} />
|
|
10
|
+
* @family Form
|
|
11
|
+
*/
|
|
5
12
|
export function PhoneInput({
|
|
6
13
|
value,
|
|
7
14
|
onChange,
|
|
@@ -4,6 +4,13 @@ import { Star } from "lucide-react"
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@monkey-mini-app/ui/lib/utils"
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Star rating.
|
|
9
|
+
* @when Feedback/score capture, 1–max.
|
|
10
|
+
* @example
|
|
11
|
+
* <Rating value={r} onChange={(v) => set(v)} />
|
|
12
|
+
* @family Form
|
|
13
|
+
*/
|
|
7
14
|
export function Rating({
|
|
8
15
|
value = 0,
|
|
9
16
|
onChange,
|
|
@@ -18,6 +18,13 @@ function rangeFor(id: RelativePreset): DateRange | undefined {
|
|
|
18
18
|
return undefined
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Preset ranges (today / last 7 days) → a concrete date range.
|
|
23
|
+
* @when Dashboard filters where “last 7 days” beats two calendars.
|
|
24
|
+
* @example
|
|
25
|
+
* <RelativeDatePicker onChange={(range, preset) => set(range)} />
|
|
26
|
+
* @family Calendar & date
|
|
27
|
+
*/
|
|
21
28
|
export function RelativeDatePicker({
|
|
22
29
|
preset = "7d",
|
|
23
30
|
value,
|
|
@@ -10,6 +10,13 @@ import {
|
|
|
10
10
|
} from "@monkey-mini-app/ui/components/input-group"
|
|
11
11
|
import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Search box with debounce.
|
|
15
|
+
* @when Filter-as-you-type against `DataGrid`/lists — use `onDebouncedChange` for network calls.
|
|
16
|
+
* @example
|
|
17
|
+
* <SearchInput onDebouncedChange={(q) => call("list", { q })} />
|
|
18
|
+
* @family Form
|
|
19
|
+
*/
|
|
13
20
|
export function SearchInput({
|
|
14
21
|
value,
|
|
15
22
|
onChange,
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { Slider } from "@monkey-mini-app/ui/components/slider"
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Two-thumb range slider.
|
|
7
|
+
* @when min/max numeric filters.
|
|
8
|
+
* @example
|
|
9
|
+
* <SliderRange min={0} max={100} value={[10, 40]} onChange={(v) => set(v)} />
|
|
10
|
+
* @family Form
|
|
11
|
+
*/
|
|
5
12
|
export function SliderRange({
|
|
6
13
|
value = [20, 80],
|
|
7
14
|
onChange,
|
|
@@ -7,6 +7,13 @@ import { Badge } from "@monkey-mini-app/ui/components/badge"
|
|
|
7
7
|
import { Input } from "@monkey-mini-app/ui/components/input"
|
|
8
8
|
import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Chip-style multi-value text input.
|
|
12
|
+
* @when Labels/owners where free values are allowed (`Transfer` when choosing from a fixed pool).
|
|
13
|
+
* @example
|
|
14
|
+
* <TagInput value={tags} onChange={(v) => set(v)} />
|
|
15
|
+
* @family Form
|
|
16
|
+
*/
|
|
10
17
|
export function TagInput({
|
|
11
18
|
value = [],
|
|
12
19
|
onChange,
|
|
@@ -26,6 +26,11 @@ function parseTime(value: string) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Column wheel for picking a time value.
|
|
31
|
+
* @family Calendar & date
|
|
32
|
+
* @when Inside a time picker where tapping a list beats typing. Prefer `TimePicker` for a normal field.
|
|
33
|
+
*/
|
|
29
34
|
export function TimeWheel({
|
|
30
35
|
values,
|
|
31
36
|
value,
|
|
@@ -140,7 +145,12 @@ export type TimePickerProps = {
|
|
|
140
145
|
className?: string
|
|
141
146
|
}
|
|
142
147
|
|
|
143
|
-
/** `value` is `HH:mm` (24h).
|
|
148
|
+
/** `value` is `HH:mm` (24h).
|
|
149
|
+
* @when Clock-only fields. `value` is a string, not a Date.
|
|
150
|
+
* @example
|
|
151
|
+
* <TimePicker value="09:30" onChange={(v) => set(v)} />
|
|
152
|
+
* @family Calendar & date
|
|
153
|
+
*/
|
|
144
154
|
export function TimePicker({
|
|
145
155
|
value = "",
|
|
146
156
|
onChange,
|
|
@@ -5,6 +5,13 @@ import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
|
5
5
|
|
|
6
6
|
export type TimeRange = { start: string; end: string }
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* From/to time of day.
|
|
10
|
+
* @when Daily windows (maintenance 02:00–04:00).
|
|
11
|
+
* @example
|
|
12
|
+
* <TimeRangePicker onChange={(r) => set(r)} />
|
|
13
|
+
* @family Calendar & date
|
|
14
|
+
*/
|
|
8
15
|
export function TimeRangePicker({
|
|
9
16
|
value,
|
|
10
17
|
onChange,
|
|
@@ -141,6 +141,13 @@ function ZoneItem({
|
|
|
141
141
|
)
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* IANA timezone dropdown.
|
|
146
|
+
* @when Pair with `DateTimePicker` when data is UTC.
|
|
147
|
+
* @example
|
|
148
|
+
* <TimezoneSelect value={tz} onChange={(v) => set(v)} />
|
|
149
|
+
* @family Calendar & date
|
|
150
|
+
*/
|
|
144
151
|
export function TimezoneSelect({
|
|
145
152
|
value,
|
|
146
153
|
onChange,
|
|
@@ -4,6 +4,13 @@ import { Button } from "@monkey-mini-app/ui/components/button"
|
|
|
4
4
|
|
|
5
5
|
export type TransferItem = { id: string; label: string }
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Two-panel move-between-lists picker.
|
|
9
|
+
* @when Selecting many items from a known pool (assign users to a shift).
|
|
10
|
+
* @example
|
|
11
|
+
* <Transfer items={[{ id: "u1", label: "张三" }]} onChange={(ids) => set(ids)} />
|
|
12
|
+
* @family Form
|
|
13
|
+
*/
|
|
7
14
|
export function Transfer({
|
|
8
15
|
items,
|
|
9
16
|
value = [],
|
|
@@ -6,6 +6,13 @@ import { useLabels } from "@monkey-mini-app/ui/i18n/context"
|
|
|
6
6
|
|
|
7
7
|
export type UserOption = { id: string; name: string }
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Pick a user from a list (avatar + name).
|
|
11
|
+
* @when Assignee/owner fields; you supply the user list.
|
|
12
|
+
* @example
|
|
13
|
+
* <UserPicker users={[{ id: "u1", name: "张三" }]} onChange={(id) => set(id)} />
|
|
14
|
+
* @family Form
|
|
15
|
+
*/
|
|
9
16
|
export function UserPicker({
|
|
10
17
|
users,
|
|
11
18
|
value,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react"
|
|
4
|
+
|
|
5
|
+
/** True when the iframe/host document is in dark mode (class, data-theme, or --background). */
|
|
6
|
+
export function htmlIsDark(el?: HTMLElement | null): boolean {
|
|
7
|
+
if (typeof document === "undefined") return false
|
|
8
|
+
const root = el ?? document.documentElement
|
|
9
|
+
if (root.classList.contains("dark")) return true
|
|
10
|
+
if (root.classList.contains("light")) return false
|
|
11
|
+
const theme = root.getAttribute("data-theme")
|
|
12
|
+
if (theme === "dark") return true
|
|
13
|
+
if (theme === "light") return false
|
|
14
|
+
try {
|
|
15
|
+
const bg =
|
|
16
|
+
root.style.getPropertyValue("--background").trim() ||
|
|
17
|
+
getComputedStyle(root).getPropertyValue("--background").trim()
|
|
18
|
+
const oklch = bg.match(/oklch\(\s*([0-9.]+)/i)
|
|
19
|
+
if (oklch) return Number(oklch[1]) < 0.5
|
|
20
|
+
} catch {
|
|
21
|
+
/* jsdom */
|
|
22
|
+
}
|
|
23
|
+
return false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function useHtmlDark(): boolean {
|
|
27
|
+
const [dark, setDark] = useState(() => htmlIsDark())
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const el = document.documentElement
|
|
30
|
+
const read = () => setDark(htmlIsDark(el))
|
|
31
|
+
read()
|
|
32
|
+
const obs = new MutationObserver(read)
|
|
33
|
+
obs.observe(el, { attributes: true, attributeFilter: ["class", "data-theme", "style"] })
|
|
34
|
+
return () => obs.disconnect()
|
|
35
|
+
}, [])
|
|
36
|
+
return dark
|
|
37
|
+
}
|
|
@@ -6,6 +6,9 @@ export function useIsMobile() {
|
|
|
6
6
|
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
7
7
|
|
|
8
8
|
React.useEffect(() => {
|
|
9
|
+
// SSR, node-render harnesses and bare jsdom have no matchMedia; a layout hook must not be
|
|
10
|
+
// the reason a view throws. Treat "unknown" as wide.
|
|
11
|
+
if (typeof window.matchMedia !== "function") return
|
|
9
12
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
13
|
const onChange = () => {
|
|
11
14
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
package/dist/src/i18n/en.ts
CHANGED
|
@@ -79,13 +79,39 @@ export const en = {
|
|
|
79
79
|
month: "Month",
|
|
80
80
|
week: "Week",
|
|
81
81
|
day: "Day",
|
|
82
|
+
year: "Year",
|
|
83
|
+
agenda: "Agenda",
|
|
84
|
+
noEvents: "No events in this range",
|
|
85
|
+
happeningNow: "Happening now",
|
|
86
|
+
noAppointments: "No appointments or consultations at the moment",
|
|
82
87
|
allDay: "All day",
|
|
83
88
|
newEvent: "New event",
|
|
84
89
|
editEvent: "Edit event",
|
|
90
|
+
addEvent: "Add Event",
|
|
85
91
|
eventTitle: "Event title",
|
|
92
|
+
titlePlaceholder: "Title",
|
|
93
|
+
descriptionPlaceholder: "Description",
|
|
94
|
+
start: "Start",
|
|
95
|
+
end: "End",
|
|
86
96
|
save: "Save",
|
|
97
|
+
saveChanges: "Save Changes",
|
|
98
|
+
createEvent: "Create Event",
|
|
87
99
|
delete: "Delete",
|
|
88
100
|
more: (count: number) => `+${count} more`,
|
|
101
|
+
eventsCount: (count: number) => `${count} events`,
|
|
102
|
+
allUsers: "All",
|
|
103
|
+
selectUser: "Select a user",
|
|
104
|
+
clearFilter: "Clear Filter",
|
|
105
|
+
settings: "Calendar settings",
|
|
106
|
+
settingsAria: "Calendar settings",
|
|
107
|
+
useDotBadge: "Use dot badge",
|
|
108
|
+
use24Hour: "Use 24 hour format",
|
|
109
|
+
scrollHour: "Scroll hour",
|
|
110
|
+
agendaGroupBy: "Agenda view group by",
|
|
111
|
+
groupByDate: "Date",
|
|
112
|
+
groupByColor: "Color",
|
|
113
|
+
searchAgenda: "Type a command or search...",
|
|
114
|
+
formatError: "Error while formatting",
|
|
89
115
|
weekdays: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] as [
|
|
90
116
|
string,
|
|
91
117
|
string,
|
|
@@ -95,6 +121,15 @@ export const en = {
|
|
|
95
121
|
string,
|
|
96
122
|
string,
|
|
97
123
|
],
|
|
124
|
+
weekdaysSun: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] as [
|
|
125
|
+
string,
|
|
126
|
+
string,
|
|
127
|
+
string,
|
|
128
|
+
string,
|
|
129
|
+
string,
|
|
130
|
+
string,
|
|
131
|
+
string,
|
|
132
|
+
],
|
|
98
133
|
},
|
|
99
134
|
dataGrid: {
|
|
100
135
|
search: "Search…",
|
|
@@ -163,6 +198,78 @@ export const en = {
|
|
|
163
198
|
jqlInput: {
|
|
164
199
|
placeholder: "project = TMS AND status = Open",
|
|
165
200
|
},
|
|
166
|
-
|
|
201
|
+
logViewer: {
|
|
202
|
+
title: "Logs",
|
|
203
|
+
search: "Search",
|
|
204
|
+
closeSearch: "Close search",
|
|
205
|
+
pauseScroll: "Pause auto-scroll",
|
|
206
|
+
resumeScroll: "Resume auto-scroll",
|
|
207
|
+
copyAll: "Copy all logs",
|
|
208
|
+
copied: "Copied",
|
|
209
|
+
download: "Download logs",
|
|
210
|
+
clear: "Clear logs",
|
|
211
|
+
filterPlaceholder: "Filter logs…",
|
|
212
|
+
clearSearch: "Clear search",
|
|
213
|
+
empty: "No log entries.",
|
|
214
|
+
emptySearch: "No matching log entries.",
|
|
215
|
+
newBelow: "New logs below",
|
|
216
|
+
scrollLatest: "Scroll to latest",
|
|
217
|
+
lines: (n: number) => `${n} lines`,
|
|
218
|
+
linesFiltered: (shown: number, total: number) =>
|
|
219
|
+
`${shown} / ${total} lines`,
|
|
220
|
+
},
|
|
221
|
+
envTable: {
|
|
222
|
+
empty: "No environment variables.",
|
|
223
|
+
hideAll: "Hide all",
|
|
224
|
+
revealAll: "Reveal all",
|
|
225
|
+
hideAllValues: "Hide all values",
|
|
226
|
+
revealAllValues: "Reveal all values",
|
|
227
|
+
copyEnv: "Copy .env",
|
|
228
|
+
copied: "Copied!",
|
|
229
|
+
hideKey: (key: string) => `Hide ${key}`,
|
|
230
|
+
revealKey: (key: string) => `Reveal ${key}`,
|
|
231
|
+
copyValue: (key: string) => `Copy ${key} value`,
|
|
232
|
+
},
|
|
233
|
+
commitGraph: {
|
|
234
|
+
empty: "No commits.",
|
|
235
|
+
parent: "Parent",
|
|
236
|
+
parents: "Parents",
|
|
237
|
+
justNow: "just now",
|
|
238
|
+
minutesAgo: (n: number) => `${n}m ago`,
|
|
239
|
+
hoursAgo: (n: number) => `${n}h ago`,
|
|
240
|
+
daysAgo: (n: number) => `${n}d ago`,
|
|
241
|
+
},
|
|
242
|
+
appError: {
|
|
243
|
+
title: "This mini-app hit an error",
|
|
244
|
+
renderHint:
|
|
245
|
+
"A component threw while rendering. Nothing else in the panel is affected.",
|
|
246
|
+
moduleHint: "The UI bundle did not load — it usually needs recompiling.",
|
|
247
|
+
uncaughtHint: "An unhandled error stopped this view.",
|
|
248
|
+
asyncHint: "A background task failed without being handled.",
|
|
249
|
+
retry: "Retry",
|
|
250
|
+
details: "Show details",
|
|
251
|
+
hideDetails: "Hide details",
|
|
252
|
+
reported: "Reported to the host",
|
|
253
|
+
},
|
|
254
|
+
listDetail: {
|
|
255
|
+
back: "Back to list",
|
|
256
|
+
},
|
|
257
|
+
formSheet: {
|
|
258
|
+
discardTitle: "Discard these changes?",
|
|
259
|
+
discardBody: "They have not been saved. Closing now throws them away.",
|
|
260
|
+
keepEditing: "Keep editing",
|
|
261
|
+
discard: "Discard",
|
|
262
|
+
},
|
|
263
|
+
wizardShell: {
|
|
264
|
+
back: "Back",
|
|
265
|
+
next: "Next",
|
|
266
|
+
finish: "Finish",
|
|
267
|
+
working: "Working…",
|
|
268
|
+
stepOf: (n: number, total: number) => `Step ${n} of ${total}`,
|
|
269
|
+
},
|
|
270
|
+
settingsSplit: {
|
|
271
|
+
nav: "Section navigation",
|
|
272
|
+
},
|
|
273
|
+
};
|
|
167
274
|
|
|
168
|
-
export type UiMessages = typeof en
|
|
275
|
+
export type UiMessages = typeof en;
|
package/dist/src/i18n/zh.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UiMessages } from "./en"
|
|
1
|
+
import type { UiMessages } from "./en";
|
|
2
2
|
|
|
3
3
|
export const zh: UiMessages = {
|
|
4
4
|
common: {
|
|
@@ -81,14 +81,41 @@ export const zh: UiMessages = {
|
|
|
81
81
|
month: "月",
|
|
82
82
|
week: "周",
|
|
83
83
|
day: "日",
|
|
84
|
+
year: "年",
|
|
85
|
+
agenda: "议程",
|
|
86
|
+
noEvents: "这段时间没有事件",
|
|
87
|
+
happeningNow: "正在进行",
|
|
88
|
+
noAppointments: "此刻没有预约或日程",
|
|
84
89
|
allDay: "全天",
|
|
85
90
|
newEvent: "新建事件",
|
|
86
91
|
editEvent: "编辑事件",
|
|
92
|
+
addEvent: "添加事件",
|
|
87
93
|
eventTitle: "事件标题",
|
|
94
|
+
titlePlaceholder: "标题",
|
|
95
|
+
descriptionPlaceholder: "描述",
|
|
96
|
+
start: "开始",
|
|
97
|
+
end: "结束",
|
|
88
98
|
save: "保存",
|
|
99
|
+
saveChanges: "保存更改",
|
|
100
|
+
createEvent: "创建事件",
|
|
89
101
|
delete: "删除",
|
|
90
102
|
more: (count: number) => `还有 ${count} 项`,
|
|
103
|
+
eventsCount: (count: number) => `${count} 个事件`,
|
|
104
|
+
allUsers: "全部",
|
|
105
|
+
selectUser: "选择用户",
|
|
106
|
+
clearFilter: "清除筛选",
|
|
107
|
+
settings: "日历设置",
|
|
108
|
+
settingsAria: "日历设置",
|
|
109
|
+
useDotBadge: "使用圆点标记",
|
|
110
|
+
use24Hour: "使用 24 小时制",
|
|
111
|
+
scrollHour: "起始小时",
|
|
112
|
+
agendaGroupBy: "议程分组方式",
|
|
113
|
+
groupByDate: "日期",
|
|
114
|
+
groupByColor: "颜色",
|
|
115
|
+
searchAgenda: "搜索事件…",
|
|
116
|
+
formatError: "日期格式化失败",
|
|
91
117
|
weekdays: ["一", "二", "三", "四", "五", "六", "日"],
|
|
118
|
+
weekdaysSun: ["日", "一", "二", "三", "四", "五", "六"],
|
|
92
119
|
},
|
|
93
120
|
dataGrid: {
|
|
94
121
|
search: "搜索…",
|
|
@@ -157,4 +184,74 @@ export const zh: UiMessages = {
|
|
|
157
184
|
jqlInput: {
|
|
158
185
|
placeholder: "project = TMS AND status = Open",
|
|
159
186
|
},
|
|
160
|
-
|
|
187
|
+
logViewer: {
|
|
188
|
+
title: "日志",
|
|
189
|
+
search: "搜索",
|
|
190
|
+
closeSearch: "关闭搜索",
|
|
191
|
+
pauseScroll: "暂停自动滚动",
|
|
192
|
+
resumeScroll: "恢复自动滚动",
|
|
193
|
+
copyAll: "复制全部日志",
|
|
194
|
+
copied: "已复制",
|
|
195
|
+
download: "下载日志",
|
|
196
|
+
clear: "清空日志",
|
|
197
|
+
filterPlaceholder: "过滤日志…",
|
|
198
|
+
clearSearch: "清除搜索",
|
|
199
|
+
empty: "暂无日志。",
|
|
200
|
+
emptySearch: "没有匹配的日志。",
|
|
201
|
+
newBelow: "下方有新日志",
|
|
202
|
+
scrollLatest: "滚到最新",
|
|
203
|
+
lines: (n: number) => `${n} 行`,
|
|
204
|
+
linesFiltered: (shown: number, total: number) => `${shown} / ${total} 行`,
|
|
205
|
+
},
|
|
206
|
+
envTable: {
|
|
207
|
+
empty: "没有环境变量。",
|
|
208
|
+
hideAll: "全部隐藏",
|
|
209
|
+
revealAll: "全部显示",
|
|
210
|
+
hideAllValues: "隐藏全部值",
|
|
211
|
+
revealAllValues: "显示全部值",
|
|
212
|
+
copyEnv: "复制 .env",
|
|
213
|
+
copied: "已复制!",
|
|
214
|
+
hideKey: (key: string) => `隐藏 ${key}`,
|
|
215
|
+
revealKey: (key: string) => `显示 ${key}`,
|
|
216
|
+
copyValue: (key: string) => `复制 ${key} 的值`,
|
|
217
|
+
},
|
|
218
|
+
commitGraph: {
|
|
219
|
+
empty: "没有提交。",
|
|
220
|
+
parent: "父提交",
|
|
221
|
+
parents: "父提交",
|
|
222
|
+
justNow: "刚刚",
|
|
223
|
+
minutesAgo: (n: number) => `${n} 分钟前`,
|
|
224
|
+
hoursAgo: (n: number) => `${n} 小时前`,
|
|
225
|
+
daysAgo: (n: number) => `${n} 天前`,
|
|
226
|
+
},
|
|
227
|
+
appError: {
|
|
228
|
+
title: "这个小程序出错了",
|
|
229
|
+
renderHint: "某个组件在渲染时抛出异常,面板其他部分不受影响。",
|
|
230
|
+
moduleHint: "UI 代码没有加载成功,通常需要重新编译。",
|
|
231
|
+
uncaughtHint: "一个未被捕获的错误中断了当前视图。",
|
|
232
|
+
asyncHint: "一个后台任务失败且未被处理。",
|
|
233
|
+
retry: "重试",
|
|
234
|
+
details: "查看详情",
|
|
235
|
+
hideDetails: "收起详情",
|
|
236
|
+
reported: "已上报宿主",
|
|
237
|
+
},
|
|
238
|
+
listDetail: {
|
|
239
|
+
back: "返回列表",
|
|
240
|
+
},
|
|
241
|
+
formSheet: {
|
|
242
|
+
discardTitle: "放弃这次修改?",
|
|
243
|
+
discardBody: "改动还没有保存,现在关闭就会丢掉。",
|
|
244
|
+
keepEditing: "继续编辑",
|
|
245
|
+
discard: "放弃",
|
|
246
|
+
},
|
|
247
|
+
wizardShell: {
|
|
248
|
+
back: "上一步",
|
|
249
|
+
next: "下一步",
|
|
250
|
+
finish: "完成",
|
|
251
|
+
working: "处理中…",
|
|
252
|
+
stepOf: (n: number, total: number) => `第 ${n} / ${total} 步`,
|
|
253
|
+
},
|
|
254
|
+
settingsSplit: {
|
|
255
|
+
nav: "章节导航",
|
|
256
|
+
},
|
|
257
|
+
};
|