@mieweb/ui 0.7.3-dev.1 → 0.7.3-dev.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 +262 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +263 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1037,6 +1037,13 @@ type ProviderModelOption = ProviderModelValue & {
|
|
|
1037
1037
|
providerLabel?: string;
|
|
1038
1038
|
id?: string;
|
|
1039
1039
|
};
|
|
1040
|
+
/** A reasoning-effort level offered alongside the model. */
|
|
1041
|
+
type ComposerEffortOption = {
|
|
1042
|
+
value: string;
|
|
1043
|
+
label: string;
|
|
1044
|
+
/** Optional secondary line, e.g. a caveat about cost or latency. */
|
|
1045
|
+
description?: string;
|
|
1046
|
+
};
|
|
1040
1047
|
type ComposerModelSelectorBaseProps = {
|
|
1041
1048
|
models: ProviderModelOption[];
|
|
1042
1049
|
value: ProviderModelValue | null;
|
|
@@ -1048,6 +1055,22 @@ type ComposerModelSelectorBaseProps = {
|
|
|
1048
1055
|
anyLabel?: string;
|
|
1049
1056
|
emptyLabel?: string;
|
|
1050
1057
|
ariaLabel?: string;
|
|
1058
|
+
/**
|
|
1059
|
+
* Reasoning-effort levels for the selected model. Omit or pass an empty
|
|
1060
|
+
* array to hide the effort row entirely, which is what a model that cannot
|
|
1061
|
+
* reason should resolve to — the levels are provider-specific, so the caller
|
|
1062
|
+
* owns deciding which apply.
|
|
1063
|
+
*/
|
|
1064
|
+
effortOptions?: ComposerEffortOption[];
|
|
1065
|
+
/** Currently selected effort. */
|
|
1066
|
+
effort?: string | null;
|
|
1067
|
+
/** Effort marked with a "default" badge in the list. */
|
|
1068
|
+
defaultEffort?: string;
|
|
1069
|
+
onEffortChange?: (value: string) => void;
|
|
1070
|
+
effortLabel?: string;
|
|
1071
|
+
effortHint?: string;
|
|
1072
|
+
defaultBadgeLabel?: string;
|
|
1073
|
+
backLabel?: string;
|
|
1051
1074
|
};
|
|
1052
1075
|
type ControlledProviderFilterProps = {
|
|
1053
1076
|
providerFilter: string | null;
|
|
@@ -1058,7 +1081,7 @@ type UncontrolledProviderFilterProps = {
|
|
|
1058
1081
|
onProviderFilterChange?: (provider: string | null) => void;
|
|
1059
1082
|
};
|
|
1060
1083
|
type ComposerModelSelectorProps = ComposerModelSelectorBaseProps & (ControlledProviderFilterProps | UncontrolledProviderFilterProps);
|
|
1061
|
-
declare function ComposerModelSelector({ models, value, providerFilter, onProviderFilterChange, onChange, disabled, className, boundaryRef, placeholder, anyLabel, emptyLabel, ariaLabel, }: ComposerModelSelectorProps): react_jsx_runtime.JSX.Element;
|
|
1084
|
+
declare function ComposerModelSelector({ models, value, providerFilter, onProviderFilterChange, onChange, disabled, className, boundaryRef, placeholder, anyLabel, emptyLabel, ariaLabel, effortOptions, effort, defaultEffort, onEffortChange, effortLabel, effortHint, defaultBadgeLabel, backLabel, }: ComposerModelSelectorProps): react_jsx_runtime.JSX.Element;
|
|
1062
1085
|
declare namespace ComposerModelSelector {
|
|
1063
1086
|
var displayName: string;
|
|
1064
1087
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1037,6 +1037,13 @@ type ProviderModelOption = ProviderModelValue & {
|
|
|
1037
1037
|
providerLabel?: string;
|
|
1038
1038
|
id?: string;
|
|
1039
1039
|
};
|
|
1040
|
+
/** A reasoning-effort level offered alongside the model. */
|
|
1041
|
+
type ComposerEffortOption = {
|
|
1042
|
+
value: string;
|
|
1043
|
+
label: string;
|
|
1044
|
+
/** Optional secondary line, e.g. a caveat about cost or latency. */
|
|
1045
|
+
description?: string;
|
|
1046
|
+
};
|
|
1040
1047
|
type ComposerModelSelectorBaseProps = {
|
|
1041
1048
|
models: ProviderModelOption[];
|
|
1042
1049
|
value: ProviderModelValue | null;
|
|
@@ -1048,6 +1055,22 @@ type ComposerModelSelectorBaseProps = {
|
|
|
1048
1055
|
anyLabel?: string;
|
|
1049
1056
|
emptyLabel?: string;
|
|
1050
1057
|
ariaLabel?: string;
|
|
1058
|
+
/**
|
|
1059
|
+
* Reasoning-effort levels for the selected model. Omit or pass an empty
|
|
1060
|
+
* array to hide the effort row entirely, which is what a model that cannot
|
|
1061
|
+
* reason should resolve to — the levels are provider-specific, so the caller
|
|
1062
|
+
* owns deciding which apply.
|
|
1063
|
+
*/
|
|
1064
|
+
effortOptions?: ComposerEffortOption[];
|
|
1065
|
+
/** Currently selected effort. */
|
|
1066
|
+
effort?: string | null;
|
|
1067
|
+
/** Effort marked with a "default" badge in the list. */
|
|
1068
|
+
defaultEffort?: string;
|
|
1069
|
+
onEffortChange?: (value: string) => void;
|
|
1070
|
+
effortLabel?: string;
|
|
1071
|
+
effortHint?: string;
|
|
1072
|
+
defaultBadgeLabel?: string;
|
|
1073
|
+
backLabel?: string;
|
|
1051
1074
|
};
|
|
1052
1075
|
type ControlledProviderFilterProps = {
|
|
1053
1076
|
providerFilter: string | null;
|
|
@@ -1058,7 +1081,7 @@ type UncontrolledProviderFilterProps = {
|
|
|
1058
1081
|
onProviderFilterChange?: (provider: string | null) => void;
|
|
1059
1082
|
};
|
|
1060
1083
|
type ComposerModelSelectorProps = ComposerModelSelectorBaseProps & (ControlledProviderFilterProps | UncontrolledProviderFilterProps);
|
|
1061
|
-
declare function ComposerModelSelector({ models, value, providerFilter, onProviderFilterChange, onChange, disabled, className, boundaryRef, placeholder, anyLabel, emptyLabel, ariaLabel, }: ComposerModelSelectorProps): react_jsx_runtime.JSX.Element;
|
|
1084
|
+
declare function ComposerModelSelector({ models, value, providerFilter, onProviderFilterChange, onChange, disabled, className, boundaryRef, placeholder, anyLabel, emptyLabel, ariaLabel, effortOptions, effort, defaultEffort, onEffortChange, effortLabel, effortHint, defaultBadgeLabel, backLabel, }: ComposerModelSelectorProps): react_jsx_runtime.JSX.Element;
|
|
1062
1085
|
declare namespace ComposerModelSelector {
|
|
1063
1086
|
var displayName: string;
|
|
1064
1087
|
}
|
package/dist/index.js
CHANGED
|
@@ -135,7 +135,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
135
135
|
import { cva } from 'class-variance-authority';
|
|
136
136
|
import * as ReactDOM from 'react-dom';
|
|
137
137
|
import { createPortal } from 'react-dom';
|
|
138
|
-
import { FileUp, X, AlertCircle as AlertCircle$1, ChevronUp as ChevronUp$1, Check,
|
|
138
|
+
import { FileUp, X, AlertCircle as AlertCircle$1, ChevronUp as ChevronUp$1, Check, ChevronRight as ChevronRight$1, ChevronLeft, Calendar as Calendar$1, ChevronDown as ChevronDown$1, FolderUp, Upload, Edit2, Phone as Phone$1, Mail as Mail$1, Clock as Clock$1, MapPin, Shield, Building2, SlidersHorizontal, Trash2 as Trash2$1, Pencil as Pencil$1, Plus as Plus$1, Link as Link$1, AlertTriangle as AlertTriangle$1, RefreshCw as RefreshCw$1 } from 'lucide-react';
|
|
139
139
|
|
|
140
140
|
var SEX_OPTIONS = [
|
|
141
141
|
{ value: "F", label: "Female" },
|
|
@@ -1971,12 +1971,23 @@ function ComposerModelSelector({
|
|
|
1971
1971
|
placeholder = "Model",
|
|
1972
1972
|
anyLabel = "Any",
|
|
1973
1973
|
emptyLabel = "No models",
|
|
1974
|
-
ariaLabel = "Model"
|
|
1974
|
+
ariaLabel = "Model",
|
|
1975
|
+
effortOptions,
|
|
1976
|
+
effort = null,
|
|
1977
|
+
defaultEffort,
|
|
1978
|
+
onEffortChange,
|
|
1979
|
+
effortLabel = "Effort",
|
|
1980
|
+
effortHint,
|
|
1981
|
+
defaultBadgeLabel = "Default",
|
|
1982
|
+
backLabel = "Back"
|
|
1975
1983
|
}) {
|
|
1976
1984
|
const [open, setOpen] = React13.useState(false);
|
|
1985
|
+
const [view, setView] = React13.useState("models");
|
|
1986
|
+
const [effortHighlight, setEffortHighlight] = React13.useState(0);
|
|
1977
1987
|
const [internalProviderFilter, setInternalProviderFilter] = React13.useState(null);
|
|
1978
1988
|
const [highlightedIndex, setHighlightedIndex] = React13.useState(0);
|
|
1979
1989
|
const listRef = React13.useRef(null);
|
|
1990
|
+
const effortListRef = React13.useRef(null);
|
|
1980
1991
|
const menuId = React13.useId();
|
|
1981
1992
|
const {
|
|
1982
1993
|
anchorRef: triggerRef,
|
|
@@ -2040,6 +2051,10 @@ function ComposerModelSelector({
|
|
|
2040
2051
|
(index) => `${menuId}-option-${index}`,
|
|
2041
2052
|
[menuId]
|
|
2042
2053
|
);
|
|
2054
|
+
const getEffortOptionId = React13.useCallback(
|
|
2055
|
+
(index) => `${menuId}-effort-option-${index}`,
|
|
2056
|
+
[menuId]
|
|
2057
|
+
);
|
|
2043
2058
|
const activeOptionId = open && renderedModels[highlightedIndex] ? getOptionId(highlightedIndex) : void 0;
|
|
2044
2059
|
const selectedRenderedIndex = React13.useMemo(
|
|
2045
2060
|
() => selectedKey ? renderedModels.findIndex(
|
|
@@ -2072,6 +2087,48 @@ function ComposerModelSelector({
|
|
|
2072
2087
|
},
|
|
2073
2088
|
[close, onChange]
|
|
2074
2089
|
);
|
|
2090
|
+
const efforts = React13.useMemo(() => effortOptions ?? [], [effortOptions]);
|
|
2091
|
+
const activeEffortOptionId = open && efforts[effortHighlight] ? getEffortOptionId(effortHighlight) : void 0;
|
|
2092
|
+
const selectedEffortOption = efforts.find(
|
|
2093
|
+
(option) => option.value === effort
|
|
2094
|
+
);
|
|
2095
|
+
const selectEffort = React13.useCallback(
|
|
2096
|
+
(value2) => {
|
|
2097
|
+
onEffortChange?.(value2);
|
|
2098
|
+
close();
|
|
2099
|
+
},
|
|
2100
|
+
[close, onEffortChange]
|
|
2101
|
+
);
|
|
2102
|
+
const handleEffortKeyDown = (event) => {
|
|
2103
|
+
if (efforts.length === 0) return;
|
|
2104
|
+
if (event.key === "ArrowDown") {
|
|
2105
|
+
event.preventDefault();
|
|
2106
|
+
setEffortHighlight((current) => (current + 1) % efforts.length);
|
|
2107
|
+
}
|
|
2108
|
+
if (event.key === "ArrowUp") {
|
|
2109
|
+
event.preventDefault();
|
|
2110
|
+
setEffortHighlight(
|
|
2111
|
+
(current) => (current - 1 + efforts.length) % efforts.length
|
|
2112
|
+
);
|
|
2113
|
+
}
|
|
2114
|
+
if (event.key === "Home") {
|
|
2115
|
+
event.preventDefault();
|
|
2116
|
+
setEffortHighlight(0);
|
|
2117
|
+
}
|
|
2118
|
+
if (event.key === "End") {
|
|
2119
|
+
event.preventDefault();
|
|
2120
|
+
setEffortHighlight(efforts.length - 1);
|
|
2121
|
+
}
|
|
2122
|
+
if (event.key === "ArrowLeft" || event.key === "Backspace") {
|
|
2123
|
+
event.preventDefault();
|
|
2124
|
+
setView("models");
|
|
2125
|
+
}
|
|
2126
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
2127
|
+
event.preventDefault();
|
|
2128
|
+
const highlighted = efforts[effortHighlight];
|
|
2129
|
+
if (highlighted) selectEffort(highlighted.value);
|
|
2130
|
+
}
|
|
2131
|
+
};
|
|
2075
2132
|
const outsideRefs = React13.useMemo(
|
|
2076
2133
|
() => [triggerRef, menuRef],
|
|
2077
2134
|
[triggerRef, menuRef]
|
|
@@ -2082,6 +2139,15 @@ function ComposerModelSelector({
|
|
|
2082
2139
|
if (!open) return;
|
|
2083
2140
|
setHighlightedIndex(selectedRenderedIndex >= 0 ? selectedRenderedIndex : 0);
|
|
2084
2141
|
}, [activeProviderFilter, open, selectedRenderedIndex]);
|
|
2142
|
+
React13.useEffect(() => {
|
|
2143
|
+
if (!open) return;
|
|
2144
|
+
setView("models");
|
|
2145
|
+
}, [open]);
|
|
2146
|
+
React13.useEffect(() => {
|
|
2147
|
+
if (!open) return;
|
|
2148
|
+
const current = efforts.findIndex((option) => option.value === effort);
|
|
2149
|
+
setEffortHighlight(current >= 0 ? current : 0);
|
|
2150
|
+
}, [effort, efforts, open]);
|
|
2085
2151
|
React13.useEffect(() => {
|
|
2086
2152
|
if (!open) return;
|
|
2087
2153
|
setHighlightedIndex(
|
|
@@ -2090,10 +2156,11 @@ function ComposerModelSelector({
|
|
|
2090
2156
|
}, [open, renderedModels.length]);
|
|
2091
2157
|
React13.useEffect(() => {
|
|
2092
2158
|
if (!open) return;
|
|
2093
|
-
requestAnimationFrame(
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2159
|
+
requestAnimationFrame(() => {
|
|
2160
|
+
const target = view === "effort" ? effortListRef.current : listRef.current;
|
|
2161
|
+
target?.focus({ preventScroll: true });
|
|
2162
|
+
});
|
|
2163
|
+
}, [open, view]);
|
|
2097
2164
|
const handleTriggerKeyDown = (event) => {
|
|
2098
2165
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
2099
2166
|
event.preventDefault();
|
|
@@ -2151,6 +2218,14 @@ function ComposerModelSelector({
|
|
|
2151
2218
|
),
|
|
2152
2219
|
children: [
|
|
2153
2220
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: selectedOption?.label ?? selectedOption?.model ?? placeholder }),
|
|
2221
|
+
selectedEffortOption && /* @__PURE__ */ jsx(
|
|
2222
|
+
"span",
|
|
2223
|
+
{
|
|
2224
|
+
"data-slot": "composer-model-selector-trigger-effort",
|
|
2225
|
+
className: "text-muted-foreground min-w-0 truncate font-normal",
|
|
2226
|
+
children: selectedEffortOption.label
|
|
2227
|
+
}
|
|
2228
|
+
),
|
|
2154
2229
|
/* @__PURE__ */ jsx(ChevronUp$1, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0" })
|
|
2155
2230
|
]
|
|
2156
2231
|
}
|
|
@@ -2167,90 +2242,190 @@ function ComposerModelSelector({
|
|
|
2167
2242
|
"animate-in fade-in overflow-hidden duration-100"
|
|
2168
2243
|
),
|
|
2169
2244
|
children: [
|
|
2170
|
-
/* @__PURE__ */
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2245
|
+
view === "models" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2246
|
+
/* @__PURE__ */ jsx(
|
|
2247
|
+
"div",
|
|
2248
|
+
{
|
|
2249
|
+
"data-slot": "composer-model-selector-provider-filter",
|
|
2250
|
+
className: "border-border flex min-h-9 items-center gap-1 overflow-x-auto overflow-y-hidden border-b p-2",
|
|
2251
|
+
children: [null, ...providers].map((provider) => {
|
|
2252
|
+
const selected = activeProviderFilter === provider;
|
|
2253
|
+
return /* @__PURE__ */ jsx(
|
|
2254
|
+
"button",
|
|
2255
|
+
{
|
|
2256
|
+
type: "button",
|
|
2257
|
+
"aria-pressed": selected,
|
|
2258
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2259
|
+
onClick: () => setProvider(provider),
|
|
2260
|
+
className: cn(
|
|
2261
|
+
"inline-flex h-6 shrink-0 items-center justify-center rounded-full px-2.5 text-xs font-medium whitespace-nowrap transition-colors",
|
|
2262
|
+
"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none",
|
|
2263
|
+
selected ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
2264
|
+
),
|
|
2265
|
+
children: provider === null ? anyLabel : providerLabels.get(provider) ?? provider
|
|
2266
|
+
},
|
|
2267
|
+
provider ?? "all-providers"
|
|
2268
|
+
);
|
|
2269
|
+
})
|
|
2270
|
+
}
|
|
2271
|
+
),
|
|
2272
|
+
/* @__PURE__ */ jsx(
|
|
2273
|
+
"div",
|
|
2274
|
+
{
|
|
2275
|
+
ref: listRef,
|
|
2276
|
+
id: menuId,
|
|
2277
|
+
role: "listbox",
|
|
2278
|
+
"aria-label": ariaLabel,
|
|
2279
|
+
"aria-activedescendant": activeOptionId,
|
|
2280
|
+
tabIndex: -1,
|
|
2281
|
+
onKeyDown: handleMenuKeyDown,
|
|
2282
|
+
className: "min-h-0 flex-1 overflow-y-auto p-1",
|
|
2283
|
+
children: groupedModels.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-3 py-4 text-center text-sm", children: emptyLabel }) : groupedRenderedModels.map((group) => /* @__PURE__ */ jsxs(
|
|
2284
|
+
"div",
|
|
2179
2285
|
{
|
|
2180
|
-
|
|
2181
|
-
"aria-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2286
|
+
role: "group",
|
|
2287
|
+
"aria-label": providerLabels.get(group.provider) ?? group.provider,
|
|
2288
|
+
children: [
|
|
2289
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground px-3 py-1.5 text-xs font-semibold uppercase", children: providerLabels.get(group.provider) ?? group.provider }),
|
|
2290
|
+
group.options.map((renderedModel) => {
|
|
2291
|
+
const { index, key, option: model } = renderedModel;
|
|
2292
|
+
const selected = optionKey(model) === selectedKey;
|
|
2293
|
+
const highlighted = index === highlightedIndex;
|
|
2294
|
+
return /* @__PURE__ */ jsxs(
|
|
2295
|
+
"button",
|
|
2296
|
+
{
|
|
2297
|
+
id: getOptionId(index),
|
|
2298
|
+
type: "button",
|
|
2299
|
+
role: "option",
|
|
2300
|
+
"aria-selected": selected,
|
|
2301
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2302
|
+
onClick: () => selectModel(model),
|
|
2303
|
+
onMouseEnter: () => setHighlightedIndex(index),
|
|
2304
|
+
className: cn(
|
|
2305
|
+
"flex w-full items-center gap-2 rounded-md px-3 py-2 text-start text-sm",
|
|
2306
|
+
"focus-visible:ring-ring transition-colors focus-visible:ring-2 focus-visible:outline-none",
|
|
2307
|
+
highlighted && "bg-muted",
|
|
2308
|
+
selected && "bg-primary/10 text-primary"
|
|
2309
|
+
),
|
|
2310
|
+
children: [
|
|
2311
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: model.label ?? model.model }),
|
|
2312
|
+
selected && /* @__PURE__ */ jsx(
|
|
2313
|
+
Check,
|
|
2314
|
+
{
|
|
2315
|
+
"aria-hidden": "true",
|
|
2316
|
+
className: "text-primary h-4 w-4 shrink-0"
|
|
2317
|
+
}
|
|
2318
|
+
)
|
|
2319
|
+
]
|
|
2320
|
+
},
|
|
2321
|
+
key
|
|
2322
|
+
);
|
|
2323
|
+
})
|
|
2324
|
+
]
|
|
2190
2325
|
},
|
|
2191
|
-
provider
|
|
2192
|
-
)
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2326
|
+
group.provider
|
|
2327
|
+
))
|
|
2328
|
+
}
|
|
2329
|
+
),
|
|
2330
|
+
efforts.length > 0 && /* @__PURE__ */ jsx("div", { className: "border-border border-t p-1", children: /* @__PURE__ */ jsxs(
|
|
2331
|
+
"button",
|
|
2332
|
+
{
|
|
2333
|
+
type: "button",
|
|
2334
|
+
"data-slot": "composer-model-selector-effort-row",
|
|
2335
|
+
"aria-haspopup": "listbox",
|
|
2336
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2337
|
+
onClick: () => setView("effort"),
|
|
2338
|
+
className: cn(
|
|
2339
|
+
"flex w-full items-center gap-2 rounded-md px-3 py-2 text-start text-sm",
|
|
2340
|
+
"hover:bg-muted transition-colors",
|
|
2341
|
+
"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
|
2342
|
+
),
|
|
2343
|
+
children: [
|
|
2344
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: effortLabel }),
|
|
2345
|
+
selectedEffortOption && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground min-w-0 truncate", children: selectedEffortOption.label }),
|
|
2346
|
+
/* @__PURE__ */ jsx(
|
|
2347
|
+
ChevronRight$1,
|
|
2348
|
+
{
|
|
2349
|
+
"aria-hidden": "true",
|
|
2350
|
+
className: "text-muted-foreground h-4 w-4 shrink-0"
|
|
2351
|
+
}
|
|
2352
|
+
)
|
|
2353
|
+
]
|
|
2354
|
+
}
|
|
2355
|
+
) })
|
|
2356
|
+
] }),
|
|
2357
|
+
view === "effort" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2358
|
+
/* @__PURE__ */ jsx("div", { className: "border-border flex items-center gap-1 border-b p-2", children: /* @__PURE__ */ jsxs(
|
|
2359
|
+
"button",
|
|
2360
|
+
{
|
|
2361
|
+
type: "button",
|
|
2362
|
+
"data-slot": "composer-model-selector-effort-back",
|
|
2363
|
+
"aria-label": backLabel,
|
|
2364
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2365
|
+
onClick: () => setView("models"),
|
|
2366
|
+
className: cn(
|
|
2367
|
+
"inline-flex h-6 shrink-0 items-center gap-1 rounded-full px-2 text-xs font-medium",
|
|
2368
|
+
"text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",
|
|
2369
|
+
"focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none"
|
|
2370
|
+
),
|
|
2371
|
+
children: [
|
|
2372
|
+
/* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
2373
|
+
effortLabel
|
|
2374
|
+
]
|
|
2375
|
+
}
|
|
2376
|
+
) }),
|
|
2377
|
+
effortHint && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground px-3 pt-2 text-xs", children: effortHint }),
|
|
2378
|
+
/* @__PURE__ */ jsx(
|
|
2379
|
+
"div",
|
|
2380
|
+
{
|
|
2381
|
+
ref: effortListRef,
|
|
2382
|
+
id: menuId,
|
|
2383
|
+
role: "listbox",
|
|
2384
|
+
"aria-label": effortLabel,
|
|
2385
|
+
"aria-activedescendant": activeEffortOptionId,
|
|
2386
|
+
tabIndex: -1,
|
|
2387
|
+
onKeyDown: handleEffortKeyDown,
|
|
2388
|
+
className: "min-h-0 flex-1 overflow-y-auto p-1",
|
|
2389
|
+
children: efforts.map((option, index) => {
|
|
2390
|
+
const selected = option.value === effort;
|
|
2391
|
+
const highlighted = index === effortHighlight;
|
|
2392
|
+
return /* @__PURE__ */ jsxs(
|
|
2393
|
+
"button",
|
|
2394
|
+
{
|
|
2395
|
+
id: getEffortOptionId(index),
|
|
2396
|
+
type: "button",
|
|
2397
|
+
role: "option",
|
|
2398
|
+
"aria-selected": selected,
|
|
2399
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2400
|
+
onClick: () => selectEffort(option.value),
|
|
2401
|
+
onMouseEnter: () => setEffortHighlight(index),
|
|
2402
|
+
className: cn(
|
|
2403
|
+
"flex w-full items-center gap-2 rounded-md px-3 py-2 text-start text-sm",
|
|
2404
|
+
"focus-visible:ring-ring transition-colors focus-visible:ring-2 focus-visible:outline-none",
|
|
2405
|
+
highlighted && "bg-muted",
|
|
2406
|
+
selected && "bg-primary/10 text-primary"
|
|
2407
|
+
),
|
|
2408
|
+
children: [
|
|
2409
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
2410
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate", children: option.label }),
|
|
2411
|
+
option.description && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground block truncate text-xs", children: option.description })
|
|
2412
|
+
] }),
|
|
2413
|
+
option.value === defaultEffort && /* @__PURE__ */ jsx("span", { className: "bg-muted text-muted-foreground shrink-0 rounded px-1.5 py-0.5 text-xs", children: defaultBadgeLabel }),
|
|
2414
|
+
selected && /* @__PURE__ */ jsx(
|
|
2415
|
+
Check,
|
|
2416
|
+
{
|
|
2417
|
+
"aria-hidden": "true",
|
|
2418
|
+
className: "text-primary h-4 w-4 shrink-0"
|
|
2419
|
+
}
|
|
2420
|
+
)
|
|
2421
|
+
]
|
|
2422
|
+
},
|
|
2423
|
+
option.value
|
|
2424
|
+
);
|
|
2425
|
+
})
|
|
2426
|
+
}
|
|
2427
|
+
)
|
|
2428
|
+
] })
|
|
2254
2429
|
]
|
|
2255
2430
|
}
|
|
2256
2431
|
),
|