Skip to content

Commit d57f029

Browse files
authored
Merge branch 'master' into dTsvetkov/fix-8207-master
2 parents 703ef73 + 673a9f1 commit d57f029

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ All notable changes for each version of this project will be documented in this
1919
- **Breaking Change** -
2020
`show` and `hide` methods have been deprecated. `open` and `close` should be used instead.
2121
`onShowing`,`onShown`,`onHiding` and `onHiden` events have been deprecated. `onOpening`, `onOpened`, `onClosing` and `onClosed`should be used instead.
22+
- `IgxInputGroup`
23+
- Added new property `theme` that allows you to set the theme explicitly and at runtime.
2224

2325
## 11.0.4
2426

projects/igniteui-angular/src/lib/input-group/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Ignite UI for Angular Hint provides a helper text placed below the input. The hi
4848
| Name | Description |
4949
| :--- | :--- |
5050
| type | How the input will be styled. The allowed values are line, box, border and search. The default is line.|
51+
| theme | Allows the user to change the theme of the input group. |
5152
| position | **`Hint` API**. Where the hint will be placed. The allowed values are start and end. The default value is start. |
5253
| displayDensity | Allows the user to change the default display density of the input group. |
5354

projects/igniteui-angular/src/lib/input-group/input-group.component.ts

+34-8
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ export type IgxInputGroupTheme = keyof typeof IgxInputGroupThemeEnum;
4949
selector: 'igx-input-group',
5050
templateUrl: 'input-group.component.html',
5151
providers: [
52-
{ provide: IgxInputGroupBase, useExisting: IgxInputGroupComponent }
52+
{ provide: IgxInputGroupBase, useExisting: IgxInputGroupComponent },
5353
],
5454
})
5555
export class IgxInputGroupComponent extends DisplayDensityBase
5656
implements IgxInputGroupBase, AfterContentInit {
5757
private _type: IgxInputGroupType = null;
5858
private _filled = false;
59-
private _variant: IgxInputGroupTheme = 'material';
59+
private _variant: IgxInputGroupTheme;
6060

6161
/**
6262
* An @Input property that sets the value of `id` attribute. If not provided it will be automatically generated.
@@ -215,7 +215,31 @@ export class IgxInputGroupComponent extends DisplayDensityBase
215215
return this._type || this._inputGroupType || 'line';
216216
}
217217

218-
/** @hidden @internal */
218+
/**
219+
* Sets the theme of the input.
220+
* Allowed values of type IgxInputGroupTheme.
221+
* ```typescript
222+
* @ViewChild("MyInputGroup")
223+
* public inputGroup: IgxInputGroupComponent;
224+
* ngAfterViewInit() {
225+
* let inputTheme = 'fluent';
226+
* }
227+
*/
228+
@Input()
229+
public set theme(variant: IgxInputGroupTheme) {
230+
this._variant = variant;
231+
}
232+
233+
/**
234+
* Returns the theme of the input.
235+
* The returned value is of tyep IgxInputGroupType.
236+
* ```typescript
237+
* @ViewChild("MyInputGroup")
238+
* public inputGroup: IgxInputGroupComponent;
239+
* ngAfterViewInit() {
240+
* let inputTheme = this.inputGroup.theme;
241+
* }
242+
*/
219243
public get theme(): IgxInputGroupTheme {
220244
return this._variant;
221245
}
@@ -253,11 +277,13 @@ export class IgxInputGroupComponent extends DisplayDensityBase
253277
}
254278

255279
ngAfterContentInit() {
256-
const variant = this.document.defaultView
257-
.getComputedStyle(this.element.nativeElement)
258-
.getPropertyValue('--igx-input-group-variant')
259-
.trim();
260-
this._variant = variant as IgxInputGroupTheme;
280+
if (!this.theme) {
281+
const variant = this.document.defaultView
282+
.getComputedStyle(this.element.nativeElement)
283+
.getPropertyValue('--igx-input-group-variant')
284+
.trim();
285+
this._variant = variant as IgxInputGroupTheme;
286+
}
261287
}
262288
/**
263289
* Returns whether the `IgxInputGroupComponent` has hints.

src/app/input-group/input-group.sample.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<br />
6161

6262
<!-- text field prefix/suffix -->
63-
<igx-input-group [displayDensity]="density" [type]="inputType">
63+
<igx-input-group [displayDensity]="density" [type]="inputType" theme="fluent">
6464
<label igxLabel>Web address</label>
6565
<igx-prefix>
6666
http://

0 commit comments

Comments
 (0)