myoperator-mcp 0.2.150 → 0.2.152

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 +73 -9
  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,23 @@ 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
+ /**
1719
+ * Applied after \`sanitizeInput\` on the combobox value (e.g. collapse spaces).
1720
+ * Does not affect invalid-character detection, which compares \`raw\` to \`sanitizeInput(raw)\` only.
1721
+ */
1722
+ normalizeComboboxInput?: (sanitized: string) => string
1723
+ /** Fired when \`sanitizeInput\` removed one or more characters from the raw input. */
1724
+ onInvalidCharacters?: () => void
1725
+ /**
1726
+ * When \`sanitizeInput\` is set, fired on input change if the raw value is already valid
1727
+ * (nothing was stripped). Use to clear validation errors when the user corrects input.
1728
+ */
1729
+ onValidInput?: () => void
1690
1730
  }
1691
1731
 
1692
1732
  const CreatableSelect = React.forwardRef(
@@ -1701,6 +1741,10 @@ const CreatableSelect = React.forwardRef(
1701
1741
  creatableHint,
1702
1742
  disabled = false,
1703
1743
  maxLength,
1744
+ sanitizeInput,
1745
+ normalizeComboboxInput,
1746
+ onInvalidCharacters,
1747
+ onValidInput,
1704
1748
  ...props
1705
1749
  }: CreatableSelectProps,
1706
1750
  ref: React.Ref<HTMLDivElement>
@@ -1749,14 +1793,24 @@ const CreatableSelect = React.forwardRef(
1749
1793
  )
1750
1794
 
1751
1795
  const handleCreate = React.useCallback(() => {
1752
- const trimmed = search.trim()
1796
+ const afterSanitize = sanitizeInput ? sanitizeInput(search) : search
1797
+ const normalized = normalizeComboboxInput
1798
+ ? normalizeComboboxInput(afterSanitize)
1799
+ : afterSanitize
1800
+ const trimmed = normalized.trim()
1753
1801
  if (trimmed) {
1754
1802
  const value = maxLength != null ? trimmed.slice(0, maxLength) : trimmed
1755
1803
  onValueChange?.(value)
1756
1804
  setOpen(false)
1757
1805
  setSearch("")
1758
1806
  }
1759
- }, [search, onValueChange, maxLength])
1807
+ }, [
1808
+ search,
1809
+ onValueChange,
1810
+ maxLength,
1811
+ sanitizeInput,
1812
+ normalizeComboboxInput,
1813
+ ])
1760
1814
 
1761
1815
  const handleKeyDown = (e: React.KeyboardEvent) => {
1762
1816
  if (e.key === "Escape") {
@@ -1845,8 +1899,18 @@ const CreatableSelect = React.forwardRef(
1845
1899
  type="text"
1846
1900
  value={search}
1847
1901
  onChange={(e) => {
1848
- const v = e.target.value
1849
- setSearch(maxLength != null ? v.slice(0, maxLength) : v)
1902
+ const raw = e.target.value
1903
+ const sanitized = sanitizeInput ? sanitizeInput(raw) : raw
1904
+ if (sanitizeInput) {
1905
+ if (raw !== sanitized) onInvalidCharacters?.()
1906
+ else onValidInput?.()
1907
+ }
1908
+ const next = normalizeComboboxInput
1909
+ ? normalizeComboboxInput(sanitized)
1910
+ : sanitized
1911
+ setSearch(
1912
+ maxLength != null ? next.slice(0, maxLength) : next
1913
+ )
1850
1914
  }}
1851
1915
  maxLength={maxLength}
1852
1916
  onKeyDown={handleKeyDown}
@@ -3603,7 +3667,7 @@ const PageHeader = React.forwardRef(
3603
3667
  {/* Content Section: Title + Description */}
3604
3668
  <div className="flex-1 min-w-0">
3605
3669
  <div className="flex h-auto items-center gap-2 sm:min-h-10">
3606
- <h1 className="m-0 text-lg font-semibold leading-none text-semantic-text-primary truncate">
3670
+ <h1 className="m-0 text-lg font-semibold leading-tight text-semantic-text-primary truncate">
3607
3671
  {title}
3608
3672
  </h1>
3609
3673
  {badge && (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-mcp",
3
- "version": "0.2.150",
3
+ "version": "0.2.152",
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",