@ash-cloud/ash-ui 0.0.2 → 0.0.3
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/dist/index.cjs +199 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -1
- package/dist/index.d.ts +78 -1
- package/dist/index.js +198 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1930,6 +1930,203 @@ function TodoPanel({
|
|
|
1930
1930
|
}
|
|
1931
1931
|
);
|
|
1932
1932
|
}
|
|
1933
|
+
function EnvVarsPanel({
|
|
1934
|
+
envVars,
|
|
1935
|
+
onChange,
|
|
1936
|
+
defaultCollapsed = true,
|
|
1937
|
+
className,
|
|
1938
|
+
label = "Environment Variables",
|
|
1939
|
+
helperText = "These environment variables will be available in the sandbox for new sessions."
|
|
1940
|
+
}) {
|
|
1941
|
+
const [expanded, setExpanded] = react.useState(!defaultCollapsed);
|
|
1942
|
+
const [newEnvKey, setNewEnvKey] = react.useState("");
|
|
1943
|
+
const [newEnvValue, setNewEnvValue] = react.useState("");
|
|
1944
|
+
const hasEnvVars = Object.keys(envVars).length > 0;
|
|
1945
|
+
const handleAddEnvVar = react.useCallback(() => {
|
|
1946
|
+
const key = newEnvKey.trim();
|
|
1947
|
+
const val = newEnvValue.trim();
|
|
1948
|
+
if (key) {
|
|
1949
|
+
onChange({ ...envVars, [key]: val });
|
|
1950
|
+
setNewEnvKey("");
|
|
1951
|
+
setNewEnvValue("");
|
|
1952
|
+
}
|
|
1953
|
+
}, [envVars, newEnvKey, newEnvValue, onChange]);
|
|
1954
|
+
const handleRemoveEnvVar = react.useCallback(
|
|
1955
|
+
(key) => {
|
|
1956
|
+
const newEnvVars = { ...envVars };
|
|
1957
|
+
delete newEnvVars[key];
|
|
1958
|
+
onChange(newEnvVars);
|
|
1959
|
+
},
|
|
1960
|
+
[envVars, onChange]
|
|
1961
|
+
);
|
|
1962
|
+
const handleEnvKeyDown = react.useCallback(
|
|
1963
|
+
(e) => {
|
|
1964
|
+
if (e.key === "Enter") {
|
|
1965
|
+
e.preventDefault();
|
|
1966
|
+
handleAddEnvVar();
|
|
1967
|
+
}
|
|
1968
|
+
},
|
|
1969
|
+
[handleAddEnvVar]
|
|
1970
|
+
);
|
|
1971
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("ash-env-vars-panel", className), children: [
|
|
1972
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1973
|
+
"button",
|
|
1974
|
+
{
|
|
1975
|
+
type: "button",
|
|
1976
|
+
onClick: () => setExpanded(!expanded),
|
|
1977
|
+
className: "ash-env-vars-header",
|
|
1978
|
+
children: [
|
|
1979
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1980
|
+
"svg",
|
|
1981
|
+
{
|
|
1982
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1983
|
+
className: cn("ash-env-vars-chevron", expanded && "ash-env-vars-chevron-expanded"),
|
|
1984
|
+
viewBox: "0 0 20 20",
|
|
1985
|
+
fill: "currentColor",
|
|
1986
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1987
|
+
"path",
|
|
1988
|
+
{
|
|
1989
|
+
fillRule: "evenodd",
|
|
1990
|
+
d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
|
|
1991
|
+
clipRule: "evenodd"
|
|
1992
|
+
}
|
|
1993
|
+
)
|
|
1994
|
+
}
|
|
1995
|
+
),
|
|
1996
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-env-vars-label", children: label }),
|
|
1997
|
+
hasEnvVars && !expanded && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-env-vars-badge", children: Object.keys(envVars).length })
|
|
1998
|
+
]
|
|
1999
|
+
}
|
|
2000
|
+
),
|
|
2001
|
+
expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ash-env-vars-content", children: [
|
|
2002
|
+
Object.entries(envVars).map(([key, val]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ash-env-vars-item", children: [
|
|
2003
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-env-vars-key", children: key }),
|
|
2004
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-env-vars-equals", children: "=" }),
|
|
2005
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-env-vars-value", children: val || "(empty)" }),
|
|
2006
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2007
|
+
"button",
|
|
2008
|
+
{
|
|
2009
|
+
type: "button",
|
|
2010
|
+
onClick: () => handleRemoveEnvVar(key),
|
|
2011
|
+
className: "ash-env-vars-remove",
|
|
2012
|
+
title: "Remove variable",
|
|
2013
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2014
|
+
"svg",
|
|
2015
|
+
{
|
|
2016
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2017
|
+
className: "w-4 h-4",
|
|
2018
|
+
viewBox: "0 0 20 20",
|
|
2019
|
+
fill: "currentColor",
|
|
2020
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2021
|
+
"path",
|
|
2022
|
+
{
|
|
2023
|
+
fillRule: "evenodd",
|
|
2024
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
2025
|
+
clipRule: "evenodd"
|
|
2026
|
+
}
|
|
2027
|
+
)
|
|
2028
|
+
}
|
|
2029
|
+
)
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
] }, key)),
|
|
2033
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ash-env-vars-add", children: [
|
|
2034
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2035
|
+
"input",
|
|
2036
|
+
{
|
|
2037
|
+
type: "text",
|
|
2038
|
+
value: newEnvKey,
|
|
2039
|
+
onChange: (e) => setNewEnvKey(e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g, "")),
|
|
2040
|
+
onKeyDown: handleEnvKeyDown,
|
|
2041
|
+
placeholder: "KEY",
|
|
2042
|
+
className: "ash-env-vars-input ash-env-vars-input-key"
|
|
2043
|
+
}
|
|
2044
|
+
),
|
|
2045
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-env-vars-equals", children: "=" }),
|
|
2046
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2047
|
+
"input",
|
|
2048
|
+
{
|
|
2049
|
+
type: "text",
|
|
2050
|
+
value: newEnvValue,
|
|
2051
|
+
onChange: (e) => setNewEnvValue(e.target.value),
|
|
2052
|
+
onKeyDown: handleEnvKeyDown,
|
|
2053
|
+
placeholder: "value",
|
|
2054
|
+
className: "ash-env-vars-input ash-env-vars-input-value"
|
|
2055
|
+
}
|
|
2056
|
+
),
|
|
2057
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2058
|
+
"button",
|
|
2059
|
+
{
|
|
2060
|
+
type: "button",
|
|
2061
|
+
onClick: handleAddEnvVar,
|
|
2062
|
+
disabled: !newEnvKey.trim(),
|
|
2063
|
+
className: "ash-env-vars-add-button",
|
|
2064
|
+
children: "Add"
|
|
2065
|
+
}
|
|
2066
|
+
)
|
|
2067
|
+
] }),
|
|
2068
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ash-env-vars-helper", children: helperText })
|
|
2069
|
+
] })
|
|
2070
|
+
] });
|
|
2071
|
+
}
|
|
2072
|
+
function DisplayModeToggle({
|
|
2073
|
+
className,
|
|
2074
|
+
showLabel = true,
|
|
2075
|
+
labels = { inline: "Inline", compact: "Compact" }
|
|
2076
|
+
}) {
|
|
2077
|
+
const { config, toggleMode } = useDisplayMode();
|
|
2078
|
+
const isInline = config.mode === "inline";
|
|
2079
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2080
|
+
"button",
|
|
2081
|
+
{
|
|
2082
|
+
type: "button",
|
|
2083
|
+
onClick: toggleMode,
|
|
2084
|
+
className: cn("ash-display-mode-toggle", className),
|
|
2085
|
+
title: isInline ? "Switch to compact mode" : "Switch to inline mode",
|
|
2086
|
+
children: isInline ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2087
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2088
|
+
"svg",
|
|
2089
|
+
{
|
|
2090
|
+
className: "ash-display-mode-icon",
|
|
2091
|
+
viewBox: "0 0 24 24",
|
|
2092
|
+
fill: "none",
|
|
2093
|
+
stroke: "currentColor",
|
|
2094
|
+
strokeWidth: "1.5",
|
|
2095
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2096
|
+
"path",
|
|
2097
|
+
{
|
|
2098
|
+
strokeLinecap: "round",
|
|
2099
|
+
strokeLinejoin: "round",
|
|
2100
|
+
d: "M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"
|
|
2101
|
+
}
|
|
2102
|
+
)
|
|
2103
|
+
}
|
|
2104
|
+
),
|
|
2105
|
+
showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-display-mode-label", children: labels.inline })
|
|
2106
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2107
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2108
|
+
"svg",
|
|
2109
|
+
{
|
|
2110
|
+
className: "ash-display-mode-icon",
|
|
2111
|
+
viewBox: "0 0 24 24",
|
|
2112
|
+
fill: "none",
|
|
2113
|
+
stroke: "currentColor",
|
|
2114
|
+
strokeWidth: "1.5",
|
|
2115
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2116
|
+
"path",
|
|
2117
|
+
{
|
|
2118
|
+
strokeLinecap: "round",
|
|
2119
|
+
strokeLinejoin: "round",
|
|
2120
|
+
d: "M3.75 6.75h16.5M3.75 12h16.5M12 17.25h8.25"
|
|
2121
|
+
}
|
|
2122
|
+
)
|
|
2123
|
+
}
|
|
2124
|
+
),
|
|
2125
|
+
showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ash-display-mode-label", children: labels.compact })
|
|
2126
|
+
] })
|
|
2127
|
+
}
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
1933
2130
|
var DEFAULT_WORDS = [
|
|
1934
2131
|
"Thinking",
|
|
1935
2132
|
"Reasoning",
|
|
@@ -2559,7 +2756,9 @@ exports.CompactToolStatusLine = CompactToolStatusLine;
|
|
|
2559
2756
|
exports.CopyIcon = CopyIcon;
|
|
2560
2757
|
exports.DEFAULT_DISPLAY_CONFIG = DEFAULT_DISPLAY_CONFIG;
|
|
2561
2758
|
exports.DisplayModeProvider = DisplayModeProvider;
|
|
2759
|
+
exports.DisplayModeToggle = DisplayModeToggle;
|
|
2562
2760
|
exports.EditIcon = EditIcon;
|
|
2761
|
+
exports.EnvVarsPanel = EnvVarsPanel;
|
|
2563
2762
|
exports.ErrorMessage = ErrorMessage;
|
|
2564
2763
|
exports.FileIcon = FileIcon;
|
|
2565
2764
|
exports.FilePlusIcon = FilePlusIcon;
|