1<template>
2  <div class="search-global">
3    <b-form-group
4      :label="$t('global.form.search')"
5      label-for="searchInput"
6      label-sr-only
7      class="mb-2"
8    >
9      <b-input-group size="md" class="align-items-center">
10        <b-input-group-prepend>
11          <icon-search class="search-icon" />
12        </b-input-group-prepend>
13        <b-form-input
14          id="searchInput"
15          v-model="filter"
16          type="text"
17          :placeholder="placeholder"
18          @input="onChangeInput"
19        ></b-form-input>
20      </b-input-group>
21    </b-form-group>
22  </div>
23</template>
24
25<script>
26import IconSearch from '@carbon/icons-vue/es/search/16';
27export default {
28  name: 'Search',
29  components: { IconSearch },
30  props: {
31    placeholder: {
32      type: String,
33      default: function() {
34        return this.$t('global.form.search');
35      }
36    }
37  },
38  data() {
39    return {
40      filter: null
41    };
42  },
43  methods: {
44    onChangeInput() {
45      this.$emit('changeSearch', this.filter);
46    }
47  }
48};
49</script>
50
51<style lang="scss" scoped>
52@import 'src/assets/styles/helpers';
53
54#searchInput {
55  padding-left: ($spacer * 2);
56}
57.search-icon {
58  position: absolute;
59  left: 10px;
60  top: 12px;
61  z-index: 4;
62  stroke: $gray-400;
63}
64</style>
65