@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/CHANGELOG.md +8 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.es.js +541 -539
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/components/atoms/badge/Badge.tsx +13 -6
- package/src/lib/components/atoms/badge/badge.classes.ts +0 -2
- package/src/lib/components/atoms/badge/badge.enums.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iota/apps-ui-kit",
|
|
3
|
-
"version": "0.9.
|
|
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.
|
|
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,
|
|
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
|
|
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
|
|
34
|
+
'inline-flex items-center space-x-2 rounded-full disabled:opacity-30',
|
|
35
|
+
{ border: !isSmall },
|
|
29
36
|
backgroundClasses,
|
|
30
|
-
|
|
37
|
+
{ [BORDER_COLORS[type]]: !isSmall },
|
|
31
38
|
labelClasses,
|
|
32
39
|
)}
|
|
33
40
|
>
|
|
34
|
-
<span className={cx(
|
|
41
|
+
<span className={cx(textSizeClass, textClasses)}>{label}</span>
|
|
35
42
|
</div>
|
|
36
43
|
);
|
|
37
44
|
}
|