30 files changed +341
-130
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @hashicorp/ember-flight-icons " : minor
3
+ ---
4
+
5
+ ` FlightIcon ` - converted component to TypeScript and published types
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import type { HdsYieldSignature } from '../yield';
18
18
import type { HdsAlertColors , HdsAlertTypes } from './types.ts' ;
19
19
import type { HdsAlertTitleSignature } from './title.ts' ;
20
20
import type { HdsAlertDescriptionSignature } from './description.ts' ;
21
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
21
22
22
23
export const TYPES : string [ ] = Object . values ( HdsAlertTypeValues ) ;
23
24
export const DEFAULT_COLOR = HdsAlertColorValues . Neutral ;
@@ -39,7 +40,7 @@ export interface HdsAlertSignature {
39
40
Args : {
40
41
type : HdsAlertTypes ;
41
42
color ?: HdsAlertColors ;
42
- icon ?: string | false ;
43
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] | false ;
43
44
// eslint-disable-next-line @typescript-eslint/no-explicit-any
44
45
onDismiss ?: ( event : MouseEvent , ...args : any [ ] ) => void ;
45
46
} ;
@@ -100,7 +101,7 @@ export default class HdsAlertComponent extends Component<HdsAlertSignature> {
100
101
* @default null
101
102
* @description The name of the icon to be used.
102
103
*/
103
- get icon ( ) {
104
+ get icon ( ) : FlightIconSignature [ 'Args' ] [ 'name' ] | false {
104
105
const { icon } = this . args ;
105
106
106
107
// If `icon` isn't passed, use the pre-defined one from `color`
Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ import Component from '@glimmer/component';
8
8
import type { HdsInteractiveSignature } from '../interactive/' ;
9
9
import type { HdsLinkColors , HdsLinkIconPositions } from '../link/types.ts' ;
10
10
import type { HdsLinkInlineSignature } from '../link/inline.ts' ;
11
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
11
12
12
13
export interface HdsAppFooterLinkSignature {
13
14
Args : HdsInteractiveSignature [ 'Args' ] & {
14
15
color ?: HdsLinkColors ;
15
- icon ?: string ;
16
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
16
17
iconPosition ?: HdsLinkIconPositions ;
17
18
} ;
18
19
Blocks : {
Original file line number Diff line number Diff line change @@ -12,14 +12,15 @@ import type { HdsInteractiveSignature } from '../interactive/';
12
12
import { HdsAppFooterStatusLinkStatusValues } from './types.ts' ;
13
13
import type { HdsAppFooterStatusTypes } from './types.ts' ;
14
14
import type { HdsAppFooterLinkSignature } from './link.ts' ;
15
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
15
16
16
17
export const STATUSES = HdsAppFooterStatusLinkStatusValues ;
17
18
18
19
export interface HdsAppFooterStatusLinkSignature {
19
20
Args : HdsInteractiveSignature [ 'Args' ] & {
20
21
itemStyle ?: SafeString ;
21
22
status ?: HdsAppFooterStatusTypes ;
22
- statusIcon ?: string ;
23
+ statusIcon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
23
24
statusIconColor ?: string ;
24
25
text ?: string ;
25
26
} ;
Original file line number Diff line number Diff line change 2
2
* Copyright (c) HashiCorp, Inc.
3
3
* SPDX-License-Identifier: MPL-2.0
4
4
*/
5
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
5
6
6
7
export enum HdsAppFooterStatusValues {
7
8
Operational = 'operational' ,
@@ -16,7 +17,7 @@ export const HdsAppFooterStatusLinkStatusValues: Record<
16
17
HdsAppFooterStatusValues ,
17
18
{
18
19
text : string ;
19
- iconName : string ;
20
+ iconName : FlightIconSignature [ 'Args' ] [ 'name' ] ;
20
21
}
21
22
> = {
22
23
[ HdsAppFooterStatusValues . Operational ] : {
Original file line number Diff line number Diff line change 5
5
6
6
import TemplateOnlyComponent from '@ember/component/template-only' ;
7
7
8
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
9
+
8
10
export interface HdsApplicationStateHeaderSignature {
9
11
Args : {
10
12
title ?: string ;
11
13
errorCode ?: string ;
12
- icon ?: string ;
14
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
13
15
} ;
14
16
Element : HTMLDivElement ;
15
17
}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
13
13
} from './types.ts' ;
14
14
15
15
import type { HdsBadgeColors , HdsBadgeSizes , HdsBadgeTypes } from './types.ts' ;
16
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
16
17
17
18
export const SIZES : string [ ] = Object . values ( HdsBadgeSizeValues ) ;
18
19
export const TYPES : string [ ] = Object . values ( HdsBadgeTypeValues ) ;
@@ -27,7 +28,7 @@ export interface HdsBadgeSignature {
27
28
type ?: HdsBadgeTypes ;
28
29
color ?: HdsBadgeColors ;
29
30
text : string ;
30
- icon ?: string | null ;
31
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
31
32
isIconOnly ?: boolean ;
32
33
} ;
33
34
Element : HTMLDivElement ;
Original file line number Diff line number Diff line change 6
6
import Component from '@glimmer/component' ;
7
7
import { assert } from '@ember/debug' ;
8
8
import type { HdsInteractiveSignature } from '../interactive/' ;
9
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
9
10
10
11
export const DEFAULT_SIZE = 'medium' ;
11
12
export const DEFAULT_COLOR = 'primary' ;
@@ -23,7 +24,7 @@ export interface HdsButtonSignature {
23
24
size ?: HdsButtonSize ;
24
25
color ?: HdsButtonColor ;
25
26
text : string ;
26
- icon ?: string ;
27
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
27
28
iconPosition ?: HdsButtonIconPosition ;
28
29
isIconOnly ?: boolean ;
29
30
isFullWidth ?: boolean ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { HdsCopyButtonSizeValues } from './types.ts';
11
11
import type { HdsCopyButtonSizes } from './types.ts' ;
12
12
import type { HdsButtonSignature } from '../../button/' ;
13
13
import type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts' ;
14
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
14
15
15
16
export const DEFAULT_SIZE = HdsCopyButtonSizeValues . Medium ;
16
17
export const SIZES : string [ ] = Object . values ( HdsCopyButtonSizeValues ) ;
@@ -40,7 +41,7 @@ export default class HdsCopyButtonComponent extends Component<HdsCopyButtonSigna
40
41
* @description The icon to be displayed for each status; automatically calculated based on the tracked property `status`.
41
42
*/
42
43
get icon ( ) {
43
- let icon = DEFAULT_ICON ;
44
+ let icon : FlightIconSignature [ 'Args' ] [ 'name' ] = DEFAULT_ICON ;
44
45
if ( this . status === 'success' ) {
45
46
icon = SUCCESS_ICON ;
46
47
} else if ( this . status === 'error' ) {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { action } from '@ember/object';
10
10
import { HdsCopySnippetColorValues } from './types.ts' ;
11
11
import type { HdsCopySnippetColors } from './types.ts' ;
12
12
import type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts' ;
13
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
13
14
14
15
export const DEFAULT_COLOR = HdsCopySnippetColorValues . Primary ;
15
16
export const COLORS : string [ ] = Object . values ( HdsCopySnippetColorValues ) ;
@@ -56,7 +57,7 @@ export default class HdsCopySnippetComponent extends Component<HdsCopySnippetSig
56
57
* @description Determines the icon to be used, based on the success state. Note that this is auto-tracked because it depends on a tracked property (status).
57
58
*/
58
59
get icon ( ) {
59
- let icon = DEFAULT_ICON ;
60
+ let icon : FlightIconSignature [ 'Args' ] [ 'name' ] = DEFAULT_ICON ;
60
61
if ( this . status === 'success' ) {
61
62
icon = SUCCESS_ICON ;
62
63
} else if ( this . status === 'error' ) {
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import type {
18
18
HdsIconTileSizes ,
19
19
} from './types.ts' ;
20
20
21
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
22
+
21
23
export const DEFAULT_SIZE = 'medium' ;
22
24
export const DEFAULT_COLOR = 'neutral' ;
23
25
export const SIZES : string [ ] = Object . values ( HdsIconTileSizeValues ) ;
@@ -32,8 +34,8 @@ export interface HdsIconTileSignature {
32
34
size ?: HdsIconTileSizes ;
33
35
color ?: HdsIconTileColors ;
34
36
logo ?: HdsIconTileProducts ;
35
- icon ?: string | null ;
36
- iconSecondary ?: string ;
37
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
38
+ iconSecondary ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
37
39
} ;
38
40
Element : HTMLDivElement ;
39
41
}
@@ -94,7 +96,7 @@ export default class HdsIconTileComponent extends Component<HdsIconTileSignature
94
96
* @type {string|null }
95
97
* @default null
96
98
*/
97
- get icon ( ) {
99
+ get icon ( ) : FlightIconSignature [ 'Args' ] [ 'name' ] | undefined {
98
100
if ( this . args . logo ) {
99
101
// for the logo version we use the colored versions directly
100
102
return `${ this . args . logo } -color` ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { HdsLinkColorValues, HdsLinkIconPositionValues } from './types.ts';
9
9
10
10
import type { HdsInteractiveSignature } from '../interactive/' ;
11
11
import type { HdsLinkColors , HdsLinkIconPositions } from './types.ts' ;
12
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
12
13
13
14
export const DEFAULT_ICONPOSITION = HdsLinkIconPositionValues . Trailing ;
14
15
export const DEFAULT_COLOR = HdsLinkColorValues . Primary ;
@@ -18,7 +19,7 @@ export const COLORS: string[] = Object.values(HdsLinkColorValues);
18
19
export interface HdsLinkInlineSignature {
19
20
Args : HdsInteractiveSignature [ 'Args' ] & {
20
21
color ?: HdsLinkColors ;
21
- icon ?: string ;
22
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
22
23
iconPosition ?: HdsLinkIconPositions ;
23
24
} ;
24
25
Blocks : {
Original file line number Diff line number Diff line change @@ -17,13 +17,14 @@ import type {
17
17
HdsLinkIconPositions ,
18
18
HdsLinkStandaloneSizes ,
19
19
} from './types.ts' ;
20
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
20
21
21
22
export interface HdsLinkStandaloneSignature {
22
23
Args : HdsInteractiveSignature [ 'Args' ] & {
23
24
size ?: HdsLinkStandaloneSizes ;
24
25
color ?: HdsLinkColors ;
25
26
text : string ;
26
- icon : string ;
27
+ icon : FlightIconSignature [ 'Args' ] [ 'name' ] ;
27
28
iconPosition ?: HdsLinkIconPositions ;
28
29
} ;
29
30
Element : HdsInteractiveSignature [ 'Element' ] ;
Original file line number Diff line number Diff line change 6
6
import Component from '@glimmer/component' ;
7
7
import { assert } from '@ember/debug' ;
8
8
9
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
9
10
import type { HdsInteractiveSignature } from '../../interactive/' ;
10
11
11
12
interface HdsSideNavHeaderHomeLinkSignature {
12
13
Args : HdsInteractiveSignature [ 'Args' ] & {
13
- icon : string ;
14
+ icon : FlightIconSignature [ 'Args' ] [ 'name' ] ;
14
15
color ?: string ;
15
16
ariaLabel : string ;
16
17
} ;
Original file line number Diff line number Diff line change 6
6
import Component from '@glimmer/component' ;
7
7
import { assert } from '@ember/debug' ;
8
8
9
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
9
10
import type { HdsInteractiveSignature } from '../../interactive/' ;
10
11
11
12
interface HdsSideNavHeaderIconButtonSignature {
12
13
Args : HdsInteractiveSignature [ 'Args' ] & {
13
- icon : string ;
14
+ icon : FlightIconSignature [ 'Args' ] [ 'name' ] ;
14
15
ariaLabel : string ;
15
16
} ;
16
17
Element : HdsInteractiveSignature [ 'Element' ] ;
Original file line number Diff line number Diff line change 5
5
6
6
import TemplateOnlyComponent from '@ember/component/template-only' ;
7
7
8
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
8
9
import type { HdsInteractiveSignature } from '../../interactive' ;
9
10
10
11
export interface HdsSideNavListLinkSignature {
11
12
Args : HdsInteractiveSignature [ 'Args' ] & {
12
- icon ?: string ;
13
+ icon ?: FlightIconSignature [ 'Args' ] [ 'name' ] ;
13
14
text ?: string ;
14
15
badge ?: string ;
15
16
count ?: string ;
Original file line number Diff line number Diff line change 5
5
6
6
import TemplateOnlyComponent from '@ember/component/template-only' ;
7
7
8
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
9
+
8
10
interface HdsSideNavToggleButtonSignature {
9
11
Args : {
10
- icon : string ;
12
+ icon : FlightIconSignature [ 'Args' ] [ 'name' ] ;
11
13
} ;
12
14
Element : HTMLButtonElement ;
13
15
}
Original file line number Diff line number Diff line change 2
2
* Copyright (c) HashiCorp, Inc.
3
3
* SPDX-License-Identifier: MPL-2.0
4
4
*/
5
+ import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon' ;
5
6
6
7
export enum HdsStepperStatusesValues {
7
8
Incomplete = 'incomplete' ,
@@ -14,7 +15,7 @@ export type HdsStepperStatuses = `${HdsStepperStatusesValues}`;
14
15
15
16
export const HdsStepperStatusToIconsValues : Record <
16
17
HdsStepperStatusesValues ,
17
- string
18
+ FlightIconSignature [ 'Args' ] [ 'name' ]
18
19
> = {
19
20
[ HdsStepperStatusesValues . Incomplete ] : 'circle' ,
20
21
[ HdsStepperStatusesValues . Progress ] : 'circle-half' ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { LinkTo } from '@ember/routing';
4
4
import { Portal , PortalTarget } from 'ember-stargate' ;
5
5
6
6
import type HdsComponentsRegistry from '../src/template-registry' ;
7
-
7
+ import type FlightIconsRegistry from '@hashicorp/ember-flight-icons/template-registry' ;
8
8
import type EmberElementHelperRegistry from 'ember-element-helper/template-registry' ;
9
9
import type EmberStargateRegistry from 'ember-stargate/template-registry' ;
10
10
import type EmberStyleModifierRegistry from 'ember-style-modifier/template-registry' ;
@@ -18,7 +18,8 @@ declare module '@glint/environment-ember-loose/registry' {
18
18
EmberStargateRegistry ,
19
19
EmberStyleModifierRegistry ,
20
20
EmberTruthRegistry ,
21
- RenderModifiersRegistry /*, other addon registries */ {
21
+ RenderModifiersRegistry ,
22
+ FlightIconsRegistry /*, other addon registries */ {
22
23
// local entries
23
24
LinkToExternal : typeof LinkTo ;
24
25
// we have to use `ember-stargate` version `0.4.3` because version `0.5.0` causes a break in the tests for `ember-lts-3.28`
Original file line number Diff line number Diff line change 4
4
# compiled output
5
5
/declarations /
6
6
/dist /
7
- /declarations /
8
7
9
8
# misc
10
9
/coverage /
Original file line number Diff line number Diff line change 1
1
{
2
- "presets" : [[" @babel/preset-typescript" ]],
3
2
"plugins" : [
3
+ [
4
+ " @babel/plugin-transform-typescript" ,
5
+ {
6
+ "allExtensions" : true ,
7
+ "onlyRemoveTypeImports" : true ,
8
+ "allowDeclareFields" : true
9
+ }
10
+ ],
4
11
" @embroider/addon-dev/template-colocation-plugin" ,
5
- [" @babel/plugin-transform-typescript" , { "allowDeclareFields" : true }],
6
- [" @babel/plugin-proposal-decorators" , { "legacy" : true }],
7
- " @babel/plugin-transform-class-properties"
12
+ [
13
+ " babel-plugin-ember-template-compilation" ,
14
+ {
15
+ "targetFormat" : " hbs" ,
16
+ "transforms" : []
17
+ }
18
+ ],
19
+ [
20
+ " module:decorator-transforms" ,
21
+ {
22
+ "runtime" : {
23
+ "import" : " decorator-transforms/runtime"
24
+ }
25
+ }
26
+ ],
27
+ [
28
+ " @babel/plugin-proposal-decorators" ,
29
+ {
30
+ "legacy" : true
31
+ }
32
+ ],
33
+ " @babel/plugin-transform-class-properties" ,
34
+ " @babel/plugin-transform-private-methods"
8
35
]
9
36
}
0 commit comments