@metamask-previews/design-system-react 0.7.0-preview.3dc70e1 → 0.11.0-preview.23cc337

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 (200) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/dist/components/AvatarNetwork/AvatarNetwork.types.cjs.map +1 -1
  3. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.cts +8 -13
  4. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.cts.map +1 -1
  5. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.mts +8 -13
  6. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.mts.map +1 -1
  7. package/dist/components/AvatarNetwork/AvatarNetwork.types.mjs.map +1 -1
  8. package/dist/components/BadgeCount/BadgeCount.cjs +2 -2
  9. package/dist/components/BadgeCount/BadgeCount.cjs.map +1 -1
  10. package/dist/components/BadgeCount/BadgeCount.constants.cjs +5 -5
  11. package/dist/components/BadgeCount/BadgeCount.constants.cjs.map +1 -1
  12. package/dist/components/BadgeCount/BadgeCount.constants.d.cts +1 -1
  13. package/dist/components/BadgeCount/BadgeCount.constants.d.cts.map +1 -1
  14. package/dist/components/BadgeCount/BadgeCount.constants.d.mts +1 -1
  15. package/dist/components/BadgeCount/BadgeCount.constants.d.mts.map +1 -1
  16. package/dist/components/BadgeCount/BadgeCount.constants.mjs +3 -3
  17. package/dist/components/BadgeCount/BadgeCount.constants.mjs.map +1 -1
  18. package/dist/components/BadgeCount/BadgeCount.d.cts.map +1 -1
  19. package/dist/components/BadgeCount/BadgeCount.d.mts.map +1 -1
  20. package/dist/components/BadgeCount/BadgeCount.mjs +1 -1
  21. package/dist/components/BadgeCount/BadgeCount.mjs.map +1 -1
  22. package/dist/components/BadgeCount/BadgeCount.types.cjs.map +1 -1
  23. package/dist/components/BadgeCount/BadgeCount.types.d.cts +4 -21
  24. package/dist/components/BadgeCount/BadgeCount.types.d.cts.map +1 -1
  25. package/dist/components/BadgeCount/BadgeCount.types.d.mts +4 -21
  26. package/dist/components/BadgeCount/BadgeCount.types.d.mts.map +1 -1
  27. package/dist/components/BadgeCount/BadgeCount.types.mjs.map +1 -1
  28. package/dist/components/BadgeCount/index.cjs +2 -2
  29. package/dist/components/BadgeCount/index.cjs.map +1 -1
  30. package/dist/components/BadgeCount/index.d.cts +1 -1
  31. package/dist/components/BadgeCount/index.d.cts.map +1 -1
  32. package/dist/components/BadgeCount/index.d.mts +1 -1
  33. package/dist/components/BadgeCount/index.d.mts.map +1 -1
  34. package/dist/components/BadgeCount/index.mjs +1 -1
  35. package/dist/components/BadgeCount/index.mjs.map +1 -1
  36. package/dist/components/BadgeStatus/BadgeStatus.types.cjs.map +1 -1
  37. package/dist/components/BadgeStatus/BadgeStatus.types.d.cts +1 -1
  38. package/dist/components/BadgeStatus/BadgeStatus.types.d.cts.map +1 -1
  39. package/dist/components/BadgeStatus/BadgeStatus.types.d.mts +1 -1
  40. package/dist/components/BadgeStatus/BadgeStatus.types.d.mts.map +1 -1
  41. package/dist/components/BadgeStatus/BadgeStatus.types.mjs.map +1 -1
  42. package/dist/components/BannerAlert/BannerAlert.cjs +43 -0
  43. package/dist/components/BannerAlert/BannerAlert.cjs.map +1 -0
  44. package/dist/components/BannerAlert/BannerAlert.constants.cjs +30 -0
  45. package/dist/components/BannerAlert/BannerAlert.constants.cjs.map +1 -0
  46. package/dist/components/BannerAlert/BannerAlert.constants.d.cts +7 -0
  47. package/dist/components/BannerAlert/BannerAlert.constants.d.cts.map +1 -0
  48. package/dist/components/BannerAlert/BannerAlert.constants.d.mts +7 -0
  49. package/dist/components/BannerAlert/BannerAlert.constants.d.mts.map +1 -0
  50. package/dist/components/BannerAlert/BannerAlert.constants.mjs +27 -0
  51. package/dist/components/BannerAlert/BannerAlert.constants.mjs.map +1 -0
  52. package/dist/components/BannerAlert/BannerAlert.d.cts +624 -0
  53. package/dist/components/BannerAlert/BannerAlert.d.cts.map +1 -0
  54. package/dist/components/BannerAlert/BannerAlert.d.mts +624 -0
  55. package/dist/components/BannerAlert/BannerAlert.d.mts.map +1 -0
  56. package/dist/components/BannerAlert/BannerAlert.mjs +24 -0
  57. package/dist/components/BannerAlert/BannerAlert.mjs.map +1 -0
  58. package/dist/components/BannerAlert/BannerAlert.types.cjs +3 -0
  59. package/dist/components/BannerAlert/BannerAlert.types.cjs.map +1 -0
  60. package/dist/components/BannerAlert/BannerAlert.types.d.cts +10 -0
  61. package/dist/components/BannerAlert/BannerAlert.types.d.cts.map +1 -0
  62. package/dist/components/BannerAlert/BannerAlert.types.d.mts +10 -0
  63. package/dist/components/BannerAlert/BannerAlert.types.d.mts.map +1 -0
  64. package/dist/components/BannerAlert/BannerAlert.types.mjs +2 -0
  65. package/dist/components/BannerAlert/BannerAlert.types.mjs.map +1 -0
  66. package/dist/components/BannerAlert/index.cjs +8 -0
  67. package/dist/components/BannerAlert/index.cjs.map +1 -0
  68. package/dist/components/BannerAlert/index.d.cts +4 -0
  69. package/dist/components/BannerAlert/index.d.cts.map +1 -0
  70. package/dist/components/BannerAlert/index.d.mts +4 -0
  71. package/dist/components/BannerAlert/index.d.mts.map +1 -0
  72. package/dist/components/BannerAlert/index.mjs +3 -0
  73. package/dist/components/BannerAlert/index.mjs.map +1 -0
  74. package/dist/components/BannerBase/BannerBase.cjs +54 -0
  75. package/dist/components/BannerBase/BannerBase.cjs.map +1 -0
  76. package/dist/components/BannerBase/BannerBase.d.cts +616 -0
  77. package/dist/components/BannerBase/BannerBase.d.cts.map +1 -0
  78. package/dist/components/BannerBase/BannerBase.d.mts +616 -0
  79. package/dist/components/BannerBase/BannerBase.d.mts.map +1 -0
  80. package/dist/components/BannerBase/BannerBase.mjs +35 -0
  81. package/dist/components/BannerBase/BannerBase.mjs.map +1 -0
  82. package/dist/components/BannerBase/BannerBase.types.cjs +3 -0
  83. package/dist/components/BannerBase/BannerBase.types.cjs.map +1 -0
  84. package/dist/components/BannerBase/BannerBase.types.d.cts +54 -0
  85. package/dist/components/BannerBase/BannerBase.types.d.cts.map +1 -0
  86. package/dist/components/BannerBase/BannerBase.types.d.mts +54 -0
  87. package/dist/components/BannerBase/BannerBase.types.d.mts.map +1 -0
  88. package/dist/components/BannerBase/BannerBase.types.mjs +2 -0
  89. package/dist/components/BannerBase/BannerBase.types.mjs.map +1 -0
  90. package/dist/components/BannerBase/index.cjs +6 -0
  91. package/dist/components/BannerBase/index.cjs.map +1 -0
  92. package/dist/components/BannerBase/index.d.cts +3 -0
  93. package/dist/components/BannerBase/index.d.cts.map +1 -0
  94. package/dist/components/BannerBase/index.d.mts +3 -0
  95. package/dist/components/BannerBase/index.d.mts.map +1 -0
  96. package/dist/components/BannerBase/index.mjs +2 -0
  97. package/dist/components/BannerBase/index.mjs.map +1 -0
  98. package/dist/components/ButtonFilter/ButtonFilter.cjs +37 -0
  99. package/dist/components/ButtonFilter/ButtonFilter.cjs.map +1 -0
  100. package/dist/components/ButtonFilter/ButtonFilter.d.cts +4 -0
  101. package/dist/components/ButtonFilter/ButtonFilter.d.cts.map +1 -0
  102. package/dist/components/ButtonFilter/ButtonFilter.d.mts +4 -0
  103. package/dist/components/ButtonFilter/ButtonFilter.d.mts.map +1 -0
  104. package/dist/components/ButtonFilter/ButtonFilter.mjs +18 -0
  105. package/dist/components/ButtonFilter/ButtonFilter.mjs.map +1 -0
  106. package/dist/components/ButtonFilter/ButtonFilter.types.cjs +3 -0
  107. package/dist/components/ButtonFilter/ButtonFilter.types.cjs.map +1 -0
  108. package/dist/components/ButtonFilter/ButtonFilter.types.d.cts +4 -0
  109. package/dist/components/ButtonFilter/ButtonFilter.types.d.cts.map +1 -0
  110. package/dist/components/ButtonFilter/ButtonFilter.types.d.mts +4 -0
  111. package/dist/components/ButtonFilter/ButtonFilter.types.d.mts.map +1 -0
  112. package/dist/components/ButtonFilter/ButtonFilter.types.mjs +2 -0
  113. package/dist/components/ButtonFilter/ButtonFilter.types.mjs.map +1 -0
  114. package/dist/components/ButtonFilter/index.cjs +6 -0
  115. package/dist/components/ButtonFilter/index.cjs.map +1 -0
  116. package/dist/components/ButtonFilter/index.d.cts +3 -0
  117. package/dist/components/ButtonFilter/index.d.cts.map +1 -0
  118. package/dist/components/ButtonFilter/index.d.mts +3 -0
  119. package/dist/components/ButtonFilter/index.d.mts.map +1 -0
  120. package/dist/components/ButtonFilter/index.mjs +2 -0
  121. package/dist/components/ButtonFilter/index.mjs.map +1 -0
  122. package/dist/components/ButtonIcon/ButtonIcon.cjs +11 -12
  123. package/dist/components/ButtonIcon/ButtonIcon.cjs.map +1 -1
  124. package/dist/components/ButtonIcon/ButtonIcon.mjs +12 -13
  125. package/dist/components/ButtonIcon/ButtonIcon.mjs.map +1 -1
  126. package/dist/components/ButtonIcon/ButtonIcon.types.cjs.map +1 -1
  127. package/dist/components/ButtonIcon/ButtonIcon.types.d.cts +4 -10
  128. package/dist/components/ButtonIcon/ButtonIcon.types.d.cts.map +1 -1
  129. package/dist/components/ButtonIcon/ButtonIcon.types.d.mts +4 -10
  130. package/dist/components/ButtonIcon/ButtonIcon.types.d.mts.map +1 -1
  131. package/dist/components/ButtonIcon/ButtonIcon.types.mjs.map +1 -1
  132. package/dist/components/ButtonIcon/index.cjs +2 -1
  133. package/dist/components/ButtonIcon/index.cjs.map +1 -1
  134. package/dist/components/ButtonIcon/index.d.cts +1 -1
  135. package/dist/components/ButtonIcon/index.d.cts.map +1 -1
  136. package/dist/components/ButtonIcon/index.d.mts +1 -1
  137. package/dist/components/ButtonIcon/index.d.mts.map +1 -1
  138. package/dist/components/ButtonIcon/index.mjs +1 -1
  139. package/dist/components/ButtonIcon/index.mjs.map +1 -1
  140. package/dist/components/Icon/icons/Ai.cjs +1 -1
  141. package/dist/components/Icon/icons/Ai.cjs.map +1 -1
  142. package/dist/components/Icon/icons/Ai.mjs +1 -1
  143. package/dist/components/Icon/icons/Ai.mjs.map +1 -1
  144. package/dist/components/Icon/icons/CorporateFare.cjs +32 -0
  145. package/dist/components/Icon/icons/CorporateFare.cjs.map +1 -0
  146. package/dist/components/Icon/icons/CorporateFare.d.cts +4 -0
  147. package/dist/components/Icon/icons/CorporateFare.d.cts.map +1 -0
  148. package/dist/components/Icon/icons/CorporateFare.d.mts +4 -0
  149. package/dist/components/Icon/icons/CorporateFare.d.mts.map +1 -0
  150. package/dist/components/Icon/icons/CorporateFare.mjs +7 -0
  151. package/dist/components/Icon/icons/CorporateFare.mjs.map +1 -0
  152. package/dist/components/Icon/icons/index.cjs +2 -0
  153. package/dist/components/Icon/icons/index.cjs.map +1 -1
  154. package/dist/components/Icon/icons/index.d.cts +1 -0
  155. package/dist/components/Icon/icons/index.d.cts.map +1 -1
  156. package/dist/components/Icon/icons/index.d.mts +1 -0
  157. package/dist/components/Icon/icons/index.d.mts.map +1 -1
  158. package/dist/components/Icon/icons/index.mjs +2 -0
  159. package/dist/components/Icon/icons/index.mjs.map +1 -1
  160. package/dist/components/Input/Input.cjs +36 -0
  161. package/dist/components/Input/Input.cjs.map +1 -0
  162. package/dist/components/Input/Input.d.cts +10 -0
  163. package/dist/components/Input/Input.d.cts.map +1 -0
  164. package/dist/components/Input/Input.d.mts +10 -0
  165. package/dist/components/Input/Input.d.mts.map +1 -0
  166. package/dist/components/Input/Input.mjs +17 -0
  167. package/dist/components/Input/Input.mjs.map +1 -0
  168. package/dist/components/Input/Input.types.cjs +3 -0
  169. package/dist/components/Input/Input.types.cjs.map +1 -0
  170. package/dist/components/Input/Input.types.d.cts +31 -0
  171. package/dist/components/Input/Input.types.d.cts.map +1 -0
  172. package/dist/components/Input/Input.types.d.mts +31 -0
  173. package/dist/components/Input/Input.types.d.mts.map +1 -0
  174. package/dist/components/Input/Input.types.mjs +2 -0
  175. package/dist/components/Input/Input.types.mjs.map +1 -0
  176. package/dist/components/Input/index.cjs +6 -0
  177. package/dist/components/Input/index.cjs.map +1 -0
  178. package/dist/components/Input/index.d.cts +3 -0
  179. package/dist/components/Input/index.d.cts.map +1 -0
  180. package/dist/components/Input/index.d.mts +3 -0
  181. package/dist/components/Input/index.d.mts.map +1 -0
  182. package/dist/components/Input/index.mjs +2 -0
  183. package/dist/components/Input/index.mjs.map +1 -0
  184. package/dist/components/index.cjs +12 -2
  185. package/dist/components/index.cjs.map +1 -1
  186. package/dist/components/index.d.cts +9 -1
  187. package/dist/components/index.d.cts.map +1 -1
  188. package/dist/components/index.d.mts +9 -1
  189. package/dist/components/index.d.mts.map +1 -1
  190. package/dist/components/index.mjs +5 -1
  191. package/dist/components/index.mjs.map +1 -1
  192. package/dist/types/index.cjs +11 -15
  193. package/dist/types/index.cjs.map +1 -1
  194. package/dist/types/index.d.cts +9 -13
  195. package/dist/types/index.d.cts.map +1 -1
  196. package/dist/types/index.d.mts +9 -13
  197. package/dist/types/index.d.mts.map +1 -1
  198. package/dist/types/index.mjs +10 -14
  199. package/dist/types/index.mjs.map +1 -1
  200. package/package.json +3 -3
@@ -0,0 +1,35 @@
1
+ function $importDefault(module) {
2
+ if (module?.__esModule) {
3
+ return module.default;
4
+ }
5
+ return module;
6
+ }
7
+ import $React, { forwardRef } from "react";
8
+ const React = $importDefault($React);
9
+ import { BoxAlignItems, BoxBackgroundColor, ButtonIconSize, ButtonSize, FontWeight, BoxFlexDirection, IconName, TextVariant } from "../../types/index.mjs";
10
+ import { twMerge } from "../../utils/tw-merge.mjs";
11
+ import { Box } from "../Box/index.mjs";
12
+ import { Button } from "../Button/index.mjs";
13
+ import { ButtonIcon } from "../ButtonIcon/index.mjs";
14
+ import { Text } from "../Text/index.mjs";
15
+ const isTextContent = (content) => typeof content === 'string' || typeof content === 'number';
16
+ const hasContent = (content) => content !== null && content !== undefined;
17
+ export const BannerBase = forwardRef(({ title, titleProps, description, descriptionProps, children, childrenWrapperProps, actionButtonLabel, actionButtonOnClick, actionButtonProps, startAccessory, onClose, closeButtonProps, className, ...props }, ref) => {
18
+ const resolvedActionButtonProps = actionButtonProps ?? {};
19
+ const { ariaLabel: closeButtonAriaLabel = 'Close banner', onClick: closeButtonPropsOnClick, className: closeButtonClassName, ...resolvedCloseButtonProps } = closeButtonProps ?? {};
20
+ const shouldShowCloseButton = Boolean(onClose || closeButtonProps);
21
+ const shouldShowActionButton = Boolean(actionButtonOnClick);
22
+ return (React.createElement(Box, { ref: ref, flexDirection: BoxFlexDirection.Row, alignItems: BoxAlignItems.Start, gap: 2, backgroundColor: BoxBackgroundColor.BackgroundDefault, padding: 3, className: twMerge('rounded-sm', className), ...props },
23
+ startAccessory,
24
+ React.createElement(Box, { className: "min-w-0 flex-1" },
25
+ hasContent(title) &&
26
+ (isTextContent(title) ? (React.createElement(Text, { variant: TextVariant.BodyMd, fontWeight: FontWeight.Medium, ...titleProps }, title)) : (title)),
27
+ hasContent(description) && (React.createElement(Box, { className: hasContent(title) ? 'mt-1' : undefined }, isTextContent(description) ? (React.createElement(Text, { variant: TextVariant.BodySm, ...descriptionProps }, description)) : (description))),
28
+ hasContent(children) &&
29
+ (isTextContent(children) ? (React.createElement(Text, { variant: TextVariant.BodyMd, ...childrenWrapperProps }, children)) : (children)),
30
+ shouldShowActionButton && (React.createElement(Box, { className: "mt-4" },
31
+ React.createElement(Button, { size: ButtonSize.Md, onClick: actionButtonOnClick, ...resolvedActionButtonProps }, actionButtonLabel)))),
32
+ shouldShowCloseButton && (React.createElement(ButtonIcon, { className: twMerge('ml-3 self-start', closeButtonClassName), iconName: IconName.Close, size: ButtonIconSize.Sm, ariaLabel: closeButtonAriaLabel, onClick: onClose ?? closeButtonPropsOnClick, ...resolvedCloseButtonProps }))));
33
+ });
34
+ BannerBase.displayName = 'BannerBase';
35
+ //# sourceMappingURL=BannerBase.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACZ,8BAAoB;AACrB,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAI/B,MAAM,aAAa,GAAG,CAAC,OAAwB,EAA8B,EAAE,CAC7E,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC;AAE7D,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE,CAC9C,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,yBAAyB,GAAG,iBAAiB,IAAI,EAAE,CAAC;IAE1D,MAAM,EACJ,SAAS,EAAE,oBAAoB,GAAG,cAAc,EAChD,OAAO,EAAE,uBAAuB,EAChC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,wBAAwB,EAC5B,GAAG,gBAAgB,IAAI,EAAE,CAAC;IAE3B,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC;IACnE,MAAM,sBAAsB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE5D,OAAO,CACL,oBAAC,GAAG,IACF,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,gBAAgB,CAAC,GAAG,EACnC,UAAU,EAAE,aAAa,CAAC,KAAK,EAC/B,GAAG,EAAE,CAAC,EACN,eAAe,EAAE,kBAAkB,CAAC,iBAAiB,EACrD,OAAO,EAAE,CAAC,EACV,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,KACvC,KAAK;QAER,cAAc;QAEf,oBAAC,GAAG,IAAC,SAAS,EAAC,gBAAgB;YAC5B,UAAU,CAAC,KAAK,CAAC;gBAChB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACtB,oBAAC,IAAI,IACH,OAAO,EAAE,WAAW,CAAC,MAAM,EAC3B,UAAU,EAAE,UAAU,CAAC,MAAM,KACzB,UAAU,IAEb,KAAK,CACD,CACR,CAAC,CAAC,CAAC,CACF,KAAK,CACN,CAAC;YAEH,UAAU,CAAC,WAAW,CAAC,IAAI,CAC1B,oBAAC,GAAG,IAAC,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IACnD,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAC5B,oBAAC,IAAI,IAAC,OAAO,EAAE,WAAW,CAAC,MAAM,KAAM,gBAAgB,IACpD,WAAW,CACP,CACR,CAAC,CAAC,CAAC,CACF,WAAW,CACZ,CACG,CACP;YAEA,UAAU,CAAC,QAAQ,CAAC;gBACnB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACzB,oBAAC,IAAI,IAAC,OAAO,EAAE,WAAW,CAAC,MAAM,KAAM,oBAAoB,IACxD,QAAQ,CACJ,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC;YAEH,sBAAsB,IAAI,CACzB,oBAAC,GAAG,IAAC,SAAS,EAAC,MAAM;gBACnB,oBAAC,MAAM,IACL,IAAI,EAAE,UAAU,CAAC,EAAE,EACnB,OAAO,EAAE,mBAAmB,KACxB,yBAAyB,IAE5B,iBAAiB,CACX,CACL,CACP,CACG;QAEL,qBAAqB,IAAI,CACxB,oBAAC,UAAU,IACT,SAAS,EAAE,OAAO,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,EAC3D,QAAQ,EAAE,QAAQ,CAAC,KAAK,EACxB,IAAI,EAAE,cAAc,CAAC,EAAE,EACvB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAO,IAAI,uBAAuB,KACvC,wBAAwB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","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"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=BannerBase.types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerBase.types.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BannerBasePropsShared } from '@metamask-previews/design-system-shared';\nimport type { MouseEventHandler } from 'react';\n\nimport type { BoxProps } from '../Box';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\ntype BannerBaseActionButtonProps = Omit<\n Partial<ButtonProps>,\n 'children' | 'onClick' | 'variant'\n>;\n\ntype BannerBaseCloseButtonProps = Omit<\n Partial<ButtonIconProps>,\n 'iconName' | 'onClick'\n> & {\n /**\n * Optional test id for the close button element.\n */\n 'data-testid'?: string;\n /**\n * Optional click handler for the close button.\n */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n};\n\ntype BannerBasePropsBase = BannerBasePropsShared &\n Omit<BoxProps, 'children'> & {\n /**\n * Optional props for the title `Text` when the title is a string.\n */\n titleProps?: Partial<TextProps>;\n /**\n * Optional props for the description `Text` when description is a string.\n */\n descriptionProps?: Partial<TextProps>;\n /**\n * Optional props for the children wrapper `Text` when children is a string.\n */\n childrenWrapperProps?: Partial<TextProps>;\n /**\n * Optional click handler for the close button.\n * If provided, a close button is shown.\n */\n onClose?: MouseEventHandler<HTMLButtonElement>;\n /**\n * Optional props for the close `ButtonIcon`.\n * Providing this also shows a close button.\n */\n closeButtonProps?: BannerBaseCloseButtonProps;\n };\n\ntype BannerBaseActionPropsWithHandler = {\n actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;\n actionButtonLabel: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\ntype BannerBaseActionPropsWithoutHandler = {\n actionButtonOnClick?: undefined;\n actionButtonLabel?: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\nexport type BannerBaseProps = BannerBasePropsBase &\n (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);\n"]}
@@ -0,0 +1,54 @@
1
+ import type { BannerBasePropsShared } from "@metamask-previews/design-system-shared";
2
+ import type { MouseEventHandler } from "react";
3
+ import type { BoxProps } from "../Box/index.cjs";
4
+ import type { ButtonProps } from "../Button/index.cjs";
5
+ import type { ButtonIconProps } from "../ButtonIcon/index.cjs";
6
+ import type { TextProps } from "../Text/index.cjs";
7
+ type BannerBaseActionButtonProps = Omit<Partial<ButtonProps>, 'children' | 'onClick' | 'variant'>;
8
+ type BannerBaseCloseButtonProps = Omit<Partial<ButtonIconProps>, 'iconName' | 'onClick'> & {
9
+ /**
10
+ * Optional test id for the close button element.
11
+ */
12
+ 'data-testid'?: string;
13
+ /**
14
+ * Optional click handler for the close button.
15
+ */
16
+ onClick?: MouseEventHandler<HTMLButtonElement>;
17
+ };
18
+ type BannerBasePropsBase = BannerBasePropsShared & Omit<BoxProps, 'children'> & {
19
+ /**
20
+ * Optional props for the title `Text` when the title is a string.
21
+ */
22
+ titleProps?: Partial<TextProps>;
23
+ /**
24
+ * Optional props for the description `Text` when description is a string.
25
+ */
26
+ descriptionProps?: Partial<TextProps>;
27
+ /**
28
+ * Optional props for the children wrapper `Text` when children is a string.
29
+ */
30
+ childrenWrapperProps?: Partial<TextProps>;
31
+ /**
32
+ * Optional click handler for the close button.
33
+ * If provided, a close button is shown.
34
+ */
35
+ onClose?: MouseEventHandler<HTMLButtonElement>;
36
+ /**
37
+ * Optional props for the close `ButtonIcon`.
38
+ * Providing this also shows a close button.
39
+ */
40
+ closeButtonProps?: BannerBaseCloseButtonProps;
41
+ };
42
+ type BannerBaseActionPropsWithHandler = {
43
+ actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;
44
+ actionButtonLabel: string;
45
+ actionButtonProps?: BannerBaseActionButtonProps;
46
+ };
47
+ type BannerBaseActionPropsWithoutHandler = {
48
+ actionButtonOnClick?: undefined;
49
+ actionButtonLabel?: string;
50
+ actionButtonProps?: BannerBaseActionButtonProps;
51
+ };
52
+ export type BannerBaseProps = BannerBasePropsBase & (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);
53
+ export {};
54
+ //# sourceMappingURL=BannerBase.types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerBase.types.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,gDAAgD;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAe;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAkB;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC,KAAK,2BAA2B,GAAG,IAAI,CACrC,OAAO,CAAC,WAAW,CAAC,EACpB,UAAU,GAAG,SAAS,GAAG,SAAS,CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACpC,OAAO,CAAC,eAAe,CAAC,EACxB,UAAU,GAAG,SAAS,CACvB,GAAG;IACF;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CAChD,CAAC;AAEF,KAAK,mBAAmB,GAAG,qBAAqB,GAC9C,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC/C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;CAC/C,CAAC;AAEJ,KAAK,gCAAgC,GAAG;IACtC,mBAAmB,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACzC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAC/C,CAAC,gCAAgC,GAAG,mCAAmC,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { BannerBasePropsShared } from "@metamask-previews/design-system-shared";
2
+ import type { MouseEventHandler } from "react";
3
+ import type { BoxProps } from "../Box/index.mjs";
4
+ import type { ButtonProps } from "../Button/index.mjs";
5
+ import type { ButtonIconProps } from "../ButtonIcon/index.mjs";
6
+ import type { TextProps } from "../Text/index.mjs";
7
+ type BannerBaseActionButtonProps = Omit<Partial<ButtonProps>, 'children' | 'onClick' | 'variant'>;
8
+ type BannerBaseCloseButtonProps = Omit<Partial<ButtonIconProps>, 'iconName' | 'onClick'> & {
9
+ /**
10
+ * Optional test id for the close button element.
11
+ */
12
+ 'data-testid'?: string;
13
+ /**
14
+ * Optional click handler for the close button.
15
+ */
16
+ onClick?: MouseEventHandler<HTMLButtonElement>;
17
+ };
18
+ type BannerBasePropsBase = BannerBasePropsShared & Omit<BoxProps, 'children'> & {
19
+ /**
20
+ * Optional props for the title `Text` when the title is a string.
21
+ */
22
+ titleProps?: Partial<TextProps>;
23
+ /**
24
+ * Optional props for the description `Text` when description is a string.
25
+ */
26
+ descriptionProps?: Partial<TextProps>;
27
+ /**
28
+ * Optional props for the children wrapper `Text` when children is a string.
29
+ */
30
+ childrenWrapperProps?: Partial<TextProps>;
31
+ /**
32
+ * Optional click handler for the close button.
33
+ * If provided, a close button is shown.
34
+ */
35
+ onClose?: MouseEventHandler<HTMLButtonElement>;
36
+ /**
37
+ * Optional props for the close `ButtonIcon`.
38
+ * Providing this also shows a close button.
39
+ */
40
+ closeButtonProps?: BannerBaseCloseButtonProps;
41
+ };
42
+ type BannerBaseActionPropsWithHandler = {
43
+ actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;
44
+ actionButtonLabel: string;
45
+ actionButtonProps?: BannerBaseActionButtonProps;
46
+ };
47
+ type BannerBaseActionPropsWithoutHandler = {
48
+ actionButtonOnClick?: undefined;
49
+ actionButtonLabel?: string;
50
+ actionButtonProps?: BannerBaseActionButtonProps;
51
+ };
52
+ export type BannerBaseProps = BannerBasePropsBase & (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);
53
+ export {};
54
+ //# sourceMappingURL=BannerBase.types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerBase.types.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,gDAAgD;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAe;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAkB;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC,KAAK,2BAA2B,GAAG,IAAI,CACrC,OAAO,CAAC,WAAW,CAAC,EACpB,UAAU,GAAG,SAAS,GAAG,SAAS,CACnC,CAAC;AAEF,KAAK,0BAA0B,GAAG,IAAI,CACpC,OAAO,CAAC,eAAe,CAAC,EACxB,UAAU,GAAG,SAAS,CACvB,GAAG;IACF;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CAChD,CAAC;AAEF,KAAK,mBAAmB,GAAG,qBAAqB,GAC9C,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,GAAG;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC/C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;CAC/C,CAAC;AAEJ,KAAK,gCAAgC,GAAG;IACtC,mBAAmB,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACzC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAC/C,CAAC,gCAAgC,GAAG,mCAAmC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=BannerBase.types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerBase.types.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { BannerBasePropsShared } from '@metamask-previews/design-system-shared';\nimport type { MouseEventHandler } from 'react';\n\nimport type { BoxProps } from '../Box';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { TextProps } from '../Text';\n\ntype BannerBaseActionButtonProps = Omit<\n Partial<ButtonProps>,\n 'children' | 'onClick' | 'variant'\n>;\n\ntype BannerBaseCloseButtonProps = Omit<\n Partial<ButtonIconProps>,\n 'iconName' | 'onClick'\n> & {\n /**\n * Optional test id for the close button element.\n */\n 'data-testid'?: string;\n /**\n * Optional click handler for the close button.\n */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n};\n\ntype BannerBasePropsBase = BannerBasePropsShared &\n Omit<BoxProps, 'children'> & {\n /**\n * Optional props for the title `Text` when the title is a string.\n */\n titleProps?: Partial<TextProps>;\n /**\n * Optional props for the description `Text` when description is a string.\n */\n descriptionProps?: Partial<TextProps>;\n /**\n * Optional props for the children wrapper `Text` when children is a string.\n */\n childrenWrapperProps?: Partial<TextProps>;\n /**\n * Optional click handler for the close button.\n * If provided, a close button is shown.\n */\n onClose?: MouseEventHandler<HTMLButtonElement>;\n /**\n * Optional props for the close `ButtonIcon`.\n * Providing this also shows a close button.\n */\n closeButtonProps?: BannerBaseCloseButtonProps;\n };\n\ntype BannerBaseActionPropsWithHandler = {\n actionButtonOnClick: MouseEventHandler<HTMLButtonElement>;\n actionButtonLabel: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\ntype BannerBaseActionPropsWithoutHandler = {\n actionButtonOnClick?: undefined;\n actionButtonLabel?: string;\n actionButtonProps?: BannerBaseActionButtonProps;\n};\n\nexport type BannerBaseProps = BannerBasePropsBase &\n (BannerBaseActionPropsWithHandler | BannerBaseActionPropsWithoutHandler);\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BannerBase = void 0;
4
+ var BannerBase_1 = require("./BannerBase.cjs");
5
+ Object.defineProperty(exports, "BannerBase", { enumerable: true, get: function () { return BannerBase_1.BannerBase; } });
6
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAAjC,wGAAA,UAAU,OAAA","sourcesContent":["export { BannerBase } from './BannerBase';\nexport type { BannerBaseProps } from './BannerBase.types';\n"]}
@@ -0,0 +1,3 @@
1
+ export { BannerBase } from "./BannerBase.cjs";
2
+ export type { BannerBaseProps } from "./BannerBase.types.cjs";
3
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
@@ -0,0 +1,3 @@
1
+ export { BannerBase } from "./BannerBase.mjs";
2
+ export type { BannerBaseProps } from "./BannerBase.types.mjs";
3
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB;AAC1C,YAAY,EAAE,eAAe,EAAE,+BAA2B"}
@@ -0,0 +1,2 @@
1
+ export { BannerBase } from "./BannerBase.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,yBAAqB","sourcesContent":["export { BannerBase } from './BannerBase';\nexport type { BannerBaseProps } from './BannerBase.types';\n"]}
@@ -0,0 +1,37 @@
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.ButtonFilter = void 0;
27
+ const react_1 = __importStar(require("react"));
28
+ const tw_merge_1 = require("../../utils/tw-merge.cjs");
29
+ const ButtonBase_1 = require("../ButtonBase/index.cjs");
30
+ exports.ButtonFilter = (0, react_1.forwardRef)(({ className, isActive = false, ...props }, ref) => {
31
+ const mergedClassName = (0, tw_merge_1.twMerge)(isActive
32
+ ? 'bg-icon-default text-icon-inverse'
33
+ : 'bg-background-muted text-default', className);
34
+ return react_1.default.createElement(ButtonBase_1.ButtonBase, { ref: ref, className: mergedClassName, ...props });
35
+ });
36
+ exports.ButtonFilter.displayName = 'ButtonFilter';
37
+ //# sourceMappingURL=ButtonFilter.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.cjs","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,uDAA+C;AAC/C,wDAA2C;AAI9B,QAAA,YAAY,GAAG,IAAA,kBAAU,EACpC,CAAC,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACjD,MAAM,eAAe,GAAG,IAAA,kBAAO,EAC7B,QAAQ;QACN,CAAC,CAAC,mCAAmC;QACrC,CAAC,CAAC,kCAAkC,EACtC,SAAS,CACV,CAAC;IAEF,OAAO,8BAAC,uBAAU,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,eAAe,KAAM,KAAK,GAAI,CAAC;AACzE,CAAC,CACF,CAAC;AAEF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { ButtonBase } from '../ButtonBase';\n\nimport type { ButtonFilterProps } from './ButtonFilter.types';\n\nexport const ButtonFilter = forwardRef<HTMLButtonElement, ButtonFilterProps>(\n ({ className, isActive = false, ...props }, ref) => {\n const mergedClassName = twMerge(\n isActive\n ? 'bg-icon-default text-icon-inverse'\n : 'bg-background-muted text-default',\n className,\n );\n\n return <ButtonBase ref={ref} className={mergedClassName} {...props} />;\n },\n);\n\nButtonFilter.displayName = 'ButtonFilter';\n"]}
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { ButtonFilterProps } from "./ButtonFilter.types.cjs";
3
+ export declare const ButtonFilter: React.ForwardRefExoticComponent<Omit<ButtonFilterProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
+ //# sourceMappingURL=ButtonFilter.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,cAAc;AAK1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY,0GAWxB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { ButtonFilterProps } from "./ButtonFilter.types.mjs";
3
+ export declare const ButtonFilter: React.ForwardRefExoticComponent<Omit<ButtonFilterProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
+ //# sourceMappingURL=ButtonFilter.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,cAAc;AAK1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY,0GAWxB,CAAC"}
@@ -0,0 +1,18 @@
1
+ function $importDefault(module) {
2
+ if (module?.__esModule) {
3
+ return module.default;
4
+ }
5
+ return module;
6
+ }
7
+ import $React, { forwardRef } from "react";
8
+ const React = $importDefault($React);
9
+ import { twMerge } from "../../utils/tw-merge.mjs";
10
+ import { ButtonBase } from "../ButtonBase/index.mjs";
11
+ export const ButtonFilter = forwardRef(({ className, isActive = false, ...props }, ref) => {
12
+ const mergedClassName = twMerge(isActive
13
+ ? 'bg-icon-default text-icon-inverse'
14
+ : 'bg-background-muted text-default', className);
15
+ return React.createElement(ButtonBase, { ref: ref, className: mergedClassName, ...props });
16
+ });
17
+ ButtonFilter.displayName = 'ButtonFilter';
18
+ //# sourceMappingURL=ButtonFilter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.mjs","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAI3C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CACpC,CAAC,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACjD,MAAM,eAAe,GAAG,OAAO,CAC7B,QAAQ;QACN,CAAC,CAAC,mCAAmC;QACrC,CAAC,CAAC,kCAAkC,EACtC,SAAS,CACV,CAAC;IAEF,OAAO,oBAAC,UAAU,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,eAAe,KAAM,KAAK,GAAI,CAAC;AACzE,CAAC,CACF,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { ButtonBase } from '../ButtonBase';\n\nimport type { ButtonFilterProps } from './ButtonFilter.types';\n\nexport const ButtonFilter = forwardRef<HTMLButtonElement, ButtonFilterProps>(\n ({ className, isActive = false, ...props }, ref) => {\n const mergedClassName = twMerge(\n isActive\n ? 'bg-icon-default text-icon-inverse'\n : 'bg-background-muted text-default',\n className,\n );\n\n return <ButtonBase ref={ref} className={mergedClassName} {...props} />;\n },\n);\n\nButtonFilter.displayName = 'ButtonFilter';\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ButtonFilter.types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.types.cjs","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonFilterPropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { ButtonBaseProps } from '../ButtonBase';\n\nexport type ButtonFilterProps = ButtonBaseProps & ButtonFilterPropsShared;\n"]}
@@ -0,0 +1,4 @@
1
+ import type { ButtonFilterPropsShared } from "@metamask-previews/design-system-shared";
2
+ import type { ButtonBaseProps } from "../ButtonBase/index.cjs";
3
+ export type ButtonFilterProps = ButtonBaseProps & ButtonFilterPropsShared;
4
+ //# sourceMappingURL=ButtonFilter.types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.types.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,gDAAgD;AAEvF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AAErD,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ButtonFilterPropsShared } from "@metamask-previews/design-system-shared";
2
+ import type { ButtonBaseProps } from "../ButtonBase/index.mjs";
3
+ export type ButtonFilterProps = ButtonBaseProps & ButtonFilterPropsShared;
4
+ //# sourceMappingURL=ButtonFilter.types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.types.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,gDAAgD;AAEvF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AAErD,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ButtonFilter.types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonFilter.types.mjs","sourceRoot":"","sources":["../../../src/components/ButtonFilter/ButtonFilter.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonFilterPropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { ButtonBaseProps } from '../ButtonBase';\n\nexport type ButtonFilterProps = ButtonBaseProps & ButtonFilterPropsShared;\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ButtonFilter = void 0;
4
+ var ButtonFilter_1 = require("./ButtonFilter.cjs");
5
+ Object.defineProperty(exports, "ButtonFilter", { enumerable: true, get: function () { return ButtonFilter_1.ButtonFilter; } });
6
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/ButtonFilter/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAArC,4GAAA,YAAY,OAAA","sourcesContent":["export { ButtonFilter } from './ButtonFilter';\nexport type { ButtonFilterProps } from './ButtonFilter.types';\n"]}
@@ -0,0 +1,3 @@
1
+ export { ButtonFilter } from "./ButtonFilter.cjs";
2
+ export type { ButtonFilterProps } from "./ButtonFilter.types.cjs";
3
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonFilter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAC9C,YAAY,EAAE,iBAAiB,EAAE,iCAA6B"}
@@ -0,0 +1,3 @@
1
+ export { ButtonFilter } from "./ButtonFilter.mjs";
2
+ export type { ButtonFilterProps } from "./ButtonFilter.types.mjs";
3
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonFilter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAC9C,YAAY,EAAE,iBAAiB,EAAE,iCAA6B"}
@@ -0,0 +1,2 @@
1
+ export { ButtonFilter } from "./ButtonFilter.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/ButtonFilter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAAuB","sourcesContent":["export { ButtonFilter } from './ButtonFilter';\nexport type { ButtonFilterProps } from './ButtonFilter.types';\n"]}
@@ -29,26 +29,25 @@ const types_1 = require("../../types/index.cjs");
29
29
  const tw_merge_1 = require("../../utils/tw-merge.cjs");
30
30
  const Icon_1 = require("../Icon/index.cjs");
31
31
  const ButtonIcon_constants_1 = require("./ButtonIcon.constants.cjs");
32
- exports.ButtonIcon = (0, react_1.forwardRef)(({ className, iconName, iconProps, ariaLabel, isDisabled = false, isInverse = false, isFloating = false, size = types_1.ButtonIconSize.Md, style, ...props }, ref) => {
32
+ exports.ButtonIcon = (0, react_1.forwardRef)(({ className, iconName, iconProps, ariaLabel, isDisabled = false, variant = types_1.ButtonIconVariant.Default, size = types_1.ButtonIconSize.Md, style, ...props }, ref) => {
33
33
  const isInteractive = !isDisabled;
34
34
  const mergedClassName = (0, tw_merge_1.twMerge)(
35
35
  // Base styles
36
36
  'inline-flex items-center justify-center p-0',
37
37
  // Size styles
38
38
  ButtonIcon_constants_1.TWCLASSMAP_BUTTONICON_SIZE_DIMENSION[size],
39
- // Floating styles
40
- isFloating && [
41
- 'rounded-full',
42
- !isInverse && 'bg-icon-default text-background-default',
43
- isInverse && 'bg-icon-default text-background-default',
44
- ],
45
- // Non-floating styles
46
- !isFloating && [
39
+ // Variant styles
40
+ variant === types_1.ButtonIconVariant.Default && [
47
41
  'rounded-lg bg-transparent',
48
- // Only apply hover/active styles when interactive
49
42
  isInteractive && 'hover:bg-hover active:bg-pressed',
50
- !isInverse && 'text-icon-default',
51
- isInverse && 'text-background-default',
43
+ 'text-icon-default',
44
+ ], variant === types_1.ButtonIconVariant.Floating && [
45
+ 'rounded-full',
46
+ 'bg-icon-default text-background-default',
47
+ ], variant === types_1.ButtonIconVariant.Filled && [
48
+ 'rounded-full',
49
+ 'bg-muted text-icon-default',
50
+ isInteractive && 'hover:bg-muted-hover active:bg-muted-pressed',
52
51
  ],
53
52
  // Disabled state
54
53
  isDisabled && 'cursor-not-allowed opacity-50', className);
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonIcon.cjs","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,iDAA6C;AAC7C,uDAA+C;AAC/C,4CAA+B;AAE/B,qEAGgC;AAGnB,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,sBAAc,CAAC,EAAE,EACxB,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,UAAU,CAAC;IAElC,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,cAAc;IACd,6CAA6C;IAC7C,cAAc;IACd,2DAAoC,CAAC,IAAI,CAAC;IAC1C,kBAAkB;IAClB,UAAU,IAAI;QACZ,cAAc;QACd,CAAC,SAAS,IAAI,yCAAyC;QACvD,SAAS,IAAI,yCAAyC;KACvD;IACD,sBAAsB;IACtB,CAAC,UAAU,IAAI;QACb,2BAA2B;QAC3B,kDAAkD;QAClD,aAAa,IAAI,kCAAkC;QACnD,CAAC,SAAS,IAAI,mBAAmB;QACjC,SAAS,IAAI,yBAAyB;KACvC;IACD,iBAAiB;IACjB,UAAU,IAAI,+BAA+B,EAC7C,SAAS,CACV,CAAC;IAEF,OAAO,CACL,0CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,UAAU,gBACR,SAAS,EACrB,KAAK,EAAE,KAAK,KACR,KAAK;QAET,8BAAC,WAAI,IACH,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,mDAA4B,CAAC,IAAI,CAAC,EACxC,SAAS,EAAE,IAAA,kBAAO,EAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,KACpD,SAAS,GACb,CACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { ButtonIconSize } from '../../types';\nimport { twMerge } from '../../utils/tw-merge';\nimport { Icon } from '../Icon';\n\nimport {\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION,\n MAP_BUTTONICON_SIZE_ICONSIZE,\n} from './ButtonIcon.constants';\nimport type { ButtonIconProps } from './ButtonIcon.types';\n\nexport const ButtonIcon = forwardRef<HTMLButtonElement, ButtonIconProps>(\n (\n {\n className,\n iconName,\n iconProps,\n ariaLabel,\n isDisabled = false,\n isInverse = false,\n isFloating = false,\n size = ButtonIconSize.Md,\n style,\n ...props\n },\n ref,\n ) => {\n const isInteractive = !isDisabled;\n\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center p-0',\n // Size styles\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION[size],\n // Floating styles\n isFloating && [\n 'rounded-full',\n !isInverse && 'bg-icon-default text-background-default',\n isInverse && 'bg-icon-default text-background-default',\n ],\n // Non-floating styles\n !isFloating && [\n 'rounded-lg bg-transparent',\n // Only apply hover/active styles when interactive\n isInteractive && 'hover:bg-hover active:bg-pressed',\n !isInverse && 'text-icon-default',\n isInverse && 'text-background-default',\n ],\n // Disabled state\n isDisabled && 'cursor-not-allowed opacity-50',\n className,\n );\n\n return (\n <button\n ref={ref}\n className={mergedClassName}\n disabled={isDisabled}\n aria-label={ariaLabel}\n style={style}\n {...props}\n >\n <Icon\n name={iconName}\n size={MAP_BUTTONICON_SIZE_ICONSIZE[size]}\n className={twMerge('text-inherit', iconProps?.className)}\n {...iconProps}\n />\n </button>\n );\n },\n);\n\nButtonIcon.displayName = 'ButtonIcon';\n"]}
1
+ {"version":3,"file":"ButtonIcon.cjs","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,iDAAgE;AAChE,uDAA+C;AAC/C,4CAA+B;AAE/B,qEAGgC;AAGnB,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,yBAAiB,CAAC,OAAO,EACnC,IAAI,GAAG,sBAAc,CAAC,EAAE,EACxB,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,UAAU,CAAC;IAElC,MAAM,eAAe,GAAG,IAAA,kBAAO;IAC7B,cAAc;IACd,6CAA6C;IAC7C,cAAc;IACd,2DAAoC,CAAC,IAAI,CAAC;IAC1C,iBAAiB;IACjB,OAAO,KAAK,yBAAiB,CAAC,OAAO,IAAI;QACvC,2BAA2B;QAC3B,aAAa,IAAI,kCAAkC;QACnD,mBAAmB;KACpB,EACD,OAAO,KAAK,yBAAiB,CAAC,QAAQ,IAAI;QACxC,cAAc;QACd,yCAAyC;KAC1C,EACD,OAAO,KAAK,yBAAiB,CAAC,MAAM,IAAI;QACtC,cAAc;QACd,4BAA4B;QAC5B,aAAa,IAAI,8CAA8C;KAChE;IACD,iBAAiB;IACjB,UAAU,IAAI,+BAA+B,EAC7C,SAAS,CACV,CAAC;IAEF,OAAO,CACL,0CACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,UAAU,gBACR,SAAS,EACrB,KAAK,EAAE,KAAK,KACR,KAAK;QAET,8BAAC,WAAI,IACH,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,mDAA4B,CAAC,IAAI,CAAC,EACxC,SAAS,EAAE,IAAA,kBAAO,EAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,KACpD,SAAS,GACb,CACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { ButtonIconSize, ButtonIconVariant } from '../../types';\nimport { twMerge } from '../../utils/tw-merge';\nimport { Icon } from '../Icon';\n\nimport {\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION,\n MAP_BUTTONICON_SIZE_ICONSIZE,\n} from './ButtonIcon.constants';\nimport type { ButtonIconProps } from './ButtonIcon.types';\n\nexport const ButtonIcon = forwardRef<HTMLButtonElement, ButtonIconProps>(\n (\n {\n className,\n iconName,\n iconProps,\n ariaLabel,\n isDisabled = false,\n variant = ButtonIconVariant.Default,\n size = ButtonIconSize.Md,\n style,\n ...props\n },\n ref,\n ) => {\n const isInteractive = !isDisabled;\n\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center p-0',\n // Size styles\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION[size],\n // Variant styles\n variant === ButtonIconVariant.Default && [\n 'rounded-lg bg-transparent',\n isInteractive && 'hover:bg-hover active:bg-pressed',\n 'text-icon-default',\n ],\n variant === ButtonIconVariant.Floating && [\n 'rounded-full',\n 'bg-icon-default text-background-default',\n ],\n variant === ButtonIconVariant.Filled && [\n 'rounded-full',\n 'bg-muted text-icon-default',\n isInteractive && 'hover:bg-muted-hover active:bg-muted-pressed',\n ],\n // Disabled state\n isDisabled && 'cursor-not-allowed opacity-50',\n className,\n );\n\n return (\n <button\n ref={ref}\n className={mergedClassName}\n disabled={isDisabled}\n aria-label={ariaLabel}\n style={style}\n {...props}\n >\n <Icon\n name={iconName}\n size={MAP_BUTTONICON_SIZE_ICONSIZE[size]}\n className={twMerge('text-inherit', iconProps?.className)}\n {...iconProps}\n />\n </button>\n );\n },\n);\n\nButtonIcon.displayName = 'ButtonIcon';\n"]}
@@ -6,30 +6,29 @@ function $importDefault(module) {
6
6
  }
7
7
  import $React, { forwardRef } from "react";
8
8
  const React = $importDefault($React);
9
- import { ButtonIconSize } from "../../types/index.mjs";
9
+ import { ButtonIconSize, ButtonIconVariant } from "../../types/index.mjs";
10
10
  import { twMerge } from "../../utils/tw-merge.mjs";
11
11
  import { Icon } from "../Icon/index.mjs";
12
12
  import { TWCLASSMAP_BUTTONICON_SIZE_DIMENSION, MAP_BUTTONICON_SIZE_ICONSIZE } from "./ButtonIcon.constants.mjs";
13
- export const ButtonIcon = forwardRef(({ className, iconName, iconProps, ariaLabel, isDisabled = false, isInverse = false, isFloating = false, size = ButtonIconSize.Md, style, ...props }, ref) => {
13
+ export const ButtonIcon = forwardRef(({ className, iconName, iconProps, ariaLabel, isDisabled = false, variant = ButtonIconVariant.Default, size = ButtonIconSize.Md, style, ...props }, ref) => {
14
14
  const isInteractive = !isDisabled;
15
15
  const mergedClassName = twMerge(
16
16
  // Base styles
17
17
  'inline-flex items-center justify-center p-0',
18
18
  // Size styles
19
19
  TWCLASSMAP_BUTTONICON_SIZE_DIMENSION[size],
20
- // Floating styles
21
- isFloating && [
22
- 'rounded-full',
23
- !isInverse && 'bg-icon-default text-background-default',
24
- isInverse && 'bg-icon-default text-background-default',
25
- ],
26
- // Non-floating styles
27
- !isFloating && [
20
+ // Variant styles
21
+ variant === ButtonIconVariant.Default && [
28
22
  'rounded-lg bg-transparent',
29
- // Only apply hover/active styles when interactive
30
23
  isInteractive && 'hover:bg-hover active:bg-pressed',
31
- !isInverse && 'text-icon-default',
32
- isInverse && 'text-background-default',
24
+ 'text-icon-default',
25
+ ], variant === ButtonIconVariant.Floating && [
26
+ 'rounded-full',
27
+ 'bg-icon-default text-background-default',
28
+ ], variant === ButtonIconVariant.Filled && [
29
+ 'rounded-full',
30
+ 'bg-muted text-icon-default',
31
+ isInteractive && 'hover:bg-muted-hover active:bg-muted-pressed',
33
32
  ],
34
33
  // Disabled state
35
34
  isDisabled && 'cursor-not-allowed opacity-50', className);
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonIcon.mjs","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.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,0BAAgB;AAE/B,OAAO,EACL,oCAAoC,EACpC,4BAA4B,EAC7B,mCAA+B;AAGhC,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,cAAc,CAAC,EAAE,EACxB,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,UAAU,CAAC;IAElC,MAAM,eAAe,GAAG,OAAO;IAC7B,cAAc;IACd,6CAA6C;IAC7C,cAAc;IACd,oCAAoC,CAAC,IAAI,CAAC;IAC1C,kBAAkB;IAClB,UAAU,IAAI;QACZ,cAAc;QACd,CAAC,SAAS,IAAI,yCAAyC;QACvD,SAAS,IAAI,yCAAyC;KACvD;IACD,sBAAsB;IACtB,CAAC,UAAU,IAAI;QACb,2BAA2B;QAC3B,kDAAkD;QAClD,aAAa,IAAI,kCAAkC;QACnD,CAAC,SAAS,IAAI,mBAAmB;QACjC,SAAS,IAAI,yBAAyB;KACvC;IACD,iBAAiB;IACjB,UAAU,IAAI,+BAA+B,EAC7C,SAAS,CACV,CAAC;IAEF,OAAO,CACL,gCACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,UAAU,gBACR,SAAS,EACrB,KAAK,EAAE,KAAK,KACR,KAAK;QAET,oBAAC,IAAI,IACH,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,4BAA4B,CAAC,IAAI,CAAC,EACxC,SAAS,EAAE,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,KACpD,SAAS,GACb,CACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { ButtonIconSize } from '../../types';\nimport { twMerge } from '../../utils/tw-merge';\nimport { Icon } from '../Icon';\n\nimport {\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION,\n MAP_BUTTONICON_SIZE_ICONSIZE,\n} from './ButtonIcon.constants';\nimport type { ButtonIconProps } from './ButtonIcon.types';\n\nexport const ButtonIcon = forwardRef<HTMLButtonElement, ButtonIconProps>(\n (\n {\n className,\n iconName,\n iconProps,\n ariaLabel,\n isDisabled = false,\n isInverse = false,\n isFloating = false,\n size = ButtonIconSize.Md,\n style,\n ...props\n },\n ref,\n ) => {\n const isInteractive = !isDisabled;\n\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center p-0',\n // Size styles\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION[size],\n // Floating styles\n isFloating && [\n 'rounded-full',\n !isInverse && 'bg-icon-default text-background-default',\n isInverse && 'bg-icon-default text-background-default',\n ],\n // Non-floating styles\n !isFloating && [\n 'rounded-lg bg-transparent',\n // Only apply hover/active styles when interactive\n isInteractive && 'hover:bg-hover active:bg-pressed',\n !isInverse && 'text-icon-default',\n isInverse && 'text-background-default',\n ],\n // Disabled state\n isDisabled && 'cursor-not-allowed opacity-50',\n className,\n );\n\n return (\n <button\n ref={ref}\n className={mergedClassName}\n disabled={isDisabled}\n aria-label={ariaLabel}\n style={style}\n {...props}\n >\n <Icon\n name={iconName}\n size={MAP_BUTTONICON_SIZE_ICONSIZE[size]}\n className={twMerge('text-inherit', iconProps?.className)}\n {...iconProps}\n />\n </button>\n );\n },\n);\n\nButtonIcon.displayName = 'ButtonIcon';\n"]}
1
+ {"version":3,"file":"ButtonIcon.mjs","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,8BAAoB;AAChE,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAE/B,OAAO,EACL,oCAAoC,EACpC,4BAA4B,EAC7B,mCAA+B;AAGhC,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,iBAAiB,CAAC,OAAO,EACnC,IAAI,GAAG,cAAc,CAAC,EAAE,EACxB,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,aAAa,GAAG,CAAC,UAAU,CAAC;IAElC,MAAM,eAAe,GAAG,OAAO;IAC7B,cAAc;IACd,6CAA6C;IAC7C,cAAc;IACd,oCAAoC,CAAC,IAAI,CAAC;IAC1C,iBAAiB;IACjB,OAAO,KAAK,iBAAiB,CAAC,OAAO,IAAI;QACvC,2BAA2B;QAC3B,aAAa,IAAI,kCAAkC;QACnD,mBAAmB;KACpB,EACD,OAAO,KAAK,iBAAiB,CAAC,QAAQ,IAAI;QACxC,cAAc;QACd,yCAAyC;KAC1C,EACD,OAAO,KAAK,iBAAiB,CAAC,MAAM,IAAI;QACtC,cAAc;QACd,4BAA4B;QAC5B,aAAa,IAAI,8CAA8C;KAChE;IACD,iBAAiB;IACjB,UAAU,IAAI,+BAA+B,EAC7C,SAAS,CACV,CAAC;IAEF,OAAO,CACL,gCACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,UAAU,gBACR,SAAS,EACrB,KAAK,EAAE,KAAK,KACR,KAAK;QAET,oBAAC,IAAI,IACH,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,4BAA4B,CAAC,IAAI,CAAC,EACxC,SAAS,EAAE,OAAO,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,KACpD,SAAS,GACb,CACK,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { ButtonIconSize, ButtonIconVariant } from '../../types';\nimport { twMerge } from '../../utils/tw-merge';\nimport { Icon } from '../Icon';\n\nimport {\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION,\n MAP_BUTTONICON_SIZE_ICONSIZE,\n} from './ButtonIcon.constants';\nimport type { ButtonIconProps } from './ButtonIcon.types';\n\nexport const ButtonIcon = forwardRef<HTMLButtonElement, ButtonIconProps>(\n (\n {\n className,\n iconName,\n iconProps,\n ariaLabel,\n isDisabled = false,\n variant = ButtonIconVariant.Default,\n size = ButtonIconSize.Md,\n style,\n ...props\n },\n ref,\n ) => {\n const isInteractive = !isDisabled;\n\n const mergedClassName = twMerge(\n // Base styles\n 'inline-flex items-center justify-center p-0',\n // Size styles\n TWCLASSMAP_BUTTONICON_SIZE_DIMENSION[size],\n // Variant styles\n variant === ButtonIconVariant.Default && [\n 'rounded-lg bg-transparent',\n isInteractive && 'hover:bg-hover active:bg-pressed',\n 'text-icon-default',\n ],\n variant === ButtonIconVariant.Floating && [\n 'rounded-full',\n 'bg-icon-default text-background-default',\n ],\n variant === ButtonIconVariant.Filled && [\n 'rounded-full',\n 'bg-muted text-icon-default',\n isInteractive && 'hover:bg-muted-hover active:bg-muted-pressed',\n ],\n // Disabled state\n isDisabled && 'cursor-not-allowed opacity-50',\n className,\n );\n\n return (\n <button\n ref={ref}\n className={mergedClassName}\n disabled={isDisabled}\n aria-label={ariaLabel}\n style={style}\n {...props}\n >\n <Icon\n name={iconName}\n size={MAP_BUTTONICON_SIZE_ICONSIZE[size]}\n className={twMerge('text-inherit', iconProps?.className)}\n {...iconProps}\n />\n </button>\n );\n },\n);\n\nButtonIcon.displayName = 'ButtonIcon';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonIcon.types.cjs","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps } from 'react';\n\nimport type { ButtonIconSize } from '../../types';\nimport type { IconName, IconProps } from '../Icon';\n\nexport type ButtonIconProps = ComponentProps<'button'> & {\n /**\n * Required prop to specify the icon to show\n */\n iconName: IconName;\n /**\n * Required prop to provide an accessible label for the button\n */\n ariaLabel: string;\n /**\n * Optional prop to pass additional properties to the icon\n */\n iconProps?: Partial<IconProps>;\n /**\n * Optional prop that when true, disables the button\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Optional prop that when true, applies inverse styling to the button\n *\n * @default false\n */\n isInverse?: boolean;\n /**\n * Optional prop that when true, applies floating/contained styling to the button\n *\n * @default false\n */\n isFloating?: boolean;\n /**\n * Optional prop to control the size of the button\n *\n * @default ButtonIconSize.Md\n */\n size?: ButtonIconSize;\n /**\n * Optional prop for additional CSS classes to be applied to the ButtonIcon component\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":"ButtonIcon.types.cjs","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps } from 'react';\n\nimport type { ButtonIconSize, ButtonIconVariant } from '../../types';\nimport type { IconName, IconProps } from '../Icon';\n\nexport type ButtonIconProps = ComponentProps<'button'> & {\n /**\n * Required prop to specify the icon to show\n */\n iconName: IconName;\n /**\n * Required prop to provide an accessible label for the button\n */\n ariaLabel: string;\n /**\n * Optional prop to pass additional properties to the icon\n */\n iconProps?: Partial<IconProps>;\n /**\n * Optional prop that when true, disables the button\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Optional prop to control the visual variant of the button.\n *\n * @default ButtonIconVariant.Default\n */\n variant?: ButtonIconVariant;\n /**\n * Optional prop to control the size of the button\n *\n * @default ButtonIconSize.Md\n */\n size?: ButtonIconSize;\n /**\n * Optional prop for additional CSS classes to be applied to the ButtonIcon component\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,5 +1,5 @@
1
1
  import type { ComponentProps } from "react";
2
- import type { ButtonIconSize } from "../../types/index.cjs";
2
+ import type { ButtonIconSize, ButtonIconVariant } from "../../types/index.cjs";
3
3
  import type { IconName, IconProps } from "../Icon/index.cjs";
4
4
  export type ButtonIconProps = ComponentProps<'button'> & {
5
5
  /**
@@ -21,17 +21,11 @@ export type ButtonIconProps = ComponentProps<'button'> & {
21
21
  */
22
22
  isDisabled?: boolean;
23
23
  /**
24
- * Optional prop that when true, applies inverse styling to the button
24
+ * Optional prop to control the visual variant of the button.
25
25
  *
26
- * @default false
27
- */
28
- isInverse?: boolean;
29
- /**
30
- * Optional prop that when true, applies floating/contained styling to the button
31
- *
32
- * @default false
26
+ * @default ButtonIconVariant.Default
33
27
  */
34
- isFloating?: boolean;
28
+ variant?: ButtonIconVariant;
35
29
  /**
36
30
  * Optional prop to control the size of the button
37
31
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonIcon.types.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,8BAAoB;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,0BAAgB;AAEnD,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG;IACvD;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC"}
1
+ {"version":3,"file":"ButtonIcon.types.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,8BAAoB;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,0BAAgB;AAEnD,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG;IACvD;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC"}