File tree 10 files changed +47
-32
lines changed
10 files changed +47
-32
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { tracked } from '@glimmer/tracking';
5
5
import { modifier } from ' ember-modifier' ;
6
6
import AuButton from ' ./au-button' ;
7
7
import AuContent from ' ./au-content' ;
8
- import AuIcon from ' ./au-icon' ;
8
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
9
9
import AuLoader from ' ./au-loader' ;
10
10
import AuToolbar from ' ./au-toolbar' ;
11
11
@@ -16,8 +16,8 @@ const autofocus = modifier(function autofocus(element: HTMLElement) {
16
16
export interface AuAccordionSignature {
17
17
Args: {
18
18
buttonLabel? : string ;
19
- iconClosed? : string ;
20
- iconOpen? : string ;
19
+ iconClosed? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
20
+ iconOpen? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
21
21
isOpenInitially? : boolean ;
22
22
loading? : boolean ;
23
23
reverse? : boolean ;
Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ import { on } from '@ember/modifier';
2
2
import { action } from ' @ember/object' ;
3
3
import Component from ' @glimmer/component' ;
4
4
import { tracked } from ' @glimmer/tracking' ;
5
- import AuIcon from ' ./au-icon' ;
5
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
6
6
7
7
export interface AuAlertSignature {
8
8
Args: {
9
9
closable? : boolean ;
10
- icon? : string ;
10
+ icon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
11
11
iconVisible? : boolean ;
12
12
onClose? : () => void ;
13
13
size? : ' tiny' | ' small' ;
Original file line number Diff line number Diff line change 1
1
import Component from ' @glimmer/component' ;
2
- import AuIcon from ' ./au-icon' ;
2
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
3
3
4
4
export interface AuBadgeSignature {
5
5
Args: {
6
- icon? : string ;
6
+ icon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
7
7
iconVisible? : boolean ;
8
8
number? : number ;
9
9
size? : ' small' ;
Original file line number Diff line number Diff line change 1
1
import Component from ' @glimmer/component' ;
2
- import AuIcon from ' ./au-icon' ;
2
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
3
3
import { LoadingAnimation } from ' ../private/components/loading-animation' ;
4
4
5
5
const SKINS = [
@@ -15,7 +15,7 @@ export interface AuButtonSignature {
15
15
alert? : boolean ;
16
16
disabled? : boolean ;
17
17
hideText? : boolean ;
18
- icon? : string ;
18
+ icon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
19
19
iconAlignment? : ' left' | ' right' ;
20
20
loading? : boolean ;
21
21
loadingMessage? : string ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { tracked } from '@glimmer/tracking';
6
6
import AuBadge from ' ./au-badge' ;
7
7
import AuButton from ' ./au-button' ;
8
8
import AuContent , { type AuContentSignature } from ' ./au-content' ;
9
- import AuIcon from ' ./au-icon' ;
9
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
10
10
11
11
export interface AuCardSignature {
12
12
Args: {
@@ -188,7 +188,7 @@ export default class AuCard extends Component<AuCardSignature> {
188
188
189
189
interface HeaderSignature {
190
190
Args: {
191
- badgeIcon? : string ;
191
+ badgeIcon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
192
192
badgeNumber? : number ;
193
193
badgeSize? : ' small' ;
194
194
badgeSkin? : ' border' | ' action' | ' brand' | ' success' | ' warning' | ' error' ;
Original file line number Diff line number Diff line change 1
1
import { getOwner } from ' @ember/owner' ;
2
2
import Component from ' @glimmer/component' ;
3
+ import { type ComponentLike } from ' @glint/template' ;
3
4
4
5
export interface AuIconSignature {
5
6
Args: {
6
7
alignment? : ' left' | ' right' ;
7
8
// TODO: We should deprecate the non-boolean versions since there is no reason to support them
8
9
ariaHidden? : boolean | ' true' | ' false' ;
9
- icon: string ;
10
+ icon: string | ComponentLike <{ Element : Element }> ;
10
11
size? : ' large' ;
11
12
};
12
- Element: SVGSVGElement ;
13
+ Element: Element ;
13
14
}
14
15
15
16
export default class AuIcon extends Component <AuIconSignature > {
@@ -39,16 +40,30 @@ export default class AuIcon extends Component<AuIconSignature> {
39
40
}
40
41
}
41
42
43
+ get iconComponent() {
44
+ return typeof this .args .icon !== ' string' && this .args .icon ;
45
+ }
46
+
42
47
<template >
43
- <svg
44
- role =" img"
45
- class =" au-c-icon au-c-icon--{{@ icon }} {{this .alignment }} {{this .size }} "
46
- aria-hidden ={{this .ariaHidden }}
47
- ...attributes
48
- >
49
- <use
50
- xlink:href =" {{this .iconPrefix }} @appuniversum/ember-appuniversum/appuniversum-symbolset.svg#{{@ icon }} "
51
- ></use >
52
- </svg >
48
+ {{#if this . iconComponent }}
49
+ {{#let this . iconComponent as | Icon | }}
50
+ <Icon
51
+ class =" au-c-icon {{this .alignment }} {{this .size }} "
52
+ aria-hidden ={{this .ariaHidden }}
53
+ ...attributes
54
+ />
55
+ {{/let }}
56
+ {{else }}
57
+ <svg
58
+ role =" img"
59
+ class =" au-c-icon au-c-icon--{{@ icon }} {{this .alignment }} {{this .size }} "
60
+ aria-hidden ={{this .ariaHidden }}
61
+ ...attributes
62
+ >
63
+ <use
64
+ xlink:href =" {{this .iconPrefix }} @appuniversum/ember-appuniversum/appuniversum-symbolset.svg#{{@ icon }} "
65
+ ></use >
66
+ </svg >
67
+ {{/if }}
53
68
</template >
54
69
}
Original file line number Diff line number Diff line change 1
1
import Component from ' @glimmer/component' ;
2
- import AuIcon from ' ./au-icon' ;
2
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
3
3
4
4
export interface AuInputSignature {
5
5
Args: {
6
6
disabled? : boolean ;
7
7
error? : boolean ;
8
- icon? : string ;
8
+ icon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
9
9
iconAlignment? : ' left' | ' right' ;
10
10
warning? : boolean ;
11
11
width? : ' block' ;
Original file line number Diff line number Diff line change 1
1
import Component from ' @glimmer/component' ;
2
- import AuIcon from ' ./au-icon' ;
2
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
3
3
4
4
const SKIN_CLASSES = {
5
5
primary: ' au-c-link' ,
@@ -12,7 +12,7 @@ const SKIN_CLASSES = {
12
12
export interface AuLinkExternalSignature {
13
13
Args: {
14
14
hideText? : boolean ;
15
- icon? : string ;
15
+ icon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
16
16
iconAlignment? : ' left' | ' right' ;
17
17
skin? :
18
18
| ' primary'
Original file line number Diff line number Diff line change 1
1
import { LinkTo } from ' @ember/routing' ;
2
2
import Component from ' @glimmer/component' ;
3
- import AuIcon from ' ./au-icon' ;
3
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
4
4
import linkToModels from ' ../private/helpers/link-to-models' ;
5
5
6
6
const SKIN_CLASSES = {
@@ -22,7 +22,7 @@ export interface AuLinkSignature {
22
22
| ' button-naked' ;
23
23
width? : ' block' ;
24
24
query? : Record <string , unknown >;
25
- icon? : string ;
25
+ icon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
26
26
route: string ;
27
27
hideText? : boolean ;
28
28
model? : unknown ;
Original file line number Diff line number Diff line change 1
1
import { on } from ' @ember/modifier' ;
2
2
import { LinkTo } from ' @ember/routing' ;
3
3
import Component from ' @glimmer/component' ;
4
- import AuIcon from ' ./au-icon' ;
4
+ import AuIcon , { type AuIconSignature } from ' ./au-icon' ;
5
5
import linkToModels from ' ../private/helpers/link-to-models' ;
6
6
7
7
const PILL_SIZES = [' small' ];
8
8
9
9
export interface AuPillSignature {
10
10
Args: {
11
- actionIcon? : string ;
11
+ actionIcon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
12
12
actionText? : string ;
13
13
draft? : boolean ;
14
14
href? : string ;
@@ -144,7 +144,7 @@ export default class AuPill extends Component<AuPillSignature> {
144
144
145
145
interface InnerSignature {
146
146
Args: {
147
- icon? : string ;
147
+ icon? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
148
148
iconAlignment? : ' left' | ' right' ;
149
149
hideText? : boolean ;
150
150
};
You can’t perform that action at this time.
0 commit comments