Skip to content

Commit dc69e2f

Browse files
authoredJun 18, 2024
Merge pull request #2142 from hashicorp/feat/embe-flight-icons-bluprint-update
feat(ember-flight-icons): update blueprint
2 parents af2ebc3 + 8cde778 commit dc69e2f

File tree

30 files changed

+341
-130
lines changed

30 files changed

+341
-130
lines changed
 

‎.changeset/long-rats-share.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hashicorp/ember-flight-icons": minor
3+
---
4+
5+
`FlightIcon` - converted component to TypeScript and published types

‎packages/components/src/components/hds/alert/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type { HdsYieldSignature } from '../yield';
1818
import type { HdsAlertColors, HdsAlertTypes } from './types.ts';
1919
import type { HdsAlertTitleSignature } from './title.ts';
2020
import type { HdsAlertDescriptionSignature } from './description.ts';
21+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
2122

2223
export const TYPES: string[] = Object.values(HdsAlertTypeValues);
2324
export const DEFAULT_COLOR = HdsAlertColorValues.Neutral;
@@ -39,7 +40,7 @@ export interface HdsAlertSignature {
3940
Args: {
4041
type: HdsAlertTypes;
4142
color?: HdsAlertColors;
42-
icon?: string | false;
43+
icon?: FlightIconSignature['Args']['name'] | false;
4344
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4445
onDismiss?: (event: MouseEvent, ...args: any[]) => void;
4546
};
@@ -100,7 +101,7 @@ export default class HdsAlertComponent extends Component<HdsAlertSignature> {
100101
* @default null
101102
* @description The name of the icon to be used.
102103
*/
103-
get icon() {
104+
get icon(): FlightIconSignature['Args']['name'] | false {
104105
const { icon } = this.args;
105106

106107
// If `icon` isn't passed, use the pre-defined one from `color`

‎packages/components/src/components/hds/app-footer/link.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import Component from '@glimmer/component';
88
import type { HdsInteractiveSignature } from '../interactive/';
99
import type { HdsLinkColors, HdsLinkIconPositions } from '../link/types.ts';
1010
import type { HdsLinkInlineSignature } from '../link/inline.ts';
11+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
1112

1213
export interface HdsAppFooterLinkSignature {
1314
Args: HdsInteractiveSignature['Args'] & {
1415
color?: HdsLinkColors;
15-
icon?: string;
16+
icon?: FlightIconSignature['Args']['name'];
1617
iconPosition?: HdsLinkIconPositions;
1718
};
1819
Blocks: {

‎packages/components/src/components/hds/app-footer/status-link.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import type { HdsInteractiveSignature } from '../interactive/';
1212
import { HdsAppFooterStatusLinkStatusValues } from './types.ts';
1313
import type { HdsAppFooterStatusTypes } from './types.ts';
1414
import type { HdsAppFooterLinkSignature } from './link.ts';
15+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
1516

1617
export const STATUSES = HdsAppFooterStatusLinkStatusValues;
1718

1819
export interface HdsAppFooterStatusLinkSignature {
1920
Args: HdsInteractiveSignature['Args'] & {
2021
itemStyle?: SafeString;
2122
status?: HdsAppFooterStatusTypes;
22-
statusIcon?: string;
23+
statusIcon?: FlightIconSignature['Args']['name'];
2324
statusIconColor?: string;
2425
text?: string;
2526
};

‎packages/components/src/components/hds/app-footer/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) HashiCorp, Inc.
33
* SPDX-License-Identifier: MPL-2.0
44
*/
5+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
56

67
export enum HdsAppFooterStatusValues {
78
Operational = 'operational',
@@ -16,7 +17,7 @@ export const HdsAppFooterStatusLinkStatusValues: Record<
1617
HdsAppFooterStatusValues,
1718
{
1819
text: string;
19-
iconName: string;
20+
iconName: FlightIconSignature['Args']['name'];
2021
}
2122
> = {
2223
[HdsAppFooterStatusValues.Operational]: {

‎packages/components/src/components/hds/application-state/header.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
import TemplateOnlyComponent from '@ember/component/template-only';
77

8+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
9+
810
export interface HdsApplicationStateHeaderSignature {
911
Args: {
1012
title?: string;
1113
errorCode?: string;
12-
icon?: string;
14+
icon?: FlightIconSignature['Args']['name'];
1315
};
1416
Element: HTMLDivElement;
1517
}

‎packages/components/src/components/hds/badge/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from './types.ts';
1414

1515
import type { HdsBadgeColors, HdsBadgeSizes, HdsBadgeTypes } from './types.ts';
16+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
1617

1718
export const SIZES: string[] = Object.values(HdsBadgeSizeValues);
1819
export const TYPES: string[] = Object.values(HdsBadgeTypeValues);
@@ -27,7 +28,7 @@ export interface HdsBadgeSignature {
2728
type?: HdsBadgeTypes;
2829
color?: HdsBadgeColors;
2930
text: string;
30-
icon?: string | null;
31+
icon?: FlightIconSignature['Args']['name'];
3132
isIconOnly?: boolean;
3233
};
3334
Element: HTMLDivElement;

‎packages/components/src/components/hds/button/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import Component from '@glimmer/component';
77
import { assert } from '@ember/debug';
88
import type { HdsInteractiveSignature } from '../interactive/';
9+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
910

1011
export const DEFAULT_SIZE = 'medium';
1112
export const DEFAULT_COLOR = 'primary';
@@ -23,7 +24,7 @@ export interface HdsButtonSignature {
2324
size?: HdsButtonSize;
2425
color?: HdsButtonColor;
2526
text: string;
26-
icon?: string;
27+
icon?: FlightIconSignature['Args']['name'];
2728
iconPosition?: HdsButtonIconPosition;
2829
isIconOnly?: boolean;
2930
isFullWidth?: boolean;

‎packages/components/src/components/hds/copy/button/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { HdsCopyButtonSizeValues } from './types.ts';
1111
import type { HdsCopyButtonSizes } from './types.ts';
1212
import type { HdsButtonSignature } from '../../button/';
1313
import type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts';
14+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
1415

1516
export const DEFAULT_SIZE = HdsCopyButtonSizeValues.Medium;
1617
export const SIZES: string[] = Object.values(HdsCopyButtonSizeValues);
@@ -40,7 +41,7 @@ export default class HdsCopyButtonComponent extends Component<HdsCopyButtonSigna
4041
* @description The icon to be displayed for each status; automatically calculated based on the tracked property `status`.
4142
*/
4243
get icon() {
43-
let icon = DEFAULT_ICON;
44+
let icon: FlightIconSignature['Args']['name'] = DEFAULT_ICON;
4445
if (this.status === 'success') {
4546
icon = SUCCESS_ICON;
4647
} else if (this.status === 'error') {

‎packages/components/src/components/hds/copy/snippet/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { action } from '@ember/object';
1010
import { HdsCopySnippetColorValues } from './types.ts';
1111
import type { HdsCopySnippetColors } from './types.ts';
1212
import type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts';
13+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
1314

1415
export const DEFAULT_COLOR = HdsCopySnippetColorValues.Primary;
1516
export const COLORS: string[] = Object.values(HdsCopySnippetColorValues);
@@ -56,7 +57,7 @@ export default class HdsCopySnippetComponent extends Component<HdsCopySnippetSig
5657
* @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).
5758
*/
5859
get icon() {
59-
let icon = DEFAULT_ICON;
60+
let icon: FlightIconSignature['Args']['name'] = DEFAULT_ICON;
6061
if (this.status === 'success') {
6162
icon = SUCCESS_ICON;
6263
} else if (this.status === 'error') {

‎packages/components/src/components/hds/icon-tile/index.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import type {
1818
HdsIconTileSizes,
1919
} from './types.ts';
2020

21+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
22+
2123
export const DEFAULT_SIZE = 'medium';
2224
export const DEFAULT_COLOR = 'neutral';
2325
export const SIZES: string[] = Object.values(HdsIconTileSizeValues);
@@ -32,8 +34,8 @@ export interface HdsIconTileSignature {
3234
size?: HdsIconTileSizes;
3335
color?: HdsIconTileColors;
3436
logo?: HdsIconTileProducts;
35-
icon?: string | null;
36-
iconSecondary?: string;
37+
icon?: FlightIconSignature['Args']['name'];
38+
iconSecondary?: FlightIconSignature['Args']['name'];
3739
};
3840
Element: HTMLDivElement;
3941
}
@@ -94,7 +96,7 @@ export default class HdsIconTileComponent extends Component<HdsIconTileSignature
9496
* @type {string|null}
9597
* @default null
9698
*/
97-
get icon() {
99+
get icon(): FlightIconSignature['Args']['name'] | undefined {
98100
if (this.args.logo) {
99101
// for the logo version we use the colored versions directly
100102
return `${this.args.logo}-color`;

‎packages/components/src/components/hds/link/inline.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { HdsLinkColorValues, HdsLinkIconPositionValues } from './types.ts';
99

1010
import type { HdsInteractiveSignature } from '../interactive/';
1111
import type { HdsLinkColors, HdsLinkIconPositions } from './types.ts';
12+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
1213

1314
export const DEFAULT_ICONPOSITION = HdsLinkIconPositionValues.Trailing;
1415
export const DEFAULT_COLOR = HdsLinkColorValues.Primary;
@@ -18,7 +19,7 @@ export const COLORS: string[] = Object.values(HdsLinkColorValues);
1819
export interface HdsLinkInlineSignature {
1920
Args: HdsInteractiveSignature['Args'] & {
2021
color?: HdsLinkColors;
21-
icon?: string;
22+
icon?: FlightIconSignature['Args']['name'];
2223
iconPosition?: HdsLinkIconPositions;
2324
};
2425
Blocks: {

‎packages/components/src/components/hds/link/standalone.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ import type {
1717
HdsLinkIconPositions,
1818
HdsLinkStandaloneSizes,
1919
} from './types.ts';
20+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
2021

2122
export interface HdsLinkStandaloneSignature {
2223
Args: HdsInteractiveSignature['Args'] & {
2324
size?: HdsLinkStandaloneSizes;
2425
color?: HdsLinkColors;
2526
text: string;
26-
icon: string;
27+
icon: FlightIconSignature['Args']['name'];
2728
iconPosition?: HdsLinkIconPositions;
2829
};
2930
Element: HdsInteractiveSignature['Element'];

‎packages/components/src/components/hds/side-nav/header/home-link.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import Component from '@glimmer/component';
77
import { assert } from '@ember/debug';
88

9+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
910
import type { HdsInteractiveSignature } from '../../interactive/';
1011

1112
interface HdsSideNavHeaderHomeLinkSignature {
1213
Args: HdsInteractiveSignature['Args'] & {
13-
icon: string;
14+
icon: FlightIconSignature['Args']['name'];
1415
color?: string;
1516
ariaLabel: string;
1617
};

‎packages/components/src/components/hds/side-nav/header/icon-button.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import Component from '@glimmer/component';
77
import { assert } from '@ember/debug';
88

9+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
910
import type { HdsInteractiveSignature } from '../../interactive/';
1011

1112
interface HdsSideNavHeaderIconButtonSignature {
1213
Args: HdsInteractiveSignature['Args'] & {
13-
icon: string;
14+
icon: FlightIconSignature['Args']['name'];
1415
ariaLabel: string;
1516
};
1617
Element: HdsInteractiveSignature['Element'];

‎packages/components/src/components/hds/side-nav/list/link.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
import TemplateOnlyComponent from '@ember/component/template-only';
77

8+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
89
import type { HdsInteractiveSignature } from '../../interactive';
910

1011
export interface HdsSideNavListLinkSignature {
1112
Args: HdsInteractiveSignature['Args'] & {
12-
icon?: string;
13+
icon?: FlightIconSignature['Args']['name'];
1314
text?: string;
1415
badge?: string;
1516
count?: string;

‎packages/components/src/components/hds/side-nav/toggle-button.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
import TemplateOnlyComponent from '@ember/component/template-only';
77

8+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
9+
810
interface HdsSideNavToggleButtonSignature {
911
Args: {
10-
icon: string;
12+
icon: FlightIconSignature['Args']['name'];
1113
};
1214
Element: HTMLButtonElement;
1315
}

‎packages/components/src/components/hds/stepper/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) HashiCorp, Inc.
33
* SPDX-License-Identifier: MPL-2.0
44
*/
5+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
56

67
export enum HdsStepperStatusesValues {
78
Incomplete = 'incomplete',
@@ -14,7 +15,7 @@ export type HdsStepperStatuses = `${HdsStepperStatusesValues}`;
1415

1516
export const HdsStepperStatusToIconsValues: Record<
1617
HdsStepperStatusesValues,
17-
string
18+
FlightIconSignature['Args']['name']
1819
> = {
1920
[HdsStepperStatusesValues.Incomplete]: 'circle',
2021
[HdsStepperStatusesValues.Progress]: 'circle-half',

‎packages/components/unpublished-development-types/@hashicorp/ember-flight-icons/flight-icon.d.ts

-25
This file was deleted.

‎packages/components/unpublished-development-types/global.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { LinkTo } from '@ember/routing';
44
import { Portal, PortalTarget } from 'ember-stargate';
55

66
import type HdsComponentsRegistry from '../src/template-registry';
7-
7+
import type FlightIconsRegistry from '@hashicorp/ember-flight-icons/template-registry';
88
import type EmberElementHelperRegistry from 'ember-element-helper/template-registry';
99
import type EmberStargateRegistry from 'ember-stargate/template-registry';
1010
import type EmberStyleModifierRegistry from 'ember-style-modifier/template-registry';
@@ -18,7 +18,8 @@ declare module '@glint/environment-ember-loose/registry' {
1818
EmberStargateRegistry,
1919
EmberStyleModifierRegistry,
2020
EmberTruthRegistry,
21-
RenderModifiersRegistry /*, other addon registries */ {
21+
RenderModifiersRegistry,
22+
FlightIconsRegistry /*, other addon registries */ {
2223
// local entries
2324
LinkToExternal: typeof LinkTo;
2425
// 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`

‎packages/ember-flight-icons/.eslintignore

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# compiled output
55
/declarations/
66
/dist/
7-
/declarations/
87

98
# misc
109
/coverage/
+31-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
{
2-
"presets": [["@babel/preset-typescript"]],
32
"plugins": [
3+
[
4+
"@babel/plugin-transform-typescript",
5+
{
6+
"allExtensions": true,
7+
"onlyRemoveTypeImports": true,
8+
"allowDeclareFields": true
9+
}
10+
],
411
"@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"
835
]
936
}

0 commit comments

Comments
 (0)
Failed to load comments.