@monkey-mini-app/ui 0.1.0 → 0.1.1

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.
@@ -1,11 +1,11 @@
1
1
  {
2
- "builtAt": "2026-08-30T11:02:56.451Z",
2
+ "builtAt": "2026-08-31T11:56:21.707Z",
3
3
  "entry": "index.js",
4
4
  "flatExports": 138,
5
5
  "componentFiles": 141,
6
6
  "srcFiles": 144,
7
7
  "css": {
8
- "bytes": 215063
8
+ "bytes": 256587
9
9
  },
10
- "bytes": 814789
10
+ "bytes": 857408
11
11
  }
@@ -8,18 +8,21 @@ import {
8
8
  ChartTooltipContent,
9
9
  type ChartConfig,
10
10
  } from "@monkey-mini-app/ui/components/chart"
11
+ import { cn } from "@monkey-mini-app/ui/lib/utils"
11
12
 
12
13
  export function StackedBarChart({
13
14
  data,
14
15
  config,
15
16
  keys,
17
+ className,
16
18
  }: {
17
19
  data: Record<string, string | number>[]
18
20
  config: ChartConfig
19
21
  keys: string[]
22
+ className?: string
20
23
  }) {
21
24
  return (
22
- <ChartContainer config={config} className="h-56 w-full" data-testid="bar-chart">
25
+ <ChartContainer config={config} className={cn("aspect-video w-full", className)} data-testid="bar-chart">
23
26
  <ReBar accessibilityLayer data={data}>
24
27
  <CartesianGrid vertical={false} />
25
28
  <XAxis dataKey="label" tickLine={false} axisLine={false} />
@@ -9,20 +9,30 @@ import {
9
9
  type ChartConfig,
10
10
  } from "@monkey-mini-app/ui/components/chart"
11
11
 
12
+ import { cn } from "@monkey-mini-app/ui/lib/utils"
13
+
12
14
  export type Slice = { name: string; value: number; fill: string }
13
15
 
14
16
  export function DonutChart({
15
17
  data,
16
18
  config,
17
19
  center,
20
+ size,
21
+ className,
18
22
  }: {
19
23
  data: Slice[]
20
24
  config: ChartConfig
21
25
  center?: string
26
+ size?: number
27
+ className?: string
22
28
  }) {
23
29
  return (
24
- <div className="relative" data-testid="donut-chart">
25
- <ChartContainer config={config} className="mx-auto aspect-square h-48">
30
+ <div className={cn("relative", className)} data-testid="donut-chart">
31
+ <ChartContainer
32
+ config={config}
33
+ className={cn("mx-auto aspect-square", size ? "" : "w-full max-w-80")}
34
+ style={size ? { width: size, height: size } : undefined}
35
+ >
26
36
  <PieChart>
27
37
  <ChartTooltip content={<ChartTooltipContent hideLabel />} />
28
38
  <Pie data={data} dataKey="value" nameKey="name" innerRadius={50} />
@@ -1,13 +1,29 @@
1
1
  import { ProgressRing } from "@monkey-mini-app/ui/blocks/progress-ring"
2
+ import { cn } from "@monkey-mini-app/ui/lib/utils"
2
3
 
3
- export function Gauge({ value, label }: { value: number; label?: string }) {
4
+ export function Gauge({
5
+ value,
6
+ label,
7
+ size = 112,
8
+ className,
9
+ }: {
10
+ value: number
11
+ label?: string
12
+ size?: number
13
+ className?: string
14
+ }) {
4
15
  return (
5
- <div className="flex items-center gap-2" data-testid="gauge">
6
- <ProgressRing value={value} />
7
- <div>
8
- <div className="text-sm font-medium">{value}%</div>
9
- {label ? <div className="text-muted-foreground text-xs">{label}</div> : null}
16
+ <div
17
+ className={cn("flex flex-col items-center gap-2", className)}
18
+ data-testid="gauge"
19
+ >
20
+ <div className="relative" style={{ width: size, height: size }}>
21
+ <ProgressRing value={value} className="h-full w-full" />
22
+ <div className="absolute inset-0 flex flex-col items-center justify-center">
23
+ <span className="text-2xl font-semibold tabular-nums">{value}%</span>
24
+ </div>
10
25
  </div>
26
+ {label ? <div className="text-xs text-muted-foreground">{label}</div> : null}
11
27
  </div>
12
28
  )
13
29
  }
@@ -1,4 +1,14 @@
1
- export function ProgressRing({ value }: { value: number }) {
1
+ import { cn } from "../lib/utils"
2
+
3
+ export function ProgressRing({
4
+ value,
5
+ size,
6
+ className,
7
+ }: {
8
+ value: number
9
+ size?: number
10
+ className?: string
11
+ }) {
2
12
  const clamped = Math.min(100, Math.max(0, value))
3
13
  const r = 16
4
14
  const c = 2 * Math.PI * r
@@ -7,7 +17,8 @@ export function ProgressRing({ value }: { value: number }) {
7
17
  <svg
8
18
  data-testid="progress-ring"
9
19
  viewBox="0 0 40 40"
10
- className="size-10 -rotate-90"
20
+ style={size ? { width: size, height: size } : undefined}
21
+ className={cn("-rotate-90 size-10", className)}
11
22
  >
12
23
  <circle cx="20" cy="20" r={r} className="fill-none stroke-muted" strokeWidth="4" />
13
24
  <circle
@@ -8,18 +8,28 @@ import {
8
8
  ChartTooltipContent,
9
9
  type ChartConfig,
10
10
  } from "@monkey-mini-app/ui/components/chart"
11
+ import { cn } from "@monkey-mini-app/ui/lib/utils"
11
12
 
12
13
  export function RadarChart({
13
14
  data,
14
15
  config,
15
16
  dataKey = "value",
17
+ size,
18
+ className,
16
19
  }: {
17
20
  data: { label: string; value: number }[]
18
21
  config: ChartConfig
19
22
  dataKey?: string
23
+ size?: number
24
+ className?: string
20
25
  }) {
21
26
  return (
22
- <ChartContainer config={config} className="mx-auto aspect-square h-56" data-testid="radar-chart">
27
+ <ChartContainer
28
+ config={config}
29
+ className={cn("mx-auto aspect-square", size ? "" : "w-full max-w-80", className)}
30
+ style={size ? { width: size, height: size } : undefined}
31
+ data-testid="radar-chart"
32
+ >
23
33
  <ReRadar data={data}>
24
34
  <PolarGrid />
25
35
  <PolarAngleAxis dataKey="label" />
@@ -1,17 +1,19 @@
1
1
  "use client"
2
2
 
3
- import { Line, LineChart } from "recharts"
3
+ import { Line, LineChart, YAxis } from "recharts"
4
4
 
5
5
  import { ChartContainer, type ChartConfig } from "@monkey-mini-app/ui/components/chart"
6
+ import { cn } from "@monkey-mini-app/ui/lib/utils"
6
7
 
7
8
  const config = {
8
9
  value: { label: "Value", color: "var(--chart-1)" },
9
10
  } satisfies ChartConfig
10
11
 
11
- export function Sparkline({ data }: { data: { value: number }[] }) {
12
+ export function Sparkline({ data, className }: { data: { value: number }[]; className?: string }) {
12
13
  return (
13
- <ChartContainer config={config} className="h-10 w-24" data-testid="sparkline">
14
+ <ChartContainer config={config} className={cn("h-20 w-full", className)} data-testid="sparkline">
14
15
  <LineChart data={data}>
16
+ <YAxis hide domain={["dataMin", "dataMax"]} />
15
17
  <Line dataKey="value" type="monotone" stroke="var(--color-value)" strokeWidth={1.5} dot={false} />
16
18
  </LineChart>
17
19
  </ChartContainer>
@@ -5,13 +5,12 @@
5
5
 
6
6
  @custom-variant dark (&:is(.dark *));
7
7
 
8
- /* No @source directives: generate the FULL default Tailwind utility set (incl. all
9
- responsive variants). Runtime mini-apps live outside this repo and would otherwise
10
- miss any class that never appears here (e.g. lg:grid-cols-2) — the per-app Tailwind
11
- re-scan was unreliable. A single comprehensive stylesheet served to every app is
12
- ~480KB but shared/cached, covers all standard classes, and removes the fragile
13
- per-app compile. Arbitrary values (w-[320px]) are NOT auto-generated by Tailwind;
14
- apps should stick to standard utilities. */
8
+ /* Base: theme + components + repo-scanned utilities. Runtime mini-apps' OWN utilities
9
+ are compiled per-app (the host copies the app dir into the project root and @source's
10
+ it), so their classes are never missed. */
11
+ @source "../../../../apps/**/*.{ts,tsx}";
12
+ @source "../../../../packages/ui/src/**/*.{ts,tsx}";
13
+ @source "../**/*.{ts,tsx}";
15
14
 
16
15
  @theme inline {
17
16
  --font-heading: var(--font-sans);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkey-mini-app/ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "scripts": {
@@ -96,5 +96,8 @@
96
96
  "files": [
97
97
  "dist",
98
98
  "components.json"
99
- ]
99
+ ],
100
+ "publishConfig": {
101
+ "access": "public"
102
+ }
100
103
  }