Skip to content

Commit fc66cb3

Browse files
authored
Merge branch '9.0.x' into mpopov/6720-9.0.x
2 parents aba2362 + 65c212b commit fc66cb3

File tree

2 files changed

+106
-61
lines changed

2 files changed

+106
-61
lines changed

projects/igniteui-angular/src/lib/badge/badge.component.ts

Lines changed: 71 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { IgxIconModule } from '../icon/index';
44

55
let NEXT_ID = 0;
66

7+
/**
8+
* Determines the igxBadge type
9+
*/
710
export enum IgxBadgeType {
811
PRIMARY = 'primary',
912
INFO = 'info',
@@ -12,28 +15,26 @@ export enum IgxBadgeType {
1215
ERROR = 'error'
1316
}
1417
/**
15-
* **Ignite UI for Angular Badge** -
16-
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/badge.html)
18+
* Badge provides visual notifications used to decorate avatars, menus, etc.
19+
*
20+
* @igxModule IgxBadgeModule
21+
*
22+
* @igxTheme igx-badge-theme
1723
*
24+
* @igxKeywords badge, icon, notification
25+
*
26+
* @igxGroup Data Entry & Display
27+
*
28+
* @remarks
1829
* The Ignite UI Badge is used to decorate avatars, navigation menus, or other components in the
1930
* application when visual notification is needed. They are usually designed as icons with a predefined
2031
* style to communicate information, success, warnings, or errors.
2132
*
22-
* Example:
33+
* @example
2334
* ```html
24-
* <igx-avatar icon="person" roundShape="true" size="small">
25-
* <igx-badge icon="check" type="success" class="badge-style">
26-
* </igx-badge>
35+
* <igx-avatar>
36+
* <igx-badge icon="check" type="success"></igx-badge>
2737
* </igx-avatar>
28-
* ```
29-
* The `badge-style` class is used to position the badge:
30-
* ```css
31-
* .badge-style {
32-
* position: absolute;
33-
* bottom: -6px;
34-
* right:-50px;
35-
* }
36-
* ```
3738
*/
3839
@Component({
3940
selector: 'igx-badge',
@@ -42,88 +43,113 @@ export enum IgxBadgeType {
4243
export class IgxBadgeComponent {
4344

4445
/**
45-
* An @Input property that sets the value of the `id` attribute.
46+
* Sets/gets the `id` of the badge.
47+
*
48+
* @remarks
49+
* If not set, the `id` will have value `"igx-badge-0"`.
50+
*
51+
* @example
4652
* ```html
47-
*<igx-badge id="igx-badge-2" icon="check" type="success" class="badge-style"></igx-badge>
53+
* <igx-badge id="igx-badge-2"></igx-badge>
4854
* ```
4955
*/
5056
@HostBinding('attr.id')
5157
@Input()
5258
public id = `igx-badge-${NEXT_ID++}`;
5359

5460
/**
55-
* An @Input property controlling the type of the badge.
61+
* Sets/gets the type of the badge.
62+
*
63+
* @remarks
5664
* Allowed values are `primary`, `info`, `success`, `warning`, `error`.
5765
* Providing an invalid value won't display a badge.
66+
*
67+
* @example
5868
* ```html
59-
*<igx-badge type="success" icon="check" class="badge-style"></igx-badge>
69+
* <igx-badge type="success"></igx-badge>
6070
* ```
6171
*/
6272
@Input()
6373
public type: string | IgxBadgeType = IgxBadgeType.PRIMARY;
6474

6575
/**
66-
* An @Input property that sets the value to be displayed inside the badge.
76+
* Sets/gets the value to be displayed inside the badge.
77+
*
78+
* @remarks
6779
* If an `icon` property is already set the `icon` will be displayed.
68-
* If neither a `value` nor an `icon` is set the contentent of the badge will be empty.
80+
* If neither a `value` nor an `icon` is set the content of the badge will be empty.
81+
*
82+
* @example
6983
* ```html
70-
*<igx-badge value="11" type="success" class="badge-style"></igx-badge>
84+
* <igx-badge value="11"></igx-badge>
7185
* ```
7286
*/
7387
@Input()
7488
public value = '';
7589

7690
/**
77-
* Set an icon for the badge from the material icons set.
91+
* Sets/gets an icon for the badge from the material icons set.
92+
*
93+
* @remarks
7894
* Has priority over the `value` property.
7995
* If neither a `value` nor an `icon` is set the content of the badge will be empty.
8096
* Providing an invalid value won't display anything.
97+
*
98+
* @example
8199
* ```html
82-
*<igx-badge icon="check" type="success" class="badge-style" value="11"></igx-badge>
100+
* <igx-badge icon="check"></igx-badge>
83101
* ```
84102
*/
85103
@Input()
86104
public icon: string;
87105

88106
/**
89-
* This allows you to set value to role attribute.
90-
*```html
91-
*@ViewChild("MyBadge", { read: IgxBadgeComponent })
92-
*public badge: IgxBadgeComponent;
93-
* //...
94-
*badge.label = "badge-status";
107+
* Sets/gets the role attribute value.
108+
*
109+
* @example
110+
* ```typescript
111+
* @ViewChild("MyBadge", { read: IgxBadgeComponent })
112+
* public badge: IgxBadgeComponent;
113+
*
114+
* badge.role = 'status';
95115
* ```
96116
*/
97117
@HostBinding('attr.role')
98118
public role = 'status';
99119

100120
/**
101-
* This allows you to disable igx-badge class. The default it's applied.
102-
*```html
103-
*@ViewChild("MyBadge", { read: IgxBadgeComponent })
104-
*public badge: IgxBadgeComponent;
105-
* //...
106-
*badge.cssClass = false;
121+
* Sets/gets the the css class to use on the badge.
122+
*
123+
* @example
124+
* ```typescript
125+
* @ViewChild("MyBadge", { read: IgxBadgeComponent })
126+
* public badge: IgxBadgeComponent;
127+
*
128+
* badge.cssClass = 'my-badge-class';
107129
* ```
108130
*/
109131
@HostBinding('class.igx-badge')
110132
public cssClass = 'igx-badge';
111133

112134
/**
113-
* This allows you to set value to aria-label attribute.
114-
*```html
115-
*@ViewChild("MyBadge", { read: IgxBadgeComponent })
116-
*public badge: IgxBadgeComponent;
117-
* //...
118-
*badge.label = "icon-badge";
135+
* Sets/gets the aria-label attribute value.
136+
*
137+
* @example
138+
* ```typescript
139+
* @ViewChild("MyBadge", { read: IgxBadgeComponent })
140+
* public badge: IgxBadgeComponent;
141+
*
142+
* badge.label = 'badge';
119143
* ```
120144
*/
121145
@HostBinding('attr.aria-label')
122146
public label = 'badge';
123147

124148
/**
149+
* Defines a human-readable, accessor, author-localized description for
150+
* the `type` and the `icon` or `value` of the element.
125151
* @hidden
126-
* Defines a human-readable, accessor, author-localized description for the `type` and the `icon` or `value` of the element.
152+
* @internal
127153
*/
128154
get roleDescription() {
129155
let message: string;
@@ -141,9 +167,10 @@ export class IgxBadgeComponent {
141167
}
142168

143169
/**
144-
* @hidden
145170
* Method which makes the name of the class more descriptive.
146171
* This helps the styling of the badges.
172+
* @hidden
173+
* @internal
147174
*/
148175
public setClasses() {
149176
let classes = {};

projects/igniteui-angular/src/lib/icon/icon.component.ts

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@ import { Component, ElementRef, HostBinding, Input, OnInit, TemplateRef, ViewChi
22
import { IgxIconService } from './icon.service';
33

44
/**
5-
* **Ignite UI for Angular Icon** -
6-
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/icon.html)
5+
* Icon provides a way to include material icons to markup
6+
*
7+
* @igxModule IgxIconModule
8+
*
9+
* @igxTheme igx-icon-theme
10+
*
11+
* @igxKeywords icon, picture
12+
*
13+
* @igxGroup Display
14+
*
15+
* @remarks
716
*
817
* The Ignite UI Icon makes it easy for developers to include material design icons directly in their markup. The icons
918
* support custom colors and can be marked as active or disabled using the `isActive` property. This will change the appearance
1019
* of the icon.
1120
*
12-
* Example:
21+
* @example
1322
* ```html
1423
* <igx-icon color="#00ff00" isActive="true">home</igx-icon>
1524
* ```
@@ -33,20 +42,16 @@ export class IgxIconComponent implements OnInit {
3342

3443
/**
3544
* This allows you to change the value of `class.igx-icon`. By default it's `igx-icon`.
36-
*```typescript
37-
*@ViewChild("MyIcon") public icon: IgxIconComponent;
38-
*constructor(private cdRef:ChangeDetectorRef) {}
39-
*ngAfterViewInit() {
40-
* this.icon.cssClass = "";
41-
* this.cdRef.detectChanges();
42-
*}
43-
* ```
45+
*
46+
* @hidden
47+
* @internal
4448
*/
4549
@HostBinding('class.igx-icon')
4650
public cssClass = 'igx-icon';
4751

4852
/**
4953
* This allows you to disable the `aria-hidden` attribute. By default it's applied.
54+
* @example
5055
*```typescript
5156
*@ViewChild("MyIcon") public icon: IgxIconComponent;
5257
*constructor(private cdRef:ChangeDetectorRef) {}
@@ -61,8 +66,9 @@ export class IgxIconComponent implements OnInit {
6166

6267
/**
6368
* An @Input property that sets the value of the `id` attribute.
69+
* @example
6470
*```html
65-
*<igx-icon id="igx-icon-1" fontSet="material" color="blue" [isActive]="false">settings</igx-icon>
71+
*<igx-icon id="igx-icon-1" fontSet="material">settings</igx-icon>
6672
*```
6773
*/
6874
@HostBinding('attr.id')
@@ -71,36 +77,39 @@ export class IgxIconComponent implements OnInit {
7177

7278
/**
7379
* An @Input property that sets the value of the `fontSet`. By default it's "material".
80+
* @example
7481
*```html
75-
*<igx-icon fontSet="material" color="blue" [isActive]="false">settings</igx-icon>
82+
*<igx-icon fontSet="material">settings</igx-icon>
7683
*```
7784
*/
7885
@Input('fontSet')
7986
public font: string;
8087

8188
/**
8289
* An @Input property that allows you to disable the `active` property. By default it's applied.
90+
* @example
8391
*```html
84-
*<igx-icon [isActive]="false" fontSet="material" color="blue">settings</igx-icon>
92+
*<igx-icon [isActive]="false">settings</igx-icon>
8593
*```
8694
*/
8795
@Input('isActive')
8896
public active = true;
8997

9098
/**
9199
* An @Input property that allows you to change the `iconColor` of the icon.
100+
* @example
92101
*```html
93-
*<igx-icon color="blue" [isActive]="true" fontSet="material">settings</igx-icon>
102+
*<igx-icon color="blue">settings</igx-icon>
94103
*```
95104
*/
96105
@Input('color')
97106
public iconColor: string;
98107

99108
/**
100109
* An @Input property that allows you to set the `iconName` of the icon.
101-
* The `iconName` can be set using the `name` property.
110+
* @example
102111
*```html
103-
*<igx-icon color="blue" [isActive]="true" fontSet="material">question_answer</igx-icon>
112+
*<igx-icon name="contains" fontSet="filter-icons"></igx-icon>
104113
*```
105114
*/
106115
@Input('name')
@@ -119,13 +128,15 @@ export class IgxIconComponent implements OnInit {
119128

120129
/**
121130
* @hidden
131+
* @internal
122132
*/
123133
ngOnInit() {
124134
this.updateIconClass();
125135
}
126136

127137
/**
128138
* An accessor that returns the value of the font property.
139+
* @example
129140
*```typescript
130141
*@ViewChild("MyIcon")
131142
*public icon: IgxIconComponent;
@@ -140,6 +151,7 @@ export class IgxIconComponent implements OnInit {
140151

141152
/**
142153
* An accessor that returns the value of the active property.
154+
* @example
143155
*```typescript
144156
*@ViewChild("MyIcon")
145157
*public icon: IgxIconComponent;
@@ -154,6 +166,7 @@ export class IgxIconComponent implements OnInit {
154166

155167
/**
156168
* An accessor that returns inactive property.
169+
* @example
157170
*```typescript
158171
*@ViewChild("MyIcon")
159172
*public icon: IgxIconComponent;
@@ -169,6 +182,7 @@ export class IgxIconComponent implements OnInit {
169182

170183
/**
171184
* An accessor that returns the opposite value of the `iconColor` property.
185+
* @example
172186
*```typescript
173187
*@ViewChild("MyIcon")
174188
*public icon: IgxIconComponent;
@@ -184,6 +198,7 @@ export class IgxIconComponent implements OnInit {
184198

185199
/**
186200
* An accessor that returns the value of the iconName property.
201+
* @example
187202
*```typescript
188203
*@ViewChild("MyIcon")
189204
*public icon: IgxIconComponent;
@@ -199,6 +214,7 @@ export class IgxIconComponent implements OnInit {
199214
/**
200215
* An accessor that returns the key of the SVG image.
201216
* The key consists of the fontSet and the iconName separated by underscore.
217+
* @example
202218
*```typescript
203219
*@ViewChild("MyIcon")
204220
*public icon: IgxIconComponent;
@@ -217,6 +233,7 @@ export class IgxIconComponent implements OnInit {
217233

218234
/**
219235
* An accessor that returns a TemplateRef to explicit, svg or no ligature.
236+
* @example
220237
*```typescript
221238
*@ViewChild("MyIcon")
222239
*public icon: IgxIconComponent;
@@ -239,6 +256,7 @@ export class IgxIconComponent implements OnInit {
239256

240257
/**
241258
* @hidden
259+
* @internal
242260
*/
243261
private updateIconClass() {
244262
const className = this.iconService.fontSetClassName(this.font);

0 commit comments

Comments
 (0)