@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -62,6 +62,13 @@ const meta: Meta = {
62
62
  category: 'callbacks',
63
63
  },
64
64
  },
65
+ faPrefix: {
66
+ control: 'text',
67
+ defaultValue: 'fas',
68
+ table: {
69
+ type: { summary: 'string' },
70
+ },
71
+ },
65
72
  },
66
73
  };
67
74
  export default meta;
@@ -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 = ({ name, size = 'md', className, ariaLabel, ...props }: IconProps) => {
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: 'fas',
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
  };