myoperator-mcp 0.2.274 → 0.2.276
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 +34 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5762,7 +5762,7 @@ export interface SelectTriggerProps
|
|
|
5762
5762
|
const SelectTrigger = React.forwardRef(({ className, state, children, ...props }: SelectTriggerProps, ref: React.Ref<React.ElementRef<typeof SelectPrimitive.Trigger>>) => (
|
|
5763
5763
|
<SelectPrimitive.Trigger
|
|
5764
5764
|
ref={ref}
|
|
5765
|
-
className={cn(selectTriggerVariants({ state, className
|
|
5765
|
+
className={cn(selectTriggerVariants({ state }), className)}
|
|
5766
5766
|
{...props}
|
|
5767
5767
|
>
|
|
5768
5768
|
{children}
|
|
@@ -7251,11 +7251,15 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
7251
7251
|
|
|
7252
7252
|
import { cn } from "@/lib/utils";
|
|
7253
7253
|
|
|
7254
|
-
//
|
|
7255
|
-
//
|
|
7256
|
-
//
|
|
7254
|
+
// Collapses runs of the space character (U+0020) so only a single space is allowed
|
|
7255
|
+
// between segments. Newlines and other whitespace are unchanged.
|
|
7256
|
+
// Inlined so the component is self-contained when distributed via the CLI.
|
|
7257
|
+
const normalizeTextareaSpaces = (value: string): string =>
|
|
7258
|
+
String(value).replace(/ {2,}/g, " ");
|
|
7259
|
+
|
|
7260
|
+
// Default counter length: normalized text length (spaces count; duplicate spaces do not).
|
|
7257
7261
|
const countNonWhitespaceChars = (value: string): number =>
|
|
7258
|
-
|
|
7262
|
+
normalizeTextareaSpaces(value).length;
|
|
7259
7263
|
|
|
7260
7264
|
/**
|
|
7261
7265
|
* Textarea variants for different visual states
|
|
@@ -7284,7 +7288,9 @@ const textareaVariants = cva(
|
|
|
7284
7288
|
|
|
7285
7289
|
/**
|
|
7286
7290
|
* A multi-line text input with label, error state, helper text, character counter, and resize control.
|
|
7287
|
-
* With \`showCount\` and \`maxLength\`, the counter
|
|
7291
|
+
* With \`showCount\` and \`maxLength\`, the counter uses normalized length (single spaces
|
|
7292
|
+
* between words count toward the limit) unless \`displayCharCount\` is set. Duplicate
|
|
7293
|
+
* spaces are collapsed on change and in the displayed value.
|
|
7288
7294
|
*
|
|
7289
7295
|
* @example
|
|
7290
7296
|
* \`\`\`tsx
|
|
@@ -7315,8 +7321,8 @@ export interface TextareaProps
|
|
|
7315
7321
|
/** Shows character count when maxLength is set */
|
|
7316
7322
|
showCount?: boolean;
|
|
7317
7323
|
/**
|
|
7318
|
-
* When set, the counter shows this number instead of the default
|
|
7319
|
-
* (see \`countNonWhitespaceChars\`
|
|
7324
|
+
* When set, the counter shows this number instead of the default normalized length
|
|
7325
|
+
* (see \`countNonWhitespaceChars\` in this file).
|
|
7320
7326
|
* Does not change native \`maxLength\` or stored value \u2014 display only.
|
|
7321
7327
|
*/
|
|
7322
7328
|
displayCharCount?: number;
|
|
@@ -7361,27 +7367,38 @@ const Textarea = React.forwardRef(
|
|
|
7361
7367
|
}: TextareaProps,
|
|
7362
7368
|
ref: React.ForwardedRef<HTMLTextAreaElement>
|
|
7363
7369
|
) => {
|
|
7364
|
-
// Internal state for character count in uncontrolled mode
|
|
7365
|
-
const [internalValue, setInternalValue] = React.useState(
|
|
7366
|
-
defaultValue ?? ""
|
|
7370
|
+
// Internal state for character count in uncontrolled mode (normalized)
|
|
7371
|
+
const [internalValue, setInternalValue] = React.useState(() =>
|
|
7372
|
+
normalizeTextareaSpaces(String(defaultValue ?? ""))
|
|
7367
7373
|
);
|
|
7368
7374
|
|
|
7369
7375
|
// Determine if controlled
|
|
7370
7376
|
const isControlled = value !== undefined;
|
|
7371
|
-
const currentValue = isControlled
|
|
7377
|
+
const currentValue = isControlled
|
|
7378
|
+
? normalizeTextareaSpaces(String(value ?? ""))
|
|
7379
|
+
: internalValue;
|
|
7372
7380
|
|
|
7373
7381
|
// Derive state from props
|
|
7374
7382
|
const derivedState = error ? "error" : (state ?? "default");
|
|
7375
7383
|
|
|
7376
|
-
// Handle change for both controlled and uncontrolled
|
|
7384
|
+
// Handle change for both controlled and uncontrolled \u2014 collapse duplicate spaces
|
|
7377
7385
|
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
7386
|
+
const normalized = normalizeTextareaSpaces(e.target.value);
|
|
7378
7387
|
if (!isControlled) {
|
|
7379
|
-
setInternalValue(
|
|
7388
|
+
setInternalValue(normalized);
|
|
7380
7389
|
}
|
|
7381
|
-
onChange
|
|
7390
|
+
if (!onChange) return;
|
|
7391
|
+
if (normalized === e.target.value) {
|
|
7392
|
+
onChange(e);
|
|
7393
|
+
return;
|
|
7394
|
+
}
|
|
7395
|
+
onChange({
|
|
7396
|
+
...e,
|
|
7397
|
+
target: { ...e.target, value: normalized },
|
|
7398
|
+
currentTarget: { ...e.currentTarget, value: normalized },
|
|
7399
|
+
} as React.ChangeEvent<HTMLTextAreaElement>);
|
|
7382
7400
|
};
|
|
7383
7401
|
|
|
7384
|
-
// Counter excludes whitespace so spacing between words does not consume the budget.
|
|
7385
7402
|
const charCount =
|
|
7386
7403
|
displayCharCount !== undefined
|
|
7387
7404
|
? displayCharCount
|
|
@@ -7436,8 +7453,7 @@ const Textarea = React.forwardRef(
|
|
|
7436
7453
|
maxLength={
|
|
7437
7454
|
enforceMaxLength !== false ? maxLength : undefined
|
|
7438
7455
|
}
|
|
7439
|
-
value={
|
|
7440
|
-
defaultValue={!isControlled ? defaultValue : undefined}
|
|
7456
|
+
value={currentValue}
|
|
7441
7457
|
onChange={handleChange}
|
|
7442
7458
|
aria-invalid={!!error}
|
|
7443
7459
|
aria-describedby={ariaDescribedBy}
|
package/package.json
CHANGED