@indico-data/design-system 3.8.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/icons/Icon.d.ts +1 -1
- package/lib/components/icons/types.d.ts +5 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.esm.js +2 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/icons/Icon.stories.tsx +7 -0
- package/src/components/icons/Icon.tsx +9 -2
- package/src/components/icons/types.ts +5 -1
package/package.json
CHANGED
|
@@ -3,7 +3,14 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
3
3
|
import { IconName as FAIconName, findIconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
4
4
|
import { IconProps } from './types';
|
|
5
5
|
|
|
6
|
-
export const Icon = ({
|
|
6
|
+
export const Icon = ({
|
|
7
|
+
name,
|
|
8
|
+
size = 'md',
|
|
9
|
+
className,
|
|
10
|
+
ariaLabel,
|
|
11
|
+
faPrefix = 'fas',
|
|
12
|
+
...props
|
|
13
|
+
}: IconProps) => {
|
|
7
14
|
const label = ariaLabel || `${name} Icon`;
|
|
8
15
|
|
|
9
16
|
const iconClasses = classNames(
|
|
@@ -20,7 +27,7 @@ export const Icon = ({ name, size = 'md', className, ariaLabel, ...props }: Icon
|
|
|
20
27
|
// Otherwise, search for an indicon (registered under Font Awesome with a prefix of 'fak')
|
|
21
28
|
const icon = faIconName
|
|
22
29
|
? findIconDefinition({
|
|
23
|
-
prefix:
|
|
30
|
+
prefix: faPrefix,
|
|
24
31
|
iconName: faIconName as FAIconName,
|
|
25
32
|
})
|
|
26
33
|
: findIconDefinition({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MouseEventHandler, CSSProperties } from 'react';
|
|
2
2
|
import { PermafrostComponent } from '../../types';
|
|
3
|
-
import { IconName as FAIconName } from '@fortawesome/fontawesome-svg-core';
|
|
3
|
+
import { IconName as FAIconName, IconPrefix } from '@fortawesome/fontawesome-svg-core';
|
|
4
4
|
import { indicons } from './indicons';
|
|
5
5
|
|
|
6
6
|
export type IconSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
@@ -20,4 +20,8 @@ export type IconProps = PermafrostComponent & {
|
|
|
20
20
|
style?: CSSProperties;
|
|
21
21
|
/** Click event handler */
|
|
22
22
|
onClick?: MouseEventHandler<SVGElement>;
|
|
23
|
+
/** The Font Awesome prefix of the icon (defaults to 'fas', the solid icon prefix)
|
|
24
|
+
* Only used for Font Awesome icons, not for Indicons.
|
|
25
|
+
*/
|
|
26
|
+
faPrefix?: IconPrefix;
|
|
23
27
|
};
|