import type { PropsPlugin } from '../../../../types/component-plugin';
import type { CheckComboUIProps } from '../types';

export function createCheckComboPlaceholderPlugin(
  placeholder: string,
): PropsPlugin<CheckComboUIProps> {
  return (props) => ({
    ...props,
    placeholder,
  });
}

export function createCheckComboSortPlugin(): PropsPlugin<CheckComboUIProps> {
  return (props) => ({
    ...props,
    data: [...props.data].sort((left, right) => left.value.localeCompare(right.value)),
  });
}
