@iota/apps-ui-kit 0.9.4 → 0.9.5

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": "@iota/apps-ui-kit",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "sideEffects": false,
5
5
  "repository": "https://github.com/iotaledger/iota",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "classnames": "^2.5.1",
28
28
  "lodash.merge": "^4.6.2",
29
29
  "react-number-format": "^5.2.2",
30
- "@iota/apps-ui-icons": "0.7.4"
30
+ "@iota/apps-ui-icons": "0.7.5"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^18 || ^19",
@@ -2,8 +2,9 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import cx from 'classnames';
5
+ import { BadgeSize } from './badge.enums';
5
6
  import type { BadgeType } from './badge.enums';
6
- import { BACKGROUND_COLORS, BADGE_TEXT_CLASS, BORDER_COLORS, TEXT_COLORS } from './badge.classes';
7
+ import { BACKGROUND_COLORS, BORDER_COLORS, TEXT_COLORS } from './badge.classes';
7
8
 
8
9
  interface BadgeProps {
9
10
  /**
@@ -14,24 +15,30 @@ interface BadgeProps {
14
15
  * The label of the badge.
15
16
  */
16
17
  label?: string;
18
+ /**
19
+ * The size of the badge
20
+ */
21
+ size?: BadgeSize;
17
22
  }
18
23
 
19
- export function Badge({ type, label }: BadgeProps): React.JSX.Element {
24
+ export function Badge({ type, label, size = BadgeSize.Medium }: BadgeProps): React.JSX.Element {
20
25
  const backgroundClasses = BACKGROUND_COLORS[type];
21
26
  const textClasses = TEXT_COLORS[type];
22
- const borderClasses = BORDER_COLORS[type];
27
+ const isSmall = size === BadgeSize.Small;
23
28
  const labelClasses = label ? 'px-xs py-xxs' : 'h-1.5 w-1.5';
29
+ const textSizeClass = isSmall ? 'text-label-sm' : 'text-label-md';
24
30
 
25
31
  return (
26
32
  <div
27
33
  className={cx(
28
- 'inline-flex items-center space-x-2 rounded-full border disabled:opacity-30',
34
+ 'inline-flex items-center space-x-2 rounded-full disabled:opacity-30',
35
+ { border: !isSmall },
29
36
  backgroundClasses,
30
- borderClasses,
37
+ { [BORDER_COLORS[type]]: !isSmall },
31
38
  labelClasses,
32
39
  )}
33
40
  >
34
- <span className={cx(BADGE_TEXT_CLASS, textClasses)}>{label}</span>
41
+ <span className={cx(textSizeClass, textClasses)}>{label}</span>
35
42
  </div>
36
43
  );
37
44
  }
@@ -29,5 +29,3 @@ export const BORDER_COLORS: Record<BadgeType, string> = {
29
29
  [BadgeType.Warning]: 'border-warning-surface',
30
30
  [BadgeType.Error]: 'border-error-surface',
31
31
  };
32
-
33
- export const BADGE_TEXT_CLASS = 'text-label-md';
@@ -9,3 +9,8 @@ export enum BadgeType {
9
9
  Warning = 'warning',
10
10
  Error = 'error',
11
11
  }
12
+
13
+ export enum BadgeSize {
14
+ Medium = 'medium',
15
+ Small = 'small',
16
+ }