@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.
Files changed (149) hide show
  1. package/components.json +23 -0
  2. package/dist/globals.css +2 -0
  3. package/dist/index.js +138 -0
  4. package/dist/manifest.json +11 -0
  5. package/dist/src/blocks/activity-feed.tsx +9 -0
  6. package/dist/src/blocks/app-shell.tsx +37 -0
  7. package/dist/src/blocks/attachment-gallery.tsx +30 -0
  8. package/dist/src/blocks/bar-chart.tsx +33 -0
  9. package/dist/src/blocks/comment-thread.tsx +30 -0
  10. package/dist/src/blocks/description-list.tsx +16 -0
  11. package/dist/src/blocks/detail-panel.tsx +43 -0
  12. package/dist/src/blocks/donut-chart.tsx +38 -0
  13. package/dist/src/blocks/env-badge.tsx +23 -0
  14. package/dist/src/blocks/file-tree.tsx +5 -0
  15. package/dist/src/blocks/filter-bar.tsx +21 -0
  16. package/dist/src/blocks/gauge.tsx +13 -0
  17. package/dist/src/blocks/notification-center.tsx +22 -0
  18. package/dist/src/blocks/page-header.tsx +30 -0
  19. package/dist/src/blocks/progress-ring.tsx +25 -0
  20. package/dist/src/blocks/radar-chart.tsx +31 -0
  21. package/dist/src/blocks/request-inspector.tsx +34 -0
  22. package/dist/src/blocks/run-timeline.tsx +5 -0
  23. package/dist/src/blocks/scrollspy.tsx +42 -0
  24. package/dist/src/blocks/severity-chip.tsx +27 -0
  25. package/dist/src/blocks/sparkline.tsx +19 -0
  26. package/dist/src/blocks/stat-card.tsx +49 -0
  27. package/dist/src/blocks/status-badge.tsx +39 -0
  28. package/dist/src/blocks/terminal.tsx +10 -0
  29. package/dist/src/blocks/test-step-list.tsx +19 -0
  30. package/dist/src/blocks/trend-card.tsx +51 -0
  31. package/dist/src/components/accordion.tsx +72 -0
  32. package/dist/src/components/alert-dialog.tsx +185 -0
  33. package/dist/src/components/alert.tsx +76 -0
  34. package/dist/src/components/aspect-ratio.tsx +22 -0
  35. package/dist/src/components/attachment.tsx +207 -0
  36. package/dist/src/components/avatar.tsx +107 -0
  37. package/dist/src/components/badge.tsx +52 -0
  38. package/dist/src/components/breadcrumb.tsx +125 -0
  39. package/dist/src/components/bubble.tsx +128 -0
  40. package/dist/src/components/button-group.tsx +87 -0
  41. package/dist/src/components/button.tsx +58 -0
  42. package/dist/src/components/calendar.tsx +221 -0
  43. package/dist/src/components/card.tsx +103 -0
  44. package/dist/src/components/chart.tsx +371 -0
  45. package/dist/src/components/checkbox.tsx +29 -0
  46. package/dist/src/components/collapsible.tsx +19 -0
  47. package/dist/src/components/combobox.tsx +295 -0
  48. package/dist/src/components/command.tsx +196 -0
  49. package/dist/src/components/context-menu.tsx +271 -0
  50. package/dist/src/components/dialog.tsx +158 -0
  51. package/dist/src/components/drawer.tsx +226 -0
  52. package/dist/src/components/dropdown-menu.tsx +268 -0
  53. package/dist/src/components/empty.tsx +123 -0
  54. package/dist/src/components/field.tsx +236 -0
  55. package/dist/src/components/hover-card.tsx +49 -0
  56. package/dist/src/components/input-group.tsx +158 -0
  57. package/dist/src/components/input.tsx +20 -0
  58. package/dist/src/components/item.tsx +201 -0
  59. package/dist/src/components/kbd.tsx +26 -0
  60. package/dist/src/components/label.tsx +20 -0
  61. package/dist/src/components/marker.tsx +71 -0
  62. package/dist/src/components/menubar.tsx +280 -0
  63. package/dist/src/components/message-scroller.tsx +129 -0
  64. package/dist/src/components/message.tsx +92 -0
  65. package/dist/src/components/native-select.tsx +61 -0
  66. package/dist/src/components/navigation-menu.tsx +168 -0
  67. package/dist/src/components/pagination.tsx +135 -0
  68. package/dist/src/components/popover.tsx +88 -0
  69. package/dist/src/components/progress.tsx +83 -0
  70. package/dist/src/components/questionnaire.tsx +329 -0
  71. package/dist/src/components/radio-group.tsx +36 -0
  72. package/dist/src/components/resizable.tsx +50 -0
  73. package/dist/src/components/scroll-area.tsx +52 -0
  74. package/dist/src/components/select.tsx +201 -0
  75. package/dist/src/components/separator.tsx +23 -0
  76. package/dist/src/components/sheet.tsx +136 -0
  77. package/dist/src/components/sidebar.tsx +721 -0
  78. package/dist/src/components/skeleton.tsx +13 -0
  79. package/dist/src/components/slider.tsx +52 -0
  80. package/dist/src/components/spinner.tsx +10 -0
  81. package/dist/src/components/switch.tsx +32 -0
  82. package/dist/src/components/table.tsx +114 -0
  83. package/dist/src/components/tabs.tsx +82 -0
  84. package/dist/src/components/textarea.tsx +18 -0
  85. package/dist/src/components/toast.tsx +234 -0
  86. package/dist/src/components/toggle-group.tsx +89 -0
  87. package/dist/src/components/toggle.tsx +43 -0
  88. package/dist/src/components/tooltip.tsx +66 -0
  89. package/dist/src/composites/autocomplete.tsx +55 -0
  90. package/dist/src/composites/cascader.tsx +46 -0
  91. package/dist/src/composites/color-picker.tsx +19 -0
  92. package/dist/src/composites/confirm-dialog.tsx +56 -0
  93. package/dist/src/composites/copyable.tsx +37 -0
  94. package/dist/src/composites/currency-input.tsx +31 -0
  95. package/dist/src/composites/date-chrome.tsx +157 -0
  96. package/dist/src/composites/date-picker.tsx +91 -0
  97. package/dist/src/composites/date-range-picker.tsx +96 -0
  98. package/dist/src/composites/date-time-picker.tsx +115 -0
  99. package/dist/src/composites/date-time-range-picker.tsx +51 -0
  100. package/dist/src/composites/duration-input.tsx +122 -0
  101. package/dist/src/composites/mini-calendar.tsx +24 -0
  102. package/dist/src/composites/number-field.tsx +53 -0
  103. package/dist/src/composites/password-field.tsx +44 -0
  104. package/dist/src/composites/phone-input.tsx +22 -0
  105. package/dist/src/composites/rating.tsx +39 -0
  106. package/dist/src/composites/relative-date-picker.tsx +62 -0
  107. package/dist/src/composites/search-input.tsx +49 -0
  108. package/dist/src/composites/slider-range.tsx +30 -0
  109. package/dist/src/composites/tag-input.tsx +56 -0
  110. package/dist/src/composites/time-picker.tsx +199 -0
  111. package/dist/src/composites/time-range-picker.tsx +25 -0
  112. package/dist/src/composites/timezone-select.tsx +251 -0
  113. package/dist/src/composites/transfer.tsx +52 -0
  114. package/dist/src/composites/user-picker.tsx +40 -0
  115. package/dist/src/hooks/use-mobile.ts +19 -0
  116. package/dist/src/i18n/context.tsx +72 -0
  117. package/dist/src/i18n/en.ts +168 -0
  118. package/dist/src/i18n/zh.ts +160 -0
  119. package/dist/src/index.ts +134 -0
  120. package/dist/src/lib/icons.tsx +16 -0
  121. package/dist/src/lib/illustrations.tsx +573 -0
  122. package/dist/src/lib/utils.ts +6 -0
  123. package/dist/src/products/cells.tsx +18 -0
  124. package/dist/src/products/code-block.tsx +75 -0
  125. package/dist/src/products/code-editor.tsx +49 -0
  126. package/dist/src/products/column-meta.d.ts +9 -0
  127. package/dist/src/products/data-grid.tsx +689 -0
  128. package/dist/src/products/diff-viewer.tsx +129 -0
  129. package/dist/src/products/event-calendar.tsx +845 -0
  130. package/dist/src/products/export-csv.ts +25 -0
  131. package/dist/src/products/file-dropzone.tsx +41 -0
  132. package/dist/src/products/gantt.tsx +41 -0
  133. package/dist/src/products/jira-wiki-parse.ts +197 -0
  134. package/dist/src/products/jira-wiki.tsx +285 -0
  135. package/dist/src/products/jql-input.tsx +62 -0
  136. package/dist/src/products/jql-language.ts +70 -0
  137. package/dist/src/products/json-viewer.tsx +37 -0
  138. package/dist/src/products/kanban-issue-panel.tsx +98 -0
  139. package/dist/src/products/kanban.tsx +245 -0
  140. package/dist/src/products/log-viewer.tsx +33 -0
  141. package/dist/src/products/markdown-editor.tsx +63 -0
  142. package/dist/src/products/markdown.tsx +26 -0
  143. package/dist/src/products/rich-text-editor.tsx +84 -0
  144. package/dist/src/products/sortable-list.tsx +61 -0
  145. package/dist/src/products/stepper.tsx +89 -0
  146. package/dist/src/products/timeline.tsx +32 -0
  147. package/dist/src/products/tree-view.tsx +56 -0
  148. package/dist/src/styles/globals.css +352 -0
  149. package/package.json +100 -0
@@ -0,0 +1,6 @@
1
+ import { clsx, type ClassValue } from "clsx"
2
+ import { twMerge } from "tailwind-merge"
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs))
6
+ }
@@ -0,0 +1,18 @@
1
+ import { StatusBadge } from "@monkey-mini-app/ui/blocks/status-badge"
2
+
3
+ export function TextCell({ value }: { value: unknown }) {
4
+ return <span className="truncate">{String(value ?? "")}</span>
5
+ }
6
+
7
+ export function StatusCell({ value }: { value: unknown }) {
8
+ return <StatusBadge status={String(value ?? "pending")} />
9
+ }
10
+
11
+ export function BooleanCell({ value }: { value: unknown }) {
12
+ return <span className="text-muted-foreground">{value ? "Yes" : "No"}</span>
13
+ }
14
+
15
+ export function NumberCell({ value }: { value: unknown }) {
16
+ const n = Number(value)
17
+ return <span className="tabular-nums">{Number.isFinite(n) ? n.toLocaleString() : "—"}</span>
18
+ }
@@ -0,0 +1,75 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { codeToHtml } from "shiki"
5
+
6
+ import { cn } from "@monkey-mini-app/ui/lib/utils"
7
+
8
+ const aliases: Record<string, string> = {
9
+ typescript: "ts",
10
+ javascript: "js",
11
+ py: "python",
12
+ sh: "bash",
13
+ shell: "bash",
14
+ yml: "yaml",
15
+ plaintext: "text",
16
+ txt: "text",
17
+ }
18
+
19
+ export function CodeBlock({
20
+ code,
21
+ language = "ts",
22
+ className,
23
+ }: {
24
+ code: string
25
+ language?: string
26
+ className?: string
27
+ }) {
28
+ const [html, setHtml] = React.useState<string | null>(null)
29
+ const lang = aliases[language.toLowerCase()] ?? language.toLowerCase()
30
+ const dark =
31
+ typeof document !== "undefined" &&
32
+ document.documentElement.classList.contains("dark")
33
+
34
+ React.useEffect(() => {
35
+ let cancelled = false
36
+ codeToHtml(code, {
37
+ lang,
38
+ theme: dark ? "github-dark" : "github-light",
39
+ })
40
+ .then((out) => {
41
+ if (!cancelled) setHtml(out)
42
+ })
43
+ .catch(() =>
44
+ codeToHtml(code, {
45
+ lang: "text",
46
+ theme: dark ? "github-dark" : "github-light",
47
+ }).then((out) => {
48
+ if (!cancelled) setHtml(out)
49
+ })
50
+ )
51
+ return () => {
52
+ cancelled = true
53
+ }
54
+ }, [code, lang, dark])
55
+
56
+ return (
57
+ <div
58
+ data-testid="code-block"
59
+ data-language={lang}
60
+ data-highlighted={html ? "true" : "false"}
61
+ className={cn(
62
+ "overflow-auto rounded-xl border text-xs leading-6 [&_code]:font-mono [&_pre]:m-0 [&_pre]:bg-transparent [&_pre]:p-3",
63
+ className
64
+ )}
65
+ >
66
+ {html ? (
67
+ <div dangerouslySetInnerHTML={{ __html: html }} />
68
+ ) : (
69
+ <pre>
70
+ <code>{code}</code>
71
+ </pre>
72
+ )}
73
+ </div>
74
+ )
75
+ }
@@ -0,0 +1,49 @@
1
+ "use client"
2
+
3
+ import { html } from "@codemirror/lang-html"
4
+ import { javascript } from "@codemirror/lang-javascript"
5
+ import { json } from "@codemirror/lang-json"
6
+ import { markdown } from "@codemirror/lang-markdown"
7
+ import { oneDark } from "@codemirror/theme-one-dark"
8
+ import CodeMirror from "@uiw/react-codemirror"
9
+
10
+ import { cn } from "@monkey-mini-app/ui/lib/utils"
11
+
12
+ const langs = {
13
+ js: javascript(),
14
+ ts: javascript({ typescript: true }),
15
+ json: json(),
16
+ html: html(),
17
+ md: markdown(),
18
+ }
19
+
20
+ export function CodeEditor({
21
+ value,
22
+ onChange,
23
+ language = "ts",
24
+ height = "220px",
25
+ className,
26
+ }: {
27
+ value: string
28
+ onChange?: (value: string) => void
29
+ language?: keyof typeof langs
30
+ height?: string
31
+ className?: string
32
+ }) {
33
+ const dark =
34
+ typeof document !== "undefined" &&
35
+ document.documentElement.classList.contains("dark")
36
+
37
+ return (
38
+ <div data-testid="code-editor" className={cn("overflow-hidden rounded-xl border", className)}>
39
+ <CodeMirror
40
+ value={value}
41
+ height={height}
42
+ theme={dark ? oneDark : "light"}
43
+ extensions={[langs[language] ?? langs.ts]}
44
+ onChange={(next) => onChange?.(next)}
45
+ basicSetup={{ lineNumbers: true }}
46
+ />
47
+ </div>
48
+ )
49
+ }
@@ -0,0 +1,9 @@
1
+ import type { DataGridColumnMeta } from "./data-grid"
2
+
3
+ declare module "@tanstack/react-table" {
4
+ interface ColumnMeta<TData, TValue> extends DataGridColumnMeta {
5
+ _unused?: TValue | TData
6
+ }
7
+ }
8
+
9
+ export {}