@metamask/design-system-react 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/dist/components/BannerAlert/BannerAlert.d.cts +4 -4
- package/dist/components/BannerAlert/BannerAlert.d.mts +4 -4
- package/dist/components/BannerBase/BannerBase.cjs +4 -3
- package/dist/components/BannerBase/BannerBase.cjs.map +1 -1
- package/dist/components/BannerBase/BannerBase.d.cts +4 -4
- package/dist/components/BannerBase/BannerBase.d.cts.map +1 -1
- package/dist/components/BannerBase/BannerBase.d.mts +4 -4
- package/dist/components/BannerBase/BannerBase.d.mts.map +1 -1
- package/dist/components/BannerBase/BannerBase.mjs +4 -3
- package/dist/components/BannerBase/BannerBase.mjs.map +1 -1
- package/dist/components/HelpText/HelpText.cjs +11 -1
- package/dist/components/HelpText/HelpText.cjs.map +1 -1
- package/dist/components/HelpText/HelpText.d.cts.map +1 -1
- package/dist/components/HelpText/HelpText.d.mts.map +1 -1
- package/dist/components/HelpText/HelpText.mjs +12 -2
- package/dist/components/HelpText/HelpText.mjs.map +1 -1
- package/dist/components/IconAlert/IconAlert.cjs +16 -0
- package/dist/components/IconAlert/IconAlert.cjs.map +1 -0
- package/dist/components/IconAlert/IconAlert.constants.cjs +23 -0
- package/dist/components/IconAlert/IconAlert.constants.cjs.map +1 -0
- package/dist/components/IconAlert/IconAlert.constants.d.cts +6 -0
- package/dist/components/IconAlert/IconAlert.constants.d.cts.map +1 -0
- package/dist/components/IconAlert/IconAlert.constants.d.mts +6 -0
- package/dist/components/IconAlert/IconAlert.constants.d.mts.map +1 -0
- package/dist/components/IconAlert/IconAlert.constants.mjs +20 -0
- package/dist/components/IconAlert/IconAlert.constants.mjs.map +1 -0
- package/dist/components/IconAlert/IconAlert.d.cts +7 -0
- package/dist/components/IconAlert/IconAlert.d.cts.map +1 -0
- package/dist/components/IconAlert/IconAlert.d.mts +7 -0
- package/dist/components/IconAlert/IconAlert.d.mts.map +1 -0
- package/dist/components/IconAlert/IconAlert.mjs +16 -0
- package/dist/components/IconAlert/IconAlert.mjs.map +1 -0
- package/dist/components/IconAlert/IconAlert.types.cjs +3 -0
- package/dist/components/IconAlert/IconAlert.types.cjs.map +1 -0
- package/dist/components/IconAlert/IconAlert.types.d.cts +4 -0
- package/dist/components/IconAlert/IconAlert.types.d.cts.map +1 -0
- package/dist/components/IconAlert/IconAlert.types.d.mts +4 -0
- package/dist/components/IconAlert/IconAlert.types.d.mts.map +1 -0
- package/dist/components/IconAlert/IconAlert.types.mjs +2 -0
- package/dist/components/IconAlert/IconAlert.types.mjs.map +1 -0
- package/dist/components/IconAlert/index.cjs +8 -0
- package/dist/components/IconAlert/index.cjs.map +1 -0
- package/dist/components/IconAlert/index.d.cts +4 -0
- package/dist/components/IconAlert/index.d.cts.map +1 -0
- package/dist/components/IconAlert/index.d.mts +4 -0
- package/dist/components/IconAlert/index.d.mts.map +1 -0
- package/dist/components/IconAlert/index.mjs +3 -0
- package/dist/components/IconAlert/index.mjs.map +1 -0
- package/dist/components/ModalContent/ModalContent.cjs +1 -1
- package/dist/components/ModalContent/ModalContent.cjs.map +1 -1
- package/dist/components/ModalContent/ModalContent.d.cts.map +1 -1
- package/dist/components/ModalContent/ModalContent.d.mts.map +1 -1
- package/dist/components/ModalContent/ModalContent.mjs +1 -1
- package/dist/components/ModalContent/ModalContent.mjs.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.cjs +6 -3
- package/dist/components/TextFieldSearch/TextFieldSearch.cjs.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.mjs +7 -4
- package/dist/components/TextFieldSearch/TextFieldSearch.mjs.map +1 -1
- package/dist/components/index.cjs +5 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +1 -0
- package/dist/components/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.35.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** `TextFieldSearch` default `size` changed from `TextFieldSize.Md` to `TextFieldSize.Lg` to match Figma designs ([#1418](https://github.com/MetaMask/metamask-design-system/pull/1418))
|
|
15
|
+
- Consumers relying on the implicit `Md` height will now render a taller field; pass `size={TextFieldSize.Md}` to preserve the prior height
|
|
16
|
+
- See [Migration Guide](./MIGRATION.md#from-version-0340-to-0350)
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fixed `ModalContent` to apply `border-muted` correctly in pure-black mode ([#1419](https://github.com/MetaMask/metamask-design-system/pull/1419))
|
|
21
|
+
|
|
22
|
+
## [0.34.0]
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Added `IconAlert` for severity-mapped icon glyphs aligned with the React Native primitive ([#1409](https://github.com/MetaMask/metamask-design-system/pull/1409))
|
|
27
|
+
- Added `showIcon` to `HelpText` (default `false`) to render a leading `IconAlert` when `severity` is set ([#1409](https://github.com/MetaMask/metamask-design-system/pull/1409))
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Updated `BannerBase` spacing (padding, title/description gap, action button margin, and close button offset) to match Figma; inherited by `BannerAlert` and `Toast` ([#1394](https://github.com/MetaMask/metamask-design-system/pull/1394))
|
|
32
|
+
|
|
10
33
|
## [0.33.0]
|
|
11
34
|
|
|
12
35
|
### Added
|
|
@@ -426,7 +449,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
426
449
|
- Full TypeScript support with type definitions and enums
|
|
427
450
|
- Tailwind CSS integration with design token support
|
|
428
451
|
|
|
429
|
-
[Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.
|
|
452
|
+
[Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.35.0...HEAD
|
|
453
|
+
[0.35.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.34.0...@metamask/design-system-react@0.35.0
|
|
454
|
+
[0.34.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.33.0...@metamask/design-system-react@0.34.0
|
|
430
455
|
[0.33.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.32.0...@metamask/design-system-react@0.33.0
|
|
431
456
|
[0.32.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.31.0...@metamask/design-system-react@0.32.0
|
|
432
457
|
[0.31.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.30.0...@metamask/design-system-react@0.31.0
|
|
@@ -304,6 +304,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
304
304
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
305
305
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
306
306
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
307
|
+
startAccessory?: React.ReactNode;
|
|
308
|
+
endAccessory?: React.ReactNode;
|
|
307
309
|
isDisabled?: boolean | undefined;
|
|
308
310
|
asChild?: boolean | undefined;
|
|
309
311
|
textProps?: Partial<import("../index.cjs").TextProps> | undefined;
|
|
@@ -313,10 +315,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
313
315
|
loadingTextProps?: Partial<import("../index.cjs").TextProps> | undefined;
|
|
314
316
|
startIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
315
317
|
startIconProps?: Partial<import("../Icon/index.cjs").IconProps> | undefined;
|
|
316
|
-
startAccessory?: React.ReactNode;
|
|
317
318
|
endIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
318
319
|
endIconProps?: Partial<import("../Icon/index.cjs").IconProps> | undefined;
|
|
319
|
-
endAccessory?: React.ReactNode;
|
|
320
320
|
loadingIconProps?: Partial<import("../Icon/index.cjs").IconProps> | undefined;
|
|
321
321
|
isDanger?: boolean | undefined;
|
|
322
322
|
isInverse?: boolean | undefined;
|
|
@@ -627,6 +627,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
627
627
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
628
628
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
629
629
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
630
|
+
startAccessory?: React.ReactNode;
|
|
631
|
+
endAccessory?: React.ReactNode;
|
|
630
632
|
isDisabled?: boolean | undefined;
|
|
631
633
|
asChild?: boolean | undefined;
|
|
632
634
|
textProps?: Partial<import("../index.cjs").TextProps> | undefined;
|
|
@@ -636,10 +638,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
636
638
|
loadingTextProps?: Partial<import("../index.cjs").TextProps> | undefined;
|
|
637
639
|
startIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
638
640
|
startIconProps?: Partial<import("../Icon/index.cjs").IconProps> | undefined;
|
|
639
|
-
startAccessory?: React.ReactNode;
|
|
640
641
|
endIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
641
642
|
endIconProps?: Partial<import("../Icon/index.cjs").IconProps> | undefined;
|
|
642
|
-
endAccessory?: React.ReactNode;
|
|
643
643
|
loadingIconProps?: Partial<import("../Icon/index.cjs").IconProps> | undefined;
|
|
644
644
|
isDanger?: boolean | undefined;
|
|
645
645
|
isInverse?: boolean | undefined;
|
|
@@ -304,6 +304,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
304
304
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
305
305
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
306
306
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
307
|
+
startAccessory?: React.ReactNode;
|
|
308
|
+
endAccessory?: React.ReactNode;
|
|
307
309
|
isDisabled?: boolean | undefined;
|
|
308
310
|
asChild?: boolean | undefined;
|
|
309
311
|
textProps?: Partial<import("../index.mjs").TextProps> | undefined;
|
|
@@ -313,10 +315,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
313
315
|
loadingTextProps?: Partial<import("../index.mjs").TextProps> | undefined;
|
|
314
316
|
startIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
315
317
|
startIconProps?: Partial<import("../Icon/index.mjs").IconProps> | undefined;
|
|
316
|
-
startAccessory?: React.ReactNode;
|
|
317
318
|
endIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
318
319
|
endIconProps?: Partial<import("../Icon/index.mjs").IconProps> | undefined;
|
|
319
|
-
endAccessory?: React.ReactNode;
|
|
320
320
|
loadingIconProps?: Partial<import("../Icon/index.mjs").IconProps> | undefined;
|
|
321
321
|
isDanger?: boolean | undefined;
|
|
322
322
|
isInverse?: boolean | undefined;
|
|
@@ -627,6 +627,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
627
627
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
628
628
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
629
629
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
630
|
+
startAccessory?: React.ReactNode;
|
|
631
|
+
endAccessory?: React.ReactNode;
|
|
630
632
|
isDisabled?: boolean | undefined;
|
|
631
633
|
asChild?: boolean | undefined;
|
|
632
634
|
textProps?: Partial<import("../index.mjs").TextProps> | undefined;
|
|
@@ -636,10 +638,8 @@ export declare const BannerAlert: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
636
638
|
loadingTextProps?: Partial<import("../index.mjs").TextProps> | undefined;
|
|
637
639
|
startIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
638
640
|
startIconProps?: Partial<import("../Icon/index.mjs").IconProps> | undefined;
|
|
639
|
-
startAccessory?: React.ReactNode;
|
|
640
641
|
endIconName?: import("@metamask/design-system-shared").IconName | undefined;
|
|
641
642
|
endIconProps?: Partial<import("../Icon/index.mjs").IconProps> | undefined;
|
|
642
|
-
endAccessory?: React.ReactNode;
|
|
643
643
|
loadingIconProps?: Partial<import("../Icon/index.mjs").IconProps> | undefined;
|
|
644
644
|
isDanger?: boolean | undefined;
|
|
645
645
|
isInverse?: boolean | undefined;
|
|
@@ -39,16 +39,17 @@ exports.BannerBase = (0, react_1.forwardRef)(({ title, titleProps, description,
|
|
|
39
39
|
const shouldShowCloseButton = Boolean(onClose);
|
|
40
40
|
const shouldShowActionButton = Boolean(actionButtonOnClick);
|
|
41
41
|
const isActionButtonLayoutEnd = actionButtonLayout === design_system_shared_1.BannerBaseActionButtonLayout.End;
|
|
42
|
+
const hasActionButtonBelow = shouldShowActionButton && !isActionButtonLayoutEnd;
|
|
42
43
|
const actionButton = shouldShowActionButton ? (react_1.default.createElement(Button_1.Button, { size: design_system_shared_1.ButtonSize.Md, onClick: actionButtonOnClick, ...resolvedActionButtonProps, variant: design_system_shared_1.ButtonVariant.Secondary }, actionButtonLabel)) : null;
|
|
43
|
-
return (react_1.default.createElement(Box_1.Box, { ref: ref, flexDirection: design_system_shared_1.BoxFlexDirection.Row, alignItems: design_system_shared_1.BoxAlignItems.Start, gap: 4, backgroundColor: design_system_shared_1.BoxBackgroundColor.BackgroundDefault,
|
|
44
|
+
return (react_1.default.createElement(Box_1.Box, { ref: ref, flexDirection: design_system_shared_1.BoxFlexDirection.Row, alignItems: design_system_shared_1.BoxAlignItems.Start, gap: 4, backgroundColor: design_system_shared_1.BoxBackgroundColor.BackgroundDefault, paddingTop: 3, paddingBottom: hasActionButtonBelow ? 4 : 3, paddingLeft: 4, paddingRight: shouldShowCloseButton ? 2 : 4, className: (0, tw_merge_1.twMerge)('rounded-xl', className), ...props },
|
|
44
45
|
startAccessory,
|
|
45
46
|
react_1.default.createElement(Box_1.Box, { className: "min-w-0 flex-1" },
|
|
46
47
|
hasContent(title) &&
|
|
47
48
|
(isTextContent(title) ? (react_1.default.createElement(Text_1.Text, { variant: design_system_shared_1.TextVariant.BodyMd, fontWeight: design_system_shared_1.FontWeight.Medium, ...titleProps }, title)) : (title)),
|
|
48
|
-
hasContent(description) && (react_1.default.createElement(Box_1.Box,
|
|
49
|
+
hasContent(description) && (react_1.default.createElement(Box_1.Box, { className: hasContent(title) ? 'mt-0.5' : undefined }, isTextContent(description) ? (react_1.default.createElement(Text_1.Text, { variant: design_system_shared_1.TextVariant.BodySm, ...descriptionProps }, description)) : (description))),
|
|
49
50
|
hasContent(children) &&
|
|
50
51
|
(isTextContent(children) ? (react_1.default.createElement(Text_1.Text, { variant: design_system_shared_1.TextVariant.BodyMd, ...childrenWrapperProps }, children)) : (children)),
|
|
51
|
-
|
|
52
|
+
hasActionButtonBelow && react_1.default.createElement(Box_1.Box, { className: "mt-2" }, actionButton)),
|
|
52
53
|
shouldShowActionButton && isActionButtonLayoutEnd && actionButton,
|
|
53
54
|
shouldShowCloseButton && (react_1.default.createElement(ButtonIcon_1.ButtonIcon, { className: (0, tw_merge_1.twMerge)('-mt-1', closeButtonClassName), iconName: design_system_shared_1.IconName.Close, size: design_system_shared_1.ButtonIconSize.Md, ariaLabel: closeButtonAriaLabel, onClick: onClose, ...resolvedCloseButtonProps }))));
|
|
54
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAWwC;AACxC,+CAA0C;AAE1C,uDAA+C;AAC/C,0CAA6B;AAC7B,gDAAmC;AACnC,wDAA2C;AAC3C,4CAA+B;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;AAE/B,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GAAG,mDAA4B,CAAC,KAAK,EACvD,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,SAAS,EAAE,oBAAoB,EAC/B,GAAG,wBAAwB,EAC5B,GAAG,gBAAgB,IAAI,EAAE,CAAC;IAE3B,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,sBAAsB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC5D,MAAM,uBAAuB,GAC3B,kBAAkB,KAAK,mDAA4B,CAAC,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/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,WAAW,CACZ,CACG,CACP;YAEA,UAAU,CAAC,QAAQ,CAAC;gBACnB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACzB,8BAAC,WAAI,IAAC,OAAO,EAAE,kCAAW,CAAC,MAAM,KAAM,oBAAoB,IACxD,QAAQ,CACJ,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC;YAEH,oBAAoB,IAAI,8BAAC,SAAG,IAAC,SAAS,EAAC,MAAM,IAAE,YAAY,CAAO,CAC/D;QAEL,sBAAsB,IAAI,uBAAuB,IAAI,YAAY;QAEjE,qBAAqB,IAAI,CACxB,8BAAC,uBAAU,IACT,SAAS,EAAE,IAAA,kBAAO,EAAC,OAAO,EAAE,oBAAoB,CAAC,EACjD,QAAQ,EAAE,+BAAQ,CAAC,KAAK,EACxB,IAAI,EAAE,qCAAc,CAAC,EAAE,EACvB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAO,KACZ,wBAAwB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import {\n BannerBaseActionButtonLayout,\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n ButtonIconSize,\n ButtonSize,\n ButtonVariant,\n FontWeight,\n IconName,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\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 actionButtonLayout = BannerBaseActionButtonLayout.Below,\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 className: closeButtonClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose);\n const shouldShowActionButton = Boolean(actionButtonOnClick);\n const isActionButtonLayoutEnd =\n actionButtonLayout === BannerBaseActionButtonLayout.End;\n const hasActionButtonBelow =\n shouldShowActionButton && !isActionButtonLayoutEnd;\n\n const actionButton = shouldShowActionButton ? (\n <Button\n size={ButtonSize.Md}\n onClick={actionButtonOnClick}\n {...resolvedActionButtonProps}\n variant={ButtonVariant.Secondary}\n >\n {actionButtonLabel}\n </Button>\n ) : null;\n\n return (\n <Box\n ref={ref}\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={4}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n paddingTop={3}\n paddingBottom={hasActionButtonBelow ? 4 : 3}\n paddingLeft={4}\n paddingRight={shouldShowCloseButton ? 2 : 4}\n className={twMerge('rounded-xl', 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-0.5' : 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 {hasActionButtonBelow && <Box className=\"mt-2\">{actionButton}</Box>}\n </Box>\n\n {shouldShowActionButton && isActionButtonLayoutEnd && actionButton}\n\n {shouldShowCloseButton && (\n <ButtonIcon\n className={twMerge('-mt-1', closeButtonClassName)}\n iconName={IconName.Close}\n size={ButtonIconSize.Md}\n ariaLabel={closeButtonAriaLabel}\n onClick={onClose}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n },\n);\n\nBannerBase.displayName = 'BannerBase';\n"]}
|
|
@@ -302,6 +302,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
302
302
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
303
303
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
304
304
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
305
|
+
startAccessory?: React.ReactNode;
|
|
306
|
+
endAccessory?: React.ReactNode;
|
|
305
307
|
isDisabled?: boolean | undefined;
|
|
306
308
|
asChild?: boolean | undefined;
|
|
307
309
|
textProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
|
|
@@ -311,10 +313,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
311
313
|
loadingTextProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
|
|
312
314
|
startIconName?: IconName | undefined;
|
|
313
315
|
startIconProps?: Partial<import("../index.cjs").IconProps> | undefined;
|
|
314
|
-
startAccessory?: React.ReactNode;
|
|
315
316
|
endIconName?: IconName | undefined;
|
|
316
317
|
endIconProps?: Partial<import("../index.cjs").IconProps> | undefined;
|
|
317
|
-
endAccessory?: React.ReactNode;
|
|
318
318
|
loadingIconProps?: Partial<import("../index.cjs").IconProps> | undefined;
|
|
319
319
|
isDanger?: boolean | undefined;
|
|
320
320
|
isInverse?: boolean | undefined;
|
|
@@ -621,6 +621,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
621
621
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
622
622
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
623
623
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
624
|
+
startAccessory?: React.ReactNode;
|
|
625
|
+
endAccessory?: React.ReactNode;
|
|
624
626
|
isDisabled?: boolean | undefined;
|
|
625
627
|
asChild?: boolean | undefined;
|
|
626
628
|
textProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
|
|
@@ -630,10 +632,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
630
632
|
loadingTextProps?: Partial<import("../Text/index.cjs").TextProps> | undefined;
|
|
631
633
|
startIconName?: IconName | undefined;
|
|
632
634
|
startIconProps?: Partial<import("../index.cjs").IconProps> | undefined;
|
|
633
|
-
startAccessory?: React.ReactNode;
|
|
634
635
|
endIconName?: IconName | undefined;
|
|
635
636
|
endIconProps?: Partial<import("../index.cjs").IconProps> | undefined;
|
|
636
|
-
endAccessory?: React.ReactNode;
|
|
637
637
|
loadingIconProps?: Partial<import("../index.cjs").IconProps> | undefined;
|
|
638
638
|
isDanger?: boolean | undefined;
|
|
639
639
|
isInverse?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAET,uCAAuC;AACxC,OAAO,KAAqB,cAAc;AAgB1C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAoHtB,CAAC"}
|
|
@@ -302,6 +302,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
302
302
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
303
303
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
304
304
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
305
|
+
startAccessory?: React.ReactNode;
|
|
306
|
+
endAccessory?: React.ReactNode;
|
|
305
307
|
isDisabled?: boolean | undefined;
|
|
306
308
|
asChild?: boolean | undefined;
|
|
307
309
|
textProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
|
|
@@ -311,10 +313,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
311
313
|
loadingTextProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
|
|
312
314
|
startIconName?: IconName | undefined;
|
|
313
315
|
startIconProps?: Partial<import("../index.mjs").IconProps> | undefined;
|
|
314
|
-
startAccessory?: React.ReactNode;
|
|
315
316
|
endIconName?: IconName | undefined;
|
|
316
317
|
endIconProps?: Partial<import("../index.mjs").IconProps> | undefined;
|
|
317
|
-
endAccessory?: React.ReactNode;
|
|
318
318
|
loadingIconProps?: Partial<import("../index.mjs").IconProps> | undefined;
|
|
319
319
|
isDanger?: boolean | undefined;
|
|
320
320
|
isInverse?: boolean | undefined;
|
|
@@ -621,6 +621,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
621
621
|
onTransitionRunCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
622
622
|
onTransitionStart?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
623
623
|
onTransitionStartCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
624
|
+
startAccessory?: React.ReactNode;
|
|
625
|
+
endAccessory?: React.ReactNode;
|
|
624
626
|
isDisabled?: boolean | undefined;
|
|
625
627
|
asChild?: boolean | undefined;
|
|
626
628
|
textProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
|
|
@@ -630,10 +632,8 @@ export declare const BannerBase: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
630
632
|
loadingTextProps?: Partial<import("../Text/index.mjs").TextProps> | undefined;
|
|
631
633
|
startIconName?: IconName | undefined;
|
|
632
634
|
startIconProps?: Partial<import("../index.mjs").IconProps> | undefined;
|
|
633
|
-
startAccessory?: React.ReactNode;
|
|
634
635
|
endIconName?: IconName | undefined;
|
|
635
636
|
endIconProps?: Partial<import("../index.mjs").IconProps> | undefined;
|
|
636
|
-
endAccessory?: React.ReactNode;
|
|
637
637
|
loadingIconProps?: Partial<import("../index.mjs").IconProps> | undefined;
|
|
638
638
|
isDanger?: boolean | undefined;
|
|
639
639
|
isInverse?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAET,uCAAuC;AACxC,OAAO,KAAqB,cAAc;AAgB1C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAoHtB,CAAC"}
|
|
@@ -20,16 +20,17 @@ export const BannerBase = forwardRef(({ title, titleProps, description, descript
|
|
|
20
20
|
const shouldShowCloseButton = Boolean(onClose);
|
|
21
21
|
const shouldShowActionButton = Boolean(actionButtonOnClick);
|
|
22
22
|
const isActionButtonLayoutEnd = actionButtonLayout === BannerBaseActionButtonLayout.End;
|
|
23
|
+
const hasActionButtonBelow = shouldShowActionButton && !isActionButtonLayoutEnd;
|
|
23
24
|
const actionButton = shouldShowActionButton ? (React.createElement(Button, { size: ButtonSize.Md, onClick: actionButtonOnClick, ...resolvedActionButtonProps, variant: ButtonVariant.Secondary }, actionButtonLabel)) : null;
|
|
24
|
-
return (React.createElement(Box, { ref: ref, flexDirection: BoxFlexDirection.Row, alignItems: BoxAlignItems.Start, gap: 4, backgroundColor: BoxBackgroundColor.BackgroundDefault,
|
|
25
|
+
return (React.createElement(Box, { ref: ref, flexDirection: BoxFlexDirection.Row, alignItems: BoxAlignItems.Start, gap: 4, backgroundColor: BoxBackgroundColor.BackgroundDefault, paddingTop: 3, paddingBottom: hasActionButtonBelow ? 4 : 3, paddingLeft: 4, paddingRight: shouldShowCloseButton ? 2 : 4, className: twMerge('rounded-xl', className), ...props },
|
|
25
26
|
startAccessory,
|
|
26
27
|
React.createElement(Box, { className: "min-w-0 flex-1" },
|
|
27
28
|
hasContent(title) &&
|
|
28
29
|
(isTextContent(title) ? (React.createElement(Text, { variant: TextVariant.BodyMd, fontWeight: FontWeight.Medium, ...titleProps }, title)) : (title)),
|
|
29
|
-
hasContent(description) && (React.createElement(Box,
|
|
30
|
+
hasContent(description) && (React.createElement(Box, { className: hasContent(title) ? 'mt-0.5' : undefined }, isTextContent(description) ? (React.createElement(Text, { variant: TextVariant.BodySm, ...descriptionProps }, description)) : (description))),
|
|
30
31
|
hasContent(children) &&
|
|
31
32
|
(isTextContent(children) ? (React.createElement(Text, { variant: TextVariant.BodyMd, ...childrenWrapperProps }, children)) : (children)),
|
|
32
|
-
|
|
33
|
+
hasActionButtonBelow && React.createElement(Box, { className: "mt-2" }, actionButton)),
|
|
33
34
|
shouldShowActionButton && isActionButtonLayoutEnd && actionButton,
|
|
34
35
|
shouldShowCloseButton && (React.createElement(ButtonIcon, { className: twMerge('-mt-1', closeButtonClassName), iconName: IconName.Close, size: ButtonIconSize.Md, ariaLabel: closeButtonAriaLabel, onClick: onClose, ...resolvedCloseButtonProps }))));
|
|
35
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,4BAA4B,EAC5B,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,aAAa,EACb,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,uCAAuC;AACxC,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,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,kBAAkB,GAAG,4BAA4B,CAAC,KAAK,EACvD,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,SAAS,EAAE,oBAAoB,EAC/B,GAAG,wBAAwB,EAC5B,GAAG,gBAAgB,IAAI,EAAE,CAAC;IAE3B,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,sBAAsB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC5D,MAAM,uBAAuB,GAC3B,kBAAkB,KAAK,4BAA4B,CAAC,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,4BAA4B,EAC5B,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,aAAa,EACb,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,uCAAuC;AACxC,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,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,MA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,CACJ,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC;YAEH,oBAAoB,IAAI,oBAAC,GAAG,IAAC,SAAS,EAAC,MAAM,IAAE,YAAY,CAAO,CAC/D;QAEL,sBAAsB,IAAI,uBAAuB,IAAI,YAAY;QAEjE,qBAAqB,IAAI,CACxB,oBAAC,UAAU,IACT,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,EACjD,QAAQ,EAAE,QAAQ,CAAC,KAAK,EACxB,IAAI,EAAE,cAAc,CAAC,EAAE,EACvB,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAO,KACZ,wBAAwB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import {\n BannerBaseActionButtonLayout,\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n ButtonIconSize,\n ButtonSize,\n ButtonVariant,\n FontWeight,\n IconName,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React, { forwardRef } from 'react';\n\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 actionButtonLayout = BannerBaseActionButtonLayout.Below,\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 className: closeButtonClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose);\n const shouldShowActionButton = Boolean(actionButtonOnClick);\n const isActionButtonLayoutEnd =\n actionButtonLayout === BannerBaseActionButtonLayout.End;\n const hasActionButtonBelow =\n shouldShowActionButton && !isActionButtonLayoutEnd;\n\n const actionButton = shouldShowActionButton ? (\n <Button\n size={ButtonSize.Md}\n onClick={actionButtonOnClick}\n {...resolvedActionButtonProps}\n variant={ButtonVariant.Secondary}\n >\n {actionButtonLabel}\n </Button>\n ) : null;\n\n return (\n <Box\n ref={ref}\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={4}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n paddingTop={3}\n paddingBottom={hasActionButtonBelow ? 4 : 3}\n paddingLeft={4}\n paddingRight={shouldShowCloseButton ? 2 : 4}\n className={twMerge('rounded-xl', 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-0.5' : 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 {hasActionButtonBelow && <Box className=\"mt-2\">{actionButton}</Box>}\n </Box>\n\n {shouldShowActionButton && isActionButtonLayoutEnd && actionButton}\n\n {shouldShowCloseButton && (\n <ButtonIcon\n className={twMerge('-mt-1', closeButtonClassName)}\n iconName={IconName.Close}\n size={ButtonIconSize.Md}\n ariaLabel={closeButtonAriaLabel}\n onClick={onClose}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n },\n);\n\nBannerBase.displayName = 'BannerBase';\n"]}
|
|
@@ -6,8 +6,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.HelpText = void 0;
|
|
7
7
|
const design_system_shared_1 = require("@metamask/design-system-shared");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const Box_1 = require("../Box/index.cjs");
|
|
10
|
+
const IconAlert_1 = require("../IconAlert/index.cjs");
|
|
9
11
|
const Text_1 = require("../Text/index.cjs");
|
|
10
12
|
const HelpText_constants_1 = require("./HelpText.constants.cjs");
|
|
11
|
-
const HelpText = ({ severity, color = design_system_shared_1.TextColor.TextDefault, className, children, ...props }) =>
|
|
13
|
+
const HelpText = ({ severity, showIcon = false, color = design_system_shared_1.TextColor.TextDefault, className, children, ...props }) => {
|
|
14
|
+
const textColor = severity ? HelpText_constants_1.MAP_HELPTEXT_SEVERITY_COLOR[severity] : color;
|
|
15
|
+
if (!(showIcon && severity)) {
|
|
16
|
+
return (react_1.default.createElement(Text_1.Text, { variant: design_system_shared_1.TextVariant.BodySm, color: textColor, className: className, ...props }, children));
|
|
17
|
+
}
|
|
18
|
+
return (react_1.default.createElement(Box_1.Box, { flexDirection: design_system_shared_1.BoxFlexDirection.Row, alignItems: design_system_shared_1.BoxAlignItems.Center, gap: 1, className: className },
|
|
19
|
+
react_1.default.createElement(IconAlert_1.IconAlert, { severity: severity, size: design_system_shared_1.IconSize.Sm, "data-testid": "help-text-icon" }),
|
|
20
|
+
react_1.default.createElement(Text_1.Text, { variant: design_system_shared_1.TextVariant.BodySm, color: textColor, ...props }, children)));
|
|
21
|
+
};
|
|
12
22
|
exports.HelpText = HelpText;
|
|
13
23
|
//# sourceMappingURL=HelpText.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpText.cjs","sourceRoot":"","sources":["../../../src/components/HelpText/HelpText.tsx"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"HelpText.cjs","sourceRoot":"","sources":["../../../src/components/HelpText/HelpText.tsx"],"names":[],"mappings":";;;;;;AAAA,yEAMwC;AACxC,kDAA0B;AAE1B,0CAA6B;AAC7B,sDAAyC;AACzC,4CAA+B;AAE/B,iEAAmE;AAG5D,MAAM,QAAQ,GAA4B,CAAC,EAChD,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,gCAAS,CAAC,WAAW,EAC7B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,gDAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAE3E,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAAE;QAC3B,OAAO,CACL,8BAAC,WAAI,IACH,OAAO,EAAE,kCAAW,CAAC,MAAM,EAC3B,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,SAAS,KAChB,KAAK,IAER,QAAQ,CACJ,CACR,CAAC;KACH;IAED,OAAO,CACL,8BAAC,SAAG,IACF,aAAa,EAAE,uCAAgB,CAAC,GAAG,EACnC,UAAU,EAAE,oCAAa,CAAC,MAAM,EAChC,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,SAAS;QAEpB,8BAAC,qBAAS,IACR,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,+BAAQ,CAAC,EAAE,iBACL,gBAAgB,GAC5B;QACF,8BAAC,WAAI,IAAC,OAAO,EAAE,kCAAW,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,KAAM,KAAK,IAC3D,QAAQ,CACJ,CACH,CACP,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,QAAQ,YAwCnB","sourcesContent":["import {\n BoxAlignItems,\n BoxFlexDirection,\n IconSize,\n TextColor,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React from 'react';\n\nimport { Box } from '../Box';\nimport { IconAlert } from '../IconAlert';\nimport { Text } from '../Text';\n\nimport { MAP_HELPTEXT_SEVERITY_COLOR } from './HelpText.constants';\nimport type { HelpTextProps } from './HelpText.types';\n\nexport const HelpText: React.FC<HelpTextProps> = ({\n severity,\n showIcon = false,\n color = TextColor.TextDefault,\n className,\n children,\n ...props\n}) => {\n const textColor = severity ? MAP_HELPTEXT_SEVERITY_COLOR[severity] : color;\n\n if (!(showIcon && severity)) {\n return (\n <Text\n variant={TextVariant.BodySm}\n color={textColor}\n className={className}\n {...props}\n >\n {children}\n </Text>\n );\n }\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={1}\n className={className}\n >\n <IconAlert\n severity={severity}\n size={IconSize.Sm}\n data-testid=\"help-text-icon\"\n />\n <Text variant={TextVariant.BodySm} color={textColor} {...props}>\n {children}\n </Text>\n </Box>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpText.d.cts","sourceRoot":"","sources":["../../../src/components/HelpText/HelpText.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HelpText.d.cts","sourceRoot":"","sources":["../../../src/components/HelpText/HelpText.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpText.d.mts","sourceRoot":"","sources":["../../../src/components/HelpText/HelpText.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HelpText.d.mts","sourceRoot":"","sources":["../../../src/components/HelpText/HelpText.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwC5C,CAAC"}
|
|
@@ -4,10 +4,20 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
-
import { TextColor, TextVariant } from "@metamask/design-system-shared";
|
|
7
|
+
import { BoxAlignItems, BoxFlexDirection, IconSize, TextColor, TextVariant } from "@metamask/design-system-shared";
|
|
8
8
|
import $React from "react";
|
|
9
9
|
const React = $importDefault($React);
|
|
10
|
+
import { Box } from "../Box/index.mjs";
|
|
11
|
+
import { IconAlert } from "../IconAlert/index.mjs";
|
|
10
12
|
import { Text } from "../Text/index.mjs";
|
|
11
13
|
import { MAP_HELPTEXT_SEVERITY_COLOR } from "./HelpText.constants.mjs";
|
|
12
|
-
export const HelpText = ({ severity, color = TextColor.TextDefault, className, children, ...props }) =>
|
|
14
|
+
export const HelpText = ({ severity, showIcon = false, color = TextColor.TextDefault, className, children, ...props }) => {
|
|
15
|
+
const textColor = severity ? MAP_HELPTEXT_SEVERITY_COLOR[severity] : color;
|
|
16
|
+
if (!(showIcon && severity)) {
|
|
17
|
+
return (React.createElement(Text, { variant: TextVariant.BodySm, color: textColor, className: className, ...props }, children));
|
|
18
|
+
}
|
|
19
|
+
return (React.createElement(Box, { flexDirection: BoxFlexDirection.Row, alignItems: BoxAlignItems.Center, gap: 1, className: className },
|
|
20
|
+
React.createElement(IconAlert, { severity: severity, size: IconSize.Sm, "data-testid": "help-text-icon" }),
|
|
21
|
+
React.createElement(Text, { variant: TextVariant.BodySm, color: textColor, ...props }, children)));
|
|
22
|
+
};
|
|
13
23
|
//# sourceMappingURL=HelpText.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpText.mjs","sourceRoot":"","sources":["../../../src/components/HelpText/HelpText.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"HelpText.mjs","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sourcesContent":["import {\n BoxAlignItems,\n BoxFlexDirection,\n IconSize,\n TextColor,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport React from 'react';\n\nimport { Box } from '../Box';\nimport { IconAlert } from '../IconAlert';\nimport { Text } from '../Text';\n\nimport { MAP_HELPTEXT_SEVERITY_COLOR } from './HelpText.constants';\nimport type { HelpTextProps } from './HelpText.types';\n\nexport const HelpText: React.FC<HelpTextProps> = ({\n severity,\n showIcon = false,\n color = TextColor.TextDefault,\n className,\n children,\n ...props\n}) => {\n const textColor = severity ? MAP_HELPTEXT_SEVERITY_COLOR[severity] : color;\n\n if (!(showIcon && severity)) {\n return (\n <Text\n variant={TextVariant.BodySm}\n color={textColor}\n className={className}\n {...props}\n >\n {children}\n </Text>\n );\n }\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={1}\n className={className}\n >\n <IconAlert\n severity={severity}\n size={IconSize.Sm}\n data-testid=\"help-text-icon\"\n />\n <Text variant={TextVariant.BodySm} color={textColor} {...props}>\n {children}\n </Text>\n </Box>\n );\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IconAlert = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Icon_1 = require("../Icon/index.cjs");
|
|
9
|
+
const IconAlert_constants_1 = require("./IconAlert.constants.cjs");
|
|
10
|
+
const IconAlert = ({ severity, ...props }) => {
|
|
11
|
+
const { name, color } = IconAlert_constants_1.ICON_ALERT_SEVERITY_MAP[severity];
|
|
12
|
+
return react_1.default.createElement(Icon_1.Icon, { ...props, color: color, name: name });
|
|
13
|
+
};
|
|
14
|
+
exports.IconAlert = IconAlert;
|
|
15
|
+
exports.IconAlert.displayName = 'IconAlert';
|
|
16
|
+
//# sourceMappingURL=IconAlert.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.cjs","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,4CAA+B;AAE/B,mEAAgE;AAGzD,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAkB,EAAE,EAAE;IAClE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,6CAAuB,CAAC,QAAQ,CAAC,CAAC;IAC1D,OAAO,8BAAC,WAAI,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;AACvD,CAAC,CAAC;AAHW,QAAA,SAAS,aAGpB;AAEF,iBAAS,CAAC,WAAW,GAAG,WAAW,CAAC","sourcesContent":["import React from 'react';\n\nimport { Icon } from '../Icon';\n\nimport { ICON_ALERT_SEVERITY_MAP } from './IconAlert.constants';\nimport type { IconAlertProps } from './IconAlert.types';\n\nexport const IconAlert = ({ severity, ...props }: IconAlertProps) => {\n const { name, color } = ICON_ALERT_SEVERITY_MAP[severity];\n return <Icon {...props} color={color} name={name} />;\n};\n\nIconAlert.displayName = 'IconAlert';\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ICON_ALERT_SEVERITY_MAP = void 0;
|
|
4
|
+
const design_system_shared_1 = require("@metamask/design-system-shared");
|
|
5
|
+
exports.ICON_ALERT_SEVERITY_MAP = {
|
|
6
|
+
[design_system_shared_1.IconAlertSeverity.Info]: {
|
|
7
|
+
name: design_system_shared_1.IconName.Info,
|
|
8
|
+
color: design_system_shared_1.IconColor.PrimaryDefault,
|
|
9
|
+
},
|
|
10
|
+
[design_system_shared_1.IconAlertSeverity.Success]: {
|
|
11
|
+
name: design_system_shared_1.IconName.Confirmation,
|
|
12
|
+
color: design_system_shared_1.IconColor.SuccessDefault,
|
|
13
|
+
},
|
|
14
|
+
[design_system_shared_1.IconAlertSeverity.Warning]: {
|
|
15
|
+
name: design_system_shared_1.IconName.Danger,
|
|
16
|
+
color: design_system_shared_1.IconColor.WarningDefault,
|
|
17
|
+
},
|
|
18
|
+
[design_system_shared_1.IconAlertSeverity.Danger]: {
|
|
19
|
+
name: design_system_shared_1.IconName.Error,
|
|
20
|
+
color: design_system_shared_1.IconColor.ErrorDefault,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=IconAlert.constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.constants.cjs","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.constants.ts"],"names":[],"mappings":";;;AAAA,yEAIwC;AAE3B,QAAA,uBAAuB,GAGhC;IACF,CAAC,wCAAiB,CAAC,IAAI,CAAC,EAAE;QACxB,IAAI,EAAE,+BAAQ,CAAC,IAAI;QACnB,KAAK,EAAE,gCAAS,CAAC,cAAc;KAChC;IACD,CAAC,wCAAiB,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,EAAE,+BAAQ,CAAC,YAAY;QAC3B,KAAK,EAAE,gCAAS,CAAC,cAAc;KAChC;IACD,CAAC,wCAAiB,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,KAAK,EAAE,gCAAS,CAAC,cAAc;KAChC;IACD,CAAC,wCAAiB,CAAC,MAAM,CAAC,EAAE;QAC1B,IAAI,EAAE,+BAAQ,CAAC,KAAK;QACpB,KAAK,EAAE,gCAAS,CAAC,YAAY;KAC9B;CACF,CAAC","sourcesContent":["import {\n IconAlertSeverity,\n IconColor,\n IconName,\n} from '@metamask/design-system-shared';\n\nexport const ICON_ALERT_SEVERITY_MAP: Record<\n IconAlertSeverity,\n { name: IconName; color: IconColor }\n> = {\n [IconAlertSeverity.Info]: {\n name: IconName.Info,\n color: IconColor.PrimaryDefault,\n },\n [IconAlertSeverity.Success]: {\n name: IconName.Confirmation,\n color: IconColor.SuccessDefault,\n },\n [IconAlertSeverity.Warning]: {\n name: IconName.Danger,\n color: IconColor.WarningDefault,\n },\n [IconAlertSeverity.Danger]: {\n name: IconName.Error,\n color: IconColor.ErrorDefault,\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.constants.d.cts","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACT,uCAAuC;AAExC,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,iBAAiB,EACjB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAkBrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.constants.d.mts","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACT,uCAAuC;AAExC,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,iBAAiB,EACjB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAkBrC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IconAlertSeverity, IconColor, IconName } from "@metamask/design-system-shared";
|
|
2
|
+
export const ICON_ALERT_SEVERITY_MAP = {
|
|
3
|
+
[IconAlertSeverity.Info]: {
|
|
4
|
+
name: IconName.Info,
|
|
5
|
+
color: IconColor.PrimaryDefault,
|
|
6
|
+
},
|
|
7
|
+
[IconAlertSeverity.Success]: {
|
|
8
|
+
name: IconName.Confirmation,
|
|
9
|
+
color: IconColor.SuccessDefault,
|
|
10
|
+
},
|
|
11
|
+
[IconAlertSeverity.Warning]: {
|
|
12
|
+
name: IconName.Danger,
|
|
13
|
+
color: IconColor.WarningDefault,
|
|
14
|
+
},
|
|
15
|
+
[IconAlertSeverity.Danger]: {
|
|
16
|
+
name: IconName.Error,
|
|
17
|
+
color: IconColor.ErrorDefault,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=IconAlert.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.constants.mjs","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACT,uCAAuC;AAExC,MAAM,CAAC,MAAM,uBAAuB,GAGhC;IACF,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;QACxB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,KAAK,EAAE,SAAS,CAAC,cAAc;KAChC;IACD,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,EAAE,QAAQ,CAAC,YAAY;QAC3B,KAAK,EAAE,SAAS,CAAC,cAAc;KAChC;IACD,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,EAAE,QAAQ,CAAC,MAAM;QACrB,KAAK,EAAE,SAAS,CAAC,cAAc;KAChC;IACD,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE;QAC1B,IAAI,EAAE,QAAQ,CAAC,KAAK;QACpB,KAAK,EAAE,SAAS,CAAC,YAAY;KAC9B;CACF,CAAC","sourcesContent":["import {\n IconAlertSeverity,\n IconColor,\n IconName,\n} from '@metamask/design-system-shared';\n\nexport const ICON_ALERT_SEVERITY_MAP: Record<\n IconAlertSeverity,\n { name: IconName; color: IconColor }\n> = {\n [IconAlertSeverity.Info]: {\n name: IconName.Info,\n color: IconColor.PrimaryDefault,\n },\n [IconAlertSeverity.Success]: {\n name: IconName.Confirmation,\n color: IconColor.SuccessDefault,\n },\n [IconAlertSeverity.Warning]: {\n name: IconName.Danger,\n color: IconColor.WarningDefault,\n },\n [IconAlertSeverity.Danger]: {\n name: IconName.Error,\n color: IconColor.ErrorDefault,\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.d.cts","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAK1B,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA0B;AAExD,eAAO,MAAM,SAAS;6BAA4B,cAAc;;CAG/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.d.mts","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAK1B,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA0B;AAExD,eAAO,MAAM,SAAS;6BAA4B,cAAc;;CAG/D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
import $React from "react";
|
|
8
|
+
const React = $importDefault($React);
|
|
9
|
+
import { Icon } from "../Icon/index.mjs";
|
|
10
|
+
import { ICON_ALERT_SEVERITY_MAP } from "./IconAlert.constants.mjs";
|
|
11
|
+
export const IconAlert = ({ severity, ...props }) => {
|
|
12
|
+
const { name, color } = ICON_ALERT_SEVERITY_MAP[severity];
|
|
13
|
+
return React.createElement(Icon, { ...props, color: color, name: name });
|
|
14
|
+
};
|
|
15
|
+
IconAlert.displayName = 'IconAlert';
|
|
16
|
+
//# sourceMappingURL=IconAlert.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.mjs","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAE/B,OAAO,EAAE,uBAAuB,EAAE,kCAA8B;AAGhE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAkB,EAAE,EAAE;IAClE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC1D,OAAO,oBAAC,IAAI,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;AACvD,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC","sourcesContent":["import React from 'react';\n\nimport { Icon } from '../Icon';\n\nimport { ICON_ALERT_SEVERITY_MAP } from './IconAlert.constants';\nimport type { IconAlertProps } from './IconAlert.types';\n\nexport const IconAlert = ({ severity, ...props }: IconAlertProps) => {\n const { name, color } = ICON_ALERT_SEVERITY_MAP[severity];\n return <Icon {...props} color={color} name={name} />;\n};\n\nIconAlert.displayName = 'IconAlert';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconAlert.types.cjs","sourceRoot":"","sources":["../../../src/components/IconAlert/IconAlert.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { IconAlertPropsShared } from '@metamask/design-system-shared';\n\nimport type { IconProps } from '../Icon';\n\nexport type IconAlertProps = IconAlertPropsShared &\n Omit<IconProps, 'name' | 'color' | keyof IconAlertPropsShared>;\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IconAlertPropsShared } from "@metamask/design-system-shared";
|
|
2
|
+
import type { IconProps } from "../Icon/index.cjs";
|
|
3
|
+
export type IconAlertProps = IconAlertPropsShared & Omit<IconProps, 'name' | 'color' | keyof IconAlertPropsShared>;
|
|
4
|
+
//# sourceMappingURL=IconAlert.types.d.cts.map
|