@lunora/studio 0.0.0 → 1.0.0-alpha.2

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 (81) hide show
  1. package/LICENSE.md +105 -0
  2. package/README.md +123 -9
  3. package/__assets__/package-og.svg +14 -0
  4. package/dist/index.d.ts +1402 -0
  5. package/dist/index.js +41 -0
  6. package/dist/mount.d.ts +21 -0
  7. package/dist/mount.js +26 -0
  8. package/dist/packem_shared/ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js +45 -0
  9. package/dist/packem_shared/ApiDocsPanel-DpRjJhG5.js +842 -0
  10. package/dist/packem_shared/ApiReferencePanel-DMIUp-kK.js +229 -0
  11. package/dist/packem_shared/ApiTab-DURGU15e.js +251 -0
  12. package/dist/packem_shared/AuditPanel-BC59Nhst.js +212 -0
  13. package/dist/packem_shared/CommandPalette-Dx_CoB9i.js +373 -0
  14. package/dist/packem_shared/ConfirmButton-WQVUoGFb.js +59 -0
  15. package/dist/packem_shared/ConnectionBadge-Bxagrip8.js +111 -0
  16. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +50 -0
  17. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +89 -0
  18. package/dist/packem_shared/DataBrowser-Coz6jJE6.js +4542 -0
  19. package/dist/packem_shared/DataFilters-FNquMaiu.js +249 -0
  20. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +66 -0
  21. package/dist/packem_shared/ExportImportPanel-WO34fJxy.js +193 -0
  22. package/dist/packem_shared/FileBrowser-Zcr-Qgxo.js +2932 -0
  23. package/dist/packem_shared/FunctionRunner-j0Rd5m9t.js +343 -0
  24. package/dist/packem_shared/FunctionStatsPanel-DboBl-XL.js +432 -0
  25. package/dist/packem_shared/GlobalDataBrowser-9MhPEfgN.js +318 -0
  26. package/dist/packem_shared/HealthPanel-DOIgbUtx.js +640 -0
  27. package/dist/packem_shared/HomePanel-bdOCNA-p.js +1273 -0
  28. package/dist/packem_shared/InsightsPanel-DaZPnSgt.js +423 -0
  29. package/dist/packem_shared/LogsPanel-CWdqAGpQ.js +839 -0
  30. package/dist/packem_shared/MailPanel-D_EGtDnS.js +447 -0
  31. package/dist/packem_shared/MetricsPanel-E4Gv6wTO.js +1625 -0
  32. package/dist/packem_shared/MigrationsPanel-DQdPY9io.js +246 -0
  33. package/dist/packem_shared/OpenRpcReferencePanel-j2p3HB0s.js +191 -0
  34. package/dist/packem_shared/PitrPanel-BbBkQR6t.js +252 -0
  35. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +3 -0
  36. package/dist/packem_shared/ScheduledJobs-Ok1CYYwI.js +159 -0
  37. package/dist/packem_shared/SchemaViewer-D8XGnp-X.js +2512 -0
  38. package/dist/packem_shared/SecurityAdvisorPanel-Cdm2IxLW.js +79 -0
  39. package/dist/packem_shared/SettingsPanel-D3WF2mBU.js +176 -0
  40. package/dist/packem_shared/ShardInput-DNCsT1KW.js +107 -0
  41. package/dist/packem_shared/SqlEditorPanel-BuQ7f2Hs.js +13 -0
  42. package/dist/packem_shared/Studio-D36od9Oz.js +33 -0
  43. package/dist/packem_shared/StudioApp-dvywkJ8I.js +383 -0
  44. package/dist/packem_shared/StudioI18nProvider-Dcajsznk.js +48 -0
  45. package/dist/packem_shared/TableEditor-DIVDk3vT.js +371 -0
  46. package/dist/packem_shared/advisor-view-DBlzJi6C.js +159 -0
  47. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +108 -0
  48. package/dist/packem_shared/app.d-CCmwDEVs.d.ts +300 -0
  49. package/dist/packem_shared/badge-B2PKA1-5.js +49 -0
  50. package/dist/packem_shared/bar-chart-CzJAgqkp.js +3245 -0
  51. package/dist/packem_shared/button-BhsN2uZH.js +49 -0
  52. package/dist/packem_shared/card-DURq3ElK.js +175 -0
  53. package/dist/packem_shared/cf-links-BZfRdxSE.js +8 -0
  54. package/dist/packem_shared/checkbox-UNkzAxl-.js +63 -0
  55. package/dist/packem_shared/createStudioI18n-CgvlmDkN.js +27 -0
  56. package/dist/packem_shared/data-grid-CCh2Couo.js +183 -0
  57. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +280 -0
  58. package/dist/packem_shared/empty-state-DY_oe0k6.js +98 -0
  59. package/dist/packem_shared/grid-features-DTjG6Sex.js +840 -0
  60. package/dist/packem_shared/input-XH4r1Pt1.js +53 -0
  61. package/dist/packem_shared/internal-BBZYexre.js +68 -0
  62. package/dist/packem_shared/label-D8ykjn5J.js +46 -0
  63. package/dist/packem_shared/live-status-bPff1O7Y.js +44 -0
  64. package/dist/packem_shared/reference-view-BCKIoai7.js +2180 -0
  65. package/dist/packem_shared/shard-history-DyebH1R5.js +38 -0
  66. package/dist/packem_shared/sparkline-10dG-_f0.js +93 -0
  67. package/dist/packem_shared/sql-editor-panel-CW2y2x9h.js +2562 -0
  68. package/dist/packem_shared/storage-tier-CL98eOvn.js +85 -0
  69. package/dist/packem_shared/studio-BDVd7rIV.js +10303 -0
  70. package/dist/packem_shared/table-_RzNvy3R.js +246 -0
  71. package/dist/packem_shared/table-list-sidebar-aZHLq70w.js +832 -0
  72. package/dist/packem_shared/textarea-D3gaCU_-.js +46 -0
  73. package/dist/packem_shared/use-live-admin-D1h1Fzsd.js +73 -0
  74. package/dist/packem_shared/use-live-shard-seed-B74RYcOy.js +76 -0
  75. package/dist/packem_shared/useDebounced-Dxncpg6z.js +32 -0
  76. package/dist/packem_shared/utils-B05Dmz_H.js +8 -0
  77. package/dist/packem_shared/virtual-rect-CVMUskSm.js +10 -0
  78. package/dist/standalone/studio.js +356 -0
  79. package/dist/styles.css +2 -0
  80. package/package.json +77 -17
  81. package/src/theme.css +59 -0
@@ -0,0 +1,300 @@
1
+ import { CronJobInfo, ScheduleRecord, LunoraClient } from '@lunora/client';
2
+ import { ReactElement } from 'react';
3
+ import { I18n } from '@lingui/core';
4
+ interface CronTriggersPanelProps {
5
+ /**
6
+ * Load the code-defined cron triggers. Defaults to `client.getCronJobs`,
7
+ * which hits the worker's admin-gated `/_lunora/admin/cron-jobs` endpoint —
8
+ * so the panel works out of the box under `<LunoraProvider>`, provided the
9
+ * worker is built with a `cronJobs` map and `adminToken`. Override it to
10
+ * source triggers from elsewhere (e.g. tests).
11
+ */
12
+ readonly loadCronJobs?: () => Promise<CronJobInfo[]>;
13
+ /**
14
+ * Manually fire one cron job by name. Defaults to `client.runCronJob`, which
15
+ * hits the admin-gated `POST /_lunora/admin/cron-jobs/run` endpoint (the same
16
+ * dispatch the scheduled trigger runs). When a custom {@link CronTriggersPanelProps.loadCronJobs}
17
+ * is supplied without a `runCronJob`, the "Run now" control is hidden — useful
18
+ * for a read-only view.
19
+ */
20
+ readonly runCronJob?: (name: string) => Promise<{
21
+ name: string;
22
+ ran: boolean;
23
+ }>;
24
+ }
25
+ /**
26
+ * Read-only view of the **static cron triggers** — the `cronJobs()` map compiled
27
+ * into the worker — with a per-row **Run now** action. Unlike the dynamic
28
+ * `runAfter` / `runAt` schedule, the triggers themselves are fixed for the
29
+ * deployment (Cloudflare exposes no runtime cron introspection, so the injected
30
+ * map is the only source of truth and nothing here is editable). One row per
31
+ * scheduled invocation: its cron expression, its target (a function dispatch or
32
+ * a durable workflow start), any bound shard / args, and a button to fire it on
33
+ * demand.
34
+ */
35
+ interface ScheduledJobsProps {
36
+ /**
37
+ * Cancel a pending job by id. Defaults to `client.cancelScheduledJob` when
38
+ * {@link ScheduledJobsProps.loadJobs} is also left to the client. When a
39
+ * custom `loadJobs` is supplied without a `cancelJob`, the cancel control is
40
+ * hidden — useful for a read-only view.
41
+ */
42
+ readonly cancelJob?: (id: string) => Promise<{
43
+ cancelled: boolean;
44
+ }>;
45
+ /**
46
+ * Load the pending scheduled jobs. Defaults to `client.listScheduledJobs`,
47
+ * which hits the worker's admin-gated `/_lunora/admin/scheduled` endpoint —
48
+ * so the panel works out of the box under `&lt;LunoraProvider>`, provided the
49
+ * worker is built with a `schedulerDO` namespace and `adminToken`. Override
50
+ * it to source jobs from elsewhere.
51
+ */
52
+ readonly loadJobs?: () => Promise<ScheduleRecord[]>;
53
+ }
54
+ /**
55
+ * View — and cancel — the functions queued via `runAfter` / `runAt` on the
56
+ * scheduler. Cron *triggers* are static wrangler config and don't appear here;
57
+ * this lists the dynamic, in-flight schedule only.
58
+ *
59
+ * Works out of the box under `&lt;LunoraProvider>` via the client's scheduler
60
+ * admin methods; pass {@link ScheduledJobsProps.loadJobs} /
61
+ * {@link ScheduledJobsProps.cancelJob} to override the transport.
62
+ */
63
+ declare const ScheduledJobs: ({
64
+ cancelJob,
65
+ loadJobs
66
+ }?: ScheduledJobsProps) => ReactElement;
67
+ interface SchedulePanelProps {
68
+ /** Override how the Cron triggers sub-view loads triggers; see {@link CronTriggersPanel}. */
69
+ readonly loadCronJobs?: CronTriggersPanelProps["loadCronJobs"];
70
+ /** Override how the Scheduled jobs sub-view cancels a job; see {@link ScheduledJobs}. */
71
+ readonly scheduledCancel?: ScheduledJobsProps["cancelJob"];
72
+ /** Override how the Scheduled jobs sub-view loads jobs; see {@link ScheduledJobs}. */
73
+ readonly scheduledLoad?: ScheduledJobsProps["loadJobs"];
74
+ }
75
+ /**
76
+ * The studio's Schedule tab. Hosts complementary surfaces behind a segmented
77
+ * toggle. **Scheduled jobs** is the dynamic, in-flight queue — functions enqueued
78
+ * via `runAfter` / `runAt`, live-updating and cancellable. **Dead letter** is the
79
+ * recovery surface for jobs that exhausted their retries (retry or drop them).
80
+ * **Pools** shows the workpool backlog / concurrency (`createWorkpool`). **Cron
81
+ * triggers** is the static `cronJobs()` map compiled into the worker: fixed for
82
+ * the deployment and read-only (Cloudflare exposes no runtime cron
83
+ * introspection). Jobs is the default — it is the surface an operator acts on.
84
+ */
85
+ /** Which client method a {@link FunctionDescriptor} is invoked through. */
86
+ type FunctionKind = "action" | "mutation" | "query";
87
+ /**
88
+ * One argument of a registered function, derived from its `v.*` validator by the
89
+ * worker's `/_lunora/admin/functions` endpoint. A compact signature shape.
90
+ */
91
+ interface FunctionArgumentDescriptor {
92
+ /** Element validator kind for an `array` arg (one level), e.g. `string`. */
93
+ element?: string;
94
+ /** The (optional-unwrapped) validator kind, e.g. `string`, `id`, `object`. */
95
+ kind: string;
96
+ /** The argument name. */
97
+ name: string;
98
+ /** True when the arg is wrapped in `v.optional(...)`. */
99
+ optional: boolean;
100
+ /** Target table for an `id` arg (`v.id("table")`). */
101
+ table?: string;
102
+ }
103
+ /**
104
+ * Runtime descriptor for a registered Lunora function. The function's `kind` is
105
+ * a compile-time-only phantom on `FunctionReference`, so the runner needs it
106
+ * spelled out here to know which client method to call. `args` carries the
107
+ * function's argument signature (absent on responses from an older worker).
108
+ */
109
+ interface FunctionDescriptor {
110
+ args?: FunctionArgumentDescriptor[];
111
+ kind: FunctionKind;
112
+ /** The `&lt;file>:&lt;function>` identifier, e.g. `messages:list`. */
113
+ path: string;
114
+ }
115
+ /** Outcome of a single `FunctionRunner` invocation. */
116
+ type RunStatus = "error" | "idle" | "running" | "success";
117
+ /** Identifier for each built-in studio tab. */
118
+ type StudioTab = "analytics" | "api" | "audit" | "authConfig" | "authSessions" | "dashboards" | "data" | "drains" | "export" | "files" | "functions" | "health" | "home" | "insights" | "logs" | "mail" | "metrics" | "migrations" | "organizations" | "payments" | "permissions" | "pitr" | "realtime" | "rls" | "schedule" | "schema" | "security" | "settings" | "sql" | "storageRules" | "users" | "vectors" | "workflows";
119
+ interface StudioProps {
120
+ /**
121
+ * URL path prefix the studio is mounted under, passed to the router as its
122
+ * `basepath`. Defaults to `/` (mounted at the origin root). The `@lunora/vite`
123
+ * dev route serves the studio under `/__lunora`, so it sets this — without
124
+ * it the router treats `/__lunora` as unknown and bounces to `/data`, escaping
125
+ * the mount.
126
+ */
127
+ readonly basePath?: string;
128
+ /**
129
+ * App-owned top-bar + sidebar-footer chrome (theme toggle, admin-token
130
+ * popover, rules banner). The batteries-included `StudioApp` supplies
131
+ * this; composing `&lt;Studio>` bare omits those affordances. See {@link StudioChrome}.
132
+ */
133
+ readonly chrome?: StudioChrome;
134
+ /**
135
+ * Make the data tab editable (insert/edit/delete rows). Off by default so
136
+ * the studio is read-only unless the host opts in; see {@link TableEditor}.
137
+ */
138
+ readonly dataEditable?: boolean;
139
+ /**
140
+ * Functions exposed in the runner tab. The runner tab only appears when at
141
+ * least one descriptor is supplied (a query/mutation/action's `kind` is
142
+ * compile-time-only, so it must be named here).
143
+ */
144
+ readonly functions?: FunctionDescriptor[];
145
+ /** Reuse an existing Lingui instance (wins over `locale`). */
146
+ readonly i18n?: I18n;
147
+ /** Shard key every shard-scoped panel targets on first load. */
148
+ readonly initialShardKey?: string;
149
+ /** Active locale for the studio's own UI strings. Defaults to `en`. */
150
+ readonly locale?: string;
151
+ /**
152
+ * Inline OpenAPI 3.1 document rendered by the API tab's reference sub-view.
153
+ * Thread the generated `_generated/openapi.json` here to render it
154
+ * without a round-trip. When omitted the reference fetches the worker's
155
+ * admin-gated `GET /_lunora/admin/openapi` endpoint via the client.
156
+ */
157
+ readonly openApiSpec?: unknown;
158
+ /**
159
+ * Inline OpenRPC 1.x document rendered by the API tab's reference sub-view
160
+ * when the OpenRPC format is selected. Thread the generated
161
+ * `_generated/openrpc.json` here to render it without a round-trip. When
162
+ * omitted the OpenRPC view fetches the worker's admin-gated
163
+ * `GET /_lunora/admin/openrpc` endpoint via the client.
164
+ */
165
+ readonly openRpcSpec?: unknown;
166
+ /**
167
+ * Allow the function runner to execute a function AS a chosen authenticated
168
+ * identity (the "Run as identity" tool), so an operator can test auth + RLS
169
+ * behavior. Security-sensitive: it forges identity on an admin-gated RPC, so
170
+ * the host MUST set this only on a trusted loopback-dev gate (the same gate
171
+ * as `dataEditable`) — never in a production/static deploy. Off by default;
172
+ * see {@link FunctionRunner}.
173
+ */
174
+ readonly runAsIdentity?: boolean;
175
+ /**
176
+ * Override how the schedule tab cancels a job. Defaults to the client's
177
+ * scheduler admin endpoint; see {@link SchedulePanel}.
178
+ */
179
+ readonly scheduledCancel?: SchedulePanelProps["scheduledCancel"];
180
+ /**
181
+ * Override how the schedule tab's Cron triggers sub-view loads triggers.
182
+ * Defaults to the client's `/_lunora/admin/cron-jobs` endpoint; see
183
+ * {@link SchedulePanel}.
184
+ */
185
+ readonly scheduledCron?: SchedulePanelProps["loadCronJobs"];
186
+ /**
187
+ * Override how the schedule tab loads jobs. Defaults to the client's
188
+ * scheduler admin endpoint, so the tab works without extra wiring.
189
+ */
190
+ readonly scheduledLoad?: SchedulePanelProps["scheduledLoad"];
191
+ /**
192
+ * Enable the visual schema editor overlay on the schema diagram (add table /
193
+ * column / index, written back to `lunora/schema.ts` + codegen). Off by default
194
+ * so the diagram stays read-only unless a host opts in. Like {@link
195
+ * StudioProps.dataEditable}, only the loopback-only dev hosts set this — the
196
+ * write path needs the project's filesystem + toolchain, so a static deploy
197
+ * leaves it off.
198
+ */
199
+ readonly schemaEditable?: boolean;
200
+ }
201
+ /**
202
+ * Top-bar + sidebar-footer chrome the `StudioApp` owns (theme + admin
203
+ * token state, the rules banner) but which renders *inside* the router-owned
204
+ * {@link StudioLayout} (the header and sidebar footer). The layout is a route
205
+ * component with no props, so it reads this from context rather than threading
206
+ * it through the router. Absent (composing `&lt;Studio>` bare) the layout simply
207
+ * omits those affordances.
208
+ */
209
+ interface StudioChrome {
210
+ readonly clearToken: () => void;
211
+ readonly onTokenChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
212
+ readonly rulesInstalled?: boolean;
213
+ readonly token: string;
214
+ }
215
+ /**
216
+ * The composable studio. {@link StudioShell} reads its strings from `useT`,
217
+ * which needs a `StudioI18nProvider` above it.
218
+ *
219
+ * When an `i18n` instance or a `locale` is supplied, this owns a provider so the
220
+ * studio localises itself standalone. When neither is given it renders the
221
+ * shell bare and inherits whatever provider is already in scope — the host app's
222
+ * (`StudioApp` owns one for the top bar too) or the shared default — instead
223
+ * of nesting a second, redundant provider.
224
+ */
225
+ declare const Studio: ({
226
+ basePath,
227
+ chrome,
228
+ dataEditable,
229
+ functions,
230
+ i18n,
231
+ initialShardKey,
232
+ locale,
233
+ openApiSpec,
234
+ openRpcSpec,
235
+ runAsIdentity,
236
+ schemaEditable,
237
+ scheduledCancel,
238
+ scheduledCron,
239
+ scheduledLoad
240
+ }: StudioProps) => ReactElement;
241
+ interface StudioAppProps {
242
+ /**
243
+ * Admin bearer token to send with every admin request. When omitted the app
244
+ * renders a small prompt so an operator can paste it at runtime — handy in
245
+ * dev where you don't want to bake the token into a bundle.
246
+ */
247
+ readonly adminToken?: string;
248
+ /**
249
+ * URL path prefix the studio is mounted under (router `basepath`). Defaults
250
+ * to `/`. The `@lunora/vite` dev route sets `/__lunora`. Forwarded to the
251
+ * composed {@link Studio}.
252
+ */
253
+ readonly basePath?: string;
254
+ /**
255
+ * Base URL of the Lunora worker the studio talks to. Defaults to the
256
+ * current origin, which is correct when the studio is served from the
257
+ * same worker (the `@lunora/vite` dev route) or proxied to it.
258
+ */
259
+ readonly baseUrl?: string;
260
+ /**
261
+ * Inject a pre-built client instead of constructing one from `baseUrl` +
262
+ * the admin token. Used by the dev mock harness (and embeddings that own
263
+ * the client) so the chrome renders against a supplied client; when set,
264
+ * `baseUrl`/`adminToken` are ignored and this client is never closed here.
265
+ */
266
+ readonly client?: LunoraClient;
267
+ /** UI language for the studio's own strings. Defaults to `en`. */
268
+ readonly locale?: string;
269
+ /**
270
+ * Whether the project's Lunora agent skills ("rules") are installed. When
271
+ * explicitly `false`, the studio shows a one-line banner pointing at
272
+ * `lunora rules install`. The loopback dev hosts inject this; a static deploy
273
+ * leaves it unset (no banner).
274
+ */
275
+ readonly rulesInstalled?: boolean;
276
+ /** Forwarded to the composed {@link Studio} (functions, initialShardKey, scheduled overrides). */
277
+ readonly studio?: Omit<StudioProps, "children" | "chrome" | "i18n" | "locale">;
278
+ }
279
+ /**
280
+ * A fully self-contained studio page: it constructs a {@link LunoraClient}
281
+ * pointed at the worker, wires it through a `&lt;LunoraProvider>`, manages the
282
+ * admin token + theme, and renders the composed {@link Studio} — handing it the
283
+ * top-bar/sidebar {@link StudioChrome} (theme toggle, admin-token popover, rules
284
+ * banner) so those affordances render inside the sidebar shell.
285
+ *
286
+ * Mount this directly (the standalone app and the `@lunora/vite` dev route both
287
+ * do) when you want the batteries-included page rather than composing panels
288
+ * yourself. For embedding into an existing admin UI, use the individual panels
289
+ * or `&lt;Studio>` under your own provider instead.
290
+ */
291
+ declare const StudioApp: ({
292
+ adminToken,
293
+ basePath,
294
+ baseUrl,
295
+ client: injectedClient,
296
+ rulesInstalled,
297
+ studio,
298
+ locale
299
+ }?: StudioAppProps) => ReactElement;
300
+ export { FunctionDescriptor as F, RunStatus as R, StudioAppProps as S, FunctionKind as a, ScheduledJobs as b, ScheduledJobsProps as c, Studio as d, StudioApp as e, StudioProps as f, StudioTab as g };
@@ -0,0 +1,49 @@
1
+ import { mergeProps } from '@base-ui/react/merge-props';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import { cva } from 'class-variance-authority';
4
+ import { c as cn } from './utils-B05Dmz_H.js';
5
+
6
+ const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
7
+ variants: {
8
+ // Semantic status variants get the Lunora "instrument-panel" label
9
+ // treatment (Geist Mono, ALL CAPS, tracked). Content variants
10
+ // (default/secondary/outline/…) stay normal-case so badges carrying
11
+ // proper nouns — table names, usernames — read correctly.
12
+ variant: {
13
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
14
+ secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
15
+ destructive: "bg-destructive/10 text-destructive font-mono text-[11px] tracking-wide uppercase focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
16
+ outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
17
+ ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
18
+ link: "text-primary underline-offset-4 hover:underline",
19
+ success: "bg-success/10 text-success font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-success/15 dark:bg-success/15",
20
+ warning: "bg-warning/10 text-warning font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-warning/15 dark:bg-warning/15",
21
+ info: "bg-info/10 text-info font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-info/15 dark:bg-info/15"
22
+ }
23
+ },
24
+ defaultVariants: {
25
+ variant: "default"
26
+ }
27
+ });
28
+ function Badge({
29
+ className,
30
+ variant = "default",
31
+ render,
32
+ ...props
33
+ }) {
34
+ return useRender({
35
+ defaultTagName: "span",
36
+ props: mergeProps({
37
+ className: cn(badgeVariants({
38
+ variant
39
+ }), className)
40
+ }, props),
41
+ render,
42
+ state: {
43
+ slot: "badge",
44
+ variant
45
+ }
46
+ });
47
+ }
48
+
49
+ export { Badge as B };