diff --git a/packages/angular-test-app/src/preview-examples/input-search.ts b/packages/angular-test-app/src/preview-examples/input-search.ts new file mode 100644 index 00000000000..6e25a486f0f --- /dev/null +++ b/packages/angular-test-app/src/preview-examples/input-search.ts @@ -0,0 +1,62 @@ +/* + * SPDX-FileCopyrightText: 2023 Siemens AG + * + * SPDX-License-Identifier: MIT + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-example', + template: ` +
+ + + + + + + + + +
+ `, +}) +export default class Input { + customSearch = '' + display = 'none' + + public ngOnInit(): void { + if(this.customSearch !== ''){ + this.display = 'block' + } + } + + clearInput() { + this.customSearch = '' + this.display = 'none' + } + + onKey(event: any) { + event.target.value === '' ? this.display = 'none' + : this.display = 'block' + } +} diff --git a/packages/core/src/components/input-group/input-group.scss b/packages/core/src/components/input-group/input-group.scss index bf265aae871..d630e18089a 100644 --- a/packages/core/src/components/input-group/input-group.scss +++ b/packages/core/src/components/input-group/input-group.scss @@ -28,4 +28,8 @@ .group-end { right: 0px; } + + ::slotted(*) { + display: flex; + } } diff --git a/packages/documentation/docs/controls/input.md b/packages/documentation/docs/controls/input.md index a1e1f17be4f..78567dc64e3 100644 --- a/packages/documentation/docs/controls/input.md +++ b/packages/documentation/docs/controls/input.md @@ -4,21 +4,25 @@ import SourceInput from './../auto-generated/previews/web-component/input.md' import SourceInputDisabled from './../auto-generated/previews/web-component/input-disabled.md' import SourceInputReadonly from './../auto-generated/previews/web-component/input-readonly.md' import SourceInputIcon from './../auto-generated/previews/web-component/input-with-icon.md' +import SourceInputSearch from './../auto-generated/previews/web-component/input-search.md' import SourceReactInput from './../auto-generated/previews/react/input.md' import SourceReactInputDisabled from './../auto-generated/previews/react/input-disabled.md' import SourceReactInputReadonly from './../auto-generated/previews/react/input-readonly.md' import SourceReactInputIcon from './../auto-generated/previews/react/input-with-icon.md' +import SourceReactInputSearch from './../auto-generated/previews/react/input-search.md' import SourceAngularInput from './../auto-generated/previews/angular/input.ts.md' import SourceAngularInputDisabled from './../auto-generated/previews/angular/input-disabled.ts.md' import SourceAngularInputReadonly from './../auto-generated/previews/angular/input-readonly.ts.md' import SourceAngularInputIcon from './../auto-generated/previews/angular/input-with-icon.ts.md' +import SourceAngularInputSearch from './../auto-generated/previews/angular/input-search.ts.md' import SourceVueInput from './../auto-generated/previews/vue/input.md' import SourceVueInputDisabled from './../auto-generated/previews/vue/input-disabled.md' import SourceVueInputReadonly from './../auto-generated/previews/vue/input-readonly.md' import SourceVueInputIcon from './../auto-generated/previews/vue/input-with-icon.md' +import SourceVueInputSearch from './../auto-generated/previews/vue/input-search.md' # Input @@ -68,3 +72,15 @@ frameworks={{ javascript: SourceInputIcon, vue: SourceVueInputIcon }}> + +### Search + + diff --git a/packages/html-test-app/src/preview-examples/input-search.html b/packages/html-test-app/src/preview-examples/input-search.html new file mode 100644 index 00000000000..6575c609b7b --- /dev/null +++ b/packages/html-test-app/src/preview-examples/input-search.html @@ -0,0 +1,51 @@ + + + + + + Input Search example + + +
+ + + + + + + + + +
+ + + + diff --git a/packages/react-test-app/src/preview-examples/input-search.tsx b/packages/react-test-app/src/preview-examples/input-search.tsx new file mode 100644 index 00000000000..c6d517731ee --- /dev/null +++ b/packages/react-test-app/src/preview-examples/input-search.tsx @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2023 Siemens AG + * + * SPDX-License-Identifier: MIT + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { IxIcon, IxIconButton, IxInputGroup } from '@siemens/ix-react'; +import React, { useState } from 'react'; + +export default () => { + const [message, setMessage] = useState(''); + + function reset() { + setMessage(''); + } + + let display = message === '' ? 'none' : 'block'; + + const handleChange = (event: { + target: { value: React.SetStateAction }; + }) => { + setMessage(event.target.value); + }; + + return ( +
+ + + + + + + + + +
+ ); +}; diff --git a/packages/vue-test-app/src/preview-examples/input-search.vue b/packages/vue-test-app/src/preview-examples/input-search.vue new file mode 100644 index 00000000000..cda8626c3a9 --- /dev/null +++ b/packages/vue-test-app/src/preview-examples/input-search.vue @@ -0,0 +1,39 @@ +/* * SPDX-FileCopyrightText: 2023 Siemens AG * * SPDX-License-Identifier: MIT * +* This source code is licensed under the MIT license found in the * LICENSE file +in the root directory of this source tree. */ + + +