@metamask/design-system-react 0.8.0 → 0.10.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/CHANGELOG.md +24 -1
- package/dist/components/BadgeCount/BadgeCount.cjs +2 -2
- package/dist/components/BadgeCount/BadgeCount.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.cjs +5 -5
- package/dist/components/BadgeCount/BadgeCount.constants.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.d.cts +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.d.mts +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.mjs +3 -3
- package/dist/components/BadgeCount/BadgeCount.constants.mjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.mjs +1 -1
- package/dist/components/BadgeCount/BadgeCount.mjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.cts +4 -21
- package/dist/components/BadgeCount/BadgeCount.types.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.mts +4 -21
- package/dist/components/BadgeCount/BadgeCount.types.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.mjs.map +1 -1
- package/dist/components/BadgeCount/index.cjs +2 -2
- package/dist/components/BadgeCount/index.cjs.map +1 -1
- package/dist/components/BadgeCount/index.d.cts +1 -1
- package/dist/components/BadgeCount/index.d.cts.map +1 -1
- package/dist/components/BadgeCount/index.d.mts +1 -1
- package/dist/components/BadgeCount/index.d.mts.map +1 -1
- package/dist/components/BadgeCount/index.mjs +1 -1
- package/dist/components/BadgeCount/index.mjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.cjs +2 -2
- package/dist/components/BadgeStatus/BadgeStatus.cjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.constants.cjs +8 -8
- package/dist/components/BadgeStatus/BadgeStatus.constants.cjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.constants.d.cts +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.constants.d.cts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.constants.d.mts +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.constants.d.mts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.constants.mjs +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.constants.mjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.d.cts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.d.mts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.mjs +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.mjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.cjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.d.cts +4 -28
- package/dist/components/BadgeStatus/BadgeStatus.types.d.cts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.d.mts +4 -28
- package/dist/components/BadgeStatus/BadgeStatus.types.d.mts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.mjs.map +1 -1
- package/dist/components/BadgeStatus/index.cjs +3 -3
- package/dist/components/BadgeStatus/index.cjs.map +1 -1
- package/dist/components/BadgeStatus/index.d.cts +1 -1
- package/dist/components/BadgeStatus/index.d.cts.map +1 -1
- package/dist/components/BadgeStatus/index.d.mts +1 -1
- package/dist/components/BadgeStatus/index.d.mts.map +1 -1
- package/dist/components/BadgeStatus/index.mjs +1 -1
- package/dist/components/BadgeStatus/index.mjs.map +1 -1
- package/dist/types/index.cjs +1 -40
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +0 -36
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +0 -36
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +0 -39
- package/dist/types/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.10.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** Updated `BadgeCount` type exports to use the ADR-0003/ADR-0004 const-object + string-union pattern instead of TypeScript enums ([#942](https://github.com/MetaMask/metamask-design-system/pull/942))
|
|
15
|
+
- `BadgeCountSize` is now provided as a const object with a derived union type rather than an enum
|
|
16
|
+
- `BadgeCount` shared prop types are now sourced from `@metamask/design-system-shared`
|
|
17
|
+
- Migration: update any enum-specific usage to const-object/union usage, while continuing to import from `@metamask/design-system-react`
|
|
18
|
+
|
|
19
|
+
## [0.9.0]
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **BREAKING:** Migrated `BadgeStatus` component from TypeScript enums to string union types with const objects ([#912](https://github.com/MetaMask/metamask-design-system/pull/912))
|
|
24
|
+
- `BadgeStatusStatus` and `BadgeStatusSize` enums replaced with const objects and derived string union types
|
|
25
|
+
- **No migration required** - continue importing from `@metamask/design-system-react` as usual
|
|
26
|
+
- Const object values remain the same (e.g., `BadgeStatusStatus.Active` still works)
|
|
27
|
+
- String literals now also accepted thanks to structural typing (e.g., `'active'` works where `BadgeStatusStatus.Active` is expected)
|
|
28
|
+
- We are still evaluating best practices for const objects vs string literals - use whichever approach works best for your codebase
|
|
29
|
+
- This change implements [ADR-0003](https://github.com/MetaMask/decisions/blob/main/decisions/design-system/0003-enum-to-string-union-migration.md) and [ADR-0004](https://github.com/MetaMask/decisions/blob/main/decisions/design-system/0004-centralized-types-architecture.md)
|
|
30
|
+
|
|
10
31
|
## [0.8.0]
|
|
11
32
|
|
|
12
33
|
### Added
|
|
@@ -145,7 +166,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
145
166
|
- Full TypeScript support with type definitions and enums
|
|
146
167
|
- Tailwind CSS integration with design token support
|
|
147
168
|
|
|
148
|
-
[Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.
|
|
169
|
+
[Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.10.0...HEAD
|
|
170
|
+
[0.10.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.9.0...@metamask/design-system-react@0.10.0
|
|
171
|
+
[0.9.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.8.0...@metamask/design-system-react@0.9.0
|
|
149
172
|
[0.8.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.7.0...@metamask/design-system-react@0.8.0
|
|
150
173
|
[0.7.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.6.1...@metamask/design-system-react@0.7.0
|
|
151
174
|
[0.6.1]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.6.0...@metamask/design-system-react@0.6.1
|
|
@@ -24,12 +24,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.BadgeCount = void 0;
|
|
27
|
+
const design_system_shared_1 = require("@metamask/design-system-shared");
|
|
27
28
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const types_1 = require("../../types/index.cjs");
|
|
29
29
|
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
30
30
|
const Text_1 = require("../Text/index.cjs");
|
|
31
31
|
const BadgeCount_constants_1 = require("./BadgeCount.constants.cjs");
|
|
32
|
-
exports.BadgeCount = (0, react_1.forwardRef)(({ size =
|
|
32
|
+
exports.BadgeCount = (0, react_1.forwardRef)(({ size = design_system_shared_1.BadgeCountSize.Md, count, max = 99, textProps, className = '', style, ...props }, ref) => {
|
|
33
33
|
const mergedClassName = (0, tw_merge_1.twMerge)(
|
|
34
34
|
// Base styles
|
|
35
35
|
'inline-flex items-center justify-center self-start rounded-lg bg-error-default', BadgeCount_constants_1.TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER[size], className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"BadgeCount.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAgE;AAChE,+CAA0C;AAE1C,uDAA+C;AAC/C,4CAAsD;AAEtD,qEAGgC;AAGnB,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,IAAI,GAAG,qCAAc,CAAC,EAAE,EACxB,KAAK,EACL,GAAG,GAAG,EAAE,EACR,SAAS,EACT,SAAS,GAAG,EAAE,EACd,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,cAAc;IACd,gFAAgF,EAChF,2DAAoC,CAAC,IAAI,CAAC,EAC1C,SAAS,CACV,CAAC;IAEF,OAAO,CACL,uCAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAM,KAAK;QAChE,8BAAC,WAAI,IACH,OAAO,EAAE,sDAA+B,CAAC,IAAI,CAAC,EAC9C,KAAK,EAAE,gBAAS,CAAC,YAAY,EAC7B,UAAU,EAAE,iBAAU,CAAC,MAAM,KACzB,SAAS,EACb,SAAS,EAAE,GAAG,SAAS,EAAE,SAAS,IAAI,EAAE,EAAE,EAC1C,OAAO;YAEP,4CAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAQ,CAC9C,CACH,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import { BadgeCountSize } from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Text, TextColor, FontWeight } from '../Text';\n\nimport {\n MAP_BADGECOUNT_SIZE_TEXTVARIANT,\n TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER,\n} from './BadgeCount.constants';\nimport type { BadgeCountProps } from './BadgeCount.types';\n\nexport const BadgeCount = forwardRef<HTMLDivElement, BadgeCountProps>(\n (\n {\n size = BadgeCountSize.Md,\n count,\n max = 99,\n textProps,\n className = '',\n style,\n ...props\n },\n ref,\n ) => {\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center self-start rounded-lg bg-error-default',\n TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER[size],\n className,\n );\n\n return (\n <div ref={ref} className={mergedClassName} style={style} {...props}>\n <Text\n variant={MAP_BADGECOUNT_SIZE_TEXTVARIANT[size]}\n color={TextColor.ErrorInverse}\n fontWeight={FontWeight.Medium}\n {...textProps}\n className={`${textProps?.className || ''}`}\n asChild\n >\n <span>{count > max ? `${max}+` : `${count}`}</span>\n </Text>\n </div>\n );\n },\n);\n\nBadgeCount.displayName = 'BadgeCount';\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER = exports.MAP_BADGECOUNT_SIZE_TEXTVARIANT = void 0;
|
|
4
|
-
const
|
|
4
|
+
const design_system_shared_1 = require("@metamask/design-system-shared");
|
|
5
5
|
const Text_1 = require("../Text/index.cjs");
|
|
6
6
|
// Mappings
|
|
7
7
|
exports.MAP_BADGECOUNT_SIZE_TEXTVARIANT = {
|
|
8
|
-
[
|
|
9
|
-
[
|
|
8
|
+
[design_system_shared_1.BadgeCountSize.Md]: Text_1.TextVariant.BodyXs,
|
|
9
|
+
[design_system_shared_1.BadgeCountSize.Lg]: Text_1.TextVariant.BodySm,
|
|
10
10
|
};
|
|
11
11
|
exports.TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER = {
|
|
12
|
-
[
|
|
13
|
-
[
|
|
12
|
+
[design_system_shared_1.BadgeCountSize.Md]: 'min-w-4 h-4 px-1',
|
|
13
|
+
[design_system_shared_1.BadgeCountSize.Lg]: 'min-w-6 h- px-1.5', // min-width 24px, height 20px, padding-horizontal 6
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=BadgeCount.constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.constants.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"BadgeCount.constants.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":";;;AAAA,yEAAgE;AAEhE,4CAAsC;AAEtC,WAAW;AACE,QAAA,+BAA+B,GAGxC;IACF,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,kBAAW,CAAC,MAAM;IACvC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,kBAAW,CAAC,MAAM;CACxC,CAAC;AAEW,QAAA,oCAAoC,GAG7C;IACF,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,kBAAkB;IACvC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,mBAAmB,EAAE,oDAAoD;CAC/F,CAAC","sourcesContent":["import { BadgeCountSize } from '@metamask/design-system-shared';\n\nimport { TextVariant } from '../Text';\n\n// Mappings\nexport const MAP_BADGECOUNT_SIZE_TEXTVARIANT: Record<\n BadgeCountSize,\n TextVariant\n> = {\n [BadgeCountSize.Md]: TextVariant.BodyXs,\n [BadgeCountSize.Lg]: TextVariant.BodySm,\n};\n\nexport const TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER: Record<\n BadgeCountSize,\n string\n> = {\n [BadgeCountSize.Md]: 'min-w-4 h-4 px-1', // min-width 16px, height 14px, padding-horizontal 4\n [BadgeCountSize.Lg]: 'min-w-6 h- px-1.5', // min-width 24px, height 20px, padding-horizontal 6\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeCountSize } from "
|
|
1
|
+
import { BadgeCountSize } from "@metamask/design-system-shared";
|
|
2
2
|
import { TextVariant } from "../Text/index.cjs";
|
|
3
3
|
export declare const MAP_BADGECOUNT_SIZE_TEXTVARIANT: Record<BadgeCountSize, TextVariant>;
|
|
4
4
|
export declare const TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER: Record<BadgeCountSize, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.constants.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"BadgeCount.constants.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uCAAuC;AAEhE,OAAO,EAAE,WAAW,EAAE,0BAAgB;AAGtC,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAClD,cAAc,EACd,WAAW,CAIZ,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,MAAM,CACvD,cAAc,EACd,MAAM,CAIP,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeCountSize } from "
|
|
1
|
+
import { BadgeCountSize } from "@metamask/design-system-shared";
|
|
2
2
|
import { TextVariant } from "../Text/index.mjs";
|
|
3
3
|
export declare const MAP_BADGECOUNT_SIZE_TEXTVARIANT: Record<BadgeCountSize, TextVariant>;
|
|
4
4
|
export declare const TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER: Record<BadgeCountSize, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"BadgeCount.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uCAAuC;AAEhE,OAAO,EAAE,WAAW,EAAE,0BAAgB;AAGtC,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAClD,cAAc,EACd,WAAW,CAIZ,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,MAAM,CACvD,cAAc,EACd,MAAM,CAIP,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeCountSize } from "
|
|
1
|
+
import { BadgeCountSize } from "@metamask/design-system-shared";
|
|
2
2
|
import { TextVariant } from "../Text/index.mjs";
|
|
3
3
|
// Mappings
|
|
4
4
|
export const MAP_BADGECOUNT_SIZE_TEXTVARIANT = {
|
|
@@ -6,7 +6,7 @@ export const MAP_BADGECOUNT_SIZE_TEXTVARIANT = {
|
|
|
6
6
|
[BadgeCountSize.Lg]: TextVariant.BodySm,
|
|
7
7
|
};
|
|
8
8
|
export const TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER = {
|
|
9
|
-
[BadgeCountSize.Md]: 'min-w-4 h-
|
|
10
|
-
[BadgeCountSize.Lg]: 'min-w-6 h-
|
|
9
|
+
[BadgeCountSize.Md]: 'min-w-4 h-4 px-1',
|
|
10
|
+
[BadgeCountSize.Lg]: 'min-w-6 h- px-1.5', // min-width 24px, height 20px, padding-horizontal 6
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=BadgeCount.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.constants.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"BadgeCount.constants.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uCAAuC;AAEhE,OAAO,EAAE,WAAW,EAAE,0BAAgB;AAEtC,WAAW;AACX,MAAM,CAAC,MAAM,+BAA+B,GAGxC;IACF,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,MAAM;IACvC,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,MAAM;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAG7C;IACF,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,kBAAkB;IACvC,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,mBAAmB,EAAE,oDAAoD;CAC/F,CAAC","sourcesContent":["import { BadgeCountSize } from '@metamask/design-system-shared';\n\nimport { TextVariant } from '../Text';\n\n// Mappings\nexport const MAP_BADGECOUNT_SIZE_TEXTVARIANT: Record<\n BadgeCountSize,\n TextVariant\n> = {\n [BadgeCountSize.Md]: TextVariant.BodyXs,\n [BadgeCountSize.Lg]: TextVariant.BodySm,\n};\n\nexport const TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER: Record<\n BadgeCountSize,\n string\n> = {\n [BadgeCountSize.Md]: 'min-w-4 h-4 px-1', // min-width 16px, height 14px, padding-horizontal 4\n [BadgeCountSize.Lg]: 'min-w-6 h- px-1.5', // min-width 24px, height 20px, padding-horizontal 6\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeCount.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,cAAc;AAS1C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,qGAmCtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeCount.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,cAAc;AAS1C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,qGAmCtB,CAAC"}
|
|
@@ -4,9 +4,9 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
+
import { BadgeCountSize } from "@metamask/design-system-shared";
|
|
7
8
|
import $React, { forwardRef } from "react";
|
|
8
9
|
const React = $importDefault($React);
|
|
9
|
-
import { BadgeCountSize } from "../../types/index.mjs";
|
|
10
10
|
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
11
11
|
import { Text, TextColor, FontWeight } from "../Text/index.mjs";
|
|
12
12
|
import { MAP_BADGECOUNT_SIZE_TEXTVARIANT, TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER } from "./BadgeCount.constants.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BadgeCount.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,uCAAuC;AAChE,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,0BAAgB;AAEtD,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,EACrC,mCAA+B;AAGhC,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,IAAI,GAAG,cAAc,CAAC,EAAE,EACxB,KAAK,EACL,GAAG,GAAG,EAAE,EACR,SAAS,EACT,SAAS,GAAG,EAAE,EACd,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GAAG,OAAO;IAC7B,cAAc;IACd,gFAAgF,EAChF,oCAAoC,CAAC,IAAI,CAAC,EAC1C,SAAS,CACV,CAAC;IAEF,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAM,KAAK;QAChE,oBAAC,IAAI,IACH,OAAO,EAAE,+BAA+B,CAAC,IAAI,CAAC,EAC9C,KAAK,EAAE,SAAS,CAAC,YAAY,EAC7B,UAAU,EAAE,UAAU,CAAC,MAAM,KACzB,SAAS,EACb,SAAS,EAAE,GAAG,SAAS,EAAE,SAAS,IAAI,EAAE,EAAE,EAC1C,OAAO;YAEP,kCAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAQ,CAC9C,CACH,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import { BadgeCountSize } from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Text, TextColor, FontWeight } from '../Text';\n\nimport {\n MAP_BADGECOUNT_SIZE_TEXTVARIANT,\n TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER,\n} from './BadgeCount.constants';\nimport type { BadgeCountProps } from './BadgeCount.types';\n\nexport const BadgeCount = forwardRef<HTMLDivElement, BadgeCountProps>(\n (\n {\n size = BadgeCountSize.Md,\n count,\n max = 99,\n textProps,\n className = '',\n style,\n ...props\n },\n ref,\n ) => {\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center self-start rounded-lg bg-error-default',\n TWCLASSMAP_BADGECOUNT_SIZE_CONTAINER[size],\n className,\n );\n\n return (\n <div ref={ref} className={mergedClassName} style={style} {...props}>\n <Text\n variant={MAP_BADGECOUNT_SIZE_TEXTVARIANT[size]}\n color={TextColor.ErrorInverse}\n fontWeight={FontWeight.Medium}\n {...textProps}\n className={`${textProps?.className || ''}`}\n asChild\n >\n <span>{count > max ? `${max}+` : `${count}`}</span>\n </Text>\n </div>\n );\n },\n);\n\nBadgeCount.displayName = 'BadgeCount';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.types.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"BadgeCount.types.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"","sourcesContent":["// Import shared type for extension\nimport type { BadgeCountPropsShared } from '@metamask/design-system-shared';\nimport type { ComponentProps } from 'react';\n\nimport type { TextProps } from '../Text';\n\n/**\n * BadgeCount component props (React platform-specific)\n * Extends shared props with React-specific platform concerns\n */\nexport type BadgeCountProps = ComponentProps<'div'> &\n BadgeCountPropsShared & {\n /**\n * Optional props to be passed to the Text component used by count\n */\n textProps?: Partial<TextProps>;\n /**\n * Optional prop for additional CSS classes to be applied to the BadgeCount component.\n * These classes will be merged with the component's default classes using twMerge.\n */\n className?: string;\n /**\n * Optional CSS styles to be applied to the component.\n * Should be used sparingly and only for dynamic styles that can't be achieved with className.\n */\n style?: React.CSSProperties;\n };\n"]}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
+
import type { BadgeCountPropsShared } from "@metamask/design-system-shared";
|
|
1
2
|
import type { ComponentProps } from "react";
|
|
2
|
-
import type { BadgeCountSize } from "../../types/index.cjs";
|
|
3
3
|
import type { TextProps } from "../Text/index.cjs";
|
|
4
4
|
/**
|
|
5
|
-
* BadgeCount component props
|
|
5
|
+
* BadgeCount component props (React platform-specific)
|
|
6
|
+
* Extends shared props with React-specific platform concerns
|
|
6
7
|
*/
|
|
7
|
-
export type BadgeCountProps = ComponentProps<'div'> & {
|
|
8
|
-
/**
|
|
9
|
-
* Optional prop to control the size of the BadgeCount
|
|
10
|
-
* Different sizes map to specific height
|
|
11
|
-
*
|
|
12
|
-
* @default IconSize.Md
|
|
13
|
-
*/
|
|
14
|
-
size?: BadgeCountSize;
|
|
15
|
-
/**
|
|
16
|
-
* Required prop to show the count number
|
|
17
|
-
*/
|
|
18
|
-
count: number;
|
|
19
|
-
/**
|
|
20
|
-
* Optional prop to determine the max the count can go up to.
|
|
21
|
-
* If count > max, the count will be shown as "max+"
|
|
22
|
-
*
|
|
23
|
-
* @default 99
|
|
24
|
-
*/
|
|
25
|
-
max?: number;
|
|
8
|
+
export type BadgeCountProps = ComponentProps<'div'> & BadgeCountPropsShared & {
|
|
26
9
|
/**
|
|
27
10
|
* Optional props to be passed to the Text component used by count
|
|
28
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.types.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeCount.types.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,uCAAuC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GACjD,qBAAqB,GAAG;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC"}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
+
import type { BadgeCountPropsShared } from "@metamask/design-system-shared";
|
|
1
2
|
import type { ComponentProps } from "react";
|
|
2
|
-
import type { BadgeCountSize } from "../../types/index.mjs";
|
|
3
3
|
import type { TextProps } from "../Text/index.mjs";
|
|
4
4
|
/**
|
|
5
|
-
* BadgeCount component props
|
|
5
|
+
* BadgeCount component props (React platform-specific)
|
|
6
|
+
* Extends shared props with React-specific platform concerns
|
|
6
7
|
*/
|
|
7
|
-
export type BadgeCountProps = ComponentProps<'div'> & {
|
|
8
|
-
/**
|
|
9
|
-
* Optional prop to control the size of the BadgeCount
|
|
10
|
-
* Different sizes map to specific height
|
|
11
|
-
*
|
|
12
|
-
* @default IconSize.Md
|
|
13
|
-
*/
|
|
14
|
-
size?: BadgeCountSize;
|
|
15
|
-
/**
|
|
16
|
-
* Required prop to show the count number
|
|
17
|
-
*/
|
|
18
|
-
count: number;
|
|
19
|
-
/**
|
|
20
|
-
* Optional prop to determine the max the count can go up to.
|
|
21
|
-
* If count > max, the count will be shown as "max+"
|
|
22
|
-
*
|
|
23
|
-
* @default 99
|
|
24
|
-
*/
|
|
25
|
-
max?: number;
|
|
8
|
+
export type BadgeCountProps = ComponentProps<'div'> & BadgeCountPropsShared & {
|
|
26
9
|
/**
|
|
27
10
|
* Optional props to be passed to the Text component used by count
|
|
28
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.types.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeCount.types.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,uCAAuC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GACjD,qBAAqB,GAAG;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeCount.types.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"BadgeCount.types.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/BadgeCount.types.ts"],"names":[],"mappings":"","sourcesContent":["// Import shared type for extension\nimport type { BadgeCountPropsShared } from '@metamask/design-system-shared';\nimport type { ComponentProps } from 'react';\n\nimport type { TextProps } from '../Text';\n\n/**\n * BadgeCount component props (React platform-specific)\n * Extends shared props with React-specific platform concerns\n */\nexport type BadgeCountProps = ComponentProps<'div'> &\n BadgeCountPropsShared & {\n /**\n * Optional props to be passed to the Text component used by count\n */\n textProps?: Partial<TextProps>;\n /**\n * Optional prop for additional CSS classes to be applied to the BadgeCount component.\n * These classes will be merged with the component's default classes using twMerge.\n */\n className?: string;\n /**\n * Optional CSS styles to be applied to the component.\n * Should be used sparingly and only for dynamic styles that can't be achieved with className.\n */\n style?: React.CSSProperties;\n };\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BadgeCount = exports.BadgeCountSize = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "BadgeCountSize", { enumerable: true, get: function () { return
|
|
4
|
+
var design_system_shared_1 = require("@metamask/design-system-shared");
|
|
5
|
+
Object.defineProperty(exports, "BadgeCountSize", { enumerable: true, get: function () { return design_system_shared_1.BadgeCountSize; } });
|
|
6
6
|
var BadgeCount_1 = require("./BadgeCount.cjs");
|
|
7
7
|
Object.defineProperty(exports, "BadgeCount", { enumerable: true, get: function () { return BadgeCount_1.BadgeCount; } });
|
|
8
8
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":";;;AAAA,uEAAgE;AAAvD,sHAAA,cAAc,OAAA;AACvB,+CAA0C;AAAjC,wGAAA,UAAU,OAAA","sourcesContent":["export { BadgeCountSize } from '@metamask/design-system-shared';\nexport { BadgeCount } from './BadgeCount';\nexport type { BadgeCountProps } from './BadgeCount.types';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BadgeCountSize } from "
|
|
1
|
+
export { BadgeCountSize } from "@metamask/design-system-shared";
|
|
2
2
|
export { BadgeCount } from "./BadgeCount.cjs";
|
|
3
3
|
export type { BadgeCountProps } from "./BadgeCount.types.cjs";
|
|
4
4
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uCAAuC;AAChE,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BadgeCountSize } from "
|
|
1
|
+
export { BadgeCountSize } from "@metamask/design-system-shared";
|
|
2
2
|
export { BadgeCount } from "./BadgeCount.mjs";
|
|
3
3
|
export type { BadgeCountProps } from "./BadgeCount.types.mjs";
|
|
4
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uCAAuC;AAChE,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uCAAuC;AAChE,OAAO,EAAE,UAAU,EAAE,yBAAqB","sourcesContent":["export { BadgeCountSize } from '@metamask/design-system-shared';\nexport { BadgeCount } from './BadgeCount';\nexport type { BadgeCountProps } from './BadgeCount.types';\n"]}
|
|
@@ -24,11 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.BadgeStatus = void 0;
|
|
27
|
+
const design_system_shared_1 = require("@metamask/design-system-shared");
|
|
27
28
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const types_1 = require("../../types/index.cjs");
|
|
29
29
|
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
30
30
|
const BadgeStatus_constants_1 = require("./BadgeStatus.constants.cjs");
|
|
31
|
-
exports.BadgeStatus = (0, react_1.forwardRef)(({ status, size =
|
|
31
|
+
exports.BadgeStatus = (0, react_1.forwardRef)(({ status, size = design_system_shared_1.BadgeStatusSize.Md, hasBorder = true, className, style, ...props }, ref) => {
|
|
32
32
|
const mergedClassName = (0, tw_merge_1.twMerge)(
|
|
33
33
|
// Base styles
|
|
34
34
|
'inline-flex rounded-full',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.cjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"BadgeStatus.cjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAiE;AACjE,+CAA0C;AAE1C,uDAA+C;AAE/C,uEAGiC;AAGpB,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,CACE,EACE,MAAM,EACN,IAAI,GAAG,sCAAe,CAAC,EAAE,EACzB,SAAS,GAAG,IAAI,EAChB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,cAAc;IACd,0BAA0B;IAC1B,kBAAkB;IAClB,SAAS,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,EAAE;IACrD,iBAAiB;IACjB,SAAS,CACV,CAAC;IAEF,MAAM,qBAAqB,GAAG,IAAA,kBAAO;IACnC,cAAc;IACd,4BAA4B;IAC5B,cAAc;IACd,iDAAyB,CAAC,IAAI,CAAC;IAC/B,8BAA8B;IAC9B,0DAAkC,CAAC,MAAM,CAAC,CAC3C,CAAC;IAEF,OAAO,CACL,uCAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAM,KAAK;QAChE,uCAAK,SAAS,EAAE,qBAAqB,GAAI,CACrC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { BadgeStatusSize } from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\n\nimport {\n CLASSMAP_BADGESTATUS_STATUS_CIRCLE,\n CLASSMAP_BADGESTATUS_SIZE,\n} from './BadgeStatus.constants';\nimport type { BadgeStatusProps } from './BadgeStatus.types';\n\nexport const BadgeStatus = forwardRef<HTMLDivElement, BadgeStatusProps>(\n (\n {\n status,\n size = BadgeStatusSize.Md,\n hasBorder = true,\n className,\n style,\n ...props\n },\n ref,\n ) => {\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex rounded-full',\n // hasBorder style\n hasBorder ? 'border-2 border-background-default' : '',\n // Custom classes\n className,\n );\n\n const mergedCircleClassName = twMerge(\n // Base styles\n 'z-10 rounded-full border-2',\n // Size styles\n CLASSMAP_BADGESTATUS_SIZE[size],\n // Circle with semantics style\n CLASSMAP_BADGESTATUS_STATUS_CIRCLE[status],\n );\n\n return (\n <div ref={ref} className={mergedClassName} style={style} {...props}>\n <div className={mergedCircleClassName} />\n </div>\n );\n },\n);\n\nBadgeStatus.displayName = 'BadgeStatus';\n"]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CLASSMAP_BADGESTATUS_SIZE = exports.CLASSMAP_BADGESTATUS_STATUS_CIRCLE = void 0;
|
|
4
|
-
const
|
|
4
|
+
const design_system_shared_1 = require("@metamask/design-system-shared");
|
|
5
5
|
// Mappings
|
|
6
6
|
exports.CLASSMAP_BADGESTATUS_STATUS_CIRCLE = {
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
7
|
+
[design_system_shared_1.BadgeStatusStatus.Active]: 'bg-success-default border-success-default',
|
|
8
|
+
[design_system_shared_1.BadgeStatusStatus.Inactive]: 'bg-default border-success-default',
|
|
9
|
+
[design_system_shared_1.BadgeStatusStatus.Disconnected]: 'bg-icon-muted border-icon-muted',
|
|
10
|
+
[design_system_shared_1.BadgeStatusStatus.New]: 'bg-primary-default border-primary-default',
|
|
11
|
+
[design_system_shared_1.BadgeStatusStatus.Attention]: 'bg-error-default border-error-default',
|
|
12
12
|
};
|
|
13
13
|
exports.CLASSMAP_BADGESTATUS_SIZE = {
|
|
14
|
-
[
|
|
15
|
-
[
|
|
14
|
+
[design_system_shared_1.BadgeStatusSize.Md]: 'h-2 w-2',
|
|
15
|
+
[design_system_shared_1.BadgeStatusSize.Lg]: 'h-2.5 w-2.5', // 10px width and height
|
|
16
16
|
};
|
|
17
17
|
//# sourceMappingURL=BadgeStatus.constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.constants.cjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"BadgeStatus.constants.cjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":";;;AAAA,yEAGwC;AAExC,WAAW;AACE,QAAA,kCAAkC,GAG3C;IACF,CAAC,wCAAiB,CAAC,MAAM,CAAC,EAAE,2CAA2C;IACvE,CAAC,wCAAiB,CAAC,QAAQ,CAAC,EAAE,mCAAmC;IACjE,CAAC,wCAAiB,CAAC,YAAY,CAAC,EAAE,iCAAiC;IACnE,CAAC,wCAAiB,CAAC,GAAG,CAAC,EAAE,2CAA2C;IACpE,CAAC,wCAAiB,CAAC,SAAS,CAAC,EAAE,uCAAuC;CACvE,CAAC;AAEW,QAAA,yBAAyB,GAAoC;IACxE,CAAC,sCAAe,CAAC,EAAE,CAAC,EAAE,SAAS;IAC/B,CAAC,sCAAe,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,wBAAwB;CAC9D,CAAC","sourcesContent":["import {\n BadgeStatusSize,\n BadgeStatusStatus,\n} from '@metamask/design-system-shared';\n\n// Mappings\nexport const CLASSMAP_BADGESTATUS_STATUS_CIRCLE: Record<\n BadgeStatusStatus,\n string\n> = {\n [BadgeStatusStatus.Active]: 'bg-success-default border-success-default',\n [BadgeStatusStatus.Inactive]: 'bg-default border-success-default',\n [BadgeStatusStatus.Disconnected]: 'bg-icon-muted border-icon-muted',\n [BadgeStatusStatus.New]: 'bg-primary-default border-primary-default',\n [BadgeStatusStatus.Attention]: 'bg-error-default border-error-default',\n};\n\nexport const CLASSMAP_BADGESTATUS_SIZE: Record<BadgeStatusSize, string> = {\n [BadgeStatusSize.Md]: 'h-2 w-2', // 8px width and height\n [BadgeStatusSize.Lg]: 'h-2.5 w-2.5', // 10px width and height\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeStatusSize, BadgeStatusStatus } from "
|
|
1
|
+
import { BadgeStatusSize, BadgeStatusStatus } from "@metamask/design-system-shared";
|
|
2
2
|
export declare const CLASSMAP_BADGESTATUS_STATUS_CIRCLE: Record<BadgeStatusStatus, string>;
|
|
3
3
|
export declare const CLASSMAP_BADGESTATUS_SIZE: Record<BadgeStatusSize, string>;
|
|
4
4
|
//# sourceMappingURL=BadgeStatus.constants.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.constants.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BadgeStatus.constants.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,iBAAiB,EAClB,uCAAuC;AAGxC,eAAO,MAAM,kCAAkC,EAAE,MAAM,CACrD,iBAAiB,EACjB,MAAM,CAOP,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAGrE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeStatusSize, BadgeStatusStatus } from "
|
|
1
|
+
import { BadgeStatusSize, BadgeStatusStatus } from "@metamask/design-system-shared";
|
|
2
2
|
export declare const CLASSMAP_BADGESTATUS_STATUS_CIRCLE: Record<BadgeStatusStatus, string>;
|
|
3
3
|
export declare const CLASSMAP_BADGESTATUS_SIZE: Record<BadgeStatusSize, string>;
|
|
4
4
|
//# sourceMappingURL=BadgeStatus.constants.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BadgeStatus.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,iBAAiB,EAClB,uCAAuC;AAGxC,eAAO,MAAM,kCAAkC,EAAE,MAAM,CACrD,iBAAiB,EACjB,MAAM,CAOP,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAGrE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeStatusSize, BadgeStatusStatus } from "
|
|
1
|
+
import { BadgeStatusSize, BadgeStatusStatus } from "@metamask/design-system-shared";
|
|
2
2
|
// Mappings
|
|
3
3
|
export const CLASSMAP_BADGESTATUS_STATUS_CIRCLE = {
|
|
4
4
|
[BadgeStatusStatus.Active]: 'bg-success-default border-success-default',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.constants.mjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BadgeStatus.constants.mjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,iBAAiB,EAClB,uCAAuC;AAExC,WAAW;AACX,MAAM,CAAC,MAAM,kCAAkC,GAG3C;IACF,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,2CAA2C;IACvE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,mCAAmC;IACjE,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,iCAAiC;IACnE,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,2CAA2C;IACpE,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,uCAAuC;CACvE,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAoC;IACxE,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,SAAS;IAC/B,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,wBAAwB;CAC9D,CAAC","sourcesContent":["import {\n BadgeStatusSize,\n BadgeStatusStatus,\n} from '@metamask/design-system-shared';\n\n// Mappings\nexport const CLASSMAP_BADGESTATUS_STATUS_CIRCLE: Record<\n BadgeStatusStatus,\n string\n> = {\n [BadgeStatusStatus.Active]: 'bg-success-default border-success-default',\n [BadgeStatusStatus.Inactive]: 'bg-default border-success-default',\n [BadgeStatusStatus.Disconnected]: 'bg-icon-muted border-icon-muted',\n [BadgeStatusStatus.New]: 'bg-primary-default border-primary-default',\n [BadgeStatusStatus.Attention]: 'bg-error-default border-error-default',\n};\n\nexport const CLASSMAP_BADGESTATUS_SIZE: Record<BadgeStatusSize, string> = {\n [BadgeStatusSize.Md]: 'h-2 w-2', // 8px width and height\n [BadgeStatusSize.Lg]: 'h-2.5 w-2.5', // 10px width and height\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeStatus.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,cAAc;AAQ1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAA4B;AAE5D,eAAO,MAAM,WAAW,sGAoCvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BadgeStatus.d.mts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,cAAc;AAQ1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAA4B;AAE5D,eAAO,MAAM,WAAW,sGAoCvB,CAAC"}
|
|
@@ -4,9 +4,9 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
+
import { BadgeStatusSize } from "@metamask/design-system-shared";
|
|
7
8
|
import $React, { forwardRef } from "react";
|
|
8
9
|
const React = $importDefault($React);
|
|
9
|
-
import { BadgeStatusSize } from "../../types/index.mjs";
|
|
10
10
|
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
11
11
|
import { CLASSMAP_BADGESTATUS_STATUS_CIRCLE, CLASSMAP_BADGESTATUS_SIZE } from "./BadgeStatus.constants.mjs";
|
|
12
12
|
export const BadgeStatus = forwardRef(({ status, size = BadgeStatusSize.Md, hasBorder = true, className, style, ...props }, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.mjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BadgeStatus.mjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,uCAAuC;AACjE,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAE/C,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EAC1B,oCAAgC;AAGjC,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,CACE,EACE,MAAM,EACN,IAAI,GAAG,eAAe,CAAC,EAAE,EACzB,SAAS,GAAG,IAAI,EAChB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GAAG,OAAO;IAC7B,cAAc;IACd,0BAA0B;IAC1B,kBAAkB;IAClB,SAAS,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,EAAE;IACrD,iBAAiB;IACjB,SAAS,CACV,CAAC;IAEF,MAAM,qBAAqB,GAAG,OAAO;IACnC,cAAc;IACd,4BAA4B;IAC5B,cAAc;IACd,yBAAyB,CAAC,IAAI,CAAC;IAC/B,8BAA8B;IAC9B,kCAAkC,CAAC,MAAM,CAAC,CAC3C,CAAC;IAEF,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAM,KAAK;QAChE,6BAAK,SAAS,EAAE,qBAAqB,GAAI,CACrC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { BadgeStatusSize } from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\n\nimport {\n CLASSMAP_BADGESTATUS_STATUS_CIRCLE,\n CLASSMAP_BADGESTATUS_SIZE,\n} from './BadgeStatus.constants';\nimport type { BadgeStatusProps } from './BadgeStatus.types';\n\nexport const BadgeStatus = forwardRef<HTMLDivElement, BadgeStatusProps>(\n (\n {\n status,\n size = BadgeStatusSize.Md,\n hasBorder = true,\n className,\n style,\n ...props\n },\n ref,\n ) => {\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex rounded-full',\n // hasBorder style\n hasBorder ? 'border-2 border-background-default' : '',\n // Custom classes\n className,\n );\n\n const mergedCircleClassName = twMerge(\n // Base styles\n 'z-10 rounded-full border-2',\n // Size styles\n CLASSMAP_BADGESTATUS_SIZE[size],\n // Circle with semantics style\n CLASSMAP_BADGESTATUS_STATUS_CIRCLE[status],\n );\n\n return (\n <div ref={ref} className={mergedClassName} style={style} {...props}>\n <div className={mergedCircleClassName} />\n </div>\n );\n },\n);\n\nBadgeStatus.displayName = 'BadgeStatus';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.types.cjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"BadgeStatus.types.cjs","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BadgeStatusPropsShared } from '@metamask/design-system-shared';\nimport type { ComponentProps } from 'react';\n\n/**\n * BadgeStatus component props (React platform-specific)\n * Extends shared props from @metamask/design-system-shared with React-specific platform concerns\n */\nexport type BadgeStatusProps = ComponentProps<'div'> &\n BadgeStatusPropsShared & {\n /**\n * Optional prop for additional CSS classes to be applied to the BadgeStatus component.\n * These classes will be merged with the component's default classes using twMerge.\n */\n className?: string;\n /**\n * Optional CSS styles to be applied to the component.\n * Should be used sparingly and only for dynamic styles that can't be achieved with className.\n */\n style?: React.CSSProperties;\n };\n"]}
|
|
@@ -1,34 +1,10 @@
|
|
|
1
|
+
import type { BadgeStatusPropsShared } from "@metamask/design-system-shared";
|
|
1
2
|
import type { ComponentProps } from "react";
|
|
2
|
-
import type { BadgeStatusSize, BadgeStatusStatus } from "../../types/index.cjs";
|
|
3
3
|
/**
|
|
4
|
-
* BadgeStatus component props
|
|
4
|
+
* BadgeStatus component props (React platform-specific)
|
|
5
|
+
* Extends shared props from @metamask/design-system-shared with React-specific platform concerns
|
|
5
6
|
*/
|
|
6
|
-
export type BadgeStatusProps = ComponentProps<'div'> & {
|
|
7
|
-
/**
|
|
8
|
-
* Optional prop to control the status of the badge
|
|
9
|
-
* Possible values:
|
|
10
|
-
* - BadgeStatusStatus.Active. (Connected)
|
|
11
|
-
* - BadgeStatusStatus.Inactive. (Connected)
|
|
12
|
-
* - BadgeStatusStatus.Disconnected.
|
|
13
|
-
* - BadgeStatusStatus.New.
|
|
14
|
-
* - BadgeStatusStatus.Attention.
|
|
15
|
-
*/
|
|
16
|
-
status: BadgeStatusStatus;
|
|
17
|
-
/**
|
|
18
|
-
* Optional prop to determine whether the badge should display a border
|
|
19
|
-
*
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
hasBorder?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Optional prop to control the size of the BadgeStatus
|
|
25
|
-
* Possible values:
|
|
26
|
-
* - BadgeStatusSize.Md (8px),
|
|
27
|
-
* - BadgeStatusSize.Lg (10px),
|
|
28
|
-
*
|
|
29
|
-
* @default AvatarBaseSize.Md
|
|
30
|
-
*/
|
|
31
|
-
size?: BadgeStatusSize;
|
|
7
|
+
export type BadgeStatusProps = ComponentProps<'div'> & BadgeStatusPropsShared & {
|
|
32
8
|
/**
|
|
33
9
|
* Optional prop for additional CSS classes to be applied to the BadgeStatus component.
|
|
34
10
|
* These classes will be merged with the component's default classes using twMerge.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeStatus.types.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"BadgeStatus.types.d.cts","sourceRoot":"","sources":["../../../src/components/BadgeStatus/BadgeStatus.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uCAAuC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAClD,sBAAsB,GAAG;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC"}
|