22 Component ,
33 Input ,
44 EventEmitter ,
5- Output
5+ Output ,
6+ HostBinding
67} from "@angular/core" ;
78import { NG_VALUE_ACCESSOR , ControlValueAccessor } from "@angular/forms" ;
89
@@ -34,56 +35,53 @@ export class SearchChange {
3435@Component ( {
3536 selector : "ibm-search" ,
3637 template : `
37- <div class="bx--form-item">
38- <div
39- class="bx--search"
38+ <div
39+ class="bx--search"
40+ [ngClass]="{
41+ 'bx--search--sm': size === 'sm',
42+ 'bx--search--lg': size === 'lg',
43+ 'bx--search--light': theme === 'light'
44+ }"
45+ role="search">
46+ <label class="bx--label" [for]="id">Search</label>
47+ <input
48+ class="bx--search-input"
49+ type="text"
50+ role="search"
51+ [id]="id"
52+ [value]="value"
53+ [placeholder]="placeholder"
54+ [disabled]="disabled"
55+ [required]="required"
56+ (input)="onSearch($event.target.value)"/>
57+ <svg
58+ class="bx--search-magnifier"
59+ width="16"
60+ height="16"
61+ viewBox="0 0 16 16">
62+ <path
63+ d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zm4.936-1.27l4.563 4.557-.707.708-4.563-4.558a6.5 6.5 0 1 1 .707-.707z"
64+ fill-rule="nonzero"/>
65+ </svg>
66+ <button
67+ class="bx--search-close"
4068 [ngClass]="{
41- 'bx--search--sm': size === 'sm',
42- 'bx--search--lg': size === 'lg',
43- 'bx--search--light': theme === 'light'
69+ 'bx--search-close--hidden': !value || value === 0
4470 }"
45- role="search">
46- <label class="bx--label" [for]="id">Search</label>
47- <input
48- class="bx--search-input"
49- type="text"
50- role="search"
51- [id]="id"
52- [value]="value"
53- [placeholder]="placeholder"
54- [disabled]="disabled"
55- [required]="required"
56- [attr.aria-labelledby]="ariaLabelledby"
57- (input)="onSearch($event.target.value)"/>
71+ title="Clear search input"
72+ [attr.aria-label]="ariaLabel"
73+ (click)="clearSearch()">
5874 <svg
59- class="bx--search-magnifier"
6075 width="16"
6176 height="16"
62- viewBox="0 0 16 16">
77+ viewBox="0 0 16 16"
78+ xmlns="http://www.w3.org/2000/svg">
6379 <path
64- d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zm4.936-1.27l4.563 4.557-.707.708-4.563-4.558a6.5 6.5 0 1 1 .707-.707z"
65- fill-rule="nonzero"/>
80+ d="M8 6.586L5.879 4.464 4.464 5.88 6.586 8l-2.122 2.121 1.415 1.415L8 9.414l2.121 2.122 1.415-1.415L9.414
81+ 8l2.122-2.121-1.415-1.415L8 6.586zM8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"
82+ fill-rule="evenodd"/>
6683 </svg>
67- <button
68- class="bx--search-close"
69- [ngClass]="{
70- 'bx--search-close--hidden': !value || value === 0
71- }"
72- title="Clear search input"
73- [attr.aria-label]="ariaLabel"
74- (click)="clearSearch()">
75- <svg
76- width="16"
77- height="16"
78- viewBox="0 0 16 16"
79- xmlns="http://www.w3.org/2000/svg">
80- <path
81- d="M8 6.586L5.879 4.464 4.464 5.88 6.586 8l-2.122 2.121 1.415 1.415L8 9.414l2.121 2.122 1.415-1.415L9.414
82- 8l2.122-2.121-1.415-1.415L8 6.586zM8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"
83- fill-rule="evenodd"/>
84- </svg>
85- </button>
86- </div>
84+ </button>
8785 </div>
8886 ` ,
8987 providers : [
@@ -100,6 +98,8 @@ export class Search implements ControlValueAccessor {
10098 */
10199 static searchCount = 0 ;
102100
101+ @HostBinding ( "class.bx--form-item" ) containerClass = true ;
102+
103103 /**
104104 * `light` or `dark` search theme.
105105 */
@@ -137,11 +137,6 @@ export class Search implements ControlValueAccessor {
137137 */
138138 // tslint:disable-next-line:no-input-rename
139139 @Input ( "aria-label" ) ariaLabel = "Clear search input" ;
140- /**
141- * Used to set the `aria-labelledby` attribute on the input element.
142- */
143- // tslint:disable-next-line:no-input-rename
144- @Input ( "aria-labelledby" ) ariaLabelledby : string ;
145140 /**
146141 * Emits event notifying other classes when a change in state occurs in the input.
147142 */
0 commit comments