diff --git a/components/auto-complete/__tests__/__snapshots__/index.test.tsx.snap b/components/auto-complete/__tests__/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000..1d19d86
--- /dev/null
+++ b/components/auto-complete/__tests__/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,12 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AutoComplete should render correctly 1`] = `
+
+`;
diff --git a/components/auto-complete/__tests__/__snapshots__/search.test.tsx.snap b/components/auto-complete/__tests__/__snapshots__/search.test.tsx.snap
new file mode 100644
index 0000000..5d37363
--- /dev/null
+++ b/components/auto-complete/__tests__/__snapshots__/search.test.tsx.snap
@@ -0,0 +1,1589 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AutoComplete Search should hide empty component 1`] = `
+initialize {
+ "0": Object {
+ "attribs": Object {
+ "class": "auto-complete",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "with-label",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": [Circular],
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": [Circular],
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .auto-complete {
+ width: max-content;
+ }
+
+ .auto-complete :global(.loading) {
+ left: -3px;
+ right: -3px;
+ width: max-content;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": [Circular],
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .auto-complete {
+ width: max-content;
+ }
+
+ .auto-complete :global(.loading) {
+ left: -3px;
+ right: -3px;
+ width: max-content;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": Object {
+ "attribs": Object {
+ "class": "with-label",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": [Circular],
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": [Circular],
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": [Circular],
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": null,
+ "prev": null,
+ "root": Object {
+ "attribs": Object {},
+ "children": Array [
+ [Circular],
+ ],
+ "name": "root",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": null,
+ "prev": null,
+ "type": "root",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "_root": [Circular],
+ "length": 1,
+ "options": Object {
+ "decodeEntities": true,
+ "normalizeWhitespace": false,
+ "withDomLvl1": true,
+ "xml": false,
+ },
+}
+`;
+
+exports[`AutoComplete Search should hide empty component 2`] = `
+initialize {
+ "0": Object {
+ "attribs": Object {
+ "class": "auto-complete",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "with-label",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": [Circular],
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": [Circular],
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .auto-complete {
+ width: max-content;
+ }
+
+ .auto-complete :global(.loading) {
+ left: -3px;
+ right: -3px;
+ width: max-content;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": [Circular],
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .auto-complete {
+ width: max-content;
+ }
+
+ .auto-complete :global(.loading) {
+ left: -3px;
+ right: -3px;
+ width: max-content;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": Object {
+ "attribs": Object {
+ "class": "with-label",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": [Circular],
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ Object {
+ "attribs": Object {},
+ "children": Array [
+ Object {
+ "data": "
+ .with-label {
+ display: inline-block;
+ width: initial;
+ box-sizing: border-box;
+ -webkit-box-align: center;
+ }
+
+ .input-container {
+ display: inline-flex;
+ align-items: center;
+ width: initial;
+ height: calc(1.687 * 16pt);
+ }
+
+ .input-wrapper {
+ display: inline-flex;
+ vertical-align: middle;
+ align-items: center;
+ height: 100%;
+ flex: 1;
+ user-select: none;
+ border-radius: 5px;
+ border: 1px solid #eaeaea;
+ transition: border 0.2s ease 0s, color 0.2s ease 0s;
+ }
+
+ .input-wrapper.left-label {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .input-wrapper.right-label {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .input-wrapper.disabled {
+ background-color: #fafafa;
+ border-color: #eaeaea;
+ cursor: not-allowed;
+ }
+
+ input.disabled {
+ cursor: not-allowed;
+ }
+
+ .input-wrapper.hover {
+ border-color: #666;
+ }
+
+ input {
+ margin: 4px 10px;
+ padding: 0;
+ box-shadow: none;
+ font-size: .875rem;
+ background-color: transparent;
+ border: none;
+ color: #000;
+ outline: none;
+ border-radius: 0;
+ width: 100%;
+ -webkit-appearance: none;
+ }
+
+ input.left-icon {
+ margin-left: 0;
+ }
+
+ input.right-icon {
+ margin-right: 0;
+ }
+
+ ::placeholder, ::-moz-placeholder, :-ms-input-placeholder, ::-webkit-input-placeholder {
+ color: #999;
+ }
+ ",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "text",
+ },
+ ],
+ "name": "style",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": Object {
+ "attribs": Object {
+ "class": "input-container ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "class": "input-wrapper ",
+ },
+ "children": Array [
+ Object {
+ "attribs": Object {
+ "autocomplete": "off",
+ "class": " ",
+ "placeholder": "Enter here",
+ "type": "text",
+ "value": "",
+ },
+ "children": Array [],
+ "name": "input",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "autocomplete": undefined,
+ "class": undefined,
+ "placeholder": undefined,
+ "type": undefined,
+ "value": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": [Circular],
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": [Circular],
+ "parent": [Circular],
+ "prev": null,
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "type": "style",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ ],
+ "name": "div",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": null,
+ "prev": null,
+ "root": Object {
+ "attribs": Object {},
+ "children": Array [
+ [Circular],
+ ],
+ "name": "root",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "next": null,
+ "parent": null,
+ "prev": null,
+ "type": "root",
+ "x-attribsNamespace": Object {},
+ "x-attribsPrefix": Object {},
+ },
+ "type": "tag",
+ "x-attribsNamespace": Object {
+ "class": undefined,
+ },
+ "x-attribsPrefix": Object {
+ "class": undefined,
+ },
+ },
+ "_root": [Circular],
+ "length": 1,
+ "options": Object {
+ "decodeEntities": true,
+ "normalizeWhitespace": false,
+ "withDomLvl1": true,
+ "xml": false,
+ },
+}
+`;
diff --git a/components/auto-complete/__tests__/index.test.tsx b/components/auto-complete/__tests__/index.test.tsx
new file mode 100644
index 0000000..d302139
--- /dev/null
+++ b/components/auto-complete/__tests__/index.test.tsx
@@ -0,0 +1,54 @@
+import React from 'react'
+import { mount } from 'enzyme'
+import { AutoComplete } from '../../index'
+import { nativeEvent } from '../../../tests/utils'
+
+describe('AutoComplete', () => {
+ it('should render correctly', () => {
+ const wrapper = mount()
+ expect(() => wrapper.unmount()).not.toThrow()
+ expect().toMatchSnapshot()
+ })
+
+ it('should support sizes and status', () => {
+ const wrapper = mount(
+
+ )
+ expect(() => wrapper.unmount()).not.toThrow()
+ })
+
+ it('should set input value from initial value', () => {
+ let wrapper = mount()
+ let input = wrapper.find('input').at(0).getDOMNode()
+ expect((input as HTMLInputElement).value).toEqual('value')
+
+ wrapper = mount()
+ input = wrapper.find('input').at(0).getDOMNode()
+ expect((input as HTMLInputElement).value).toEqual('value2')
+ })
+
+ it('should render clear icon', () => {
+ const wrapper = mount()
+ expect(wrapper.find('svg').length).toBe(0)
+
+ wrapper.setProps({ clearable: true })
+ expect(wrapper.find('svg').length).toBe(1)
+
+ wrapper.find('svg').simulate('click', nativeEvent)
+ const input = wrapper.find('input').at(0).getDOMNode()
+ expect((input as HTMLInputElement).value).toEqual('')
+ })
+
+ it('should reponse width change', () => {
+ const wrapper = mount()
+ expect(wrapper.prop('width')).toEqual('100px')
+
+ wrapper.setProps({ width: '200px' })
+ expect(wrapper.prop('width')).toEqual('200px')
+ })
+})
diff --git a/components/auto-complete/__tests__/search.test.tsx b/components/auto-complete/__tests__/search.test.tsx
new file mode 100644
index 0000000..d71b7cb
--- /dev/null
+++ b/components/auto-complete/__tests__/search.test.tsx
@@ -0,0 +1,142 @@
+import React from 'react'
+import { mount, render } from 'enzyme'
+import { AutoComplete } from '../../index'
+import { nativeEvent } from '../../../tests/utils'
+const mockOptions = [
+ { label: 'London', value: 'london' },
+]
+
+describe('AutoComplete Search', () => {
+ it('should render options element', () => {
+ const wrapper = mount()
+ wrapper.find('input').at(0).simulate('focus')
+ let dropdown = wrapper.find('.auto-complete-dropdown').children()
+ expect(dropdown.length).not.toBe(0)
+
+ wrapper.find('input').at(0).simulate('blur')
+ expect(() => wrapper.unmount()).not.toThrow()
+ })
+
+ it('should update value when dropdown clicked', () => {
+ let value = ''
+ const wrapper = mount( value = val} />)
+ wrapper.find('input').at(0).simulate('focus')
+ wrapper.find('.item').at(0).simulate('click', nativeEvent)
+ expect(value).toEqual('london')
+ })
+
+ it('should ignore events when disabled', () => {
+ let value = ''
+ const wrapper = mount(
+ value = val} />
+ )
+ wrapper.find('input').at(0).simulate('focus')
+ wrapper.find('.item').at(0).simulate('click', nativeEvent)
+ expect(value).not.toEqual('london')
+ })
+
+ it('should render searching component', () => {
+ let wrapper = mount(
+
+ )
+ wrapper.setProps({ searching: true })
+ wrapper.find('input').at(0).simulate('focus')
+ let dropdown = wrapper.find('.auto-complete-dropdown')
+ expect(dropdown.text()).not.toContain('london')
+
+ const loading = wrapper.find('.loading')
+ expect(loading.length).not.toBe(0)
+
+ wrapper = mount(
+
+
+ waiting...
+
+
+ )
+ wrapper.find('input').at(0).simulate('focus')
+ dropdown = wrapper.find('.auto-complete-dropdown')
+ expect(dropdown.text()).toContain('waiting')
+ })
+
+ it('should hide empty component', () => {
+ let wrapper = render(
+
+
+
+ )
+ expect(wrapper).toMatchSnapshot()
+
+ wrapper = render(
+
+ empty
+
+ )
+ expect(wrapper).toMatchSnapshot()
+
+ const mountWrapper = mount(
+
+ empty
+
+ )
+ mountWrapper.find('input').at(0).simulate('focus')
+ const text = mountWrapper.find('.auto-complete-dropdown').text()
+ expect(text).toContain('empty')
+
+ const mountWrapper2 = mount(
+
+ empty
+
+ )
+ mountWrapper2.find('input').at(0).simulate('focus')
+ const text2 = mountWrapper2.find('.auto-complete-dropdown').text()
+ expect(text2).not.toContain('empty')
+ })
+
+ it('should trigger search handler', () => {
+ const handler = jest.fn()
+ const wrapper = mount()
+ const input = wrapper.find('input').at(0)
+ input.simulate('focus')
+ input.simulate('change')
+ ;(input.getDOMNode() as HTMLInputElement).value = 'value'
+ expect(handler).toHaveBeenCalled()
+ })
+
+ it('should trigger select and change handler', () => {
+ const selectHandler = jest.fn()
+ const changeHandler = jest.fn()
+ const wrapper = mount(
+
+ )
+ wrapper.find('input').at(0).simulate('focus')
+ wrapper.find('.item').at(0).simulate('click', nativeEvent)
+ expect(selectHandler).toHaveBeenCalled()
+ expect(changeHandler).toHaveBeenCalled()
+ })
+
+ it('should work with custom options', () => {
+ const changeHandler = jest.fn()
+ const makeOption = (label: string, value: string): any => (
+
+ {label}
+
+ )
+ const options = mockOptions
+ .map(({ label, value }) => makeOption(label, value) as typeof AutoComplete.Option)
+ const wrapper = mount(
+
+ )
+ wrapper.find('input').at(0).simulate('focus')
+ wrapper.find('.item').at(0).simulate('click', nativeEvent)
+ expect(changeHandler).toHaveBeenCalled()
+ })
+
+ it('should work correctly without options', () => {
+ const wrapper = mount()
+ expect(() => wrapper.unmount()).not.toThrow()
+ })
+
+})
diff --git a/components/auto-complete/auto-complete-context.ts b/components/auto-complete/auto-complete-context.ts
index c7acc6e..56e949d 100644
--- a/components/auto-complete/auto-complete-context.ts
+++ b/components/auto-complete/auto-complete-context.ts
@@ -6,7 +6,7 @@ export interface AutoCompleteConfig {
updateValue?: Function
visible?: boolean
updateVisible?: Function
- size?: NormalSizes
+ size: NormalSizes
ref?: MutableRefObject
}
diff --git a/components/auto-complete/auto-complete-dropdown.tsx b/components/auto-complete/auto-complete-dropdown.tsx
index 07de10c..6dfcd10 100644
--- a/components/auto-complete/auto-complete-dropdown.tsx
+++ b/components/auto-complete/auto-complete-dropdown.tsx
@@ -20,10 +20,10 @@ const AutoCompleteDropdown: React.FC> = ({
return (
-