@dudousxd/nestjs-catalog-react 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.
- package/LICENSE-bklit +21 -0
- package/README.md +282 -0
- package/dist/AccessConsole.d.ts +40 -0
- package/dist/AccessConsole.js +160 -0
- package/dist/CatalogManager.d.ts +12 -0
- package/dist/CatalogManager.js +123 -0
- package/dist/ConnectionPanel.d.ts +41 -0
- package/dist/ConnectionPanel.js +228 -0
- package/dist/CoverageLedger.d.ts +16 -0
- package/dist/CoverageLedger.js +16 -0
- package/dist/DashboardBoard.d.ts +10 -0
- package/dist/DashboardBoard.js +206 -0
- package/dist/EditableField.d.ts +18 -0
- package/dist/EditableField.js +61 -0
- package/dist/FlowView.d.ts +13 -0
- package/dist/FlowView.js +93 -0
- package/dist/GovernanceTimeline.d.ts +16 -0
- package/dist/GovernanceTimeline.js +93 -0
- package/dist/ObjectExplorer.d.ts +9 -0
- package/dist/ObjectExplorer.js +153 -0
- package/dist/PipelineConsole.d.ts +20 -0
- package/dist/PipelineConsole.js +272 -0
- package/dist/QueryConsole.d.ts +11 -0
- package/dist/QueryConsole.js +144 -0
- package/dist/SavedQueryPanel.d.ts +16 -0
- package/dist/SavedQueryPanel.js +78 -0
- package/dist/TraceExplorer.d.ts +54 -0
- package/dist/TraceExplorer.js +342 -0
- package/dist/TransformEditor.d.ts +23 -0
- package/dist/TransformEditor.js +129 -0
- package/dist/WorkflowCanvas.d.ts +24 -0
- package/dist/WorkflowCanvas.js +701 -0
- package/dist/charts/bklit/animation.d.ts +19 -0
- package/dist/charts/bklit/animation.js +28 -0
- package/dist/charts/bklit/area-chart-loading.d.ts +33 -0
- package/dist/charts/bklit/area-chart-loading.js +30 -0
- package/dist/charts/bklit/area-chart.d.ts +47 -0
- package/dist/charts/bklit/area-chart.js +65 -0
- package/dist/charts/bklit/area-gradient-defs.d.ts +28 -0
- package/dist/charts/bklit/area-gradient-defs.js +23 -0
- package/dist/charts/bklit/area.d.ts +75 -0
- package/dist/charts/bklit/area.js +112 -0
- package/dist/charts/bklit/bar-chart-loading.d.ts +16 -0
- package/dist/charts/bklit/bar-chart-loading.js +22 -0
- package/dist/charts/bklit/bar-chart.d.ts +54 -0
- package/dist/charts/bklit/bar-chart.js +440 -0
- package/dist/charts/bklit/bar-depth-geometry.d.ts +41 -0
- package/dist/charts/bklit/bar-depth-geometry.js +46 -0
- package/dist/charts/bklit/bar-squares-layout.d.ts +36 -0
- package/dist/charts/bklit/bar-squares-layout.js +46 -0
- package/dist/charts/bklit/bar-squares.d.ts +48 -0
- package/dist/charts/bklit/bar-squares.js +206 -0
- package/dist/charts/bklit/bar-x-axis.d.ts +13 -0
- package/dist/charts/bklit/bar-x-axis.js +81 -0
- package/dist/charts/bklit/bar-y-axis.d.ts +11 -0
- package/dist/charts/bklit/bar-y-axis.js +72 -0
- package/dist/charts/bklit/bar.d.ts +40 -0
- package/dist/charts/bklit/bar.js +207 -0
- package/dist/charts/bklit/chart-child-passthrough.d.ts +25 -0
- package/dist/charts/bklit/chart-child-passthrough.js +82 -0
- package/dist/charts/bklit/chart-config-context.d.ts +34 -0
- package/dist/charts/bklit/chart-config-context.js +55 -0
- package/dist/charts/bklit/chart-context.d.ts +207 -0
- package/dist/charts/bklit/chart-context.js +200 -0
- package/dist/charts/bklit/chart-defs.d.ts +21 -0
- package/dist/charts/bklit/chart-defs.js +57 -0
- package/dist/charts/bklit/chart-formatters.d.ts +16 -0
- package/dist/charts/bklit/chart-formatters.js +26 -0
- package/dist/charts/bklit/chart-legend-hover.d.ts +21 -0
- package/dist/charts/bklit/chart-legend-hover.js +26 -0
- package/dist/charts/bklit/chart-loading-label.d.ts +9 -0
- package/dist/charts/bklit/chart-loading-label.js +29 -0
- package/dist/charts/bklit/chart-phase.d.ts +39 -0
- package/dist/charts/bklit/chart-phase.js +20 -0
- package/dist/charts/bklit/chart-reveal-clip.d.ts +32 -0
- package/dist/charts/bklit/chart-reveal-clip.js +23 -0
- package/dist/charts/bklit/dash-tail-stroke.d.ts +17 -0
- package/dist/charts/bklit/dash-tail-stroke.js +21 -0
- package/dist/charts/bklit/decimate-time-series.d.ts +18 -0
- package/dist/charts/bklit/decimate-time-series.js +120 -0
- package/dist/charts/bklit/fade-edges.d.ts +42 -0
- package/dist/charts/bklit/fade-edges.js +34 -0
- package/dist/charts/bklit/filter-data-by-x-domain.d.ts +13 -0
- package/dist/charts/bklit/filter-data-by-x-domain.js +50 -0
- package/dist/charts/bklit/generate-chart-skeleton-data.d.ts +24 -0
- package/dist/charts/bklit/generate-chart-skeleton-data.js +33 -0
- package/dist/charts/bklit/grid.d.ts +57 -0
- package/dist/charts/bklit/grid.js +88 -0
- package/dist/charts/bklit/highlight-segment-bounds.d.ts +26 -0
- package/dist/charts/bklit/highlight-segment-bounds.js +35 -0
- package/dist/charts/bklit/highlight-segment.d.ts +30 -0
- package/dist/charts/bklit/highlight-segment.js +22 -0
- package/dist/charts/bklit/indicator-fade.d.ts +23 -0
- package/dist/charts/bklit/indicator-fade.js +41 -0
- package/dist/charts/bklit/line-chart-loading.d.ts +33 -0
- package/dist/charts/bklit/line-chart-loading.js +30 -0
- package/dist/charts/bklit/line-chart.d.ts +45 -0
- package/dist/charts/bklit/line-chart.js +99 -0
- package/dist/charts/bklit/line-loading-pulse.d.ts +19 -0
- package/dist/charts/bklit/line-loading-pulse.js +132 -0
- package/dist/charts/bklit/line-loading-timing.d.ts +18 -0
- package/dist/charts/bklit/line-loading-timing.js +18 -0
- package/dist/charts/bklit/line-series-terminal-marker.d.ts +15 -0
- package/dist/charts/bklit/line-series-terminal-marker.js +54 -0
- package/dist/charts/bklit/line.d.ts +63 -0
- package/dist/charts/bklit/line.js +104 -0
- package/dist/charts/bklit/loading-sweep.d.ts +65 -0
- package/dist/charts/bklit/loading-sweep.js +182 -0
- package/dist/charts/bklit/motion-utils.d.ts +17 -0
- package/dist/charts/bklit/motion-utils.js +27 -0
- package/dist/charts/bklit/path-stroke-utils.d.ts +28 -0
- package/dist/charts/bklit/path-stroke-utils.js +64 -0
- package/dist/charts/bklit/pattern-area.d.ts +20 -0
- package/dist/charts/bklit/pattern-area.js +27 -0
- package/dist/charts/bklit/pattern-preset.d.ts +34 -0
- package/dist/charts/bklit/pattern-preset.js +82 -0
- package/dist/charts/bklit/projection-config.d.ts +19 -0
- package/dist/charts/bklit/projection-config.js +88 -0
- package/dist/charts/bklit/projection-line-end-marker.d.ts +14 -0
- package/dist/charts/bklit/projection-line-end-marker.js +35 -0
- package/dist/charts/bklit/projection-line.d.ts +39 -0
- package/dist/charts/bklit/projection-line.js +87 -0
- package/dist/charts/bklit/projection-utils.d.ts +54 -0
- package/dist/charts/bklit/projection-utils.js +252 -0
- package/dist/charts/bklit/reference-area-config.d.ts +18 -0
- package/dist/charts/bklit/reference-area-config.js +47 -0
- package/dist/charts/bklit/reference-area-registration-context.d.ts +7 -0
- package/dist/charts/bklit/reference-area-registration-context.js +15 -0
- package/dist/charts/bklit/series-bar-layout.d.ts +26 -0
- package/dist/charts/bklit/series-bar-layout.js +39 -0
- package/dist/charts/bklit/series-dash-tail-overlay.d.ts +16 -0
- package/dist/charts/bklit/series-dash-tail-overlay.js +47 -0
- package/dist/charts/bklit/series-highlight-layer.d.ts +31 -0
- package/dist/charts/bklit/series-highlight-layer.js +20 -0
- package/dist/charts/bklit/series-hover-dim.d.ts +28 -0
- package/dist/charts/bklit/series-hover-dim.js +34 -0
- package/dist/charts/bklit/series-markers.d.ts +13 -0
- package/dist/charts/bklit/series-markers.js +106 -0
- package/dist/charts/bklit/series-path-utils.d.ts +18 -0
- package/dist/charts/bklit/series-path-utils.js +68 -0
- package/dist/charts/bklit/series-point-marker.d.ts +47 -0
- package/dist/charts/bklit/series-point-marker.js +47 -0
- package/dist/charts/bklit/static-chart-preview-context.d.ts +15 -0
- package/dist/charts/bklit/static-chart-preview-context.js +20 -0
- package/dist/charts/bklit/time-series-chart-shell.d.ts +46 -0
- package/dist/charts/bklit/time-series-chart-shell.js +398 -0
- package/dist/charts/bklit/tooltip/chart-tooltip.d.ts +75 -0
- package/dist/charts/bklit/tooltip/chart-tooltip.js +158 -0
- package/dist/charts/bklit/tooltip/date-ticker.d.ts +10 -0
- package/dist/charts/bklit/tooltip/date-ticker.js +85 -0
- package/dist/charts/bklit/tooltip/index.d.ts +15 -0
- package/dist/charts/bklit/tooltip/index.js +15 -0
- package/dist/charts/bklit/tooltip/tooltip-box.d.ts +56 -0
- package/dist/charts/bklit/tooltip/tooltip-box.js +122 -0
- package/dist/charts/bklit/tooltip/tooltip-content.d.ts +26 -0
- package/dist/charts/bklit/tooltip/tooltip-content.js +8 -0
- package/dist/charts/bklit/tooltip/tooltip-dot.d.ts +27 -0
- package/dist/charts/bklit/tooltip/tooltip-dot.js +62 -0
- package/dist/charts/bklit/tooltip/tooltip-indicator.d.ts +44 -0
- package/dist/charts/bklit/tooltip/tooltip-indicator.js +73 -0
- package/dist/charts/bklit/use-animated-series-path.d.ts +18 -0
- package/dist/charts/bklit/use-animated-series-path.js +101 -0
- package/dist/charts/bklit/use-animated-y-domains.d.ts +13 -0
- package/dist/charts/bklit/use-animated-y-domains.js +158 -0
- package/dist/charts/bklit/use-chart-interaction.d.ts +40 -0
- package/dist/charts/bklit/use-chart-interaction.js +252 -0
- package/dist/charts/bklit/use-chart-phase-orchestrator.d.ts +22 -0
- package/dist/charts/bklit/use-chart-phase-orchestrator.js +147 -0
- package/dist/charts/bklit/use-enter-complete.d.ts +16 -0
- package/dist/charts/bklit/use-enter-complete.js +22 -0
- package/dist/charts/bklit/use-grid-shimmer.d.ts +15 -0
- package/dist/charts/bklit/use-grid-shimmer.js +71 -0
- package/dist/charts/bklit/use-highlight-segment.d.ts +22 -0
- package/dist/charts/bklit/use-highlight-segment.js +42 -0
- package/dist/charts/bklit/use-mount-progress.d.ts +12 -0
- package/dist/charts/bklit/use-mount-progress.js +30 -0
- package/dist/charts/bklit/use-scheduled-tooltip.d.ts +8 -0
- package/dist/charts/bklit/use-scheduled-tooltip.js +84 -0
- package/dist/charts/bklit/visx-pattern.d.ts +27 -0
- package/dist/charts/bklit/visx-pattern.js +28 -0
- package/dist/charts/bklit/x-axis.d.ts +26 -0
- package/dist/charts/bklit/x-axis.js +423 -0
- package/dist/charts/bklit/y-axis-scales.d.ts +34 -0
- package/dist/charts/bklit/y-axis-scales.js +80 -0
- package/dist/charts/bklit/y-axis-ticks.d.ts +20 -0
- package/dist/charts/bklit/y-axis-ticks.js +32 -0
- package/dist/charts/bklit/y-domain-utils.d.ts +26 -0
- package/dist/charts/bklit/y-domain-utils.js +96 -0
- package/dist/charts/bklit.d.ts +2 -0
- package/dist/charts/bklit.js +90 -0
- package/dist/charts/components/shimmering-text.d.ts +31 -0
- package/dist/charts/components/shimmering-text.js +39 -0
- package/dist/charts/css.d.ts +35 -0
- package/dist/charts/css.js +64 -0
- package/dist/charts/recharts.d.ts +28 -0
- package/dist/charts/recharts.js +48 -0
- package/dist/charts/registry.d.ts +34 -0
- package/dist/charts/registry.js +60 -0
- package/dist/charts/skeleton.d.ts +55 -0
- package/dist/charts/skeleton.js +66 -0
- package/dist/cn.d.ts +10 -0
- package/dist/cn.js +13 -0
- package/dist/context.d.ts +346 -0
- package/dist/context.js +95 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +65 -0
- package/dist/routes.d.ts +70 -0
- package/dist/routes.js +73 -0
- package/dist/source-fields.d.ts +111 -0
- package/dist/source-fields.js +204 -0
- package/dist/ui/chart.d.ts +54 -0
- package/dist/ui/chart.js +122 -0
- package/dist/ui/dialog.d.ts +27 -0
- package/dist/ui/dialog.js +24 -0
- package/dist/ui/field.d.ts +29 -0
- package/dist/ui/field.js +31 -0
- package/dist/ui/select.d.ts +42 -0
- package/dist/ui/select.js +30 -0
- package/dist/ui/sheet.d.ts +38 -0
- package/dist/ui/sheet.js +37 -0
- package/dist/ui/switch.d.ts +17 -0
- package/dist/ui/switch.js +14 -0
- package/dist/ui/tabs.d.ts +30 -0
- package/dist/ui/tabs.js +36 -0
- package/dist/ui/tooltip.d.ts +37 -0
- package/dist/ui/tooltip.js +43 -0
- package/dist/workflow/graph.d.ts +112 -0
- package/dist/workflow/graph.js +297 -0
- package/dist/workflow/index.d.ts +16 -0
- package/dist/workflow/index.js +16 -0
- package/dist/workflow/model.d.ts +151 -0
- package/dist/workflow/model.js +97 -0
- package/dist/workflow/name.d.ts +28 -0
- package/dist/workflow/name.js +28 -0
- package/dist/workflow/nodes.d.ts +40 -0
- package/dist/workflow/nodes.js +86 -0
- package/dist/workflow/validate.d.ts +104 -0
- package/dist/workflow/validate.js +199 -0
- package/package.json +148 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A confirmation dialog, vendored in the shadcn style on Base UI.
|
|
4
|
+
*
|
|
5
|
+
* This exists because the screens that moved into this package deleted things
|
|
6
|
+
* on a single click of an unlabelled icon. Deleting a transform takes the code
|
|
7
|
+
* a load runs; deleting a connection takes the address every connector reading
|
|
8
|
+
* through it depends on. Neither is recoverable from this console, and neither
|
|
9
|
+
* asked.
|
|
10
|
+
*
|
|
11
|
+
* Purpose-built rather than a set of exported parts, because the only dialog
|
|
12
|
+
* these screens need is "are you sure, and here is what you would break", and a
|
|
13
|
+
* generic Dialog would have every call site rebuild that.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ConfirmDialog({ open, onOpenChange, title, description, confirmLabel, onConfirm, pending, error,
|
|
16
|
+
/** Set for anything unrecoverable. Colours the action, and nothing else. */
|
|
17
|
+
destructive, }: {
|
|
18
|
+
open: boolean;
|
|
19
|
+
onOpenChange: (open: boolean) => void;
|
|
20
|
+
title: string;
|
|
21
|
+
description: ReactNode;
|
|
22
|
+
confirmLabel: string;
|
|
23
|
+
onConfirm: () => void;
|
|
24
|
+
pending?: boolean;
|
|
25
|
+
error?: ReactNode;
|
|
26
|
+
destructive?: boolean;
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import { Loader2 } from 'lucide-react';
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
/**
|
|
6
|
+
* A confirmation dialog, vendored in the shadcn style on Base UI.
|
|
7
|
+
*
|
|
8
|
+
* This exists because the screens that moved into this package deleted things
|
|
9
|
+
* on a single click of an unlabelled icon. Deleting a transform takes the code
|
|
10
|
+
* a load runs; deleting a connection takes the address every connector reading
|
|
11
|
+
* through it depends on. Neither is recoverable from this console, and neither
|
|
12
|
+
* asked.
|
|
13
|
+
*
|
|
14
|
+
* Purpose-built rather than a set of exported parts, because the only dialog
|
|
15
|
+
* these screens need is "are you sure, and here is what you would break", and a
|
|
16
|
+
* generic Dialog would have every call site rebuild that.
|
|
17
|
+
*/
|
|
18
|
+
export function ConfirmDialog({ open, onOpenChange, title, description, confirmLabel, onConfirm, pending, error,
|
|
19
|
+
/** Set for anything unrecoverable. Colours the action, and nothing else. */
|
|
20
|
+
destructive = true, }) {
|
|
21
|
+
return (_jsx(BaseDialog.Root, { open: open, onOpenChange: onOpenChange, children: _jsxs(BaseDialog.Portal, { children: [_jsx(BaseDialog.Backdrop, { className: cn('fixed inset-0 z-50 bg-zinc-950/30 backdrop-blur-[1px] dark:bg-zinc-950/60', 'transition-opacity duration-150', 'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0') }), _jsxs(BaseDialog.Popup, { className: cn('fixed left-1/2 top-1/2 z-50 w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2', 'rounded-lg border p-5 shadow-lg outline-none', 'border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900', 'transition-[opacity,transform] duration-150 ease-out', 'data-[starting-style]:scale-95 data-[starting-style]:opacity-0', 'data-[ending-style]:scale-95 data-[ending-style]:opacity-0'), children: [_jsx(BaseDialog.Title, { className: "text-sm font-semibold tracking-tight", children: title }), _jsx(BaseDialog.Description, { className: "mt-1.5 text-xs leading-relaxed text-zinc-500 dark:text-zinc-400", children: description }), error && (_jsx("p", { className: "mt-3 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300", children: error })), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(BaseDialog.Close, { className: cn('rounded-md border px-3 py-1.5 text-xs', 'border-zinc-200 hover:bg-zinc-50', 'dark:border-zinc-800 dark:hover:bg-zinc-800'), children: "Cancel" }), _jsxs("button", { type: "button", onClick: onConfirm, disabled: pending, className: cn('flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs text-white disabled:opacity-40', destructive
|
|
22
|
+
? 'bg-red-600 hover:bg-red-700'
|
|
23
|
+
: 'bg-zinc-950 hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950'), children: [pending && _jsx(Loader2, { size: 12, className: "animate-spin" }), confirmLabel] })] })] })] }) }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare function TextField({ label, value, onChange, placeholder, hint, type, inputMode, autoComplete, disabled, }: {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
hint?: ReactNode;
|
|
8
|
+
type?: 'text' | 'password' | 'email';
|
|
9
|
+
inputMode?: 'numeric' | 'text';
|
|
10
|
+
autoComplete?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function TextAreaField({ label, value, onChange, placeholder, hint, rows, mono, disabled, }: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
onChange: (value: string) => void;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
hint?: ReactNode;
|
|
19
|
+
rows?: number;
|
|
20
|
+
mono?: boolean;
|
|
21
|
+
/** Matches {@link TextField}, so a read-only form can dim every control. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/** A heading for a run of fields, so a long form reads as sections. */
|
|
25
|
+
export declare function FieldGroup({ title, hint, children, }: {
|
|
26
|
+
title: string;
|
|
27
|
+
hint?: ReactNode;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/ui/field.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../cn';
|
|
3
|
+
/**
|
|
4
|
+
* Labelled text inputs, in the shadcn style.
|
|
5
|
+
*
|
|
6
|
+
* Plain elements rather than a Base UI primitive, exactly as shadcn's own input
|
|
7
|
+
* is: there is nothing about a text box that needs a headless component, and
|
|
8
|
+
* wrapping one would add a layer for no behaviour.
|
|
9
|
+
*
|
|
10
|
+
* What these do add is a real `<label>`. The forms that moved into this package
|
|
11
|
+
* leaned on placeholders, which vanish the moment somebody types — so a person
|
|
12
|
+
* checking a half-filled connector form has no way to tell which box held the
|
|
13
|
+
* prefix and which held the suffix.
|
|
14
|
+
*/
|
|
15
|
+
const CONTROL = cn('w-full rounded-md border px-2 py-1.5 text-xs outline-none', 'border-zinc-200 bg-white text-zinc-900 placeholder:text-zinc-400', 'dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-100 dark:placeholder:text-zinc-600', 'focus-visible:border-violet-500 focus-visible:ring-2 focus-visible:ring-violet-500/15');
|
|
16
|
+
function Label({ children }) {
|
|
17
|
+
return (_jsx("span", { className: "mb-1 block font-mono text-[10px] uppercase tracking-[0.14em] text-zinc-400 dark:text-zinc-500", children: children }));
|
|
18
|
+
}
|
|
19
|
+
function Hint({ children }) {
|
|
20
|
+
return (_jsx("span", { className: "mt-1 block text-[11px] leading-relaxed text-zinc-400 dark:text-zinc-500", children: children }));
|
|
21
|
+
}
|
|
22
|
+
export function TextField({ label, value, onChange, placeholder, hint, type = 'text', inputMode, autoComplete, disabled, }) {
|
|
23
|
+
return (_jsxs("label", { className: "block", children: [_jsx(Label, { children: label }), _jsx("input", { type: type, value: value, onChange: (event) => onChange(event.target.value), placeholder: placeholder, inputMode: inputMode, autoComplete: autoComplete, disabled: disabled, className: cn(CONTROL, 'disabled:opacity-40') }), hint && _jsx(Hint, { children: hint })] }));
|
|
24
|
+
}
|
|
25
|
+
export function TextAreaField({ label, value, onChange, placeholder, hint, rows = 4, mono = false, disabled, }) {
|
|
26
|
+
return (_jsxs("label", { className: "block", children: [_jsx(Label, { children: label }), _jsx("textarea", { value: value, onChange: (event) => onChange(event.target.value), placeholder: placeholder, rows: rows, spellCheck: false, disabled: disabled, className: cn(CONTROL, 'resize-none disabled:opacity-40', mono && 'font-mono') }), hint && _jsx(Hint, { children: hint })] }));
|
|
27
|
+
}
|
|
28
|
+
/** A heading for a run of fields, so a long form reads as sections. */
|
|
29
|
+
export function FieldGroup({ title, hint, children, }) {
|
|
30
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { children: [_jsx("p", { className: "font-mono text-[10px] uppercase tracking-[0.14em] text-zinc-400 dark:text-zinc-500", children: title }), hint && _jsx(Hint, { children: hint })] }), children] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A select, vendored in the shadcn style on Base UI.
|
|
4
|
+
*
|
|
5
|
+
* Data-driven rather than composed at the call site. Base UI's select is eight
|
|
6
|
+
* parts — root, trigger, value, icon, portal, positioner, popup, list — and the
|
|
7
|
+
* screens in this package hold two dozen of them; repeating that anatomy per
|
|
8
|
+
* field means the popup styling drifts field by field, and the one field
|
|
9
|
+
* somebody forgot to portal is the one that clips inside a scrolling form.
|
|
10
|
+
*
|
|
11
|
+
* The native `<select>` this replaced was smaller still, and would have been
|
|
12
|
+
* fine forever if the options had stayed one line each. They did not: choosing
|
|
13
|
+
* a connection has to say what the connection *is* — its kind, its address —
|
|
14
|
+
* and a native option element renders a single string with no markup at all.
|
|
15
|
+
*/
|
|
16
|
+
export interface SelectOption {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
/** A second line under the label. The reason a native option was not enough. */
|
|
20
|
+
hint?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function Select({ value, onValueChange, options, ariaLabel, placeholder, disabled, className, }: {
|
|
24
|
+
value: string;
|
|
25
|
+
onValueChange: (value: string) => void;
|
|
26
|
+
options: SelectOption[];
|
|
27
|
+
/** Required: this renders a button, and a button with only a chevron is mute. */
|
|
28
|
+
ariaLabel: string;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
className?: string;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* A select with a label above it, which is what every form in this package
|
|
35
|
+
* actually wants.
|
|
36
|
+
*
|
|
37
|
+
* Separate from `Select` so a toolbar can still drop a bare one in.
|
|
38
|
+
*/
|
|
39
|
+
export declare function SelectField({ label, hint, ...props }: Parameters<typeof Select>[0] & {
|
|
40
|
+
label: string;
|
|
41
|
+
hint?: ReactNode;
|
|
42
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
3
|
+
import { Check, ChevronsUpDown } from 'lucide-react';
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
export function Select({ value, onValueChange, options, ariaLabel, placeholder = 'Choose…', disabled, className, }) {
|
|
6
|
+
const selected = options.find((option) => option.value === value);
|
|
7
|
+
return (_jsxs(BaseSelect.Root, { value: value,
|
|
8
|
+
// Base UI hands back the item's value, which is `unknown` as far as its
|
|
9
|
+
// generics are concerned, and `null` when a selection is cleared. Narrowed
|
|
10
|
+
// rather than asserted: a cleared select must not call back with null and
|
|
11
|
+
// leave a form field holding something its own type says it cannot.
|
|
12
|
+
onValueChange: (next) => {
|
|
13
|
+
if (typeof next === 'string')
|
|
14
|
+
onValueChange(next);
|
|
15
|
+
}, disabled: disabled, children: [_jsxs(BaseSelect.Trigger, { "aria-label": ariaLabel, className: cn('flex w-full items-center justify-between gap-2 rounded-md border px-2 py-1.5 text-left text-xs', 'border-zinc-200 bg-white text-zinc-900 outline-none', 'dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-100', 'focus-visible:border-violet-500 focus-visible:ring-2 focus-visible:ring-violet-500/15', 'disabled:opacity-40', className), children: [_jsx(BaseSelect.Value, { className: "truncate", children: selected ? (selected.label) : (_jsx("span", { className: "text-zinc-400 dark:text-zinc-500", children: placeholder })) }), _jsx(BaseSelect.Icon, { children: _jsx(ChevronsUpDown, { size: 12, className: "shrink-0 text-zinc-400" }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { sideOffset: 4,
|
|
16
|
+
// Overlapping the trigger so the chosen row lands under the cursor is
|
|
17
|
+
// Base UI's default and it is wrong here: these popups carry a hint
|
|
18
|
+
// line per row, so the popup is much taller than the trigger and the
|
|
19
|
+
// overlap puts it over the field somebody is reading.
|
|
20
|
+
alignItemWithTrigger: false, className: "z-50", children: _jsx(BaseSelect.Popup, { className: cn('max-h-72 min-w-[var(--anchor-width)] overflow-y-auto rounded-md border p-1 shadow-md', 'border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900', 'origin-[var(--transform-origin)] transition-[opacity,transform] duration-100 ease-out', 'data-[starting-style]:scale-95 data-[starting-style]:opacity-0', 'data-[ending-style]:scale-95 data-[ending-style]:opacity-0'), children: _jsx(BaseSelect.List, { children: options.map((option) => (_jsxs(BaseSelect.Item, { value: option.value, disabled: option.disabled, className: cn('flex cursor-default items-start gap-2 rounded-sm px-2 py-1.5 text-xs outline-none', 'data-[highlighted]:bg-zinc-100 dark:data-[highlighted]:bg-zinc-800', 'data-[disabled]:opacity-40'), children: [_jsx(BaseSelect.ItemIndicator, { className: "mt-0.5 shrink-0", children: _jsx(Check, { size: 11, className: "text-violet-600" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx(BaseSelect.ItemText, { className: "block truncate", children: option.label }), option.hint && (_jsx("span", { className: "mt-0.5 block truncate font-mono text-[10px] text-zinc-400 dark:text-zinc-500", children: option.hint }))] })] }, option.value))) }) }) }) })] }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A select with a label above it, which is what every form in this package
|
|
24
|
+
* actually wants.
|
|
25
|
+
*
|
|
26
|
+
* Separate from `Select` so a toolbar can still drop a bare one in.
|
|
27
|
+
*/
|
|
28
|
+
export function SelectField({ label, hint, ...props }) {
|
|
29
|
+
return (_jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block font-mono text-[10px] uppercase tracking-[0.14em] text-zinc-400 dark:text-zinc-500", children: label }), _jsx(Select, { ...props }), hint && (_jsx("span", { className: "mt-1 block text-[11px] text-zinc-400 dark:text-zinc-500", children: hint }))] }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A panel that slides in from the right, on Base UI's Dialog.
|
|
4
|
+
*
|
|
5
|
+
* This exists for one reason: the workflow canvas has to open an inspector, and
|
|
6
|
+
* a code editor, *without unmounting the canvas*. Everything a person has done
|
|
7
|
+
* since the last save — node positions, a half-drawn branch, the viewport they
|
|
8
|
+
* panned to — lives in the canvas's own state, and swapping the canvas out for
|
|
9
|
+
* an editor and back loses all of it. Rendering the editor over the canvas
|
|
10
|
+
* keeps it mounted and keeps that state.
|
|
11
|
+
*
|
|
12
|
+
* On a Dialog rather than a plain absolutely-positioned div, because the free
|
|
13
|
+
* parts are the ones that are laborious to get right and easy to skip: focus
|
|
14
|
+
* moves into the panel when it opens and returns to whatever opened it when it
|
|
15
|
+
* closes, Escape closes it, focus cannot Tab out into the canvas behind, and
|
|
16
|
+
* the whole thing is announced as a dialog.
|
|
17
|
+
*
|
|
18
|
+
* That last point is the one worth spelling out. A hand-rolled panel floating
|
|
19
|
+
* over a canvas leaks focus the other way: Tab walks out of the panel and onto
|
|
20
|
+
* graph nodes that are visually behind it, so a keyboard user ends up operating
|
|
21
|
+
* something they cannot see and did not open. Both variants here are therefore
|
|
22
|
+
* modal by default — keeping the canvas *mounted* is what preserves unsaved
|
|
23
|
+
* positions and the viewport, and that has nothing to do with keeping it
|
|
24
|
+
* reachable while a form is open on top of it.
|
|
25
|
+
*
|
|
26
|
+
* `modal` remains a prop for the case where a caller genuinely wants the
|
|
27
|
+
* background operable, but nothing in this package passes false.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Sheet({ open, onOpenChange, title, description, width, modal, children, }: {
|
|
30
|
+
open: boolean;
|
|
31
|
+
onOpenChange: (open: boolean) => void;
|
|
32
|
+
title: string;
|
|
33
|
+
description?: ReactNode;
|
|
34
|
+
/** `wide` is for the code editor, which needs two columns to be usable. */
|
|
35
|
+
width?: 'narrow' | 'wide';
|
|
36
|
+
modal?: boolean;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/ui/sheet.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import { X } from 'lucide-react';
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
import { Tooltip } from './tooltip';
|
|
6
|
+
/**
|
|
7
|
+
* A panel that slides in from the right, on Base UI's Dialog.
|
|
8
|
+
*
|
|
9
|
+
* This exists for one reason: the workflow canvas has to open an inspector, and
|
|
10
|
+
* a code editor, *without unmounting the canvas*. Everything a person has done
|
|
11
|
+
* since the last save — node positions, a half-drawn branch, the viewport they
|
|
12
|
+
* panned to — lives in the canvas's own state, and swapping the canvas out for
|
|
13
|
+
* an editor and back loses all of it. Rendering the editor over the canvas
|
|
14
|
+
* keeps it mounted and keeps that state.
|
|
15
|
+
*
|
|
16
|
+
* On a Dialog rather than a plain absolutely-positioned div, because the free
|
|
17
|
+
* parts are the ones that are laborious to get right and easy to skip: focus
|
|
18
|
+
* moves into the panel when it opens and returns to whatever opened it when it
|
|
19
|
+
* closes, Escape closes it, focus cannot Tab out into the canvas behind, and
|
|
20
|
+
* the whole thing is announced as a dialog.
|
|
21
|
+
*
|
|
22
|
+
* That last point is the one worth spelling out. A hand-rolled panel floating
|
|
23
|
+
* over a canvas leaks focus the other way: Tab walks out of the panel and onto
|
|
24
|
+
* graph nodes that are visually behind it, so a keyboard user ends up operating
|
|
25
|
+
* something they cannot see and did not open. Both variants here are therefore
|
|
26
|
+
* modal by default — keeping the canvas *mounted* is what preserves unsaved
|
|
27
|
+
* positions and the viewport, and that has nothing to do with keeping it
|
|
28
|
+
* reachable while a form is open on top of it.
|
|
29
|
+
*
|
|
30
|
+
* `modal` remains a prop for the case where a caller genuinely wants the
|
|
31
|
+
* background operable, but nothing in this package passes false.
|
|
32
|
+
*/
|
|
33
|
+
export function Sheet({ open, onOpenChange, title, description, width = 'narrow', modal = true, children, }) {
|
|
34
|
+
return (_jsx(BaseDialog.Root, { open: open, onOpenChange: onOpenChange, modal: modal, children: _jsxs(BaseDialog.Portal, { children: [modal && (_jsx(BaseDialog.Backdrop, { className: cn('fixed inset-0 z-40 bg-zinc-950/20 dark:bg-zinc-950/50', 'transition-opacity duration-150', 'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0') })), _jsxs(BaseDialog.Popup, { className: cn('fixed inset-y-0 right-0 z-50 flex flex-col border-l shadow-xl outline-none', 'border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900', width === 'wide'
|
|
35
|
+
? 'w-[min(64rem,calc(100vw-2rem))]'
|
|
36
|
+
: 'w-[min(24rem,calc(100vw-2rem))]', 'transition-transform duration-200 ease-out', 'data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full'), children: [_jsxs("div", { className: "flex items-start gap-3 border-b border-zinc-200 px-4 py-3 dark:border-zinc-800", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(BaseDialog.Title, { className: "truncate text-sm font-semibold tracking-tight", children: title }), description && (_jsx(BaseDialog.Description, { className: "mt-0.5 text-[11px] leading-relaxed text-zinc-500 dark:text-zinc-400", children: description }))] }), _jsx(Tooltip, { content: "Close (Esc)", children: _jsx(BaseDialog.Close, { "aria-label": "Close", className: cn('rounded-md p-1 text-zinc-400 outline-none', 'hover:bg-zinc-100 hover:text-zinc-900', 'focus-visible:ring-2 focus-visible:ring-violet-500/30', 'dark:hover:bg-zinc-800 dark:hover:text-zinc-100'), children: _jsx(X, { size: 14 }) }) })] }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-4 py-4", children: children })] })] }) }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A switch, vendored in the shadcn style on Base UI.
|
|
4
|
+
*
|
|
5
|
+
* A switch rather than the checkbox these forms used to carry, because every
|
|
6
|
+
* one of them toggles something that takes effect immediately in meaning —
|
|
7
|
+
* whether a connector runs, whether path-style addressing is used — and a
|
|
8
|
+
* checkbox reads as "include this in what I am about to submit".
|
|
9
|
+
*/
|
|
10
|
+
export declare function Switch({ checked, onCheckedChange, label, hint, disabled, }: {
|
|
11
|
+
checked: boolean;
|
|
12
|
+
onCheckedChange: (checked: boolean) => void;
|
|
13
|
+
/** The label is not optional: an unlabelled switch is a mystery toggle. */
|
|
14
|
+
label: ReactNode;
|
|
15
|
+
hint?: ReactNode;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
3
|
+
import { cn } from '../cn';
|
|
4
|
+
/**
|
|
5
|
+
* A switch, vendored in the shadcn style on Base UI.
|
|
6
|
+
*
|
|
7
|
+
* A switch rather than the checkbox these forms used to carry, because every
|
|
8
|
+
* one of them toggles something that takes effect immediately in meaning —
|
|
9
|
+
* whether a connector runs, whether path-style addressing is used — and a
|
|
10
|
+
* checkbox reads as "include this in what I am about to submit".
|
|
11
|
+
*/
|
|
12
|
+
export function Switch({ checked, onCheckedChange, label, hint, disabled, }) {
|
|
13
|
+
return (_jsxs("label", { className: "flex items-start gap-2.5", children: [_jsx(BaseSwitch.Root, { checked: checked, onCheckedChange: onCheckedChange, disabled: disabled, className: cn('relative mt-0.5 h-4 w-7 shrink-0 rounded-full border transition-colors outline-none', 'border-zinc-300 bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800', 'data-[checked]:border-violet-600 data-[checked]:bg-violet-600', 'focus-visible:ring-2 focus-visible:ring-violet-500/30', 'disabled:opacity-40'), children: _jsx(BaseSwitch.Thumb, { className: cn('block h-3 w-3 translate-x-0.5 rounded-full bg-white shadow-sm transition-transform', 'data-[checked]:translate-x-[14px]') }) }), _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block text-[11px] text-zinc-600 dark:text-zinc-300", children: label }), hint && _jsx("span", { className: "block text-[11px] text-zinc-400 dark:text-zinc-500", children: hint })] })] }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Tabs, vendored in the shadcn style on Base UI.
|
|
4
|
+
*
|
|
5
|
+
* The screens used to switch on a `useState` string and render buttons by hand,
|
|
6
|
+
* which looks the same and is not the same: hand-rolled tabs are a row of
|
|
7
|
+
* buttons as far as a screen reader is concerned, with no arrow-key movement
|
|
8
|
+
* between them and no relationship to the panel they reveal. Base UI's Tabs
|
|
9
|
+
* carries the roving tabindex and the `aria-controls` wiring, and costs a
|
|
10
|
+
* wrapper.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Tabs({ value, onValueChange, children, className, }: {
|
|
13
|
+
value: string;
|
|
14
|
+
onValueChange: (value: string) => void;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function TabsList({ children, className, }: {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function TabsTab({ value, children, }: {
|
|
23
|
+
value: string;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function TabsPanel({ value, children, className, }: {
|
|
27
|
+
value: string;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/ui/tabs.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
3
|
+
import { cn } from '../cn';
|
|
4
|
+
/**
|
|
5
|
+
* Tabs, vendored in the shadcn style on Base UI.
|
|
6
|
+
*
|
|
7
|
+
* The screens used to switch on a `useState` string and render buttons by hand,
|
|
8
|
+
* which looks the same and is not the same: hand-rolled tabs are a row of
|
|
9
|
+
* buttons as far as a screen reader is concerned, with no arrow-key movement
|
|
10
|
+
* between them and no relationship to the panel they reveal. Base UI's Tabs
|
|
11
|
+
* carries the roving tabindex and the `aria-controls` wiring, and costs a
|
|
12
|
+
* wrapper.
|
|
13
|
+
*/
|
|
14
|
+
export function Tabs({ value, onValueChange, children, className, }) {
|
|
15
|
+
return (_jsx(BaseTabs.Root, { value: value,
|
|
16
|
+
// Same narrowing as the select, for the same reason: Base UI allows any
|
|
17
|
+
// value on a tab, including `null` for "no tab active", and this package
|
|
18
|
+
// only ever names them with strings.
|
|
19
|
+
onValueChange: (next) => {
|
|
20
|
+
if (typeof next === 'string')
|
|
21
|
+
onValueChange(next);
|
|
22
|
+
}, className: className, children: children }));
|
|
23
|
+
}
|
|
24
|
+
export function TabsList({ children, className, }) {
|
|
25
|
+
return (_jsx(BaseTabs.List, { className: cn('flex gap-1 border-b border-zinc-200 dark:border-zinc-800', className), children: children }));
|
|
26
|
+
}
|
|
27
|
+
export function TabsTab({ value, children, }) {
|
|
28
|
+
return (_jsx(BaseTabs.Tab, { value: value, className: cn('flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors outline-none', 'border-transparent text-zinc-500', 'hover:text-zinc-950 dark:hover:text-zinc-50', 'focus-visible:ring-2 focus-visible:ring-violet-500/30', 'data-[selected]:border-violet-600 data-[selected]:text-zinc-950', 'dark:data-[selected]:text-zinc-50'), children: children }));
|
|
29
|
+
}
|
|
30
|
+
export function TabsPanel({ value, children, className, }) {
|
|
31
|
+
// Not `keepMounted`: a panel holding a half-typed connector form should keep
|
|
32
|
+
// its draft when somebody looks at another tab, but these panels each own a
|
|
33
|
+
// query of their own, and keeping them all mounted means every tab polls for
|
|
34
|
+
// the whole time the screen is open.
|
|
35
|
+
return (_jsx(BaseTabs.Panel, { value: value, className: cn('outline-none', className), children: children }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The shadcn/ui tooltip, vendored, on Base UI.
|
|
4
|
+
*
|
|
5
|
+
* Vendored rather than imported because that is what shadcn is: components you
|
|
6
|
+
* own, not a dependency you take. A host already using shadcn gets something
|
|
7
|
+
* that looks and behaves like the rest of their app; one that is not gets an
|
|
8
|
+
* accessible primitive and some Tailwind, with nothing to configure either way.
|
|
9
|
+
*
|
|
10
|
+
* Base UI rather than Radix because that is where shadcn's primitives are
|
|
11
|
+
* going, and running one generation behind in a library other people install
|
|
12
|
+
* means every host inherits the migration rather than us doing it once.
|
|
13
|
+
*
|
|
14
|
+
* The package is `@base-ui/react`. The older `@base-ui-components/react` name is
|
|
15
|
+
* deprecated on npm and its last release under that name is a release candidate,
|
|
16
|
+
* so pinning it would have shipped an RC of an abandoned name — worth stating
|
|
17
|
+
* here because the two look interchangeable in a search result and only one of
|
|
18
|
+
* them is maintained. Everything Base-UI-shaped in this package goes through
|
|
19
|
+
* these wrappers, so when its API moves, it moves here and nowhere else.
|
|
20
|
+
*
|
|
21
|
+
* The exported surface is deliberately identical to the Radix version it
|
|
22
|
+
* replaced — `Tooltip` and `TooltipProvider`, same props — because every screen
|
|
23
|
+
* in this package and in the consuming app imports it, and a primitive swap that
|
|
24
|
+
* forces call sites to change is a primitive swap nobody performs.
|
|
25
|
+
*/
|
|
26
|
+
export declare function TooltipProvider({ children, delay, closeDelay, }: {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
/** Shared open delay. A per-tooltip `delay` still wins over this. */
|
|
29
|
+
delay?: number;
|
|
30
|
+
closeDelay?: number;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function Tooltip({ children, content, side, delay, }: {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
content: ReactNode;
|
|
35
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
36
|
+
delay?: number;
|
|
37
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
3
|
+
import { isValidElement } from 'react';
|
|
4
|
+
import { cn } from '../cn';
|
|
5
|
+
/**
|
|
6
|
+
* The shadcn/ui tooltip, vendored, on Base UI.
|
|
7
|
+
*
|
|
8
|
+
* Vendored rather than imported because that is what shadcn is: components you
|
|
9
|
+
* own, not a dependency you take. A host already using shadcn gets something
|
|
10
|
+
* that looks and behaves like the rest of their app; one that is not gets an
|
|
11
|
+
* accessible primitive and some Tailwind, with nothing to configure either way.
|
|
12
|
+
*
|
|
13
|
+
* Base UI rather than Radix because that is where shadcn's primitives are
|
|
14
|
+
* going, and running one generation behind in a library other people install
|
|
15
|
+
* means every host inherits the migration rather than us doing it once.
|
|
16
|
+
*
|
|
17
|
+
* The package is `@base-ui/react`. The older `@base-ui-components/react` name is
|
|
18
|
+
* deprecated on npm and its last release under that name is a release candidate,
|
|
19
|
+
* so pinning it would have shipped an RC of an abandoned name — worth stating
|
|
20
|
+
* here because the two look interchangeable in a search result and only one of
|
|
21
|
+
* them is maintained. Everything Base-UI-shaped in this package goes through
|
|
22
|
+
* these wrappers, so when its API moves, it moves here and nowhere else.
|
|
23
|
+
*
|
|
24
|
+
* The exported surface is deliberately identical to the Radix version it
|
|
25
|
+
* replaced — `Tooltip` and `TooltipProvider`, same props — because every screen
|
|
26
|
+
* in this package and in the consuming app imports it, and a primitive swap that
|
|
27
|
+
* forces call sites to change is a primitive swap nobody performs.
|
|
28
|
+
*/
|
|
29
|
+
export function TooltipProvider({ children, delay = 200, closeDelay = 0, }) {
|
|
30
|
+
return (_jsx(BaseTooltip.Provider, { delay: delay, closeDelay: closeDelay, children: children }));
|
|
31
|
+
}
|
|
32
|
+
export function Tooltip({ children, content, side = 'top', delay = 200, }) {
|
|
33
|
+
if (!content)
|
|
34
|
+
return _jsx(_Fragment, { children: children });
|
|
35
|
+
return (_jsxs(BaseTooltip.Root, { children: [isValidElement(children) ? (_jsx(BaseTooltip.Trigger, { delay: delay, render: children })) : (_jsx(BaseTooltip.Trigger, { delay: delay, children: children })), _jsx(BaseTooltip.Portal, { children: _jsx(BaseTooltip.Positioner, { side: side, sideOffset: 6, className: "z-50", children: _jsxs(BaseTooltip.Popup, { className: cn('max-w-xs rounded-md border border-zinc-200 bg-white px-2.5 py-1.5', 'text-xs leading-snug text-zinc-700 shadow-md', 'dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-200',
|
|
36
|
+
// Plain transition utilities driven by Base UI's own data
|
|
37
|
+
// attributes, rather than the `animate-in` classes the Radix
|
|
38
|
+
// version used. Those come from the `tailwindcss-animate` plugin,
|
|
39
|
+
// which is a line in the host's Tailwind config — and a component
|
|
40
|
+
// library that silently needs a plugin renders unstyled in half
|
|
41
|
+
// the apps that install it.
|
|
42
|
+
'origin-[var(--transform-origin)] transition-[opacity,transform] duration-100 ease-out', 'data-[starting-style]:scale-95 data-[starting-style]:opacity-0', 'data-[ending-style]:scale-95 data-[ending-style]:opacity-0', 'data-[instant]:duration-0'), children: [_jsx(BaseTooltip.Arrow, { className: cn('data-[side=bottom]:top-[-6px] data-[side=bottom]:rotate-180', 'data-[side=top]:bottom-[-6px]', 'data-[side=left]:right-[-9px] data-[side=left]:-rotate-90', 'data-[side=right]:left-[-9px] data-[side=right]:rotate-90'), children: _jsxs("svg", { width: "12", height: "6", viewBox: "0 0 12 6", "aria-hidden": true, className: "block fill-white stroke-zinc-200 dark:fill-zinc-900 dark:stroke-zinc-800", children: [_jsx("title", { children: "\u00B7" }), _jsx("path", { d: "M0 0 L6 6 L12 0" })] }) }), content] }) }) })] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Edge, Node } from '@xyflow/react';
|
|
2
|
+
import { type WorkflowEdge, type WorkflowNode, type WorkflowNodeKind, type WorkflowRunNode } from './model';
|
|
3
|
+
import { type WorkflowProblem } from './validate';
|
|
4
|
+
/**
|
|
5
|
+
* Turning the stored graph into what React Flow draws, and back.
|
|
6
|
+
*
|
|
7
|
+
* Kept out of the screen because the two models genuinely differ and the
|
|
8
|
+
* conversion is where that difference is allowed to live. React Flow wants
|
|
9
|
+
* `source`/`target` on an edge and a `data` bag on a node; the executable model
|
|
10
|
+
* wants `from`/`to` and named fields. Letting React Flow's vocabulary leak into
|
|
11
|
+
* what gets saved would tie the wire format to a rendering library, and the
|
|
12
|
+
* next person swapping the canvas would be migrating a database.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Fixed node dimensions, used by the layout below.
|
|
16
|
+
*
|
|
17
|
+
* Declared rather than measured because layout runs before React Flow has
|
|
18
|
+
* measured anything — on a graph loaded from the server, or one somebody just
|
|
19
|
+
* pasted — and a layout that waits for measurements draws every node stacked at
|
|
20
|
+
* the origin for one frame, which reads as a broken canvas.
|
|
21
|
+
*/
|
|
22
|
+
export declare const NODE_WIDTH = 224;
|
|
23
|
+
export declare const NODE_HEIGHT = 80;
|
|
24
|
+
/**
|
|
25
|
+
* What a node needs to draw itself.
|
|
26
|
+
*
|
|
27
|
+
* A `type` alias rather than an `interface`, and this is not a style
|
|
28
|
+
* preference: React Flow's `Node<T>` constrains `T extends Record<string,
|
|
29
|
+
* unknown>`, and TypeScript gives a type alias of an object literal an implicit
|
|
30
|
+
* index signature while an interface never gets one. Written as an interface,
|
|
31
|
+
* this fails to satisfy the constraint with an error that points at the
|
|
32
|
+
* generic rather than at the declaration.
|
|
33
|
+
*
|
|
34
|
+
* Handlers are deliberately absent — they arrive through context instead (see
|
|
35
|
+
* `WorkflowNodeContext`). Putting a callback in `data` gives every node a new
|
|
36
|
+
* `data` object on every render of the screen, which defeats React Flow's own
|
|
37
|
+
* memoisation and makes a large graph stutter while somebody drags one node.
|
|
38
|
+
*/
|
|
39
|
+
export type WorkflowNodeData = {
|
|
40
|
+
kind: WorkflowNodeKind;
|
|
41
|
+
label: string;
|
|
42
|
+
/** The second line: which transform, which system, which type. */
|
|
43
|
+
subtitle: string;
|
|
44
|
+
/** Only the problems naming this node, so the node can ring itself. */
|
|
45
|
+
problems: WorkflowProblem[];
|
|
46
|
+
run?: WorkflowRunNode;
|
|
47
|
+
};
|
|
48
|
+
export type WorkflowFlowNode = Node<WorkflowNodeData, 'workflowNode'>;
|
|
49
|
+
export type WorkflowFlowEdge = Edge;
|
|
50
|
+
export interface NodeDescriptions {
|
|
51
|
+
transformName(id: string | undefined): string | undefined;
|
|
52
|
+
connectionName(id: string | undefined): string | undefined;
|
|
53
|
+
}
|
|
54
|
+
export declare function toFlowNodes(nodes: WorkflowNode[], edges: WorkflowEdge[], describe: NodeDescriptions, problemsFor: Map<string, WorkflowProblem[]>, runFor: Map<string, WorkflowRunNode>): WorkflowFlowNode[];
|
|
55
|
+
export declare function defaultLabel(kind: WorkflowNodeKind): string;
|
|
56
|
+
export declare function toFlowEdges(edges: WorkflowEdge[], nodes: WorkflowNode[], brokenEdgeIds: ReadonlySet<string>): WorkflowFlowEdge[];
|
|
57
|
+
/**
|
|
58
|
+
* Lay the graph out left to right, one column per dependency depth.
|
|
59
|
+
*
|
|
60
|
+
* Sources end up on the left, every wire points right, and **every sink is put
|
|
61
|
+
* in the last column** — past the deepest node in the graph — because a sink is
|
|
62
|
+
* where a branch ends and the arrangement is the only thing that communicates
|
|
63
|
+
* direction. A reader who cannot tell which way the graph flows has to fall back
|
|
64
|
+
* on the wiring rail, and at that point the canvas is decoration. With several
|
|
65
|
+
* sinks that matters more, not less: "everything ends at the right" is how the
|
|
66
|
+
* shape is read at a glance.
|
|
67
|
+
*
|
|
68
|
+
* The positions this produces are then draggable and saved like any others.
|
|
69
|
+
*/
|
|
70
|
+
export declare function layout(nodes: WorkflowNode[], edges: WorkflowEdge[]): WorkflowNode[];
|
|
71
|
+
/**
|
|
72
|
+
* Arrange a graph that nobody has arranged, and leave one that somebody has.
|
|
73
|
+
*
|
|
74
|
+
* Graphs arrive from the API as often as they are drawn — created by a
|
|
75
|
+
* scheduler, promoted from another environment, written by a script — and none
|
|
76
|
+
* of those set positions. `position` is optional in the executable model
|
|
77
|
+
* precisely because it means nothing to execution, so an unset one is normal
|
|
78
|
+
* rather than exceptional. Drawing those at the origin puts every node on top of
|
|
79
|
+
* the first one, and the graph then reads as something it is not: a sink stacked
|
|
80
|
+
* under a source draws its inbound edge doubling back across the canvas, which
|
|
81
|
+
* looks exactly like a cycle. A DAG that renders as apparently cyclic is wrong
|
|
82
|
+
* by definition.
|
|
83
|
+
*
|
|
84
|
+
* Two triggers, not one. Any node **missing** a position is the obvious case.
|
|
85
|
+
* Two nodes sharing **the same** position is the other, and it is included
|
|
86
|
+
* because a server that defaults a missing position to `{0, 0}` produces
|
|
87
|
+
* collisions rather than absences, and the two are the same problem wearing
|
|
88
|
+
* different clothes. Nobody drags two boxes onto the same pixel, so treating an
|
|
89
|
+
* exact collision as "never arranged" costs nothing real.
|
|
90
|
+
*
|
|
91
|
+
* All-or-nothing on purpose. Positioning only the unplaced nodes relative to
|
|
92
|
+
* hand-placed ones produces a worse arrangement than either — the new ones land
|
|
93
|
+
* in columns that mean nothing next to the old ones — so either the layout is
|
|
94
|
+
* authored or it is derived.
|
|
95
|
+
*
|
|
96
|
+
* This runs when a workflow is loaded, and does **not** mark the draft as
|
|
97
|
+
* modified: the result is a pure function of the graph, so it re-derives
|
|
98
|
+
* identically next time and there is nothing to lose by not saving it. Somebody
|
|
99
|
+
* who then drags a node has authored a layout, and that one is saved.
|
|
100
|
+
*/
|
|
101
|
+
export declare function layoutIfUnarranged(nodes: WorkflowNode[], edges: WorkflowEdge[]): WorkflowNode[];
|
|
102
|
+
/**
|
|
103
|
+
* Where to drop a node somebody just added.
|
|
104
|
+
*
|
|
105
|
+
* To the right of everything that already exists, rather than at the origin,
|
|
106
|
+
* because dropping it at the origin puts it underneath whatever is already
|
|
107
|
+
* there and reads as "the button did nothing".
|
|
108
|
+
*/
|
|
109
|
+
export declare function nextPosition(nodes: WorkflowNode[]): {
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
};
|