diff --git a/README.md b/README.md index 8019add..e70c293 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,10 @@ Add JS onto your html ```html ``` -Add either raw or default CSS styles to your html -(feel free to change any CSS according to your html) +Add CSS onto your html. You can omit the second onw if you do not want any UI styling as in examples ```html -``` -If you do not want custom styling as in examples here is the css with only core styles -```html - + ``` ### CDN @@ -42,7 +38,7 @@ You can also use below CDN links. Feel free to change version number with respec ```html - + ``` Initialize Autocomplete object with your configurations diff --git a/css/autocomplete-core.css b/css/autocomplete-core.css deleted file mode 100644 index c304b2e..0000000 --- a/css/autocomplete-core.css +++ /dev/null @@ -1,84 +0,0 @@ -.ac-hidden{ - display: none; -} -.ac-wrapper{ - position: relative; - display: inline-block; -} -.ac-wrapper input{ - padding-right: 40px; -} -.ac-wrapper .ac-suggestion-list{ - width: 100%; - position: absolute; - left: 0px; - text-align: left; - background-color: white; - max-width: 100%; - z-index: 5; - border-radius: 0 0 5px 5px; - overflow: hidden; - border: 1px solid #e8e8e8; - border-top: none; -} -.ac-wrapper .ac-autocomplete-clear-icon{ - position: absolute; - top: 0; - right: 0; - width: 20px; - height: 100%; - background-image: url(../img/clear.svg); - background-repeat: no-repeat; - background-position: center; -} -.ac-wrapper .ac-autocomplete-clear-icon:hover{ - cursor: pointer; -} -.ac-wrapper .ac-autocomplete-loading-icon{ - position: absolute; - top: 0; - right: 20px; - width: 20px; - height: 100%; - background-image: url(../img/loading.svg); - background-repeat: no-repeat; - background-position: center; - -webkit-animation:spin 1s linear infinite; - -moz-animation:spin 1s linear infinite; - animation:spin 1s linear infinite; -} -@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } -@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } -@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } - -.ac-wrapper .ac-suggestion-list div.autocomplete-result { - max-width: 100%; - display: flex; -} -.ac-wrapper .ac-suggestion-list div:hover { - cursor: pointer; - background-color: whitesmoke; -} -.ac-wrapper .ac-suggestion-list div.active { - background-color: #e4e2e2; -} -.ac-wrapper .ac-suggestion-list div.autocomplete-text { - padding: 5px 0px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - flex-grow: 1; -} -.ac-wrapper .ac-suggestion-list div.autocomplete-mobile-icon { - display: none; - flex-shrink: 0; - width: 20px; - background-image: url(../img/arrow-top-left.svg); - background-repeat: no-repeat; - background-position: center; -} -@media screen and (max-width: 768px) { - .ac-wrapper .ac-suggestion-list div.autocomplete-mobile-icon { - display: initial; - } -} \ No newline at end of file diff --git a/css/autocomplete-theme.css b/css/autocomplete-theme.css new file mode 100644 index 0000000..c838986 --- /dev/null +++ b/css/autocomplete-theme.css @@ -0,0 +1,41 @@ +input.ac-input-default{ + width: 350px; + transition: all .25s ease-out; + color: #4a5568; + padding: 10px 20px 10px 20px; + line-height: 1.5; + border-width: 1px; + border-radius: .5rem; + border-color: transparent; + background-color: #edf2f7; + font-family: sans-serif; + font-size: 15px; +} +input.ac-input-default:focus{ + outline: none; + background-color: white; + border: 1px solid #edf2f7; +} +.ac-wrapper input.ac-list-open{ + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} +.ac-wrapper .ac-suggestion-list{ + font-family: sans-serif; + font-size: 15px; + color: #4a5568; + box-sizing: border-box; +} +.ac-wrapper .ac-suggestion-list div.autocomplete-text { + padding: 10px 20px 10px 20px; + line-height: 1.5; +} +.ac-wrapper .ac-autocomplete-clear-icon{ + width: 40px; +} +.ac-wrapper .ac-autocomplete-loading-icon{ + right: 40px; +} +.ac-wrapper .ac-suggestion-list div.autocomplete-mobile-icon { + width: 40px; +} \ No newline at end of file diff --git a/css/autocomplete.css b/css/autocomplete.css index d4f99dc..c304b2e 100644 --- a/css/autocomplete.css +++ b/css/autocomplete.css @@ -8,14 +8,7 @@ .ac-wrapper input{ padding-right: 40px; } -.ac-wrapper input.ac-list-open{ - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; -} .ac-wrapper .ac-suggestion-list{ - font-family: sans-serif; - font-size: 15px; - color: #4a5568; width: 100%; position: absolute; left: 0px; @@ -27,12 +20,11 @@ overflow: hidden; border: 1px solid #e8e8e8; border-top: none; - box-sizing: border-box; } .ac-wrapper .ac-autocomplete-clear-icon{ position: absolute; top: 0; - right: 10px; + right: 0; width: 20px; height: 100%; background-image: url(../img/clear.svg); @@ -45,7 +37,7 @@ .ac-wrapper .ac-autocomplete-loading-icon{ position: absolute; top: 0; - right: 40px; + right: 20px; width: 20px; height: 100%; background-image: url(../img/loading.svg); @@ -71,8 +63,7 @@ background-color: #e4e2e2; } .ac-wrapper .ac-suggestion-list div.autocomplete-text { - padding: 10px 20px 10px 20px; - line-height: 1.5; + padding: 5px 0px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -82,7 +73,6 @@ display: none; flex-shrink: 0; width: 20px; - padding: 0 10px; background-image: url(../img/arrow-top-left.svg); background-repeat: no-repeat; background-position: center; diff --git a/index.html b/index.html index 866eaea..31d6a99 100644 --- a/index.html +++ b/index.html @@ -5,8 +5,7 @@