myoperator-mcp 0.2.267 → 0.2.268

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.
Files changed (2) hide show
  1. package/dist/index.js +40 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3155,6 +3155,7 @@ import { Check } from "lucide-react";
3155
3155
  import { cn } from "@/lib/utils";
3156
3156
 
3157
3157
  const blockedNumberKeys = new Set(["e", "E"]);
3158
+ const decimalSeparatorKeys = new Set([".", ","]);
3158
3159
 
3159
3160
  /**
3160
3161
  * Input variants for different visual states
@@ -3203,6 +3204,15 @@ export interface InputProps
3203
3204
  * Default \`true\` so amount-like fields cannot accept exponent values such as \`2e22\`.
3204
3205
  */
3205
3206
  preventNumberExponent?: boolean;
3207
+ /**
3208
+ * When \`type="number"\`, whether decimal separators (\`.\` / \`,\`) are allowed.
3209
+ * Default \`true\`. Set \`false\` for whole-number-only fields; uses \`inputMode="numeric"\` on supported agents.
3210
+ */
3211
+ decimal?: boolean;
3212
+ /**
3213
+ * Same as \`decimal\` for whole-number-only fields. If both are set, this wins.
3214
+ */
3215
+ allowDecimal?: boolean;
3206
3216
  }
3207
3217
 
3208
3218
  const Input = React.forwardRef(
@@ -3214,19 +3224,25 @@ const Input = React.forwardRef(
3214
3224
  showCheckIcon,
3215
3225
  hideNumberSpinners = true,
3216
3226
  preventNumberExponent = true,
3227
+ decimal = true,
3228
+ allowDecimal,
3217
3229
  onFocus,
3218
3230
  onBlur,
3219
3231
  onWheel,
3220
3232
  onKeyDown,
3221
3233
  onPaste,
3222
3234
  onChange,
3235
+ step,
3223
3236
  ...props
3224
3237
  }: InputProps,
3225
3238
  ref: React.Ref<HTMLInputElement>
3226
3239
  ) => {
3227
3240
  const [isFocused, setIsFocused] = React.useState(false);
3241
+ const decimalAllowed = allowDecimal ?? decimal;
3228
3242
  const shouldPreventNumberExponent =
3229
3243
  type === "number" && preventNumberExponent;
3244
+ const shouldBlockDecimals =
3245
+ type === "number" && !decimalAllowed;
3230
3246
 
3231
3247
  const inputEl = (
3232
3248
  <input
@@ -3239,6 +3255,16 @@ const Input = React.forwardRef(
3239
3255
  "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
3240
3256
  )}
3241
3257
  ref={ref}
3258
+ inputMode={
3259
+ type === "number"
3260
+ ? decimalAllowed
3261
+ ? "decimal"
3262
+ : "numeric"
3263
+ : undefined
3264
+ }
3265
+ step={
3266
+ type === "number" && !decimalAllowed ? (step ?? 1) : step
3267
+ }
3242
3268
  onFocus={(e) => {
3243
3269
  setIsFocused(true);
3244
3270
  onFocus?.(e);
@@ -3259,13 +3285,20 @@ const Input = React.forwardRef(
3259
3285
  if (shouldPreventNumberExponent && blockedNumberKeys.has(e.key)) {
3260
3286
  e.preventDefault();
3261
3287
  }
3288
+ if (
3289
+ shouldBlockDecimals &&
3290
+ decimalSeparatorKeys.has(e.key)
3291
+ ) {
3292
+ e.preventDefault();
3293
+ }
3262
3294
  onKeyDown?.(e);
3263
3295
  }}
3264
3296
  onPaste={(e) => {
3265
- if (
3266
- shouldPreventNumberExponent &&
3267
- /[eE]/.test(e.clipboardData.getData("text"))
3268
- ) {
3297
+ const text = e.clipboardData.getData("text");
3298
+ if (shouldPreventNumberExponent && /[eE]/.test(text)) {
3299
+ e.preventDefault();
3300
+ }
3301
+ if (shouldBlockDecimals && /[.,]/.test(text)) {
3269
3302
  e.preventDefault();
3270
3303
  }
3271
3304
  onPaste?.(e);
@@ -3274,6 +3307,9 @@ const Input = React.forwardRef(
3274
3307
  if (shouldPreventNumberExponent && /[eE]/.test(e.target.value)) {
3275
3308
  return;
3276
3309
  }
3310
+ if (shouldBlockDecimals && /[.,]/.test(e.target.value)) {
3311
+ return;
3312
+ }
3277
3313
  onChange?.(e);
3278
3314
  }}
3279
3315
  {...props}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-mcp",
3
- "version": "0.2.267",
3
+ "version": "0.2.268",
4
4
  "description": "MCP server for myOperator UI components - enables AI assistants to access component metadata, examples, and design tokens",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.js",