@xemahq/ui-kernel 0.4.0 → 0.5.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.
- package/README.md +49 -0
- package/dist/lib/biome-host/index.d.ts +2 -0
- package/dist/lib/biome-host/index.d.ts.map +1 -1
- package/dist/lib/biome-host/index.js +2 -0
- package/dist/lib/biome-host/index.js.map +1 -1
- package/dist/lib/biome-host/use-mutation-with-error-toast.d.ts +10 -0
- package/dist/lib/biome-host/use-mutation-with-error-toast.d.ts.map +1 -0
- package/dist/lib/biome-host/use-mutation-with-error-toast.js +35 -0
- package/dist/lib/biome-host/use-mutation-with-error-toast.js.map +1 -0
- package/dist/lib/biome-host/use-page-state.d.ts +4 -0
- package/dist/lib/biome-host/use-page-state.d.ts.map +1 -0
- package/dist/lib/biome-host/use-page-state.js +140 -0
- package/dist/lib/biome-host/use-page-state.js.map +1 -0
- package/dist/ui/chrome/confirm-delete-dialog.d.ts +11 -0
- package/dist/ui/chrome/confirm-delete-dialog.d.ts.map +1 -0
- package/dist/ui/chrome/confirm-delete-dialog.js +10 -0
- package/dist/ui/chrome/confirm-delete-dialog.js.map +1 -0
- package/dist/ui/chrome/page-shell.d.ts +27 -0
- package/dist/ui/chrome/page-shell.d.ts.map +1 -0
- package/dist/ui/chrome/page-shell.js +19 -0
- package/dist/ui/chrome/page-shell.js.map +1 -0
- package/dist/ui/chrome/scope-badge.d.ts +9 -0
- package/dist/ui/chrome/scope-badge.d.ts.map +1 -0
- package/dist/ui/chrome/scope-badge.js +10 -0
- package/dist/ui/chrome/scope-badge.js.map +1 -0
- package/dist/ui/chrome/status-badge.d.ts +11 -0
- package/dist/ui/chrome/status-badge.d.ts.map +1 -0
- package/dist/ui/chrome/status-badge.js +30 -0
- package/dist/ui/chrome/status-badge.js.map +1 -0
- package/dist/ui/design-tokens.d.ts +72 -0
- package/dist/ui/design-tokens.d.ts.map +1 -0
- package/dist/ui/design-tokens.js +251 -0
- package/dist/ui/design-tokens.js.map +1 -0
- package/dist/ui/hooks/use-debounced-value.d.ts +2 -0
- package/dist/ui/hooks/use-debounced-value.d.ts.map +1 -0
- package/dist/ui/hooks/use-debounced-value.js +13 -0
- package/dist/ui/hooks/use-debounced-value.js.map +1 -0
- package/dist/ui/index.d.ts +8 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +14 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/primitives/async-combobox.d.ts +19 -0
- package/dist/ui/primitives/async-combobox.d.ts.map +1 -0
- package/dist/ui/primitives/async-combobox.js +42 -0
- package/dist/ui/primitives/async-combobox.js.map +1 -0
- package/dist/ui/primitives/form-stepper.d.ts +19 -0
- package/dist/ui/primitives/form-stepper.d.ts.map +1 -0
- package/dist/ui/primitives/form-stepper.js +23 -0
- package/dist/ui/primitives/form-stepper.js.map +1 -0
- package/package.json +1 -1
- package/src/lib/biome-host/index.ts +2 -0
- package/src/lib/biome-host/use-mutation-with-error-toast.ts +88 -0
- package/src/lib/biome-host/use-page-state.ts +231 -0
- package/src/ui/chrome/confirm-delete-dialog.tsx +59 -0
- package/src/ui/chrome/page-shell.tsx +165 -0
- package/src/ui/chrome/scope-badge.tsx +40 -0
- package/src/ui/chrome/status-badge.tsx +75 -0
- package/src/ui/design-tokens.ts +346 -0
- package/src/ui/hooks/use-debounced-value.ts +16 -0
- package/src/ui/index.ts +15 -0
- package/src/ui/primitives/async-combobox.tsx +178 -0
- package/src/ui/primitives/form-stepper.tsx +109 -0
package/README.md
CHANGED
|
@@ -53,6 +53,36 @@ pnpm add @xemahq/ui-kernel
|
|
|
53
53
|
|
|
54
54
|
## Usage
|
|
55
55
|
|
|
56
|
+
Author a web biome with `defineWebBiome` — a declarative page list where each
|
|
57
|
+
`slug` single-sources both the nav route and the route path, and each page
|
|
58
|
+
declares its menu `category` (the host owns where that category renders):
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { defineWebBiome } from '@xemahq/ui-kernel';
|
|
62
|
+
import { Layers } from 'lucide-react';
|
|
63
|
+
|
|
64
|
+
export default defineWebBiome({
|
|
65
|
+
id: 'spaces-web',
|
|
66
|
+
displayName: 'Spaces',
|
|
67
|
+
pages: [
|
|
68
|
+
{
|
|
69
|
+
slug: 'system/spaces',
|
|
70
|
+
label: 'Spaces',
|
|
71
|
+
icon: Layers,
|
|
72
|
+
category: 'knowledge', // primary | build | operate | knowledge | admin | account
|
|
73
|
+
load: () => import('./pages/SpacesPage'),
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The helper emits the nav item + route (wrapping the lazily-loaded page in a
|
|
80
|
+
`<Suspense>` boundary) and passes through `init`/`panels`/`session` for bespoke
|
|
81
|
+
biomes. Pass a per-page `id` to keep a short nav id distinct from the route
|
|
82
|
+
slug, or `navHidden: true` to register a route with no nav item.
|
|
83
|
+
|
|
84
|
+
Lower-level building blocks are also exported:
|
|
85
|
+
|
|
56
86
|
```ts
|
|
57
87
|
import { buildSystemBus, biomeRegistry } from '@xemahq/ui-kernel';
|
|
58
88
|
|
|
@@ -62,6 +92,25 @@ const bus = buildSystemBus(hostPorts);
|
|
|
62
92
|
biomeRegistry.registerBiome(myBiome);
|
|
63
93
|
```
|
|
64
94
|
|
|
95
|
+
## UI components
|
|
96
|
+
|
|
97
|
+
Build your pages with the shared design system from `@xemahq/ui-kernel/ui` so a
|
|
98
|
+
third-party biome renders pixel-identical to a built-in one (they resolve
|
|
99
|
+
against the host theme at render):
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import {
|
|
103
|
+
Button, Badge, Input, Select, Dialog, Card, Tabs, Table, // primitives
|
|
104
|
+
PageShell, PageHeader, EmptyState, ErrorCard, StateCard, LoadingState, AsyncBoundary,
|
|
105
|
+
StatusBadge, ScopeBadge, ConfirmDeleteDialog, FormStepper, AsyncCombobox,
|
|
106
|
+
getStatusStyle, cn,
|
|
107
|
+
} from '@xemahq/ui-kernel/ui';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Host-service hooks (toast, error copy, URL-backed page state) come from the
|
|
111
|
+
`HostBridge` — e.g. `useMutationWithErrorToast`, `usePageState` from
|
|
112
|
+
`@xemahq/ui-kernel` — so biomes never import host internals directly.
|
|
113
|
+
|
|
65
114
|
## Peer requirements
|
|
66
115
|
|
|
67
116
|
- `react` — the shared component model.
|
|
@@ -17,4 +17,6 @@ export * from './realtime-port';
|
|
|
17
17
|
export * from './realtime-hooks';
|
|
18
18
|
export * from './errors';
|
|
19
19
|
export * from './response-envelope';
|
|
20
|
+
export * from './use-mutation-with-error-toast';
|
|
21
|
+
export * from './use-page-state';
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":"AAcA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":"AAcA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC"}
|
|
@@ -33,4 +33,6 @@ __exportStar(require("./realtime-port"), exports);
|
|
|
33
33
|
__exportStar(require("./realtime-hooks"), exports);
|
|
34
34
|
__exportStar(require("./errors"), exports);
|
|
35
35
|
__exportStar(require("./response-envelope"), exports);
|
|
36
|
+
__exportStar(require("./use-mutation-with-error-toast"), exports);
|
|
37
|
+
__exportStar(require("./use-page-state"), exports);
|
|
36
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAcA,mDAAiC;AACjC,gDAA8B;AAC9B,qDAAmC;AACnC,gDAA8B;AAC9B,uDAAqC;AACrC,mDAAiC;AACjC,qDAAmC;AACnC,8DAA4C;AAC5C,mDAAiC;AACjC,0DAAwC;AACxC,qDAAmC;AACnC,iDAA+B;AAC/B,wCAAsB;AACtB,+CAA6B;AAC7B,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,2CAAyB;AACzB,sDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/biome-host/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAcA,mDAAiC;AACjC,gDAA8B;AAC9B,qDAAmC;AACnC,gDAA8B;AAC9B,uDAAqC;AACrC,mDAAiC;AACjC,qDAAmC;AACnC,8DAA4C;AAC5C,mDAAiC;AACjC,0DAAwC;AACxC,qDAAmC;AACnC,iDAA+B;AAC/B,wCAAsB;AACtB,+CAA6B;AAC7B,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,2CAAyB;AACzB,sDAAoC;AACpC,kEAAgD;AAChD,mDAAiC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
export type MutationCoreOptions<TData = unknown, TError = Error, TVariables = unknown, TContext = unknown> = Omit<UseMutationOptions<TData, TError, TVariables, TContext>, 'onError'>;
|
|
3
|
+
export interface MutationToastOptions<TError = Error> {
|
|
4
|
+
successTitle?: string | null;
|
|
5
|
+
successDescription?: string;
|
|
6
|
+
errorTitle?: string;
|
|
7
|
+
onError?: (error: TError) => boolean | void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useMutationWithErrorToast<TData = unknown, TError extends Error = Error, TVariables = unknown, TContext = unknown>(mutationOptions: MutationCoreOptions<TData, TError, TVariables, TContext>, toastOptions?: MutationToastOptions<TError>): import("@tanstack/react-query").UseMutationResult<TData, TError, TVariables, TContext>;
|
|
10
|
+
//# sourceMappingURL=use-mutation-with-error-toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mutation-with-error-toast.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/use-mutation-with-error-toast.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK7E,MAAM,MAAM,mBAAmB,CAC7B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,OAAO,IAChB,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;AAE7E,MAAM,WAAW,oBAAoB,CAAC,MAAM,GAAG,KAAK;IAElD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,UAAU,CAAC,EAAE,MAAM,CAAC;IAKpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,yBAAyB,CACvC,KAAK,GAAG,OAAO,EACf,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,OAAO,EAElB,eAAe,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EACzE,YAAY,CAAC,EAAE,oBAAoB,CAAC,MAAM,CAAC,0FAqC5C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMutationWithErrorToast = useMutationWithErrorToast;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
const host_bridge_1 = require("./host-bridge");
|
|
7
|
+
function useMutationWithErrorToast(mutationOptions, toastOptions) {
|
|
8
|
+
const bridge = (0, host_bridge_1.useHostBridge)();
|
|
9
|
+
const decodeError = bridge.errors?.getUserFacingErrorMessage ?? errors_1.getUserFacingErrorMessage;
|
|
10
|
+
const { onSuccess: userOnSuccess, ...coreMutationOptions } = mutationOptions;
|
|
11
|
+
const { successTitle, successDescription, errorTitle, onError: customOnError, } = toastOptions ?? {};
|
|
12
|
+
return (0, react_query_1.useMutation)({
|
|
13
|
+
...coreMutationOptions,
|
|
14
|
+
onSuccess: (data, variables, context, mutation) => {
|
|
15
|
+
if (successTitle !== null && successTitle !== undefined) {
|
|
16
|
+
bridge.toast.success(successTitle, successDescription);
|
|
17
|
+
}
|
|
18
|
+
if (userOnSuccess)
|
|
19
|
+
userOnSuccess(data, variables, context, mutation);
|
|
20
|
+
},
|
|
21
|
+
onError: (error) => {
|
|
22
|
+
if (errorTitle !== null && errorTitle !== undefined) {
|
|
23
|
+
const shouldSuppressToast = customOnError?.(error) === true;
|
|
24
|
+
if (!shouldSuppressToast) {
|
|
25
|
+
const errorMessage = decodeError(error, 'Unable to complete this action.');
|
|
26
|
+
bridge.toast.error(errorTitle, errorMessage);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
customOnError?.(error);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=use-mutation-with-error-toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mutation-with-error-toast.js","sourceRoot":"","sources":["../../../src/lib/biome-host/use-mutation-with-error-toast.ts"],"names":[],"mappings":";;AA2CA,8DA4CC;AAtED,uDAA6E;AAE7E,qCAAqD;AACrD,+CAA8C;AAuB9C,SAAgB,yBAAyB,CAMvC,eAAyE,EACzE,YAA2C;IAE3C,MAAM,MAAM,GAAG,IAAA,2BAAa,GAAE,CAAC;IAC/B,MAAM,WAAW,GACf,MAAM,CAAC,MAAM,EAAE,yBAAyB,IAAI,kCAAyB,CAAC;IAExE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,mBAAmB,EAAE,GAAG,eAAe,CAAC;IAC7E,MAAM,EACJ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,OAAO,EAAE,aAAa,GACvB,GAAG,YAAY,IAAI,EAAE,CAAC;IAEvB,OAAO,IAAA,yBAAW,EAAC;QACjB,GAAG,mBAAmB;QACtB,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;YAChD,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBACxD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;YACzD,CAAC;YACD,IAAI,aAAa;gBAAE,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,EAAE,CAAC,KAAa,EAAE,EAAE;YACzB,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBACpD,MAAM,mBAAmB,GAAG,aAAa,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;gBAC5D,IAAI,CAAC,mBAAmB,EAAE,CAAC;oBACzB,MAAM,YAAY,GAAG,WAAW,CAC9B,KAAK,EACL,iCAAiC,CAClC,CAAC;oBACF,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function usePageState<T>(stateKey: string, defaultValue: T): [T, (value: T) => void];
|
|
2
|
+
export declare function usePageInputState(stateKey: string, defaultValue: string, debounceMs?: number): [string, (value: string) => void];
|
|
3
|
+
export declare function useBatchPageState(): (updates: Record<string, string | null>) => void;
|
|
4
|
+
//# sourceMappingURL=use-page-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-page-state.d.ts","sourceRoot":"","sources":["../../../src/lib/biome-host/use-page-state.ts"],"names":[],"mappings":"AAuFA,wBAAgB,YAAY,CAAC,CAAC,EAC5B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CA0BzB;AAsBD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,UAAU,GAAE,MAAqC,GAChD,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAwDnC;AAWD,wBAAgB,iBAAiB,IAAI,CACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,KACnC,IAAI,CAmBR"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePageState = usePageState;
|
|
4
|
+
exports.usePageInputState = usePageInputState;
|
|
5
|
+
exports.useBatchPageState = useBatchPageState;
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const host_bridge_1 = require("./host-bridge");
|
|
8
|
+
const INPUT_URL_MIRROR_DEBOUNCE_MS = 300;
|
|
9
|
+
function buildPath(pathname, params) {
|
|
10
|
+
const queryString = params.toString();
|
|
11
|
+
return queryString ? `${pathname}?${queryString}` : pathname;
|
|
12
|
+
}
|
|
13
|
+
function serializeValue(value) {
|
|
14
|
+
if (typeof value === 'string')
|
|
15
|
+
return value;
|
|
16
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
17
|
+
return String(value);
|
|
18
|
+
return JSON.stringify(value);
|
|
19
|
+
}
|
|
20
|
+
function tryParseJson(rawValue) {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(rawValue);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function deserializePrimitive(rawValue, defaultValue) {
|
|
29
|
+
if (typeof defaultValue === 'string')
|
|
30
|
+
return rawValue;
|
|
31
|
+
if (typeof defaultValue === 'number') {
|
|
32
|
+
const numericValue = Number(rawValue);
|
|
33
|
+
return (Number.isNaN(numericValue) ? defaultValue : numericValue);
|
|
34
|
+
}
|
|
35
|
+
if (typeof defaultValue === 'boolean') {
|
|
36
|
+
if (rawValue === 'true')
|
|
37
|
+
return true;
|
|
38
|
+
if (rawValue === 'false')
|
|
39
|
+
return false;
|
|
40
|
+
return defaultValue;
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
function deserializeValue(rawValue, defaultValue) {
|
|
45
|
+
if (rawValue === null)
|
|
46
|
+
return defaultValue;
|
|
47
|
+
const primitive = deserializePrimitive(rawValue, defaultValue);
|
|
48
|
+
if (primitive !== undefined)
|
|
49
|
+
return primitive;
|
|
50
|
+
const parsedValue = tryParseJson(rawValue);
|
|
51
|
+
if (parsedValue !== undefined && typeof parsedValue === 'object') {
|
|
52
|
+
return parsedValue;
|
|
53
|
+
}
|
|
54
|
+
if (defaultValue === null || defaultValue === undefined)
|
|
55
|
+
return rawValue;
|
|
56
|
+
if (parsedValue !== undefined)
|
|
57
|
+
return parsedValue;
|
|
58
|
+
if (Array.isArray(defaultValue)) {
|
|
59
|
+
return rawValue ? [rawValue] : defaultValue;
|
|
60
|
+
}
|
|
61
|
+
return defaultValue;
|
|
62
|
+
}
|
|
63
|
+
function usePageState(stateKey, defaultValue) {
|
|
64
|
+
const { navigation } = (0, host_bridge_1.useHostBridge)();
|
|
65
|
+
const searchParams = navigation.useSearchParams();
|
|
66
|
+
const { pathname } = navigation.useLocation();
|
|
67
|
+
const rawValue = searchParams.get(stateKey);
|
|
68
|
+
const value = deserializeValue(rawValue, defaultValue);
|
|
69
|
+
const setValue = (0, react_1.useCallback)((newValue) => {
|
|
70
|
+
const next = new URLSearchParams(searchParams);
|
|
71
|
+
if (newValue === null ||
|
|
72
|
+
newValue === undefined ||
|
|
73
|
+
serializeValue(newValue) === serializeValue(defaultValue)) {
|
|
74
|
+
next.delete(stateKey);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
next.set(stateKey, serializeValue(newValue));
|
|
78
|
+
}
|
|
79
|
+
navigation.push(buildPath(pathname, next));
|
|
80
|
+
}, [defaultValue, stateKey, searchParams, pathname, navigation]);
|
|
81
|
+
return [value, setValue];
|
|
82
|
+
}
|
|
83
|
+
function usePageInputState(stateKey, defaultValue, debounceMs = INPUT_URL_MIRROR_DEBOUNCE_MS) {
|
|
84
|
+
const { navigation } = (0, host_bridge_1.useHostBridge)();
|
|
85
|
+
const searchParams = navigation.useSearchParams();
|
|
86
|
+
const { pathname } = navigation.useLocation();
|
|
87
|
+
const urlValue = searchParams.get(stateKey) ?? defaultValue;
|
|
88
|
+
const [localValue, setLocalValue] = (0, react_1.useState)(urlValue);
|
|
89
|
+
const lastMirroredRef = (0, react_1.useRef)(urlValue);
|
|
90
|
+
(0, react_1.useEffect)(() => {
|
|
91
|
+
if (urlValue !== lastMirroredRef.current) {
|
|
92
|
+
lastMirroredRef.current = urlValue;
|
|
93
|
+
setLocalValue(urlValue);
|
|
94
|
+
}
|
|
95
|
+
}, [urlValue]);
|
|
96
|
+
const debounceTimerRef = (0, react_1.useRef)(null);
|
|
97
|
+
(0, react_1.useEffect)(() => () => {
|
|
98
|
+
if (debounceTimerRef.current !== null) {
|
|
99
|
+
clearTimeout(debounceTimerRef.current);
|
|
100
|
+
}
|
|
101
|
+
}, []);
|
|
102
|
+
const setValue = (0, react_1.useCallback)((newValue) => {
|
|
103
|
+
setLocalValue(newValue);
|
|
104
|
+
if (debounceTimerRef.current !== null) {
|
|
105
|
+
clearTimeout(debounceTimerRef.current);
|
|
106
|
+
}
|
|
107
|
+
debounceTimerRef.current = setTimeout(() => {
|
|
108
|
+
debounceTimerRef.current = null;
|
|
109
|
+
lastMirroredRef.current =
|
|
110
|
+
newValue === defaultValue ? defaultValue : newValue;
|
|
111
|
+
const next = new URLSearchParams(searchParams);
|
|
112
|
+
if (newValue === defaultValue || newValue.length === 0) {
|
|
113
|
+
next.delete(stateKey);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
next.set(stateKey, newValue);
|
|
117
|
+
}
|
|
118
|
+
navigation.replace(buildPath(pathname, next));
|
|
119
|
+
}, debounceMs);
|
|
120
|
+
}, [debounceMs, defaultValue, stateKey, searchParams, pathname, navigation]);
|
|
121
|
+
return [localValue, setValue];
|
|
122
|
+
}
|
|
123
|
+
function useBatchPageState() {
|
|
124
|
+
const { navigation } = (0, host_bridge_1.useHostBridge)();
|
|
125
|
+
const searchParams = navigation.useSearchParams();
|
|
126
|
+
const { pathname } = navigation.useLocation();
|
|
127
|
+
return (0, react_1.useCallback)((updates) => {
|
|
128
|
+
const next = new URLSearchParams(searchParams);
|
|
129
|
+
for (const [key, value] of Object.entries(updates)) {
|
|
130
|
+
if (value === null || value === undefined) {
|
|
131
|
+
next.delete(key);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
next.set(key, value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
navigation.push(buildPath(pathname, next));
|
|
138
|
+
}, [searchParams, pathname, navigation]);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=use-page-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-page-state.js","sourceRoot":"","sources":["../../../src/lib/biome-host/use-page-state.ts"],"names":[],"mappings":";;AAuFA,oCA6BC;AAsBD,8CA4DC;AAWD,8CAqBC;AAxND,iCAAiE;AAEjE,+CAA8C;AAG9C,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEzC,SAAS,SAAS,CAAC,QAAgB,EAAE,MAAuB;IAC1D,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IACtC,OAAO,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC/D,CAAC;AAED,SAAS,cAAc,CAAI,KAAQ;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,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,OAAsC,EAAE,EAAE;QACzC,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC;QAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACnD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC1C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QACD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC,EACD,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,CAAC,CACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ConfirmDeleteDialogProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
onConfirm: () => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
isPending?: boolean;
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function ConfirmDeleteDialog({ open, onOpenChange, onConfirm, title, description, isPending, confirmLabel, }: ConfirmDeleteDialogProps): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=confirm-delete-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-delete-dialog.d.ts","sourceRoot":"","sources":["../../../src/ui/chrome/confirm-delete-dialog.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAMD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,KAAqB,EACrB,WAAgF,EAChF,SAAS,EACT,YAAuB,GACxB,EAAE,wBAAwB,+BAsB1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = ConfirmDeleteDialog;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const lucide_react_1 = require("lucide-react");
|
|
6
|
+
const alert_dialog_1 = require("../primitives/alert-dialog");
|
|
7
|
+
function ConfirmDeleteDialog({ open, onOpenChange, onConfirm, title = 'Delete item', description = 'This action cannot be undone. Are you sure you want to continue?', isPending, confirmLabel = 'Delete', }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialog, { open: open, onOpenChange: onOpenChange, children: (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogContent, { children: [(0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogHeader, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogTitle, { children: title }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogDescription, { children: description })] }), (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogFooter, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogCancel, { disabled: isPending, children: "Cancel" }), (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogAction, { onClick: onConfirm, disabled: isPending, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: [isPending && (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 mr-1.5 animate-spin" }), confirmLabel] })] })] }) }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=confirm-delete-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-delete-dialog.js","sourceRoot":"","sources":["../../../src/ui/chrome/confirm-delete-dialog.tsx"],"names":[],"mappings":";;AA4BA,sCA8BC;;AA1DD,+CAAuC;AAEvC,6DASoC;AAiBpC,SAAwB,mBAAmB,CAAC,EAC1C,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,KAAK,GAAG,aAAa,EACrB,WAAW,GAAG,kEAAkE,EAChF,SAAS,EACT,YAAY,GAAG,QAAQ,GACE;IACzB,OAAO,CACL,uBAAC,0BAAW,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,YACjD,wBAAC,iCAAkB,eACjB,wBAAC,gCAAiB,eAChB,uBAAC,+BAAgB,cAAE,KAAK,GAAoB,EAC5C,uBAAC,qCAAsB,cAAE,WAAW,GAA0B,IAC5C,EACpB,wBAAC,gCAAiB,eAChB,uBAAC,gCAAiB,IAAC,QAAQ,EAAE,SAAS,uBAA4B,EAClE,wBAAC,gCAAiB,IAChB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,oEAAoE,aAE7E,SAAS,IAAI,uBAAC,sBAAO,IAAC,SAAS,EAAC,6BAA6B,GAAG,EAChE,YAAY,IACK,IACF,IACD,GACT,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type PageBackTarget } from '../../lib/biome-host';
|
|
4
|
+
interface TabDef {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string | ReactNode;
|
|
7
|
+
count?: number;
|
|
8
|
+
indicator?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface PageShellProps {
|
|
11
|
+
icon: LucideIcon;
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
tabs?: TabDef[];
|
|
17
|
+
activeTab?: string;
|
|
18
|
+
onTabChange?: (value: string) => void;
|
|
19
|
+
maxWidth?: string;
|
|
20
|
+
embedded?: boolean;
|
|
21
|
+
eyebrow?: string;
|
|
22
|
+
backTo?: PageBackTarget;
|
|
23
|
+
topbarActions?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export default function PageShell({ icon: _Icon, title, description, children, actions, tabs, activeTab, onTabChange, maxWidth, embedded, eyebrow, backTo, topbarActions, }: Readonly<PageShellProps>): import("react").JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=page-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-shell.d.ts","sourceRoot":"","sources":["../../../src/ui/chrome/page-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAI1E,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAKjB,MAAM,CAAC,EAAE,cAAc,CAAC;IAOxB,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAQD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,IAAI,EAAE,KAAK,EACX,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,EACN,aAAa,GACd,EAAE,QAAQ,CAAC,cAAc,CAAC,+BAuG1B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = PageShell;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const lucide_react_1 = require("lucide-react");
|
|
9
|
+
const biome_host_1 = require("../../lib/biome-host");
|
|
10
|
+
const EmptyState_1 = __importDefault(require("./EmptyState"));
|
|
11
|
+
const tabs_1 = require("../primitives/tabs");
|
|
12
|
+
function PageShell({ icon: _Icon, title, description, children, actions, tabs, activeTab, onTabChange, maxWidth, embedded, eyebrow, backTo, topbarActions, }) {
|
|
13
|
+
(0, biome_host_1.useHostBridge)().pageMeta.usePageMeta({ title, description, eyebrow, backTo, topbarActions });
|
|
14
|
+
if (embedded) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-full min-h-0 flex-col bg-paper", children: [(tabs && tabs.length > 0) || actions ? ((0, jsx_runtime_1.jsx)("div", { className: "shrink-0 border-b border-rule bg-paper-elev/40", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 px-4 py-2 lg:px-6", children: [tabs && tabs.length > 0 && ((0, jsx_runtime_1.jsx)(tabs_1.Tabs, { value: activeTab, onValueChange: onTabChange, className: "flex-1 min-w-0", children: (0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: (0, jsx_runtime_1.jsx)(tabs_1.TabsList, { className: "h-7 bg-transparent p-0 gap-0", children: tabs.map((tab) => ((0, jsx_runtime_1.jsxs)(tabs_1.TabsTrigger, { value: tab.value, className: "rounded-none border-b-2 border-transparent px-2 py-1 text-body-2 font-medium text-ink-3 transition-colors data-[state=active]:border-primary data-[state=active]:text-ink data-[state=active]:bg-transparent data-[state=active]:shadow-none", children: [tab.label, tab.count !== undefined && ((0, jsx_runtime_1.jsx)("span", { className: "ml-1.5 text-caption tabular-nums opacity-70", children: tab.count })), tab.indicator && ((0, jsx_runtime_1.jsx)("span", { className: "ml-1.5 inline-block h-1.5 w-1.5 rounded-full bg-warning" }))] }, tab.value))) }) }) })), !tabs && (0, jsx_runtime_1.jsx)("div", { className: "flex-1" }), actions && (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2 shrink-0", children: actions })] }) })) : null, (0, jsx_runtime_1.jsx)("div", { className: "flex-1 overflow-auto min-h-0", children: (0, jsx_runtime_1.jsx)("div", { className: "flex h-full min-h-0 flex-col px-4 pb-4 pt-3 lg:px-6", children: children }) })] }));
|
|
16
|
+
}
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `flex h-full min-h-0 flex-col ${maxWidth ?? ''}`, children: [(tabs || actions) && ((0, jsx_runtime_1.jsx)("div", { className: "shrink-0 border-b border-border/50 px-4 sm:px-5 lg:px-8", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex min-h-[34px] flex-col gap-2 py-1.5 sm:flex-row sm:items-center sm:gap-3 sm:py-0", children: [tabs && tabs.length > 0 && ((0, jsx_runtime_1.jsx)(tabs_1.Tabs, { value: activeTab, onValueChange: onTabChange, className: "flex-1 min-w-0", children: (0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: (0, jsx_runtime_1.jsx)(tabs_1.TabsList, { className: "h-7 bg-transparent p-0 gap-0", children: tabs.map((tab) => ((0, jsx_runtime_1.jsxs)(tabs_1.TabsTrigger, { value: tab.value, className: "whitespace-nowrap rounded-none border-b-2 border-transparent px-2.5 py-1.5 text-caption font-medium text-ink-3/90 transition-colors data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-ink data-[state=active]:shadow-none hover:text-ink", children: [tab.label, tab.count !== undefined && ((0, jsx_runtime_1.jsx)("span", { className: "ml-1.5 text-caption tabular-nums opacity-60", children: tab.count })), tab.indicator && ((0, jsx_runtime_1.jsx)("span", { className: "ml-1.5 inline-block h-1.5 w-1.5 rounded-full bg-warning" }))] }, tab.value))) }) }) })), !tabs && (0, jsx_runtime_1.jsx)("div", { className: "flex-1" }), actions && ((0, jsx_runtime_1.jsx)("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto sm:shrink-0 sm:justify-end", children: actions }))] }) })), (0, jsx_runtime_1.jsx)("div", { className: "flex min-h-0 flex-1 flex-col overflow-auto px-4 pb-5 pt-4 sm:px-6 sm:pb-6 sm:pt-5", children: children || ((0, jsx_runtime_1.jsx)(EmptyState_1.default, { icon: lucide_react_1.FileQuestion, title: "Nothing to show yet", description: "This page has no content to display. Check back once the workspace has data." })) })] }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=page-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-shell.js","sourceRoot":"","sources":["../../../src/ui/chrome/page-shell.tsx"],"names":[],"mappings":";;;;;AA+CA,4BAqHC;;AApKD,+CAA6D;AAG7D,qDAA0E;AAC1E,8DAAsC;AACtC,6CAAiE;AA0CjE,SAAwB,SAAS,CAAC,EAChC,IAAI,EAAE,KAAK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,IAAI,CACX,uBAAC,oBAAU,IACT,IAAI,EAAE,2BAAY,EAClB,KAAK,EAAC,qBAAqB,EAC3B,WAAW,EAAC,8EAA8E,GAC1F,CACH,GACG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Tone } from '../design-tokens';
|
|
2
|
+
export interface ScopeBadgeProps {
|
|
3
|
+
label: string;
|
|
4
|
+
tone?: Tone;
|
|
5
|
+
hint?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export default function ScopeBadge({ label, tone, hint, className, }: ScopeBadgeProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=scope-badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-badge.d.ts","sourceRoot":"","sources":["../../../src/ui/chrome/scope-badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,WAAW,eAAe;IAE9B,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAUD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,IAAgB,EAChB,IAAI,EACJ,SAAS,GACV,EAAE,eAAe,+BAajB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = ScopeBadge;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const cn_1 = require("../cn");
|
|
6
|
+
const design_tokens_1 = require("../design-tokens");
|
|
7
|
+
function ScopeBadge({ label, tone = 'neutral', hint, className, }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("span", { className: (0, cn_1.cn)('inline-flex shrink-0 items-center rounded-sm border px-1.5 py-0 text-[10px] font-medium uppercase tracking-wide', design_tokens_1.TONE_STYLES[tone], className), title: hint, children: label }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=scope-badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-badge.js","sourceRoot":"","sources":["../../../src/ui/chrome/scope-badge.tsx"],"names":[],"mappings":";;AAqBA,6BAkBC;;AAvCD,8BAA2B;AAC3B,oDAA0D;AAoB1D,SAAwB,UAAU,CAAC,EACjC,KAAK,EACL,IAAI,GAAG,SAAS,EAChB,IAAI,EACJ,SAAS,GACO;IAChB,OAAO,CACL,iCACE,SAAS,EAAE,IAAA,OAAE,EACX,iHAAiH,EACjH,2BAAW,CAAC,IAAI,CAAC,EACjB,SAAS,CACV,EACD,KAAK,EAAE,IAAI,YAEV,KAAK,GACD,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type StatusBadgeSize = 'xs' | 'sm' | 'md';
|
|
3
|
+
export interface StatusBadgeProps {
|
|
4
|
+
status: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
dot?: boolean;
|
|
7
|
+
size?: StatusBadgeSize;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export default function StatusBadge({ status, className, dot, size, children, }: StatusBadgeProps): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=status-badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../../src/ui/chrome/status-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAmCD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAM,EACN,SAAS,EACT,GAAG,EACH,IAAW,EACX,QAAQ,GACT,EAAE,gBAAgB,+BAkBlB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = StatusBadge;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const cn_1 = require("../cn");
|
|
6
|
+
const design_tokens_1 = require("../design-tokens");
|
|
7
|
+
const badge_1 = require("../primitives/badge");
|
|
8
|
+
const SIZE_TOKENS = {
|
|
9
|
+
xs: {
|
|
10
|
+
badge: 'h-[18px] px-1.5 py-0 text-[10px] font-medium',
|
|
11
|
+
dot: 'h-1 w-1',
|
|
12
|
+
gap: 'gap-1',
|
|
13
|
+
},
|
|
14
|
+
sm: {
|
|
15
|
+
badge: 'h-5 px-2 py-0 text-caption font-medium',
|
|
16
|
+
dot: 'h-1.5 w-1.5',
|
|
17
|
+
gap: 'gap-1.5',
|
|
18
|
+
},
|
|
19
|
+
md: {
|
|
20
|
+
badge: 'px-2.5 py-0.5 text-body-1',
|
|
21
|
+
dot: 'h-1.5 w-1.5',
|
|
22
|
+
gap: 'gap-1.5',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
function StatusBadge({ status, className, dot, size = 'sm', children, }) {
|
|
26
|
+
const style = (0, design_tokens_1.getStatusStyle)(status);
|
|
27
|
+
const sz = SIZE_TOKENS[size];
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(badge_1.Badge, { variant: "outline", className: (0, cn_1.cn)('inline-flex items-center rounded-full', sz.badge, sz.gap, style.badge, className), children: [dot && (0, jsx_runtime_1.jsx)("span", { className: (0, cn_1.cn)('shrink-0 rounded-full', sz.dot, style.dot) }), children ?? (0, jsx_runtime_1.jsx)("span", { className: "capitalize", children: status.replace(/_/g, ' ') })] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=status-badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-badge.js","sourceRoot":"","sources":["../../../src/ui/chrome/status-badge.tsx"],"names":[],"mappings":";;AAkDA,8BAwBC;;AAxED,8BAA2B;AAC3B,oDAAkD;AAClD,+CAA4C;AAmB5C,MAAM,WAAW,GAAwC;IACvD,EAAE,EAAE;QACF,KAAK,EAAE,8CAA8C;QACrD,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,OAAO;KACb;IACD,EAAE,EAAE;QACF,KAAK,EAAE,wCAAwC;QAC/C,GAAG,EAAE,aAAa;QAClB,GAAG,EAAE,SAAS;KACf;IACD,EAAE,EAAE;QACF,KAAK,EAAE,2BAA2B;QAClC,GAAG,EAAE,aAAa;QAClB,GAAG,EAAE,SAAS;KACf;CACF,CAAC;AAWF,SAAwB,WAAW,CAAC,EAClC,MAAM,EACN,SAAS,EACT,GAAG,EACH,IAAI,GAAG,IAAI,EACX,QAAQ,GACS;IACjB,MAAM,KAAK,GAAG,IAAA,8BAAc,EAAC,MAAM,CAAC,CAAC;IACrC,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CACL,wBAAC,aAAK,IACJ,OAAO,EAAC,SAAS,EACjB,SAAS,EAAE,IAAA,OAAE,EACX,uCAAuC,EACvC,EAAE,CAAC,KAAK,EACR,EAAE,CAAC,GAAG,EACN,KAAK,CAAC,KAAK,EACX,SAAS,CACV,aAEA,GAAG,IAAI,iCAAM,SAAS,EAAE,IAAA,OAAE,EAAC,uBAAuB,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAI,EAC1E,QAAQ,IAAI,iCAAM,SAAS,EAAC,YAAY,YAAE,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,GAAQ,IACtE,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface StatusStyle {
|
|
2
|
+
badge: string;
|
|
3
|
+
dot: string;
|
|
4
|
+
text: string;
|
|
5
|
+
bg: string;
|
|
6
|
+
border: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
}
|
|
9
|
+
export type Tone = 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'accent';
|
|
10
|
+
export declare const TONE_STYLES: Record<Tone, string>;
|
|
11
|
+
export declare const STATUS_STYLES: Record<string, StatusStyle>;
|
|
12
|
+
export declare function getStatusStyle(status: string): StatusStyle;
|
|
13
|
+
export interface PriorityStyle {
|
|
14
|
+
badge: string;
|
|
15
|
+
text: string;
|
|
16
|
+
bg: string;
|
|
17
|
+
border: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const PRIORITY_STYLES: Record<string, PriorityStyle>;
|
|
21
|
+
export declare function getPriorityStyle(priority: string): PriorityStyle;
|
|
22
|
+
export interface SeverityStyle {
|
|
23
|
+
badge: string;
|
|
24
|
+
text: string;
|
|
25
|
+
bg: string;
|
|
26
|
+
border: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const SEVERITY_STYLES: Record<string, SeverityStyle>;
|
|
29
|
+
export declare function getSeverityStyle(severity: string): SeverityStyle;
|
|
30
|
+
export declare const TYPE_STYLES: Record<string, {
|
|
31
|
+
badge: string;
|
|
32
|
+
text: string;
|
|
33
|
+
border: string;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const CARD_STYLES: {
|
|
36
|
+
readonly default: "bg-card border border-border/50 rounded-xl shadow-[var(--shadow-2)]";
|
|
37
|
+
readonly elevated: "bg-card border border-border/40 rounded-xl shadow-[var(--shadow-8)]";
|
|
38
|
+
readonly dark: "bg-foreground text-background rounded-xl shadow-[var(--shadow-16)]";
|
|
39
|
+
readonly accent: "bg-primary/5 border border-primary/15 rounded-xl";
|
|
40
|
+
readonly empty: "border-2 border-dashed border-border/50 rounded-xl";
|
|
41
|
+
};
|
|
42
|
+
export declare const SECTION_STYLES: {
|
|
43
|
+
readonly pageTitle: "text-lg sm:text-xl font-semibold tracking-tight text-ink";
|
|
44
|
+
readonly sectionHeader: "text-sm font-semibold text-ink";
|
|
45
|
+
readonly cardLabel: "text-[11px] font-semibold uppercase tracking-wider text-ink-3";
|
|
46
|
+
readonly description: "text-sm text-ink-3";
|
|
47
|
+
readonly metricValue: "text-xl sm:text-2xl font-semibold tabular-nums text-ink";
|
|
48
|
+
readonly metricLabel: "text-sm text-ink-3";
|
|
49
|
+
};
|
|
50
|
+
export declare const IMPORTANCE_STYLES: Record<number, {
|
|
51
|
+
badge: string;
|
|
52
|
+
label: string;
|
|
53
|
+
star: string;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const RISK_LEVEL_STYLES: Record<string, {
|
|
56
|
+
badge: string;
|
|
57
|
+
text: string;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function getRiskLevelStyle(level: string): {
|
|
60
|
+
badge: string;
|
|
61
|
+
text: string;
|
|
62
|
+
};
|
|
63
|
+
export declare const AGENT_SOURCE_STYLES: Record<string, {
|
|
64
|
+
border: string;
|
|
65
|
+
bg: string;
|
|
66
|
+
icon: string;
|
|
67
|
+
iconBg: string;
|
|
68
|
+
}>;
|
|
69
|
+
export declare const KIND_STYLES: Record<string, string>;
|
|
70
|
+
export declare const STATE_STYLES: Record<string, string>;
|
|
71
|
+
export declare const ORIGIN_STYLES: Record<string, string>;
|
|
72
|
+
//# sourceMappingURL=design-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-tokens.d.ts","sourceRoot":"","sources":["../../src/ui/design-tokens.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,WAAW;IAC1B,KAAK,E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