myoperator-mcp 0.2.325 → 0.2.327
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 +73 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3315,6 +3315,19 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
3315
3315
|
[]
|
|
3316
3316
|
);
|
|
3317
3317
|
|
|
3318
|
+
const handleCalendarSelectTriggerPointerDown = React.useCallback(
|
|
3319
|
+
(
|
|
3320
|
+
select: CalendarSelect,
|
|
3321
|
+
event: React.PointerEvent<HTMLButtonElement>
|
|
3322
|
+
) => {
|
|
3323
|
+
if (openCalendarSelect !== select) return;
|
|
3324
|
+
|
|
3325
|
+
event.preventDefault();
|
|
3326
|
+
setOpenCalendarSelect(null);
|
|
3327
|
+
},
|
|
3328
|
+
[openCalendarSelect]
|
|
3329
|
+
);
|
|
3330
|
+
|
|
3318
3331
|
const setTriggerRef = React.useCallback(
|
|
3319
3332
|
(node: HTMLDivElement | null) => {
|
|
3320
3333
|
triggerRef.current = node;
|
|
@@ -3581,6 +3594,9 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
3581
3594
|
data-date-time-picker-calendar-select-trigger=""
|
|
3582
3595
|
aria-label="Month"
|
|
3583
3596
|
className={CALENDAR_SELECT_TRIGGER_CLASS}
|
|
3597
|
+
onPointerDown={(event) =>
|
|
3598
|
+
handleCalendarSelectTriggerPointerDown("month", event)
|
|
3599
|
+
}
|
|
3584
3600
|
>
|
|
3585
3601
|
<SelectValue />
|
|
3586
3602
|
</SelectTrigger>
|
|
@@ -3635,6 +3651,9 @@ const DateTimePicker = React.forwardRef<HTMLDivElement, DateTimePickerProps>(
|
|
|
3635
3651
|
data-date-time-picker-calendar-select-trigger=""
|
|
3636
3652
|
aria-label="Year"
|
|
3637
3653
|
className={CALENDAR_SELECT_TRIGGER_CLASS}
|
|
3654
|
+
onPointerDown={(event) =>
|
|
3655
|
+
handleCalendarSelectTriggerPointerDown("year", event)
|
|
3656
|
+
}
|
|
3638
3657
|
>
|
|
3639
3658
|
<SelectValue />
|
|
3640
3659
|
</SelectTrigger>
|
|
@@ -9155,6 +9174,11 @@ import { cn } from "@/lib/utils";
|
|
|
9155
9174
|
const normalizeTextareaSpaces = (value: string): string =>
|
|
9156
9175
|
String(value).replace(/ {2,}/g, " ");
|
|
9157
9176
|
|
|
9177
|
+
const getNormalizedSelectionOffset = (
|
|
9178
|
+
value: string,
|
|
9179
|
+
selectionOffset: number | null
|
|
9180
|
+
): number => normalizeTextareaSpaces(value.slice(0, selectionOffset ?? value.length)).length;
|
|
9181
|
+
|
|
9158
9182
|
// Default counter length: normalized text length (spaces count; duplicate spaces do not).
|
|
9159
9183
|
const countNonWhitespaceChars = (value: string): number =>
|
|
9160
9184
|
normalizeTextareaSpaces(value).length;
|
|
@@ -9237,7 +9261,7 @@ export interface TextareaProps
|
|
|
9237
9261
|
labelClassName?: string;
|
|
9238
9262
|
}
|
|
9239
9263
|
|
|
9240
|
-
const Textarea = React.forwardRef(
|
|
9264
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
9241
9265
|
(
|
|
9242
9266
|
{
|
|
9243
9267
|
className,
|
|
@@ -9263,8 +9287,27 @@ const Textarea = React.forwardRef(
|
|
|
9263
9287
|
id,
|
|
9264
9288
|
...props
|
|
9265
9289
|
}: TextareaProps,
|
|
9266
|
-
ref
|
|
9290
|
+
ref
|
|
9267
9291
|
) => {
|
|
9292
|
+
const textareaRef = React.useRef<HTMLTextAreaElement>(null);
|
|
9293
|
+
const pendingSelectionRef = React.useRef<[number, number] | null>(null);
|
|
9294
|
+
|
|
9295
|
+
const setTextareaRef = React.useCallback(
|
|
9296
|
+
(node: HTMLTextAreaElement | null) => {
|
|
9297
|
+
textareaRef.current = node;
|
|
9298
|
+
|
|
9299
|
+
if (typeof ref === "function") {
|
|
9300
|
+
ref(node);
|
|
9301
|
+
return;
|
|
9302
|
+
}
|
|
9303
|
+
|
|
9304
|
+
if (ref) {
|
|
9305
|
+
ref.current = node;
|
|
9306
|
+
}
|
|
9307
|
+
},
|
|
9308
|
+
[ref]
|
|
9309
|
+
);
|
|
9310
|
+
|
|
9268
9311
|
// Internal state for character count in uncontrolled mode (normalized)
|
|
9269
9312
|
const [internalValue, setInternalValue] = React.useState(() =>
|
|
9270
9313
|
normalizeTextareaSpaces(String(defaultValue ?? ""))
|
|
@@ -9276,12 +9319,38 @@ const Textarea = React.forwardRef(
|
|
|
9276
9319
|
? normalizeTextareaSpaces(String(value ?? ""))
|
|
9277
9320
|
: internalValue;
|
|
9278
9321
|
|
|
9322
|
+
const restoreSelection = React.useCallback(() => {
|
|
9323
|
+
const pendingSelection = pendingSelectionRef.current;
|
|
9324
|
+
const textarea = textareaRef.current;
|
|
9325
|
+
|
|
9326
|
+
if (!pendingSelection || !textarea) return;
|
|
9327
|
+
|
|
9328
|
+
pendingSelectionRef.current = null;
|
|
9329
|
+
textarea.setSelectionRange(...pendingSelection);
|
|
9330
|
+
}, []);
|
|
9331
|
+
|
|
9332
|
+
React.useLayoutEffect(() => {
|
|
9333
|
+
restoreSelection();
|
|
9334
|
+
});
|
|
9335
|
+
|
|
9279
9336
|
// Derive state from props
|
|
9280
9337
|
const derivedState = error ? "error" : (state ?? "default");
|
|
9281
9338
|
|
|
9282
9339
|
// Handle change for both controlled and uncontrolled \u2014 collapse duplicate spaces
|
|
9283
9340
|
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
9284
|
-
const
|
|
9341
|
+
const nextValue = e.target.value;
|
|
9342
|
+
const normalized = normalizeTextareaSpaces(nextValue);
|
|
9343
|
+
|
|
9344
|
+
if (normalized !== nextValue) {
|
|
9345
|
+
const nextSelection: [number, number] = [
|
|
9346
|
+
getNormalizedSelectionOffset(nextValue, e.target.selectionStart),
|
|
9347
|
+
getNormalizedSelectionOffset(nextValue, e.target.selectionEnd),
|
|
9348
|
+
];
|
|
9349
|
+
pendingSelectionRef.current = nextSelection;
|
|
9350
|
+
e.target.setSelectionRange(...nextSelection);
|
|
9351
|
+
requestAnimationFrame(restoreSelection);
|
|
9352
|
+
}
|
|
9353
|
+
|
|
9285
9354
|
if (!isControlled) {
|
|
9286
9355
|
setInternalValue(normalized);
|
|
9287
9356
|
}
|
|
@@ -9339,7 +9408,7 @@ const Textarea = React.forwardRef(
|
|
|
9339
9408
|
|
|
9340
9409
|
{/* Textarea */}
|
|
9341
9410
|
<textarea
|
|
9342
|
-
ref={
|
|
9411
|
+
ref={setTextareaRef}
|
|
9343
9412
|
id={textareaId}
|
|
9344
9413
|
rows={rows}
|
|
9345
9414
|
className={cn(
|
package/package.json
CHANGED