Css clicks on the search input box to appear from right to left. How to hide from left to right when closed?

as shown in the figure style, when you click to search, the input box slowly expands from right to left, and when closed, the input box slowly closes from left to right. How to request animation? Thank you


 // css
 * {
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    .open .inp {
      width: 30%;
    }

    .inp {
      transition: width 0.65s linear;
      width: 15%;
      position: absolute;
      right: 10px;
    }

    .inp_txt {
      width: 100%;
    }
     
    // html
    <div class="box">
    <div class="inp">
      <input class="inp_txt" type="text">
    </div>
  </div>

 //js
 window.$ = window.$ || function (el) {
      var d = document;
      if (typeof el == 'string') {
        el = el.indexOf('.') != -1 ? d.getElementsByClassName(el.replace(/\./, '')) :
          el.indexOf('-sharp') != -1 ? d.getElementById(el.replace(/\-sharp/, '')) :
            d.querySelector(el);
      }
      return el;
    }

    $('.inp_txt')[0].onfocus = function () {
      $('.box')[0].className += ' open';
    }

    $('.inp_txt')[0].onblur = function () {
      var el = $('.box')[0];
      el.className = el.className.replace(/\s+open/, '');
    }

transition animation, the width slowly expands

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30bf2-2bd46.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30bf2-2bd46.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?