File tree 3 files changed +13
-10
lines changed
3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -5,19 +5,22 @@ 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
12
12
const autofocus = modifier (function autofocus(element : HTMLElement ) {
13
13
element .focus ();
14
14
});
15
15
16
+ const iconTestName = (icon : AuIconSignature [' Args' ][' icon' ]): string =>
17
+ typeof icon === ' string' ? icon : icon .toString ();
18
+
16
19
export interface AuAccordionSignature {
17
20
Args: {
18
21
buttonLabel? : string ;
19
- iconClosed? : string ;
20
- iconOpen? : string ;
22
+ iconClosed? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
23
+ iconOpen? : AuIconSignature [ ' Args ' ][ ' icon ' ] ;
21
24
isOpenInitially? : boolean ;
22
25
loading? : boolean ;
23
26
reverse? : boolean ;
@@ -107,15 +110,15 @@ export default class AuAccordion extends Component<AuAccordionSignature> {
107
110
@ alignment =" left"
108
111
@ size =" large"
109
112
@ ariaHidden ={{ true }}
110
- data-test-accordion-icon-open ={{this .iconOpen }}
113
+ data-test-accordion-icon-open ={{iconTestName this . iconOpen}}
111
114
/>
112
115
{{else }}
113
116
<AuIcon
114
117
@ icon ={{this .iconClosed }}
115
118
@ alignment =" left"
116
119
@ size =" large"
117
120
@ ariaHidden ={{ true }}
118
- data-test-accordion-icon-closed ={{this .iconClosed }}
121
+ data-test-accordion-icon-closed ={{iconTestName this . iconClosed}}
119
122
/>
120
123
{{/if }}
121
124
</Group >
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ export interface AuIconSignature {
7
7
alignment? : ' left' | ' right' ;
8
8
// TODO: We should deprecate the non-boolean versions since there is no reason to support them
9
9
ariaHidden? : boolean | ' true' | ' false' ;
10
- icon: string | ComponentLike <Record < string , never > >;
10
+ icon: string | ComponentLike <{ Element : Element } >;
11
11
size? : ' large' ;
12
12
};
13
- Element: SVGSVGElement ;
13
+ Element: Element ;
14
14
}
15
15
16
16
export default class AuIcon extends Component <AuIconSignature > {
@@ -47,10 +47,10 @@ export default class AuIcon extends Component<AuIconSignature> {
47
47
<template >
48
48
{{#if this . iconComponent }}
49
49
{{#let this . iconComponent as | Icon | }}
50
- {{! @glint-expect-error: glint doesn't like us setting attributes on the passed component }}
51
50
<Icon
52
51
class =" au-c-icon {{this .alignment }} {{this .size }} "
53
52
aria-hidden ={{this .ariaHidden }}
53
+ ...attributes
54
54
/>
55
55
{{/let }}
56
56
{{else }}
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'
You can’t perform that action at this time.
0 commit comments