import { ref } from 'vue'; // Utils import { pick, createNamespace, preventDefault } from '../utils'; // Composition import { useExpose } from '../composables/use-expose'; // Components import Field from '../field'; const [createComponent, bem, t] = createNamespace('search'); export default createComponent({ inheritAttrs: false, props: { label: String, rightIcon: String, modelValue: String, actionText: String, background: String, showAction: Boolean, clearTrigger: String, shape: { type: String, default: 'square', }, clearable: { type: Boolean, default: true, }, leftIcon: { type: String, default: 'search', }, }, emits: ['search', 'cancel'], setup(props, { emit, slots, attrs }) { const filedRef = ref(); const onCancel = () => { if (!slots.action) { emit('update:modelValue', ''); emit('cancel'); } }; const onKeypress = (event) => { const ENTER_CODE = 13; if (event.keyCode === ENTER_CODE) { preventDefault(event); emit('search', props.modelValue); } }; const renderLabel = () => { if (slots.label || props.label) { return (