{
  "version": 3,
  "sources": ["../../src/search-control/index.tsx"],
  "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { search, closeSmall } from '@wordpress/icons';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { InputControlPrefixWrapper } from '../input-control/input-prefix-wrapper';\nimport { InputControlSuffixWrapper } from '../input-control/input-suffix-wrapper';\nimport { StyledInputControl, StyledIcon } from './styles';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction SuffixItem({\n  searchRef,\n  value,\n  onChange,\n  onClose\n}) {\n  if (!onClose && !value) {\n    return null;\n  }\n  if (onClose) {\n    deprecated('`onClose` prop in wp.components.SearchControl', {\n      since: '6.8'\n    });\n  }\n  const onReset = () => {\n    onChange('');\n    searchRef.current?.focus();\n  };\n  return /*#__PURE__*/_jsx(InputControlSuffixWrapper, {\n    variant: \"control\",\n    children: /*#__PURE__*/_jsx(Button, {\n      size: \"small\",\n      icon: closeSmall,\n      label: onClose ? __('Close search') : __('Reset search'),\n      onClick: onClose ?? onReset\n    })\n  });\n}\nfunction UnforwardedSearchControl({\n  __nextHasNoMarginBottom: _,\n  // Prevent passing to internal component\n  className,\n  onChange,\n  value,\n  label = __('Search'),\n  placeholder = __('Search'),\n  hideLabelFromVision = true,\n  onClose,\n  size = 'default',\n  ...restProps\n}, forwardedRef) {\n  // @ts-expect-error The `disabled` prop is not yet supported in the SearchControl component.\n  // Work with the design team (@WordPress/gutenberg-design) if you need this feature.\n  const {\n    disabled,\n    ...filteredRestProps\n  } = restProps;\n  const searchRef = useRef(null);\n  const instanceId = useInstanceId(SearchControl, 'components-search-control');\n  return /*#__PURE__*/_jsx(StyledInputControl, {\n    __next40pxDefaultSize: true,\n    id: instanceId,\n    hideLabelFromVision: hideLabelFromVision,\n    label: label,\n    ref: useMergeRefs([searchRef, forwardedRef]),\n    type: \"search\",\n    size: size,\n    className: clsx('components-search-control', className),\n    onChange: nextValue => onChange(nextValue ?? ''),\n    autoComplete: \"off\",\n    placeholder: placeholder,\n    value: value ?? '',\n    prefix: /*#__PURE__*/_jsx(InputControlPrefixWrapper, {\n      variant: \"icon\",\n      children: /*#__PURE__*/_jsx(StyledIcon, {\n        icon: search,\n        fill: \"currentColor\"\n      })\n    }),\n    suffix: /*#__PURE__*/_jsx(SuffixItem, {\n      searchRef: searchRef,\n      value: value,\n      onChange: onChange,\n      onClose: onClose\n    }),\n    ...filteredRestProps\n  });\n}\n\n/**\n * SearchControl components let users display a search control.\n *\n * ```jsx\n * import { SearchControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * function MySearchControl( { className, setState } ) {\n *   const [ searchInput, setSearchInput ] = useState( '' );\n *\n *   return (\n *     <SearchControl\n *       value={ searchInput }\n *       onChange={ setSearchInput }\n *     />\n *   );\n * }\n * ```\n */\nexport const SearchControl = forwardRef(UnforwardedSearchControl);\nSearchControl.displayName = 'SearchControl';\nexport default SearchControl;"],
  "mappings": ";AAGA,OAAO,UAAU;AAIjB,SAAS,eAAe,oBAAoB;AAC5C,SAAS,UAAU;AACnB,SAAS,QAAQ,kBAAkB;AACnC,SAAS,YAAY,cAAc;AACnC,OAAO,gBAAgB;AAKvB,OAAO,YAAY;AACnB,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,oBAAoB,kBAAkB;AAC/C,SAAS,OAAO,YAAY;AAC5B,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,MAAI,CAAC,WAAW,CAAC,OAAO;AACtB,WAAO;AAAA,EACT;AACA,MAAI,SAAS;AACX,eAAW,iDAAiD;AAAA,MAC1D,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACA,QAAM,UAAU,MAAM;AACpB,aAAS,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