@praxical/ui 0.0.0-stage → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +23 -2
- package/dist/activity-calendar.d.ts +13 -0
- package/dist/activity-calendar.js +7 -0
- package/dist/activity-heatmap.d.ts +14 -0
- package/dist/activity-heatmap.js +13 -0
- package/dist/chart-data.d.ts +9 -0
- package/dist/chart-data.js +9 -0
- package/dist/charts.d.ts +56 -0
- package/dist/charts.js +424 -0
- package/dist/chunk-7RMPDKZV.js +541 -0
- package/dist/chunk-7RTW3X7C.js +142 -0
- package/dist/chunk-EBF2F3LN.js +1523 -0
- package/dist/chunk-FCYIZANU.js +385 -0
- package/dist/chunk-HMO4VQZN.js +58 -0
- package/dist/chunk-II677WPC.js +177 -0
- package/dist/chunk-KZHUBPY6.js +102 -0
- package/dist/chunk-OLGZOPLD.js +166 -0
- package/dist/chunk-PDSV773E.js +52 -0
- package/dist/chunk-Q4ARHP76.js +457 -0
- package/dist/chunk-U5W7O3QV.js +22 -0
- package/dist/chunk-V6MXR4P2.js +275 -0
- package/dist/chunk-VZZDLRM5.js +152 -0
- package/dist/chunk-WEM2UQPR.js +110 -0
- package/dist/chunk-XFNDEA5M.js +104 -0
- package/dist/chunk-YKFAA7GU.js +72 -0
- package/dist/code-value.d.ts +13 -0
- package/dist/code-value.js +10 -0
- package/dist/code.d.ts +36 -0
- package/dist/code.js +198 -0
- package/dist/collection.d.ts +21 -0
- package/dist/collection.js +48 -0
- package/dist/content.d.ts +42 -0
- package/dist/content.js +122 -0
- package/dist/display.d.ts +58 -0
- package/dist/display.js +27 -0
- package/dist/feedback.d.ts +34 -0
- package/dist/feedback.js +184 -0
- package/dist/file-tree.d.ts +17 -0
- package/dist/file-tree.js +11 -0
- package/dist/forms.d.ts +69 -0
- package/dist/forms.js +273 -0
- package/dist/git-graph.d.ts +8 -0
- package/dist/git-graph.js +15 -0
- package/dist/git-layout.d.ts +24 -0
- package/dist/git-layout.js +7 -0
- package/dist/image-viewer.d.ts +18 -0
- package/dist/image-viewer.js +11 -0
- package/dist/index.d.ts +363 -0
- package/dist/index.js +98 -0
- package/dist/inputs.d.ts +112 -0
- package/dist/inputs.js +938 -0
- package/dist/layout.d.ts +56 -0
- package/dist/layout.js +180 -0
- package/dist/map-frame.d.ts +37 -0
- package/dist/map-frame.js +13 -0
- package/dist/media.d.ts +40 -0
- package/dist/media.js +19 -0
- package/dist/network-layout.d.ts +94 -0
- package/dist/network-layout.js +19 -0
- package/dist/network.d.ts +111 -0
- package/dist/network.js +354 -0
- package/dist/overlays.d.ts +95 -0
- package/dist/overlays.js +25 -0
- package/dist/patterns.d.ts +117 -0
- package/dist/patterns.js +387 -0
- package/dist/power-layout.d.ts +91 -0
- package/dist/power-layout.js +13 -0
- package/dist/power.d.ts +91 -0
- package/dist/power.js +353 -0
- package/dist/signal-context.d.ts +11 -0
- package/dist/signal-context.js +15 -0
- package/dist/strings-es-419.d.ts +13 -0
- package/dist/strings-es-419.js +357 -0
- package/dist/strings-fr.d.ts +15 -0
- package/dist/strings-fr.js +359 -0
- package/dist/strings-ja.d.ts +16 -0
- package/dist/strings-ja.js +357 -0
- package/dist/strings-pt-BR.d.ts +13 -0
- package/dist/strings-pt-BR.js +357 -0
- package/dist/strings.d.ts +394 -0
- package/dist/strings.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/tab-bar.d.ts +20 -0
- package/dist/tab-bar.js +114 -0
- package/package.json +154 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { Toast } from "@base-ui/react/toast";
|
|
3
|
+
export type FeedbackTone = "neutral" | "accent" | "success" | "warning" | "danger";
|
|
4
|
+
export declare const useToast: typeof Toast.useToastManager;
|
|
5
|
+
export declare function ToastProvider({ children, timeout, limit, }: {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
timeout?: number;
|
|
8
|
+
limit?: number;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
export interface ResourceSegment {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
value: number;
|
|
14
|
+
tone?: FeedbackTone;
|
|
15
|
+
detail?: ReactNode;
|
|
16
|
+
pattern?: "solid" | "striped" | "dotted";
|
|
17
|
+
}
|
|
18
|
+
export declare function ResourceBar({ label, segments, max, formatValue, segmented, limit, }: {
|
|
19
|
+
label: string;
|
|
20
|
+
segments: readonly ResourceSegment[];
|
|
21
|
+
max?: number;
|
|
22
|
+
formatValue?: (value: number) => string;
|
|
23
|
+
segmented?: boolean;
|
|
24
|
+
/** A soft limit below the capacity, on the same scale, such as 80% of a breaker's rating: marked on the bar. */
|
|
25
|
+
limit?: number;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
export declare function CircularGauge({ label, value, max, tone, formatValue, children, }: {
|
|
28
|
+
label: string;
|
|
29
|
+
value: number;
|
|
30
|
+
max?: number;
|
|
31
|
+
tone?: FeedbackTone;
|
|
32
|
+
formatValue?: (value: number) => string;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}): import("react").JSX.Element;
|
package/dist/feedback.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
SignalProvider
|
|
6
|
+
} from "./chunk-EBF2F3LN.js";
|
|
7
|
+
import {
|
|
8
|
+
useSignalStrings
|
|
9
|
+
} from "./chunk-U5W7O3QV.js";
|
|
10
|
+
import "./chunk-FCYIZANU.js";
|
|
11
|
+
|
|
12
|
+
// packages/ui/src/feedback.tsx
|
|
13
|
+
import { Toast } from "@base-ui/react/toast";
|
|
14
|
+
import { X } from "lucide-react";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var useToast = Toast.useToastManager;
|
|
17
|
+
function ToastProvider({
|
|
18
|
+
children,
|
|
19
|
+
timeout = 6e3,
|
|
20
|
+
limit = 3
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsxs(Toast.Provider, { timeout, limit, children: [
|
|
23
|
+
children,
|
|
24
|
+
/* @__PURE__ */ jsx(ToastViewport, {})
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
function ToastViewport() {
|
|
28
|
+
const strings = useSignalStrings();
|
|
29
|
+
const { toasts } = Toast.useToastManager();
|
|
30
|
+
return /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(SignalProvider, { className: "signal-portal", children: /* @__PURE__ */ jsx(Toast.Viewport, { className: "signal-toast-viewport", children: toasts.map((toast) => /* @__PURE__ */ jsxs(
|
|
31
|
+
Toast.Root,
|
|
32
|
+
{
|
|
33
|
+
toast,
|
|
34
|
+
className: "signal-toast",
|
|
35
|
+
"data-tone": toast.type ?? "neutral",
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsxs(Toast.Content, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(Toast.Title, { className: "signal-toast-title" }),
|
|
39
|
+
toast.description && /* @__PURE__ */ jsx(Toast.Description, { className: "signal-toast-description" }),
|
|
40
|
+
toast.actionProps && /* @__PURE__ */ jsx(Toast.Action, { render: /* @__PURE__ */ jsx(Button, {}) })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
Toast.Close,
|
|
44
|
+
{
|
|
45
|
+
render: /* @__PURE__ */ jsx(
|
|
46
|
+
Button,
|
|
47
|
+
{
|
|
48
|
+
variant: "ghost",
|
|
49
|
+
iconOnly: true,
|
|
50
|
+
"aria-label": strings.toast.dismiss
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
toast.id
|
|
59
|
+
)) }) }) });
|
|
60
|
+
}
|
|
61
|
+
function ResourceBar({
|
|
62
|
+
label,
|
|
63
|
+
segments,
|
|
64
|
+
max = 100,
|
|
65
|
+
formatValue = String,
|
|
66
|
+
segmented = false,
|
|
67
|
+
limit
|
|
68
|
+
}) {
|
|
69
|
+
const strings = useSignalStrings();
|
|
70
|
+
const capacity = Number.isFinite(max) && max > 0 ? max : 100;
|
|
71
|
+
const values = segments.map((s) => ({
|
|
72
|
+
...s,
|
|
73
|
+
value: Number.isFinite(s.value) ? Math.max(0, s.value) : 0
|
|
74
|
+
}));
|
|
75
|
+
const used = values.reduce((n, s) => n + s.value, 0), denominator = Math.max(used, capacity), free = Math.max(0, capacity - used), mark = limit !== void 0 && Number.isFinite(limit) && limit > 0 && limit < capacity ? limit : void 0;
|
|
76
|
+
return /* @__PURE__ */ jsxs("div", { className: "signal-resource", children: [
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { className: "signal-slider-label", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("strong", { children: label }),
|
|
79
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
80
|
+
formatValue(used),
|
|
81
|
+
" / ",
|
|
82
|
+
formatValue(capacity)
|
|
83
|
+
] })
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ jsxs(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "signal-resource-track",
|
|
89
|
+
"data-segmented": segmented || void 0,
|
|
90
|
+
role: "img",
|
|
91
|
+
"aria-label": strings.resource.summary(
|
|
92
|
+
label,
|
|
93
|
+
values.map((s) => strings.resource.segment(s.label, formatValue(s.value))).join(", "),
|
|
94
|
+
formatValue(free),
|
|
95
|
+
used > capacity
|
|
96
|
+
) + (mark === void 0 ? "" : `; ${strings.resource.limit(formatValue(mark))}`),
|
|
97
|
+
children: [
|
|
98
|
+
values.map((s) => /* @__PURE__ */ jsx(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
"data-tone": s.tone ?? "accent",
|
|
102
|
+
"data-pattern": s.pattern ?? "solid",
|
|
103
|
+
style: { width: `${s.value / denominator * 100}%` }
|
|
104
|
+
},
|
|
105
|
+
s.id
|
|
106
|
+
)),
|
|
107
|
+
free > 0 && /* @__PURE__ */ jsx(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
className: "signal-resource-free",
|
|
111
|
+
style: { width: `${free / denominator * 100}%` }
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
mark !== void 0 && /* @__PURE__ */ jsx(
|
|
115
|
+
"i",
|
|
116
|
+
{
|
|
117
|
+
className: "signal-resource-limit",
|
|
118
|
+
style: { left: `${mark / denominator * 100}%` }
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsx("ul", { className: "signal-resource-legend", children: values.map((s) => /* @__PURE__ */ jsxs("li", { children: [
|
|
125
|
+
/* @__PURE__ */ jsx("i", { "aria-hidden": "true", "data-tone": s.tone ?? "accent" }),
|
|
126
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
127
|
+
s.label,
|
|
128
|
+
s.detail && /* @__PURE__ */ jsx("small", { children: s.detail })
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ jsx("strong", { children: formatValue(s.value) })
|
|
131
|
+
] }, s.id)) }),
|
|
132
|
+
used > capacity ? /* @__PURE__ */ jsx("p", { className: "signal-error", children: strings.resource.overCapacity(formatValue(used - capacity)) }) : mark !== void 0 && used > mark && /* @__PURE__ */ jsx("p", { className: "signal-resource-over-limit", children: strings.resource.overLimit(formatValue(used - mark)) })
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
function CircularGauge({
|
|
136
|
+
label,
|
|
137
|
+
value,
|
|
138
|
+
max = 100,
|
|
139
|
+
tone = "accent",
|
|
140
|
+
formatValue = (v) => `${Math.round(v)}%`,
|
|
141
|
+
children
|
|
142
|
+
}) {
|
|
143
|
+
const capacity = Number.isFinite(max) && max > 0 ? max : 100, actual = Number.isFinite(value) ? value : 0, percent = Math.max(0, Math.min(100, actual / capacity * 100));
|
|
144
|
+
return /* @__PURE__ */ jsxs("figure", { className: "signal-gauge", "data-tone": tone, children: [
|
|
145
|
+
/* @__PURE__ */ jsxs(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
role: "meter",
|
|
149
|
+
"aria-label": label,
|
|
150
|
+
"aria-valuemin": 0,
|
|
151
|
+
"aria-valuemax": capacity,
|
|
152
|
+
"aria-valuenow": Math.max(0, Math.min(capacity, actual)),
|
|
153
|
+
"aria-valuetext": formatValue(actual),
|
|
154
|
+
style: { "--signal-gauge-value": percent },
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 120 120", "aria-hidden": "true", children: [
|
|
157
|
+
/* @__PURE__ */ jsx("circle", { cx: "60", cy: "60", r: "50" }),
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
"circle",
|
|
160
|
+
{
|
|
161
|
+
cx: "60",
|
|
162
|
+
cy: "60",
|
|
163
|
+
r: "50",
|
|
164
|
+
pathLength: "100",
|
|
165
|
+
strokeDasharray: `${percent} 100`
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ jsx("strong", { children: formatValue(actual) })
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
/* @__PURE__ */ jsxs("figcaption", { children: [
|
|
174
|
+
label,
|
|
175
|
+
children && /* @__PURE__ */ jsx("small", { children })
|
|
176
|
+
] })
|
|
177
|
+
] });
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
CircularGauge,
|
|
181
|
+
ResourceBar,
|
|
182
|
+
ToastProvider,
|
|
183
|
+
useToast
|
|
184
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface FileTreeNode {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
children?: readonly FileTreeNode[];
|
|
5
|
+
detail?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Flat ARIA tree with explicit level/set metadata; a single tab stop and APG tree keyboard navigation. */
|
|
9
|
+
export declare function FileTree({ label, nodes, expanded, defaultExpanded, onExpandedChange, selected, onSelect, }: {
|
|
10
|
+
label?: string;
|
|
11
|
+
nodes: readonly FileTreeNode[];
|
|
12
|
+
expanded?: readonly string[];
|
|
13
|
+
defaultExpanded?: readonly string[];
|
|
14
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
15
|
+
selected?: string;
|
|
16
|
+
onSelect?: (node: FileTreeNode) => void;
|
|
17
|
+
}): import("react").JSX.Element;
|
package/dist/forms.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
3
|
+
export interface RadioOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** A group of related fields under one legend. */
|
|
10
|
+
export declare function Fieldset({ legend, description, className, children, ...props }: ComponentProps<"fieldset"> & {
|
|
11
|
+
legend: string;
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/** A summary of validation errors that links to each field. Render it above
|
|
15
|
+
* the form and move focus to it after a failed submit. */
|
|
16
|
+
export declare function FormErrors({ title, errors, className, ...props }: ComponentProps<"div"> & {
|
|
17
|
+
title?: string;
|
|
18
|
+
errors: readonly {
|
|
19
|
+
id: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}[];
|
|
22
|
+
}): import("react").JSX.Element | null;
|
|
23
|
+
/** Free-form values as tags: Enter or comma adds, Backspace on an empty
|
|
24
|
+
* input removes the last. Suggestions are the application's. */
|
|
25
|
+
export declare function TagInput({ label, value, onValueChange, placeholder, hint, error, max, id, }: {
|
|
26
|
+
label: string;
|
|
27
|
+
value: readonly string[];
|
|
28
|
+
onValueChange: (value: string[]) => void;
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
hint?: ReactNode;
|
|
31
|
+
error?: string;
|
|
32
|
+
max?: number;
|
|
33
|
+
id?: string;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
/** A labelled set of exclusive choices. Each option is one hit target with its own description. */
|
|
36
|
+
export declare function RadioGroup({ label, options, orientation, hint, error, ...props }: {
|
|
37
|
+
label: string;
|
|
38
|
+
options: readonly RadioOption[];
|
|
39
|
+
orientation?: "vertical" | "horizontal";
|
|
40
|
+
hint?: ReactNode;
|
|
41
|
+
error?: string;
|
|
42
|
+
} & Omit<ComponentProps<typeof BaseRadioGroup>, "className" | "children" | "aria-label">): import("react").JSX.Element;
|
|
43
|
+
export declare namespace RadioGroup {
|
|
44
|
+
var signalLabelled: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Joined controls on one boundary: inputs, selects, buttons and addons share
|
|
47
|
+
* a single outer border and a fixed control height. */
|
|
48
|
+
export declare function InputGroup({ label, className, ...props }: ComponentProps<"div"> & {
|
|
49
|
+
label: string;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
51
|
+
/** Static text inside an InputGroup, such as a unit or a prefix. */
|
|
52
|
+
export declare function InputAddon({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
53
|
+
/** A text input with optional leading and trailing content and a clear action.
|
|
54
|
+
* A trailing button sits against the border; other trailing content, such as
|
|
55
|
+
* a `Kbd` shortcut hint or a unit, is inset like the leading icon, and the
|
|
56
|
+
* input reserves its measured width so typed text never runs underneath. */
|
|
57
|
+
export declare const TextInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("./index.js").InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement> & {
|
|
58
|
+
leading?: ReactNode;
|
|
59
|
+
trailing?: ReactNode;
|
|
60
|
+
clearable?: boolean;
|
|
61
|
+
onClear?: () => void;
|
|
62
|
+
clearLabel?: string;
|
|
63
|
+
}, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
64
|
+
/** A password input with a reveal toggle. Revealing is a user action; the
|
|
65
|
+
* input never remembers it across mounts. */
|
|
66
|
+
export declare const PasswordInput: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("./index.js").InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>, "type"> & {
|
|
67
|
+
showLabel?: string;
|
|
68
|
+
hideLabel?: string;
|
|
69
|
+
}, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
package/dist/forms.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
Tag
|
|
5
|
+
} from "./chunk-V6MXR4P2.js";
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
Input
|
|
9
|
+
} from "./chunk-EBF2F3LN.js";
|
|
10
|
+
import {
|
|
11
|
+
useSignalStrings
|
|
12
|
+
} from "./chunk-U5W7O3QV.js";
|
|
13
|
+
import "./chunk-FCYIZANU.js";
|
|
14
|
+
|
|
15
|
+
// packages/ui/src/forms.tsx
|
|
16
|
+
import {
|
|
17
|
+
forwardRef,
|
|
18
|
+
useEffect,
|
|
19
|
+
useId,
|
|
20
|
+
useLayoutEffect,
|
|
21
|
+
useRef,
|
|
22
|
+
useState
|
|
23
|
+
} from "react";
|
|
24
|
+
import { CircleAlert, Eye, EyeOff, X } from "lucide-react";
|
|
25
|
+
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
26
|
+
import { Radio } from "@base-ui/react/radio";
|
|
27
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
var cx = (...values) => values.filter(Boolean).join(" ");
|
|
29
|
+
function Fieldset({
|
|
30
|
+
legend,
|
|
31
|
+
description,
|
|
32
|
+
className,
|
|
33
|
+
children,
|
|
34
|
+
...props
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ jsxs("fieldset", { ...props, className: cx("signal-fieldset", className), children: [
|
|
37
|
+
/* @__PURE__ */ jsx("legend", { children: legend }),
|
|
38
|
+
description && /* @__PURE__ */ jsx("p", { className: "signal-fieldset-description", children: description }),
|
|
39
|
+
/* @__PURE__ */ jsx("div", { className: "signal-fieldset-fields", children })
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
function FormErrors({
|
|
43
|
+
title,
|
|
44
|
+
errors,
|
|
45
|
+
className,
|
|
46
|
+
...props
|
|
47
|
+
}) {
|
|
48
|
+
const strings = useSignalStrings();
|
|
49
|
+
if (!errors.length) return null;
|
|
50
|
+
return /* @__PURE__ */ jsxs(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
...props,
|
|
54
|
+
role: "alert",
|
|
55
|
+
tabIndex: -1,
|
|
56
|
+
className: cx("signal-form-errors", className),
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(CircleAlert, { "aria-hidden": "true" }),
|
|
59
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
60
|
+
/* @__PURE__ */ jsx("strong", { children: title ?? strings.form.errors }),
|
|
61
|
+
/* @__PURE__ */ jsx("ul", { children: errors.map((e) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: `#${e.id}`, onClick: (event) => {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
document.getElementById(e.id)?.focus();
|
|
64
|
+
}, children: e.message }) }, e.id)) })
|
|
65
|
+
] })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function TagInput({
|
|
71
|
+
label,
|
|
72
|
+
value,
|
|
73
|
+
onValueChange,
|
|
74
|
+
placeholder,
|
|
75
|
+
hint,
|
|
76
|
+
error,
|
|
77
|
+
max,
|
|
78
|
+
id
|
|
79
|
+
}) {
|
|
80
|
+
const strings = useSignalStrings();
|
|
81
|
+
const generated = useId(), inputId = id ?? generated;
|
|
82
|
+
const [draft, setDraft] = useState("");
|
|
83
|
+
const add = () => {
|
|
84
|
+
const next = draft.trim().replace(/,$/, "");
|
|
85
|
+
if (!next || value.includes(next) || max && value.length >= max) return;
|
|
86
|
+
onValueChange([...value, next]);
|
|
87
|
+
setDraft("");
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ jsxs("div", { className: "signal-field", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("label", { htmlFor: inputId, children: label }),
|
|
91
|
+
/* @__PURE__ */ jsxs("div", { className: "signal-tag-input", "data-invalid": error ? "" : void 0, children: [
|
|
92
|
+
value.map((v) => /* @__PURE__ */ jsx(Tag, { onRemove: () => onValueChange(value.filter((x) => x !== v)), children: v }, v)),
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
"input",
|
|
95
|
+
{
|
|
96
|
+
id: inputId,
|
|
97
|
+
className: "signal-tag-input-field",
|
|
98
|
+
value: draft,
|
|
99
|
+
placeholder: value.length ? "" : placeholder ?? strings.tagInput.placeholder,
|
|
100
|
+
"aria-describedby": hint || error ? `${inputId}-help` : void 0,
|
|
101
|
+
"aria-invalid": error ? true : void 0,
|
|
102
|
+
onChange: (e) => e.target.value.endsWith(",") ? (setDraft(e.target.value), add()) : setDraft(e.target.value),
|
|
103
|
+
onKeyDown: (e) => {
|
|
104
|
+
if (e.key === "Enter") {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
add();
|
|
107
|
+
} else if (e.key === "Backspace" && !draft && value.length) onValueChange(value.slice(0, -1));
|
|
108
|
+
},
|
|
109
|
+
onBlur: add
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] }),
|
|
113
|
+
(hint || error) && /* @__PURE__ */ jsx("span", { id: `${inputId}-help`, className: error ? "signal-error" : "signal-muted", role: error ? "alert" : void 0, children: error || hint })
|
|
114
|
+
] });
|
|
115
|
+
}
|
|
116
|
+
function RadioGroup({
|
|
117
|
+
label,
|
|
118
|
+
options,
|
|
119
|
+
orientation = "vertical",
|
|
120
|
+
hint,
|
|
121
|
+
error,
|
|
122
|
+
...props
|
|
123
|
+
}) {
|
|
124
|
+
const id = useId();
|
|
125
|
+
return /* @__PURE__ */ jsxs("div", { className: "signal-field", children: [
|
|
126
|
+
/* @__PURE__ */ jsx("span", { id: `${id}-label`, className: "signal-control-label", children: label }),
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
BaseRadioGroup,
|
|
129
|
+
{
|
|
130
|
+
...props,
|
|
131
|
+
"aria-labelledby": `${id}-label`,
|
|
132
|
+
"aria-describedby": hint || error ? `${id}-help` : void 0,
|
|
133
|
+
"aria-invalid": error ? true : void 0,
|
|
134
|
+
className: "signal-radio-list",
|
|
135
|
+
"data-orientation": orientation,
|
|
136
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
137
|
+
"label",
|
|
138
|
+
{
|
|
139
|
+
className: "signal-radio-option",
|
|
140
|
+
"data-disabled": option.disabled || void 0,
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
Radio.Root,
|
|
144
|
+
{
|
|
145
|
+
value: option.value,
|
|
146
|
+
disabled: option.disabled,
|
|
147
|
+
className: "signal-radio-control",
|
|
148
|
+
children: /* @__PURE__ */ jsx(Radio.Indicator, { className: "signal-radio-dot" })
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ jsxs("span", { className: "signal-radio-text", children: [
|
|
152
|
+
/* @__PURE__ */ jsx("span", { children: option.label }),
|
|
153
|
+
option.description && /* @__PURE__ */ jsx("small", { children: option.description })
|
|
154
|
+
] })
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
option.value
|
|
158
|
+
))
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
(hint || error) && /* @__PURE__ */ jsx(
|
|
162
|
+
"span",
|
|
163
|
+
{
|
|
164
|
+
id: `${id}-help`,
|
|
165
|
+
className: error ? "signal-error" : "signal-muted",
|
|
166
|
+
role: error ? "alert" : void 0,
|
|
167
|
+
children: error || hint
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] });
|
|
171
|
+
}
|
|
172
|
+
RadioGroup.signalLabelled = true;
|
|
173
|
+
function InputGroup({
|
|
174
|
+
label,
|
|
175
|
+
className,
|
|
176
|
+
...props
|
|
177
|
+
}) {
|
|
178
|
+
return /* @__PURE__ */ jsx(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
...props,
|
|
182
|
+
role: "group",
|
|
183
|
+
"aria-label": label,
|
|
184
|
+
className: cx("signal-input-group", className)
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
function InputAddon({ className, ...props }) {
|
|
189
|
+
return /* @__PURE__ */ jsx("span", { ...props, className: cx("signal-input-addon", className) });
|
|
190
|
+
}
|
|
191
|
+
var useCommitEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
192
|
+
var TextInput = forwardRef(function TextInput2({ leading, trailing, clearable, onClear, clearLabel, className, ...props }, ref) {
|
|
193
|
+
const strings = useSignalStrings();
|
|
194
|
+
const hasValue = props.value != null ? String(props.value).length > 0 : void 0;
|
|
195
|
+
const frame = useRef(null), end = useRef(null);
|
|
196
|
+
const [reserve, setReserve] = useState();
|
|
197
|
+
const hasTrailing = Boolean(trailing);
|
|
198
|
+
useCommitEffect(() => {
|
|
199
|
+
const root = frame.current, affix = end.current;
|
|
200
|
+
if (!root || !affix) return setReserve(void 0);
|
|
201
|
+
const measure = () => {
|
|
202
|
+
const width = Math.ceil(
|
|
203
|
+
root.getBoundingClientRect().right - affix.getBoundingClientRect().left
|
|
204
|
+
);
|
|
205
|
+
setReserve(width > 0 ? width : void 0);
|
|
206
|
+
};
|
|
207
|
+
measure();
|
|
208
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
209
|
+
const observer = new ResizeObserver(measure);
|
|
210
|
+
observer.observe(affix);
|
|
211
|
+
return () => observer.disconnect();
|
|
212
|
+
}, [hasTrailing]);
|
|
213
|
+
return /* @__PURE__ */ jsxs(
|
|
214
|
+
"span",
|
|
215
|
+
{
|
|
216
|
+
ref: frame,
|
|
217
|
+
className: cx("signal-text-input", className),
|
|
218
|
+
"data-leading": leading ? "" : void 0,
|
|
219
|
+
"data-trailing": trailing || clearable ? "" : void 0,
|
|
220
|
+
style: reserve ? { "--signal-text-input-trailing": `${reserve}px` } : void 0,
|
|
221
|
+
children: [
|
|
222
|
+
leading && /* @__PURE__ */ jsx("span", { className: "signal-text-input-affix", "aria-hidden": "true", children: leading }),
|
|
223
|
+
/* @__PURE__ */ jsx(Input, { ...props, ref }),
|
|
224
|
+
clearable && hasValue !== false && /* @__PURE__ */ jsx(
|
|
225
|
+
Button,
|
|
226
|
+
{
|
|
227
|
+
variant: "ghost",
|
|
228
|
+
iconOnly: true,
|
|
229
|
+
"aria-label": clearLabel ?? strings.input.clear,
|
|
230
|
+
className: "signal-text-input-clear",
|
|
231
|
+
onClick: onClear,
|
|
232
|
+
tabIndex: -1,
|
|
233
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
trailing && /* @__PURE__ */ jsx("span", { ref: end, className: "signal-text-input-affix", children: trailing })
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
});
|
|
241
|
+
var PasswordInput = forwardRef(function PasswordInput2({ showLabel, hideLabel, ...props }, ref) {
|
|
242
|
+
const strings = useSignalStrings();
|
|
243
|
+
const [visible, setVisible] = useState(false);
|
|
244
|
+
return /* @__PURE__ */ jsx(
|
|
245
|
+
TextInput,
|
|
246
|
+
{
|
|
247
|
+
...props,
|
|
248
|
+
ref,
|
|
249
|
+
type: visible ? "text" : "password",
|
|
250
|
+
trailing: /* @__PURE__ */ jsx(
|
|
251
|
+
Button,
|
|
252
|
+
{
|
|
253
|
+
variant: "ghost",
|
|
254
|
+
iconOnly: true,
|
|
255
|
+
"aria-label": visible ? hideLabel ?? strings.password.hide : showLabel ?? strings.password.show,
|
|
256
|
+
"aria-pressed": visible,
|
|
257
|
+
onClick: () => setVisible((v) => !v),
|
|
258
|
+
children: visible ? /* @__PURE__ */ jsx(EyeOff, {}) : /* @__PURE__ */ jsx(Eye, {})
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
export {
|
|
265
|
+
Fieldset,
|
|
266
|
+
FormErrors,
|
|
267
|
+
InputAddon,
|
|
268
|
+
InputGroup,
|
|
269
|
+
PasswordInput,
|
|
270
|
+
RadioGroup,
|
|
271
|
+
TagInput,
|
|
272
|
+
TextInput
|
|
273
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type GitCommit } from "./git-layout.js";
|
|
2
|
+
export { layoutGitGraph, type GitCommit } from "./git-layout.js";
|
|
3
|
+
export declare function GitGraph({ commits, label, selected, onSelect, }: {
|
|
4
|
+
commits: readonly GitCommit[];
|
|
5
|
+
label?: string;
|
|
6
|
+
selected?: string;
|
|
7
|
+
onSelect?: (commit: GitCommit) => void;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
GitGraph
|
|
5
|
+
} from "./chunk-XFNDEA5M.js";
|
|
6
|
+
import {
|
|
7
|
+
layoutGitGraph
|
|
8
|
+
} from "./chunk-YKFAA7GU.js";
|
|
9
|
+
import "./chunk-EBF2F3LN.js";
|
|
10
|
+
import "./chunk-U5W7O3QV.js";
|
|
11
|
+
import "./chunk-FCYIZANU.js";
|
|
12
|
+
export {
|
|
13
|
+
GitGraph,
|
|
14
|
+
layoutGitGraph
|
|
15
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface GitCommit {
|
|
2
|
+
id: string;
|
|
3
|
+
parents: readonly string[];
|
|
4
|
+
subject: string;
|
|
5
|
+
author?: string;
|
|
6
|
+
time?: string;
|
|
7
|
+
refs?: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export interface GitGraphEdge {
|
|
10
|
+
fromLane: number;
|
|
11
|
+
toLane: number;
|
|
12
|
+
fromRow: number;
|
|
13
|
+
toRow: number;
|
|
14
|
+
dashed: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Input is newest-first topological order. Missing parents are visible continuations, not invented commits. */
|
|
17
|
+
export declare function layoutGitGraph(commits: readonly GitCommit[]): {
|
|
18
|
+
rows: {
|
|
19
|
+
id: string;
|
|
20
|
+
lane: number;
|
|
21
|
+
}[];
|
|
22
|
+
edges: GitGraphEdge[];
|
|
23
|
+
laneCount: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
3
|
+
export interface ViewerImage {
|
|
4
|
+
url: string;
|
|
5
|
+
alt: string;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
}
|
|
9
|
+
/** Shared screenshot and message-image viewer. URLs are authorized by the caller. */
|
|
10
|
+
export declare function ImageViewer({ images, title, open, onOpenChange, selected, onSelectedChange, finalFocus, }: {
|
|
11
|
+
images: readonly ViewerImage[];
|
|
12
|
+
title?: string;
|
|
13
|
+
open: boolean;
|
|
14
|
+
onOpenChange: (open: boolean) => void;
|
|
15
|
+
selected?: number;
|
|
16
|
+
onSelectedChange?: (index: number) => void;
|
|
17
|
+
finalFocus?: ComponentProps<typeof Dialog.Popup>["finalFocus"];
|
|
18
|
+
}): import("react").JSX.Element | null;
|