Skip to content

Commit fdcc416

Browse files
committed
feat(icons): allow 3rd party packages to provide icon names for auto completion
fix Lundalogik/crm-client#622
1 parent 6ec3788 commit fdcc416

File tree

26 files changed

+144
-97
lines changed

26 files changed

+144
-97
lines changed

etc/lime-elements.api.md

Lines changed: 60 additions & 53 deletions
Large diffs are not rendered by default.

src/components/action-bar/action-bar.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Icon } from '../../global/shared-types/icon.types';
1+
import { Icon, IconName } from '../../global/shared-types/icon.types';
22
import { MenuItem } from '../menu/menu.types';
33

44
/**
@@ -16,7 +16,7 @@ export type ActionBarItem<T = any> =
1616
*/
1717
export interface ActionBarItemOnlyIcon<T> extends MenuItem<T> {
1818
iconOnly: true;
19-
icon: string | Icon;
19+
icon: IconName | Icon;
2020
}
2121

2222
/**

src/components/banner/banner.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, h, Method, Prop, State } from '@stencil/core';
2+
import { IconName } from '../../global/shared-types/icon.types';
23

34
/**
45
* @exampleComponent limel-example-banner
@@ -20,7 +21,7 @@ export class Banner {
2021
* Set icon for the banner
2122
*/
2223
@Prop({ reflect: true })
23-
public icon: string;
24+
public icon: IconName;
2425

2526
@State()
2627
private isOpen = false;

src/components/button/button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
makeEnterClickable,
44
removeEnterClickable,
55
} from '../../util/make-enter-clickable';
6-
import { Icon } from '../../global/shared-types/icon.types';
6+
import { Icon, IconName } from '../../global/shared-types/icon.types';
77
import { getIconName, getIconTitle } from '../icon/get-icon-props';
88

99
/**
@@ -47,7 +47,7 @@ export class Button {
4747
* Set icon for the button
4848
*/
4949
@Prop({ reflect: true })
50-
public icon: string | Icon;
50+
public icon: IconName | Icon;
5151

5252
/**
5353
* Set to `true` to disable the button.
@@ -149,7 +149,7 @@ export class Button {
149149
];
150150
}
151151

152-
private renderIcon(icon?: string | Icon) {
152+
private renderIcon(icon?: IconName | Icon) {
153153
const iconName = getIconName(icon);
154154
if (!iconName) {
155155
return;

src/components/card/card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
State,
1010
} from '@stencil/core';
1111
import { Image } from '../../global/shared-types/image.types';
12-
import { Icon } from '../../global/shared-types/icon.types';
12+
import { Icon, IconName } from '../../global/shared-types/icon.types';
1313
import { isItem } from '../action-bar/is-item';
1414
import { getIconName } from '../icon/get-icon-props';
1515
import { ListSeparator } from '../../global/shared-types/separator.types';
@@ -62,7 +62,7 @@ export class Card {
6262
* An icon, to display along with the heading and subheading.
6363
*/
6464
@Prop({ reflect: true })
65-
public icon?: string | Icon;
65+
public icon?: IconName | Icon;
6666

6767
/**
6868
* The content of the card.

src/components/chip-set/chip-set.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getHref, getTarget } from '../../util/link-helper';
1919
import { isEqual } from 'lodash-es';
2020
import { LimelChipCustomEvent } from '../../components';
2121
import { createRandomString } from '../../util/random-string';
22+
import { IconName } from '../../global/shared-types/icon.types';
2223

2324
/**
2425
* :::note
@@ -169,7 +170,7 @@ export class ChipSet {
169170
* Leading icon to show to the far left in the text field
170171
*/
171172
@Prop({ reflect: true })
172-
public leadingIcon: string = null;
173+
public leadingIcon: IconName = null;
173174

174175
/**
175176
* For chip-set of type `input`. Sets delimiters between chips.

src/components/chip-set/chip.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Image } from '../../global/shared-types/image.types';
2-
import { Icon } from '../../global/shared-types/icon.types';
2+
import { Icon, IconName } from '../../global/shared-types/icon.types';
33
import { MenuItem } from '../menu/menu.types';
44
import { ListSeparator } from '../list-item/list-item.types';
55
import { Color } from '../../global/shared-types/color.types';
@@ -21,7 +21,7 @@ export interface Chip<T = any> {
2121
/**
2222
* Name of the icon to use. Not valid for `filter`.
2323
*/
24-
icon?: string | Icon;
24+
icon?: IconName | Icon;
2525

2626
/**
2727
* A picture to be displayed instead of the icon on the chip.

src/components/chip/chip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Host,
88
Prop,
99
} from '@stencil/core';
10-
import { Icon } from '../../global/shared-types/icon.types';
10+
import { Icon, IconName } from '../../global/shared-types/icon.types';
1111
import { Languages } from '../date-picker/date.types';
1212
import { Link } from '../../global/shared-types/link.types';
1313
import { getRel } from '../../util/link-helper';
@@ -106,7 +106,7 @@ export class Chip implements ChipInterface {
106106
* Icon of the chip.
107107
*/
108108
@Prop()
109-
public icon?: string | Icon;
109+
public icon?: IconName | Icon;
110110

111111
/**
112112
* A picture to be displayed instead of the icon on the chip.

src/components/collapsible-section/collapsible-section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
removeEnterClickable,
1414
} from '../../util/make-enter-clickable';
1515
import { createRandomString } from '../../util/random-string';
16-
import { Icon } from '../../global/shared-types/icon.types';
16+
import { Icon, IconName } from '../../global/shared-types/icon.types';
1717
import {
1818
getIconColor,
1919
getIconName,
@@ -65,7 +65,7 @@ export class CollapsibleSection {
6565
* Icon to display in the header of the section
6666
*/
6767
@Prop()
68-
public icon?: string | Icon;
68+
public icon?: IconName | Icon;
6969

7070
/**
7171
* `true` if the section is invalid, `false` if valid.

src/components/dialog/dialog.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Icon } from '../../global/shared-types/icon.types';
1+
import { Icon, IconName } from '../../global/shared-types/icon.types';
22

33
/**
44
* @public
@@ -7,7 +7,7 @@ export interface DialogHeading {
77
title: string;
88
subtitle?: string;
99
supportingText?: string;
10-
icon?: string | Icon;
10+
icon?: IconName | Icon;
1111
}
1212

1313
/**

0 commit comments

Comments
 (0)