@metamask/design-system-react 0.9.0 → 0.11.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.
Files changed (116) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/dist/components/BadgeCount/BadgeCount.cjs +2 -2
  3. package/dist/components/BadgeCount/BadgeCount.cjs.map +1 -1
  4. package/dist/components/BadgeCount/BadgeCount.constants.cjs +5 -5
  5. package/dist/components/BadgeCount/BadgeCount.constants.cjs.map +1 -1
  6. package/dist/components/BadgeCount/BadgeCount.constants.d.cts +1 -1
  7. package/dist/components/BadgeCount/BadgeCount.constants.d.cts.map +1 -1
  8. package/dist/components/BadgeCount/BadgeCount.constants.d.mts +1 -1
  9. package/dist/components/BadgeCount/BadgeCount.constants.d.mts.map +1 -1
  10. package/dist/components/BadgeCount/BadgeCount.constants.mjs +3 -3
  11. package/dist/components/BadgeCount/BadgeCount.constants.mjs.map +1 -1
  12. package/dist/components/BadgeCount/BadgeCount.d.cts.map +1 -1
  13. package/dist/components/BadgeCount/BadgeCount.d.mts.map +1 -1
  14. package/dist/components/BadgeCount/BadgeCount.mjs +1 -1
  15. package/dist/components/BadgeCount/BadgeCount.mjs.map +1 -1
  16. package/dist/components/BadgeCount/BadgeCount.types.cjs.map +1 -1
  17. package/dist/components/BadgeCount/BadgeCount.types.d.cts +4 -21
  18. package/dist/components/BadgeCount/BadgeCount.types.d.cts.map +1 -1
  19. package/dist/components/BadgeCount/BadgeCount.types.d.mts +4 -21
  20. package/dist/components/BadgeCount/BadgeCount.types.d.mts.map +1 -1
  21. package/dist/components/BadgeCount/BadgeCount.types.mjs.map +1 -1
  22. package/dist/components/BadgeCount/index.cjs +2 -2
  23. package/dist/components/BadgeCount/index.cjs.map +1 -1
  24. package/dist/components/BadgeCount/index.d.cts +1 -1
  25. package/dist/components/BadgeCount/index.d.cts.map +1 -1
  26. package/dist/components/BadgeCount/index.d.mts +1 -1
  27. package/dist/components/BadgeCount/index.d.mts.map +1 -1
  28. package/dist/components/BadgeCount/index.mjs +1 -1
  29. package/dist/components/BadgeCount/index.mjs.map +1 -1
  30. package/dist/components/BannerBase/BannerBase.cjs +54 -0
  31. package/dist/components/BannerBase/BannerBase.cjs.map +1 -0
  32. package/dist/components/BannerBase/BannerBase.d.cts +616 -0
  33. package/dist/components/BannerBase/BannerBase.d.cts.map +1 -0
  34. package/dist/components/BannerBase/BannerBase.d.mts +616 -0
  35. package/dist/components/BannerBase/BannerBase.d.mts.map +1 -0
  36. package/dist/components/BannerBase/BannerBase.mjs +35 -0
  37. package/dist/components/BannerBase/BannerBase.mjs.map +1 -0
  38. package/dist/components/BannerBase/BannerBase.types.cjs +3 -0
  39. package/dist/components/BannerBase/BannerBase.types.cjs.map +1 -0
  40. package/dist/components/BannerBase/BannerBase.types.d.cts +54 -0
  41. package/dist/components/BannerBase/BannerBase.types.d.cts.map +1 -0
  42. package/dist/components/BannerBase/BannerBase.types.d.mts +54 -0
  43. package/dist/components/BannerBase/BannerBase.types.d.mts.map +1 -0
  44. package/dist/components/BannerBase/BannerBase.types.mjs +2 -0
  45. package/dist/components/BannerBase/BannerBase.types.mjs.map +1 -0
  46. package/dist/components/BannerBase/index.cjs +6 -0
  47. package/dist/components/BannerBase/index.cjs.map +1 -0
  48. package/dist/components/BannerBase/index.d.cts +3 -0
  49. package/dist/components/BannerBase/index.d.cts.map +1 -0
  50. package/dist/components/BannerBase/index.d.mts +3 -0
  51. package/dist/components/BannerBase/index.d.mts.map +1 -0
  52. package/dist/components/BannerBase/index.mjs +2 -0
  53. package/dist/components/BannerBase/index.mjs.map +1 -0
  54. package/dist/components/ButtonFilter/ButtonFilter.cjs +37 -0
  55. package/dist/components/ButtonFilter/ButtonFilter.cjs.map +1 -0
  56. package/dist/components/ButtonFilter/ButtonFilter.d.cts +4 -0
  57. package/dist/components/ButtonFilter/ButtonFilter.d.cts.map +1 -0
  58. package/dist/components/ButtonFilter/ButtonFilter.d.mts +4 -0
  59. package/dist/components/ButtonFilter/ButtonFilter.d.mts.map +1 -0
  60. package/dist/components/ButtonFilter/ButtonFilter.mjs +18 -0
  61. package/dist/components/ButtonFilter/ButtonFilter.mjs.map +1 -0
  62. package/dist/components/ButtonFilter/ButtonFilter.types.cjs +3 -0
  63. package/dist/components/ButtonFilter/ButtonFilter.types.cjs.map +1 -0
  64. package/dist/components/ButtonFilter/ButtonFilter.types.d.cts +4 -0
  65. package/dist/components/ButtonFilter/ButtonFilter.types.d.cts.map +1 -0
  66. package/dist/components/ButtonFilter/ButtonFilter.types.d.mts +4 -0
  67. package/dist/components/ButtonFilter/ButtonFilter.types.d.mts.map +1 -0
  68. package/dist/components/ButtonFilter/ButtonFilter.types.mjs +2 -0
  69. package/dist/components/ButtonFilter/ButtonFilter.types.mjs.map +1 -0
  70. package/dist/components/ButtonFilter/index.cjs +6 -0
  71. package/dist/components/ButtonFilter/index.cjs.map +1 -0
  72. package/dist/components/ButtonFilter/index.d.cts +3 -0
  73. package/dist/components/ButtonFilter/index.d.cts.map +1 -0
  74. package/dist/components/ButtonFilter/index.d.mts +3 -0
  75. package/dist/components/ButtonFilter/index.d.mts.map +1 -0
  76. package/dist/components/ButtonFilter/index.mjs +2 -0
  77. package/dist/components/ButtonFilter/index.mjs.map +1 -0
  78. package/dist/components/ButtonIcon/ButtonIcon.cjs +11 -12
  79. package/dist/components/ButtonIcon/ButtonIcon.cjs.map +1 -1
  80. package/dist/components/ButtonIcon/ButtonIcon.mjs +12 -13
  81. package/dist/components/ButtonIcon/ButtonIcon.mjs.map +1 -1
  82. package/dist/components/ButtonIcon/ButtonIcon.types.cjs.map +1 -1
  83. package/dist/components/ButtonIcon/ButtonIcon.types.d.cts +4 -10
  84. package/dist/components/ButtonIcon/ButtonIcon.types.d.cts.map +1 -1
  85. package/dist/components/ButtonIcon/ButtonIcon.types.d.mts +4 -10
  86. package/dist/components/ButtonIcon/ButtonIcon.types.d.mts.map +1 -1
  87. package/dist/components/ButtonIcon/ButtonIcon.types.mjs.map +1 -1
  88. package/dist/components/ButtonIcon/index.cjs +2 -1
  89. package/dist/components/ButtonIcon/index.cjs.map +1 -1
  90. package/dist/components/ButtonIcon/index.d.cts +1 -1
  91. package/dist/components/ButtonIcon/index.d.cts.map +1 -1
  92. package/dist/components/ButtonIcon/index.d.mts +1 -1
  93. package/dist/components/ButtonIcon/index.d.mts.map +1 -1
  94. package/dist/components/ButtonIcon/index.mjs +1 -1
  95. package/dist/components/ButtonIcon/index.mjs.map +1 -1
  96. package/dist/components/Icon/icons/Ai.cjs +1 -1
  97. package/dist/components/Icon/icons/Ai.cjs.map +1 -1
  98. package/dist/components/Icon/icons/Ai.mjs +1 -1
  99. package/dist/components/Icon/icons/Ai.mjs.map +1 -1
  100. package/dist/components/index.cjs +7 -2
  101. package/dist/components/index.cjs.map +1 -1
  102. package/dist/components/index.d.cts +5 -1
  103. package/dist/components/index.d.cts.map +1 -1
  104. package/dist/components/index.d.mts +5 -1
  105. package/dist/components/index.d.mts.map +1 -1
  106. package/dist/components/index.mjs +3 -1
  107. package/dist/components/index.mjs.map +1 -1
  108. package/dist/types/index.cjs +10 -15
  109. package/dist/types/index.cjs.map +1 -1
  110. package/dist/types/index.d.cts +8 -13
  111. package/dist/types/index.d.cts.map +1 -1
  112. package/dist/types/index.d.mts +8 -13
  113. package/dist/types/index.d.mts.map +1 -1
  114. package/dist/types/index.mjs +9 -14
  115. package/dist/types/index.mjs.map +1 -1
  116. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.0]
11
+
12
+ ### Added
13
+
14
+ - Added `ButtonFilter` component for filter button functionality ([#964](https://github.com/MetaMask/metamask-design-system/pull/964))
15
+ - Added `BannerBase` component for creating custom banner notifications ([#961](https://github.com/MetaMask/metamask-design-system/pull/961))
16
+
17
+ ### Changed
18
+
19
+ - **BREAKING:** Updated `ButtonIcon` API to use `variant` prop instead of `isInverse` and `isFloating` boolean props ([#948](https://github.com/MetaMask/metamask-design-system/pull/948))
20
+ - Removed `isInverse` and `isFloating` props
21
+ - Added `variant` prop with three options: `ButtonIconVariant.Default` (default), `ButtonIconVariant.Filled` (new muted background with rounded corners), and `ButtonIconVariant.Floating` (replaces `isFloating` behavior)
22
+ - Migration: Replace `isFloating={true}` with `variant={ButtonIconVariant.Floating}`, and use `variant={ButtonIconVariant.Default}` for standard transparent background
23
+ - See [Migration Guide](./MIGRATION.md#from-version-0100-to-0110) for complete migration instructions
24
+ - Updated `Ai` icon to filled version for visual consistency ([#970](https://github.com/MetaMask/metamask-design-system/pull/970))
25
+
26
+ ## [0.10.0]
27
+
28
+ ### Changed
29
+
30
+ - **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))
31
+ - `BadgeCountSize` is now provided as a const object with a derived union type rather than an enum
32
+ - `BadgeCount` shared prop types are now sourced from `@metamask/design-system-shared`
33
+ - Migration: update any enum-specific usage to const-object/union usage, while continuing to import from `@metamask/design-system-react`
34
+
10
35
  ## [0.9.0]
11
36
 
12
37
  ### Changed
@@ -157,7 +182,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
157
182
  - Full TypeScript support with type definitions and enums
158
183
  - Tailwind CSS integration with design token support
159
184
 
160
- [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.9.0...HEAD
185
+ [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.11.0...HEAD
186
+ [0.11.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.10.0...@metamask/design-system-react@0.11.0
187
+ [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
161
188
  [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
162
189
  [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
163
190
  [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
@@ -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 = types_1.BadgeCountSize.Md, count, max = 99, textProps, className = '', style, ...props }, ref) => {
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,iDAA6C;AAC7C,uDAA+C;AAC/C,4CAAsD;AAEtD,qEAGgC;AAGnB,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,IAAI,GAAG,sBAAc,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 React, { forwardRef } from 'react';\n\nimport { BadgeCountSize } from '../../types';\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
+ {"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 types_1 = require("../../types/index.cjs");
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
- [types_1.BadgeCountSize.Md]: Text_1.TextVariant.BodyXs,
9
- [types_1.BadgeCountSize.Lg]: Text_1.TextVariant.BodySm,
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
- [types_1.BadgeCountSize.Md]: 'min-w-4 h-3.5 py-0 px-1',
13
- [types_1.BadgeCountSize.Lg]: 'min-w-6 h-5 py-0.5 px-1.5', // min-width 24px, height 20px, padding-vertical 2, padding-horizontal 6
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,iDAA6C;AAC7C,4CAAsC;AAEtC,WAAW;AACE,QAAA,+BAA+B,GAGxC;IACF,CAAC,sBAAc,CAAC,EAAE,CAAC,EAAE,kBAAW,CAAC,MAAM;IACvC,CAAC,sBAAc,CAAC,EAAE,CAAC,EAAE,kBAAW,CAAC,MAAM;CACxC,CAAC;AAEW,QAAA,oCAAoC,GAG7C;IACF,CAAC,sBAAc,CAAC,EAAE,CAAC,EAAE,yBAAyB;IAC9C,CAAC,sBAAc,CAAC,EAAE,CAAC,EAAE,2BAA2B,EAAE,wEAAwE;CAC3H,CAAC","sourcesContent":["import { BadgeCountSize } from '../../types';\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-3.5 py-0 px-1', // min-width 16px, height 14px, padding-vertical 0, padding-horizontal 4\n [BadgeCountSize.Lg]: 'min-w-6 h-5 py-0.5 px-1.5', // min-width 24px, height 20px, padding-vertical 2, padding-horizontal 6\n};\n"]}
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 "../../types/index.cjs";
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,8BAAoB;AAC7C,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
+ {"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 "../../types/index.mjs";
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,8BAAoB;AAC7C,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
+ {"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 "../../types/index.mjs";
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-3.5 py-0 px-1',
10
- [BadgeCountSize.Lg]: 'min-w-6 h-5 py-0.5 px-1.5', // min-width 24px, height 20px, padding-vertical 2, padding-horizontal 6
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,8BAAoB;AAC7C,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,yBAAyB;IAC9C,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,2BAA2B,EAAE,wEAAwE;CAC3H,CAAC","sourcesContent":["import { BadgeCountSize } from '../../types';\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-3.5 py-0 px-1', // min-width 16px, height 14px, padding-vertical 0, padding-horizontal 4\n [BadgeCountSize.Lg]: 'min-w-6 h-5 py-0.5 px-1.5', // min-width 24px, height 20px, padding-vertical 2, padding-horizontal 6\n};\n"]}
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":"AAAA,OAAO,KAAqB,cAAc;AAU1C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,qGAmCtB,CAAC"}
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":"AAAA,OAAO,KAAqB,cAAc;AAU1C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,qGAmCtB,CAAC"}
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,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,cAAc,EAAE,8BAAoB;AAC7C,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 React, { forwardRef } from 'react';\n\nimport { BadgeCountSize } from '../../types';\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
+ {"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":["import type { ComponentProps } from 'react';\n\nimport type { BadgeCountSize } from '../../types';\nimport type { TextProps } from '../Text';\n\n/**\n * BadgeCount component props.\n */\nexport type BadgeCountProps = ComponentProps<'div'> & {\n /**\n * Optional prop to control the size of the BadgeCount\n * Different sizes map to specific height\n *\n * @default IconSize.Md\n */\n size?: BadgeCountSize;\n /**\n * Required prop to show the count number\n */\n count: number;\n /**\n * Optional prop to determine the max the count can go up to.\n * If count > max, the count will be shown as \"max+\"\n *\n * @default 99\n */\n max?: number;\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
+ {"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":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,8BAAoB;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;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
+ {"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":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,8BAAoB;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;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
+ {"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":["import type { ComponentProps } from 'react';\n\nimport type { BadgeCountSize } from '../../types';\nimport type { TextProps } from '../Text';\n\n/**\n * BadgeCount component props.\n */\nexport type BadgeCountProps = ComponentProps<'div'> & {\n /**\n * Optional prop to control the size of the BadgeCount\n * Different sizes map to specific height\n *\n * @default IconSize.Md\n */\n size?: BadgeCountSize;\n /**\n * Required prop to show the count number\n */\n count: number;\n /**\n * Optional prop to determine the max the count can go up to.\n * If count > max, the count will be shown as \"max+\"\n *\n * @default 99\n */\n max?: number;\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
+ {"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 types_1 = require("../../types/index.cjs");
5
- Object.defineProperty(exports, "BadgeCountSize", { enumerable: true, get: function () { return types_1.BadgeCountSize; } });
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,+CAA6C;AAApC,uGAAA,cAAc,OAAA;AACvB,+CAA0C;AAAjC,wGAAA,UAAU,OAAA","sourcesContent":["export { BadgeCountSize } from '../../types';\nexport { BadgeCount } from './BadgeCount';\nexport type { BadgeCountProps } from './BadgeCount.types';\n"]}
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 "../../types/index.cjs";
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,8BAAoB;AAC7C,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
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 "../../types/index.mjs";
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,8BAAoB;AAC7C,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
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,3 +1,3 @@
1
- export { BadgeCountSize } from "../../types/index.mjs";
1
+ export { BadgeCountSize } from "@metamask/design-system-shared";
2
2
  export { BadgeCount } from "./BadgeCount.mjs";
3
3
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/BadgeCount/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,8BAAoB;AAC7C,OAAO,EAAE,UAAU,EAAE,yBAAqB","sourcesContent":["export { BadgeCountSize } from '../../types';\nexport { BadgeCount } from './BadgeCount';\nexport type { BadgeCountProps } from './BadgeCount.types';\n"]}
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"]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.BannerBase = void 0;
27
+ const react_1 = __importStar(require("react"));
28
+ const types_1 = require("../../types/index.cjs");
29
+ const tw_merge_1 = require("../../utils/tw-merge.cjs");
30
+ const Box_1 = require("../Box/index.cjs");
31
+ const Button_1 = require("../Button/index.cjs");
32
+ const ButtonIcon_1 = require("../ButtonIcon/index.cjs");
33
+ const Text_1 = require("../Text/index.cjs");
34
+ const isTextContent = (content) => typeof content === 'string' || typeof content === 'number';
35
+ const hasContent = (content) => content !== null && content !== undefined;
36
+ exports.BannerBase = (0, react_1.forwardRef)(({ title, titleProps, description, descriptionProps, children, childrenWrapperProps, actionButtonLabel, actionButtonOnClick, actionButtonProps, startAccessory, onClose, closeButtonProps, className, ...props }, ref) => {
37
+ const resolvedActionButtonProps = actionButtonProps ?? {};
38
+ const { ariaLabel: closeButtonAriaLabel = 'Close banner', onClick: closeButtonPropsOnClick, className: closeButtonClassName, ...resolvedCloseButtonProps } = closeButtonProps ?? {};
39
+ const shouldShowCloseButton = Boolean(onClose || closeButtonProps);
40
+ const shouldShowActionButton = Boolean(actionButtonOnClick);
41
+ return (react_1.default.createElement(Box_1.Box, { ref: ref, flexDirection: types_1.BoxFlexDirection.Row, alignItems: types_1.BoxAlignItems.Start, gap: 2, backgroundColor: types_1.BoxBackgroundColor.BackgroundDefault, padding: 3, className: (0, tw_merge_1.twMerge)('rounded-sm', className), ...props },
42
+ startAccessory,
43
+ react_1.default.createElement(Box_1.Box, { className: "min-w-0 flex-1" },
44
+ hasContent(title) &&
45
+ (isTextContent(title) ? (react_1.default.createElement(Text_1.Text, { variant: types_1.TextVariant.BodyMd, fontWeight: types_1.FontWeight.Medium, ...titleProps }, title)) : (title)),
46
+ hasContent(description) && (react_1.default.createElement(Box_1.Box, { className: hasContent(title) ? 'mt-1' : undefined }, isTextContent(description) ? (react_1.default.createElement(Text_1.Text, { variant: types_1.TextVariant.BodySm, ...descriptionProps }, description)) : (description))),
47
+ hasContent(children) &&
48
+ (isTextContent(children) ? (react_1.default.createElement(Text_1.Text, { variant: types_1.TextVariant.BodyMd, ...childrenWrapperProps }, children)) : (children)),
49
+ shouldShowActionButton && (react_1.default.createElement(Box_1.Box, { className: "mt-4" },
50
+ react_1.default.createElement(Button_1.Button, { size: types_1.ButtonSize.Md, onClick: actionButtonOnClick, ...resolvedActionButtonProps }, actionButtonLabel)))),
51
+ shouldShowCloseButton && (react_1.default.createElement(ButtonIcon_1.ButtonIcon, { className: (0, tw_merge_1.twMerge)('ml-3 self-start', closeButtonClassName), iconName: types_1.IconName.Close, size: types_1.ButtonIconSize.Sm, ariaLabel: closeButtonAriaLabel, onClick: onClose ?? closeButtonPropsOnClick, ...resolvedCloseButtonProps }))));
52
+ });
53
+ exports.BannerBase.displayName = 'BannerBase';
54
+ //# sourceMappingURL=BannerBase.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"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","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport {\n BoxAlignItems,\n BoxBackgroundColor,\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n BoxFlexDirection,\n IconName,\n TextVariant,\n} from '../../types';\nimport { twMerge } from '../../utils/tw-merge';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase = forwardRef<HTMLDivElement, BannerBaseProps>(\n (\n {\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n className,\n ...props\n },\n ref,\n ) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n ariaLabel: closeButtonAriaLabel = 'Close banner',\n onClick: closeButtonPropsOnClick,\n className: closeButtonClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnClick);\n\n return (\n <Box\n ref={ref}\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n className={twMerge('rounded-sm', className)}\n {...props}\n >\n {startAccessory}\n\n <Box className=\"min-w-0 flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box className={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box className=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onClick={actionButtonOnClick}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n className={twMerge('ml-3 self-start', closeButtonClassName)}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n ariaLabel={closeButtonAriaLabel}\n onClick={onClose ?? closeButtonPropsOnClick}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n },\n);\n\nBannerBase.displayName = 'BannerBase';\n"]}