jaml-ui 0.3.1 → 0.4.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.
|
@@ -13,5 +13,7 @@ export interface JamlIdeProps {
|
|
|
13
13
|
title?: string;
|
|
14
14
|
actions?: React.ReactNode;
|
|
15
15
|
codePlaceholder?: string;
|
|
16
|
+
onSearch?: () => void;
|
|
17
|
+
isSearching?: boolean;
|
|
16
18
|
}
|
|
17
|
-
export declare function JamlIde({ jaml, onChange, defaultMode, searchResults, className, title, actions, codePlaceholder, }: JamlIdeProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function JamlIde({ jaml, onChange, defaultMode, searchResults, className, title, actions, codePlaceholder, onSearch, isSearching, }: JamlIdeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,7 +25,7 @@ function ResultsView({ results }) {
|
|
|
25
25
|
padding: "10px 12px",
|
|
26
26
|
}, children: [_jsx("div", { style: { fontWeight: 700, letterSpacing: 0.4 }, children: result.seed }), _jsx("div", { style: { fontSize: 12, opacity: 0.7 }, children: result.score !== undefined ? result.score : "-" })] }, `${result.seed}-${index}`))) }));
|
|
27
27
|
}
|
|
28
|
-
export function JamlIde({ jaml, onChange, defaultMode = "code", searchResults = [], className = "", title = "JAML IDE", actions, codePlaceholder = "Enter JAML...", }) {
|
|
28
|
+
export function JamlIde({ jaml, onChange, defaultMode = "code", searchResults = [], className = "", title = "JAML IDE", actions, codePlaceholder = "Enter JAML...", onSearch, isSearching = false, }) {
|
|
29
29
|
const [mode, setMode] = useState(defaultMode);
|
|
30
30
|
const results = useMemo(() => searchResults, [searchResults]);
|
|
31
31
|
return (_jsxs("div", { className: className, style: {
|
|
@@ -45,7 +45,7 @@ export function JamlIde({ jaml, onChange, defaultMode = "code", searchResults =
|
|
|
45
45
|
padding: "12px 14px",
|
|
46
46
|
borderBottom: "1px solid rgba(255,255,255,0.08)",
|
|
47
47
|
background: "rgba(255,255,255,0.03)",
|
|
48
|
-
}, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 16, fontWeight: 800 }, children: title }), _jsx("div", { style: { fontSize: 11, opacity: 0.66 }, children: "Reusable JAML authoring and preview surface." })] }), actions ? _jsx("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: actions }) : null] }), _jsx(JamlIdeToolbar, { mode: mode, onModeChange: setMode, resultCount: results.length }), _jsxs("div", { style: { flex: 1, minHeight: 0, overflow: "auto" }, children: [mode === "code" ? (_jsx("textarea", { title: "JAML IDE Editor", value: jaml, onChange: (event) => onChange(event.target.value), placeholder: codePlaceholder, spellCheck: false, autoCapitalize: "off", autoCorrect: "off", style: {
|
|
48
|
+
}, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 16, fontWeight: 800 }, children: title }), _jsx("div", { style: { fontSize: 11, opacity: 0.66 }, children: "Reusable JAML authoring and preview surface." })] }), actions ? _jsx("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: actions }) : null] }), _jsx(JamlIdeToolbar, { mode: mode, onModeChange: setMode, resultCount: results.length, onSearch: onSearch, isSearching: isSearching }), _jsxs("div", { style: { flex: 1, minHeight: 0, overflow: "auto" }, children: [mode === "code" ? (_jsx("textarea", { title: "JAML IDE Editor", value: jaml, onChange: (event) => onChange(event.target.value), placeholder: codePlaceholder, spellCheck: false, autoCapitalize: "off", autoCorrect: "off", style: {
|
|
49
49
|
width: "100%",
|
|
50
50
|
minHeight: 320,
|
|
51
51
|
resize: "vertical",
|
|
@@ -4,5 +4,7 @@ export interface JamlIdeToolbarProps {
|
|
|
4
4
|
onModeChange: (mode: JamlIdeMode) => void;
|
|
5
5
|
resultCount?: number;
|
|
6
6
|
className?: string;
|
|
7
|
+
onSearch?: () => void;
|
|
8
|
+
isSearching?: boolean;
|
|
7
9
|
}
|
|
8
|
-
export declare function JamlIdeToolbar({ mode, onModeChange, resultCount, className }: JamlIdeToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function JamlIdeToolbar({ mode, onModeChange, resultCount, className, onSearch, isSearching }: JamlIdeToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,8 +5,8 @@ const TABS = [
|
|
|
5
5
|
{ id: "map", label: "Map" },
|
|
6
6
|
{ id: "results", label: "Results" },
|
|
7
7
|
];
|
|
8
|
-
export function JamlIdeToolbar({ mode, onModeChange, resultCount = 0, className = "" }) {
|
|
9
|
-
return (
|
|
8
|
+
export function JamlIdeToolbar({ mode, onModeChange, resultCount = 0, className = "", onSearch, isSearching = false }) {
|
|
9
|
+
return (_jsxs("div", { className: className, style: {
|
|
10
10
|
display: "flex",
|
|
11
11
|
alignItems: "center",
|
|
12
12
|
justifyContent: "space-between",
|
|
@@ -14,23 +14,32 @@ export function JamlIdeToolbar({ mode, onModeChange, resultCount = 0, className
|
|
|
14
14
|
padding: "8px 10px",
|
|
15
15
|
borderBottom: "1px solid rgba(255,255,255,0.08)",
|
|
16
16
|
background: "rgba(255,255,255,0.04)",
|
|
17
|
-
}, children: _jsx("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: TABS.map((tab) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
}, children: [_jsx("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: TABS.map((tab) => {
|
|
18
|
+
const selected = mode === tab.id;
|
|
19
|
+
return (_jsxs("button", { type: "button", onClick: () => onModeChange(tab.id), style: {
|
|
20
|
+
cursor: "pointer",
|
|
21
|
+
borderRadius: 8,
|
|
22
|
+
border: selected ? "1px solid rgba(247,185,85,0.55)" : "1px solid transparent",
|
|
23
|
+
background: selected ? "rgba(247,185,85,0.16)" : "transparent",
|
|
24
|
+
color: selected ? "#f7b955" : "rgba(255,255,255,0.58)",
|
|
25
|
+
padding: "6px 10px",
|
|
26
|
+
fontSize: 11,
|
|
27
|
+
fontWeight: 600,
|
|
28
|
+
}, children: [tab.label, tab.id === "results" && resultCount > 0 ? (_jsx("span", { style: {
|
|
29
|
+
marginLeft: 6,
|
|
30
|
+
borderRadius: 999,
|
|
31
|
+
background: "rgba(0,0,0,0.25)",
|
|
32
|
+
padding: "1px 6px",
|
|
33
|
+
fontSize: 10,
|
|
34
|
+
}, children: resultCount })) : null] }, tab.id));
|
|
35
|
+
}) }), onSearch ? (_jsx("button", { type: "button", onClick: onSearch, disabled: isSearching, style: {
|
|
36
|
+
cursor: isSearching ? "not-allowed" : "pointer",
|
|
37
|
+
borderRadius: 8,
|
|
38
|
+
border: "1px solid rgba(74,222,128,0.4)",
|
|
39
|
+
background: isSearching ? "rgba(239,68,68,0.2)" : "rgba(74,222,128,0.15)",
|
|
40
|
+
color: isSearching ? "#ef4444" : "#4ade80",
|
|
41
|
+
padding: "6px 14px",
|
|
42
|
+
fontSize: 11,
|
|
43
|
+
fontWeight: 700,
|
|
44
|
+
}, children: isSearching ? "Stop" : "Search" })) : null] }));
|
|
36
45
|
}
|