myoperator-mcp 0.2.149 → 0.2.151

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 +51 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1416,6 +1416,18 @@ export interface CreatableMultiSelectProps
1416
1416
  maxItems?: number
1417
1417
  /** Max character length per item when typing/creating (default: unlimited) */
1418
1418
  maxLengthPerItem?: number
1419
+ /**
1420
+ * When set, the text input is transformed (e.g. strip invalid characters).
1421
+ * If the raw value differs from the sanitized value, \`onInvalidCharacters\` is called.
1422
+ */
1423
+ sanitizeInput?: (raw: string) => string
1424
+ /** Fired when \`sanitizeInput\` removed one or more characters from the raw input. */
1425
+ onInvalidCharacters?: () => void
1426
+ /**
1427
+ * When \`sanitizeInput\` is set, fired on input change if the raw value is already valid.
1428
+ * Use to clear validation errors when the user corrects input.
1429
+ */
1430
+ onValidInput?: () => void
1419
1431
  }
1420
1432
 
1421
1433
  const CreatableMultiSelect = React.forwardRef(
@@ -1431,6 +1443,9 @@ const CreatableMultiSelect = React.forwardRef(
1431
1443
  helperText,
1432
1444
  maxItems,
1433
1445
  maxLengthPerItem,
1446
+ sanitizeInput,
1447
+ onInvalidCharacters,
1448
+ onValidInput,
1434
1449
  ...props
1435
1450
  }: CreatableMultiSelectProps,
1436
1451
  ref: React.Ref<HTMLDivElement>
@@ -1445,7 +1460,8 @@ const CreatableMultiSelect = React.forwardRef(
1445
1460
 
1446
1461
  const addValue = React.useCallback(
1447
1462
  (val: string) => {
1448
- const trimmed = val.trim()
1463
+ const afterSanitize = sanitizeInput ? sanitizeInput(val) : val
1464
+ const trimmed = afterSanitize.trim()
1449
1465
  if (!trimmed || value.includes(trimmed)) return
1450
1466
  if (maxItems != null && value.length >= maxItems) return
1451
1467
  const toAdd =
@@ -1457,7 +1473,7 @@ const CreatableMultiSelect = React.forwardRef(
1457
1473
  setInputValue("")
1458
1474
  }
1459
1475
  },
1460
- [value, onValueChange, maxItems, maxLengthPerItem]
1476
+ [value, onValueChange, maxItems, maxLengthPerItem, sanitizeInput]
1461
1477
  )
1462
1478
 
1463
1479
  const removeValue = React.useCallback(
@@ -1558,9 +1574,16 @@ const CreatableMultiSelect = React.forwardRef(
1558
1574
  type="text"
1559
1575
  value={inputValue}
1560
1576
  onChange={(e) => {
1561
- const v = e.target.value
1577
+ const raw = e.target.value
1578
+ const sanitized = sanitizeInput ? sanitizeInput(raw) : raw
1579
+ if (sanitizeInput) {
1580
+ if (raw !== sanitized) onInvalidCharacters?.()
1581
+ else onValidInput?.()
1582
+ }
1562
1583
  setInputValue(
1563
- maxLengthPerItem != null ? v.slice(0, maxLengthPerItem) : v
1584
+ maxLengthPerItem != null
1585
+ ? sanitized.slice(0, maxLengthPerItem)
1586
+ : sanitized
1564
1587
  )
1565
1588
  if (!isOpen) setIsOpen(true)
1566
1589
  }}
@@ -1687,6 +1710,18 @@ export interface CreatableSelectProps
1687
1710
  disabled?: boolean
1688
1711
  /** Max character length for the value (enforced when open and when creating) */
1689
1712
  maxLength?: number
1713
+ /**
1714
+ * When set, combobox input is transformed (e.g. strip invalid characters).
1715
+ * If the raw value differs from the sanitized value, \`onInvalidCharacters\` is called.
1716
+ */
1717
+ sanitizeInput?: (raw: string) => string
1718
+ /** Fired when \`sanitizeInput\` removed one or more characters from the raw input. */
1719
+ onInvalidCharacters?: () => void
1720
+ /**
1721
+ * When \`sanitizeInput\` is set, fired on input change if the raw value is already valid
1722
+ * (nothing was stripped). Use to clear validation errors when the user corrects input.
1723
+ */
1724
+ onValidInput?: () => void
1690
1725
  }
1691
1726
 
1692
1727
  const CreatableSelect = React.forwardRef(
@@ -1701,6 +1736,9 @@ const CreatableSelect = React.forwardRef(
1701
1736
  creatableHint,
1702
1737
  disabled = false,
1703
1738
  maxLength,
1739
+ sanitizeInput,
1740
+ onInvalidCharacters,
1741
+ onValidInput,
1704
1742
  ...props
1705
1743
  }: CreatableSelectProps,
1706
1744
  ref: React.Ref<HTMLDivElement>
@@ -1845,8 +1883,15 @@ const CreatableSelect = React.forwardRef(
1845
1883
  type="text"
1846
1884
  value={search}
1847
1885
  onChange={(e) => {
1848
- const v = e.target.value
1849
- setSearch(maxLength != null ? v.slice(0, maxLength) : v)
1886
+ const raw = e.target.value
1887
+ const sanitized = sanitizeInput ? sanitizeInput(raw) : raw
1888
+ if (sanitizeInput) {
1889
+ if (raw !== sanitized) onInvalidCharacters?.()
1890
+ else onValidInput?.()
1891
+ }
1892
+ setSearch(
1893
+ maxLength != null ? sanitized.slice(0, maxLength) : sanitized
1894
+ )
1850
1895
  }}
1851
1896
  maxLength={maxLength}
1852
1897
  onKeyDown={handleKeyDown}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-mcp",
3
- "version": "0.2.149",
3
+ "version": "0.2.151",
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",