File "ComboboxControl.js"

Full Path: /home/tekvhqgl/public_html/dev2024_old_skip/wp-content/plugins/presto-player/src/admin/settings/components/ComboboxControl.js
File size: 612 bytes
MIME-type: text/x-java
Charset: utf-8

const { ComboboxControl } = wp.components;
const { useState } = wp.element;
const { dispatch } = wp.data;
import classNames from "classnames";

export default ({ value, options, onChange, ...rest }) => {
  const [filteredOptions, setFilteredOptions] = useState(options || []);
  return (
    <ComboboxControl
      options={filteredOptions}
      onFilterValueChange={(inputValue) =>
        setFilteredOptions(
          options.filter((option) =>
            value.label.toLowerCase().startsWith(inputValue.toLowerCase())
          )
        )
      }
      onChange={onChange}
      {...props}
    />
  );
};