myoperator-ui 0.0.182 → 0.0.183
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 +16 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2228,6 +2228,19 @@ const SelectField = React.forwardRef<HTMLButtonElement, SelectFieldProps>(
|
|
|
2228
2228
|
[onValueChange, onSelect, interceptValue, options]
|
|
2229
2229
|
);
|
|
2230
2230
|
|
|
2231
|
+
// Support re-selection: fire onSelect when clicking the already-selected
|
|
2232
|
+
// item. Radix only fires onValueChange for *new* values, so without this
|
|
2233
|
+
// clicking an action item like "Add custom date" a second time would be a
|
|
2234
|
+
// no-op.
|
|
2235
|
+
const handleItemClick = React.useCallback(
|
|
2236
|
+
(option: SelectOption) => {
|
|
2237
|
+
if (option.value === value && onSelect) {
|
|
2238
|
+
onSelect(option);
|
|
2239
|
+
}
|
|
2240
|
+
},
|
|
2241
|
+
[value, onSelect]
|
|
2242
|
+
);
|
|
2243
|
+
|
|
2231
2244
|
// Derive state from props
|
|
2232
2245
|
const derivedState = error ? "error" : "default";
|
|
2233
2246
|
|
|
@@ -2343,6 +2356,7 @@ const SelectField = React.forwardRef<HTMLButtonElement, SelectFieldProps>(
|
|
|
2343
2356
|
key={option.value}
|
|
2344
2357
|
value={option.value}
|
|
2345
2358
|
disabled={option.disabled}
|
|
2359
|
+
onClick={() => handleItemClick(option)}
|
|
2346
2360
|
>
|
|
2347
2361
|
{option.label}
|
|
2348
2362
|
</SelectItem>
|
|
@@ -2359,7 +2373,8 @@ const SelectField = React.forwardRef<HTMLButtonElement, SelectFieldProps>(
|
|
|
2359
2373
|
key={option.value}
|
|
2360
2374
|
value={option.value}
|
|
2361
2375
|
disabled={option.disabled}
|
|
2362
|
-
|
|
2376
|
+
onClick={() => handleItemClick(option)}
|
|
2377
|
+
>
|
|
2363
2378
|
{option.label}
|
|
2364
2379
|
</SelectItem>
|
|
2365
2380
|
))}
|