myoperator-ui 0.0.173 → 0.0.174
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.js +19 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2190,18 +2190,14 @@ const SelectField = React.forwardRef<HTMLButtonElement, SelectFieldProps>(
|
|
|
2190
2190
|
// Internal state for search
|
|
2191
2191
|
const [searchQuery, setSearchQuery] = React.useState("");
|
|
2192
2192
|
|
|
2193
|
-
// Handle
|
|
2194
|
-
const
|
|
2195
|
-
(
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
const selectedOption = options.find((o) => o.value === newValue);
|
|
2199
|
-
if (selectedOption) {
|
|
2200
|
-
onSelect(selectedOption);
|
|
2201
|
-
}
|
|
2193
|
+
// Handle onSelect at item level (fires even when same value is re-selected)
|
|
2194
|
+
const handleItemSelect = React.useCallback(
|
|
2195
|
+
(option: SelectOption) => {
|
|
2196
|
+
if (!option.disabled) {
|
|
2197
|
+
onSelect?.(option);
|
|
2202
2198
|
}
|
|
2203
2199
|
},
|
|
2204
|
-
[
|
|
2200
|
+
[onSelect]
|
|
2205
2201
|
);
|
|
2206
2202
|
|
|
2207
2203
|
// Derive state from props
|
|
@@ -2278,7 +2274,7 @@ const SelectField = React.forwardRef<HTMLButtonElement, SelectFieldProps>(
|
|
|
2278
2274
|
<Select
|
|
2279
2275
|
value={value}
|
|
2280
2276
|
defaultValue={defaultValue}
|
|
2281
|
-
onValueChange={
|
|
2277
|
+
onValueChange={onValueChange}
|
|
2282
2278
|
disabled={disabled || loading}
|
|
2283
2279
|
name={name}
|
|
2284
2280
|
onOpenChange={handleOpenChange}
|
|
@@ -2319,6 +2315,12 @@ const SelectField = React.forwardRef<HTMLButtonElement, SelectFieldProps>(
|
|
|
2319
2315
|
key={option.value}
|
|
2320
2316
|
value={option.value}
|
|
2321
2317
|
disabled={option.disabled}
|
|
2318
|
+
onPointerUp={() => handleItemSelect(option)}
|
|
2319
|
+
onKeyDown={(e) => {
|
|
2320
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2321
|
+
handleItemSelect(option);
|
|
2322
|
+
}
|
|
2323
|
+
}}
|
|
2322
2324
|
>
|
|
2323
2325
|
{option.label}
|
|
2324
2326
|
</SelectItem>
|
|
@@ -2335,6 +2337,12 @@ const SelectField = React.forwardRef<HTMLButtonElement, SelectFieldProps>(
|
|
|
2335
2337
|
key={option.value}
|
|
2336
2338
|
value={option.value}
|
|
2337
2339
|
disabled={option.disabled}
|
|
2340
|
+
onPointerUp={() => handleItemSelect(option)}
|
|
2341
|
+
onKeyDown={(e) => {
|
|
2342
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2343
|
+
handleItemSelect(option);
|
|
2344
|
+
}
|
|
2345
|
+
}}
|
|
2338
2346
|
>
|
|
2339
2347
|
{option.label}
|
|
2340
2348
|
</SelectItem>
|