@metamask-previews/design-system-react-native 0.13.0-preview.b4e6ece → 0.14.0-preview.dff9dce
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 +28 -1
- package/dist/components/AvatarAccount/AvatarAccount.cjs +6 -6
- package/dist/components/AvatarAccount/AvatarAccount.cjs.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.constants.cjs +6 -6
- package/dist/components/AvatarAccount/AvatarAccount.constants.cjs.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.constants.d.cts +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.constants.d.cts.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.constants.d.mts +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.constants.d.mts.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.constants.mjs +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.constants.mjs.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.d.cts.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.d.mts.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.mjs +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.mjs.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.types.cjs.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.types.d.cts +2 -12
- package/dist/components/AvatarAccount/AvatarAccount.types.d.cts.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.types.d.mts +2 -12
- package/dist/components/AvatarAccount/AvatarAccount.types.d.mts.map +1 -1
- package/dist/components/AvatarAccount/AvatarAccount.types.mjs.map +1 -1
- package/dist/components/AvatarAccount/index.cjs +3 -3
- package/dist/components/AvatarAccount/index.cjs.map +1 -1
- package/dist/components/AvatarAccount/index.d.cts +1 -1
- package/dist/components/AvatarAccount/index.d.cts.map +1 -1
- package/dist/components/AvatarAccount/index.d.mts +1 -1
- package/dist/components/AvatarAccount/index.d.mts.map +1 -1
- package/dist/components/AvatarAccount/index.mjs +1 -1
- package/dist/components/AvatarAccount/index.mjs.map +1 -1
- package/dist/components/AvatarBase/index.cjs.map +1 -1
- package/dist/components/AvatarBase/index.d.cts.map +1 -1
- package/dist/components/AvatarBase/index.d.mts.map +1 -1
- package/dist/components/AvatarBase/index.mjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs +2 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.cts.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.mts.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs +2 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs +2 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.cts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.mts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs +2 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.cjs +3 -3
- package/dist/components/AvatarToken/AvatarToken.cjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.cts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.mts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.mjs +1 -1
- package/dist/components/AvatarToken/AvatarToken.mjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.types.cjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.types.d.cts +5 -7
- package/dist/components/AvatarToken/AvatarToken.types.d.cts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.types.d.mts +5 -7
- package/dist/components/AvatarToken/AvatarToken.types.d.mts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.types.mjs.map +1 -1
- package/dist/components/AvatarToken/index.cjs +2 -2
- package/dist/components/AvatarToken/index.cjs.map +1 -1
- package/dist/components/AvatarToken/index.d.cts +1 -1
- package/dist/components/AvatarToken/index.d.cts.map +1 -1
- package/dist/components/AvatarToken/index.d.mts +1 -1
- package/dist/components/AvatarToken/index.d.mts.map +1 -1
- package/dist/components/AvatarToken/index.mjs +1 -1
- package/dist/components/AvatarToken/index.mjs.map +1 -1
- package/dist/components/BannerBase/BannerBase.cjs +4 -3
- package/dist/components/BannerBase/BannerBase.cjs.map +1 -1
- package/dist/components/BannerBase/BannerBase.d.cts.map +1 -1
- package/dist/components/BannerBase/BannerBase.d.mts.map +1 -1
- package/dist/components/BannerBase/BannerBase.mjs +2 -1
- package/dist/components/BannerBase/BannerBase.mjs.map +1 -1
- package/dist/components/Icon/Icon.cjs +2 -1
- package/dist/components/Icon/Icon.cjs.map +1 -1
- package/dist/components/Icon/Icon.constants.cjs +12 -0
- package/dist/components/Icon/Icon.constants.cjs.map +1 -0
- package/dist/components/Icon/Icon.constants.d.cts +3 -0
- package/dist/components/Icon/Icon.constants.d.cts.map +1 -0
- package/dist/components/Icon/Icon.constants.d.mts +3 -0
- package/dist/components/Icon/Icon.constants.d.mts.map +1 -0
- package/dist/components/Icon/Icon.constants.mjs +9 -0
- package/dist/components/Icon/Icon.constants.mjs.map +1 -0
- package/dist/components/Icon/Icon.d.cts.map +1 -1
- package/dist/components/Icon/Icon.d.mts.map +1 -1
- package/dist/components/Icon/Icon.mjs +2 -1
- package/dist/components/Icon/Icon.mjs.map +1 -1
- package/dist/components/Input/Input.cjs +3 -3
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.constants.cjs +15 -15
- package/dist/components/Input/Input.constants.cjs.map +1 -1
- package/dist/components/Input/Input.constants.d.cts +1 -1
- package/dist/components/Input/Input.constants.d.cts.map +1 -1
- package/dist/components/Input/Input.constants.d.mts +1 -1
- package/dist/components/Input/Input.constants.d.mts.map +1 -1
- package/dist/components/Input/Input.constants.mjs +1 -1
- package/dist/components/Input/Input.constants.mjs.map +1 -1
- package/dist/components/Input/Input.d.cts +1 -1
- package/dist/components/Input/Input.d.cts.map +1 -1
- package/dist/components/Input/Input.d.mts +1 -1
- package/dist/components/Input/Input.d.mts.map +1 -1
- package/dist/components/Input/Input.mjs +1 -1
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/Input/Input.types.cjs.map +1 -1
- package/dist/components/Input/Input.types.d.cts +1 -1
- package/dist/components/Input/Input.types.d.cts.map +1 -1
- package/dist/components/Input/Input.types.d.mts +1 -1
- package/dist/components/Input/Input.types.d.mts.map +1 -1
- package/dist/components/Input/Input.types.mjs.map +1 -1
- package/dist/components/Text/Text.cjs +4 -4
- package/dist/components/Text/Text.cjs.map +1 -1
- package/dist/components/Text/Text.constants.cjs +18 -23
- package/dist/components/Text/Text.constants.cjs.map +1 -1
- package/dist/components/Text/Text.constants.d.cts +1 -1
- package/dist/components/Text/Text.constants.d.cts.map +1 -1
- package/dist/components/Text/Text.constants.d.mts +1 -1
- package/dist/components/Text/Text.constants.d.mts.map +1 -1
- package/dist/components/Text/Text.constants.mjs +15 -20
- package/dist/components/Text/Text.constants.mjs.map +1 -1
- package/dist/components/Text/Text.d.cts.map +1 -1
- package/dist/components/Text/Text.d.mts.map +1 -1
- package/dist/components/Text/Text.mjs +1 -1
- package/dist/components/Text/Text.mjs.map +1 -1
- package/dist/components/Text/Text.types.cjs.map +1 -1
- package/dist/components/Text/Text.types.d.cts +3 -17
- package/dist/components/Text/Text.types.d.cts.map +1 -1
- package/dist/components/Text/Text.types.d.mts +3 -17
- package/dist/components/Text/Text.types.d.mts.map +1 -1
- package/dist/components/Text/Text.types.mjs.map +1 -1
- package/dist/components/Text/index.cjs +7 -7
- package/dist/components/Text/index.cjs.map +1 -1
- package/dist/components/Text/index.d.cts +1 -1
- package/dist/components/Text/index.d.cts.map +1 -1
- package/dist/components/Text/index.d.mts +1 -1
- package/dist/components/Text/index.d.mts.map +1 -1
- package/dist/components/Text/index.mjs +1 -1
- package/dist/components/Text/index.mjs.map +1 -1
- package/dist/components/TextButton/TextButton.cjs +3 -3
- package/dist/components/TextButton/TextButton.cjs.map +1 -1
- package/dist/components/TextButton/TextButton.d.cts.map +1 -1
- package/dist/components/TextButton/TextButton.d.mts.map +1 -1
- package/dist/components/TextButton/TextButton.mjs +1 -1
- package/dist/components/TextButton/TextButton.mjs.map +1 -1
- package/dist/components/TextField/TextField.cjs +2 -2
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.d.cts.map +1 -1
- package/dist/components/TextField/TextField.d.mts.map +1 -1
- package/dist/components/TextField/TextField.mjs +1 -1
- package/dist/components/TextField/TextField.mjs.map +1 -1
- package/dist/types/index.cjs +11 -131
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +5 -113
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +5 -113
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +5 -123
- package/dist/types/index.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.cjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AAGxC,
|
|
1
|
+
{"version":3,"file":"AvatarToken.cjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kFAGiD;AACjD,+CAAwC;AAGxC,wDAA2C;AAC3C,wEAA2D;AAIpD,MAAM,WAAW,GAAG,CAAC,EAC1B,GAAG,EACH,IAAI,GAAG,sCAAe,CAAC,EAAE,EACzB,IAAI,EACJ,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,GAAG,KAAK,EACS,EAAE,EAAE;IACrB,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAS,EAAE,CAAC,CAAC;IAElE,MAAM,kBAAkB,GAAG,YAAY,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3D,MAAM,mBAAmB,GAAG,CAC1B,CAA4C,EAC5C,EAAE;QACF,eAAe,CAAC,kBAAkB,CAAC,CAAC;QACpC,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;QACrC,eAAe,CAAC,kBAAkB,CAAC,CAAC;QACpC,eAAe,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,uBAAU,CACT,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,KAAK,CAAC,CAAC,sCAAe,CAAC,MAAM,CAAC,CAC9B,YAAY,CAAC,CAAC,iBAAiB,CAAC,CAChC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,GAAG,IAAI,CACN,CAAC,uBAAU,CACT,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,KAAK,CAAC,CAAC,MAAM,CAAC,CACd,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,IAAI,eAAe,CAAC,CACpB,UAAU,CAAC,CAAC;gBACV,UAAU,EAAE,SAAS;gBACrB,GAAG,eAAe,EAAE,UAAU;aAC/B,CAAC,CACF,YAAY,CAAC,CAAC,mBAAmB,CAAC,CAClC,UAAU,CAAC,CAAC,iBAAiB,CAAC,EAC9B,CACH,CACH;IAAA,EAAE,uBAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,WAAW,eAgDtB","sourcesContent":["import {\n AvatarBaseShape,\n AvatarTokenSize,\n} from '@metamask-previews/design-system-shared';\nimport React, { useState } from 'react';\nimport type { ImageErrorEventData, NativeSyntheticEvent } from 'react-native';\n\nimport { AvatarBase } from '../AvatarBase';\nimport { ImageOrSvg } from '../temp-components/ImageOrSvg';\n\nimport type { AvatarTokenProps } from './AvatarToken.types';\n\nexport const AvatarToken = ({\n src,\n size = AvatarTokenSize.Md,\n name,\n fallbackText,\n fallbackTextProps,\n imageOrSvgProps,\n ...props\n}: AvatarTokenProps) => {\n const [finalFallbackText, setFallbackText] = useState<string>('');\n\n const backupFallbackText = fallbackText || name?.[0] || '';\n const onImageErrorHandler = (\n e: NativeSyntheticEvent<ImageErrorEventData>,\n ) => {\n setFallbackText(backupFallbackText);\n imageOrSvgProps?.onImageError?.(e);\n };\n\n const onSvgErrorHandler = (e: Error) => {\n setFallbackText(backupFallbackText);\n imageOrSvgProps?.onSvgError?.(e);\n };\n\n return (\n <AvatarBase\n size={size}\n shape={AvatarBaseShape.Circle}\n fallbackText={finalFallbackText}\n fallbackTextProps={fallbackTextProps}\n {...props}\n >\n {src && (\n <ImageOrSvg\n src={src}\n width={'100%'}\n height={'100%'}\n {...imageOrSvgProps}\n imageProps={{\n resizeMode: 'contain',\n ...imageOrSvgProps?.imageProps,\n }}\n onImageError={onImageErrorHandler}\n onSvgError={onSvgErrorHandler}\n />\n )}\n </AvatarBase>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.d.cts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AvatarToken.d.cts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,cAAc;AAMxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAA4B;AAE5D,eAAO,MAAM,WAAW,oFAQrB,gBAAgB,sBAwClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.d.mts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AvatarToken.d.mts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,cAAc;AAMxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAA4B;AAE5D,eAAO,MAAM,WAAW,oFAQrB,gBAAgB,sBAwClB,CAAC"}
|
|
@@ -4,9 +4,9 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
+
import { AvatarBaseShape, AvatarTokenSize } from "@metamask-previews/design-system-shared";
|
|
7
8
|
import $React, { useState } from "react";
|
|
8
9
|
const React = $importDefault($React);
|
|
9
|
-
import { AvatarTokenSize, AvatarBaseShape } from "../../types/index.mjs";
|
|
10
10
|
import { AvatarBase } from "../AvatarBase/index.mjs";
|
|
11
11
|
import { ImageOrSvg } from "../temp-components/ImageOrSvg/index.mjs";
|
|
12
12
|
export const AvatarToken = ({ src, size = AvatarTokenSize.Md, name, fallbackText, fallbackTextProps, imageOrSvgProps, ...props }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.mjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AvatarToken.mjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,eAAe,EACf,eAAe,EAChB,gDAAgD;AACjD,OAAO,QAAO,EAAE,QAAQ,EAAE,cAAc;;AAGxC,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,UAAU,EAAE,gDAAsC;AAI3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,GAAG,EACH,IAAI,GAAG,eAAe,CAAC,EAAE,EACzB,IAAI,EACJ,YAAY,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metamask-previews/design-system-shared';\nimport React, { useState } from 'react';\nimport type { ImageErrorEventData, NativeSyntheticEvent } from 'react-native';\n\nimport { AvatarBase } from '../AvatarBase';\nimport { ImageOrSvg } from '../temp-components/ImageOrSvg';\n\nimport type { AvatarTokenProps } from './AvatarToken.types';\n\nexport const AvatarToken = ({\n src,\n size = AvatarTokenSize.Md,\n name,\n fallbackText,\n fallbackTextProps,\n imageOrSvgProps,\n ...props\n}: AvatarTokenProps) => {\n const [finalFallbackText, setFallbackText] = useState<string>('');\n\n const backupFallbackText = fallbackText || name?.[0] || '';\n const onImageErrorHandler = (\n e: NativeSyntheticEvent<ImageErrorEventData>,\n ) => {\n setFallbackText(backupFallbackText);\n imageOrSvgProps?.onImageError?.(e);\n };\n\n const onSvgErrorHandler = (e: Error) => {\n setFallbackText(backupFallbackText);\n imageOrSvgProps?.onSvgError?.(e);\n };\n\n return (\n <AvatarBase\n size={size}\n shape={AvatarBaseShape.Circle}\n fallbackText={finalFallbackText}\n fallbackTextProps={fallbackTextProps}\n {...props}\n >\n {src && (\n <ImageOrSvg\n src={src}\n width={'100%'}\n height={'100%'}\n {...imageOrSvgProps}\n imageProps={{\n resizeMode: 'contain',\n ...imageOrSvgProps?.imageProps,\n }}\n onImageError={onImageErrorHandler}\n onSvgError={onSvgErrorHandler}\n />\n )}\n </AvatarBase>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.types.cjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AvatarBaseProps } from '../AvatarBase';\nimport type {\n ImageOrSvgProps,\n ImageOrSvgSrc,\n} from '../temp-components/ImageOrSvg';\n\n/**\n * AvatarToken component props
|
|
1
|
+
{"version":3,"file":"AvatarToken.types.cjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AvatarTokenPropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { AvatarBaseProps } from '../AvatarBase';\nimport type {\n ImageOrSvgProps,\n ImageOrSvgSrc,\n} from '../temp-components/ImageOrSvg';\n\n/**\n * AvatarToken component props (React Native platform-specific)\n * Extends shared props from @metamask-previews/design-system-shared with React Native-specific platform concerns\n */\nexport type AvatarTokenProps = AvatarTokenPropsShared &\n Omit<AvatarBaseProps, 'children'> & {\n /**\n * Optional prop for the source of the image or SVG.\n */\n src?: ImageOrSvgSrc;\n /**\n * Optional prop to pass to the underlying ImageOrSvg element\n * Useful for overriding the default alt text which is the dapp name\n */\n imageOrSvgProps?: Partial<ImageOrSvgProps>;\n };\n"]}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
+
import type { AvatarTokenPropsShared } from "@metamask-previews/design-system-shared";
|
|
1
2
|
import type { AvatarBaseProps } from "../AvatarBase/index.cjs";
|
|
2
3
|
import type { ImageOrSvgProps, ImageOrSvgSrc } from "../temp-components/ImageOrSvg/index.cjs";
|
|
3
4
|
/**
|
|
4
|
-
* AvatarToken component props
|
|
5
|
+
* AvatarToken component props (React Native platform-specific)
|
|
6
|
+
* Extends shared props from @metamask-previews/design-system-shared with React Native-specific platform concerns
|
|
5
7
|
*/
|
|
6
|
-
export type AvatarTokenProps = {
|
|
8
|
+
export type AvatarTokenProps = AvatarTokenPropsShared & Omit<AvatarBaseProps, 'children'> & {
|
|
7
9
|
/**
|
|
8
10
|
* Optional prop for the source of the image or SVG.
|
|
9
11
|
*/
|
|
10
12
|
src?: ImageOrSvgSrc;
|
|
11
|
-
/**
|
|
12
|
-
* Optional props for token name, to be used to calculate the fallbackText.
|
|
13
|
-
*/
|
|
14
|
-
name?: string;
|
|
15
13
|
/**
|
|
16
14
|
* Optional prop to pass to the underlying ImageOrSvg element
|
|
17
15
|
* Useful for overriding the default alt text which is the dapp name
|
|
18
16
|
*/
|
|
19
17
|
imageOrSvgProps?: Partial<ImageOrSvgProps>;
|
|
20
|
-
}
|
|
18
|
+
};
|
|
21
19
|
//# sourceMappingURL=AvatarToken.types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.types.d.cts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,gDAAsC;AAEvC
|
|
1
|
+
{"version":3,"file":"AvatarToken.types.d.cts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,gDAAgD;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,gDAAsC;AAEvC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GACnD,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IAClC;;OAEG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5C,CAAC"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
+
import type { AvatarTokenPropsShared } from "@metamask-previews/design-system-shared";
|
|
1
2
|
import type { AvatarBaseProps } from "../AvatarBase/index.mjs";
|
|
2
3
|
import type { ImageOrSvgProps, ImageOrSvgSrc } from "../temp-components/ImageOrSvg/index.mjs";
|
|
3
4
|
/**
|
|
4
|
-
* AvatarToken component props
|
|
5
|
+
* AvatarToken component props (React Native platform-specific)
|
|
6
|
+
* Extends shared props from @metamask-previews/design-system-shared with React Native-specific platform concerns
|
|
5
7
|
*/
|
|
6
|
-
export type AvatarTokenProps = {
|
|
8
|
+
export type AvatarTokenProps = AvatarTokenPropsShared & Omit<AvatarBaseProps, 'children'> & {
|
|
7
9
|
/**
|
|
8
10
|
* Optional prop for the source of the image or SVG.
|
|
9
11
|
*/
|
|
10
12
|
src?: ImageOrSvgSrc;
|
|
11
|
-
/**
|
|
12
|
-
* Optional props for token name, to be used to calculate the fallbackText.
|
|
13
|
-
*/
|
|
14
|
-
name?: string;
|
|
15
13
|
/**
|
|
16
14
|
* Optional prop to pass to the underlying ImageOrSvg element
|
|
17
15
|
* Useful for overriding the default alt text which is the dapp name
|
|
18
16
|
*/
|
|
19
17
|
imageOrSvgProps?: Partial<ImageOrSvgProps>;
|
|
20
|
-
}
|
|
18
|
+
};
|
|
21
19
|
//# sourceMappingURL=AvatarToken.types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.types.d.mts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,gDAAsC;AAEvC
|
|
1
|
+
{"version":3,"file":"AvatarToken.types.d.mts","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,gDAAgD;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,gDAAsC;AAEvC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GACnD,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IAClC;;OAEG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarToken.types.mjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AvatarBaseProps } from '../AvatarBase';\nimport type {\n ImageOrSvgProps,\n ImageOrSvgSrc,\n} from '../temp-components/ImageOrSvg';\n\n/**\n * AvatarToken component props
|
|
1
|
+
{"version":3,"file":"AvatarToken.types.mjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/AvatarToken.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AvatarTokenPropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { AvatarBaseProps } from '../AvatarBase';\nimport type {\n ImageOrSvgProps,\n ImageOrSvgSrc,\n} from '../temp-components/ImageOrSvg';\n\n/**\n * AvatarToken component props (React Native platform-specific)\n * Extends shared props from @metamask-previews/design-system-shared with React Native-specific platform concerns\n */\nexport type AvatarTokenProps = AvatarTokenPropsShared &\n Omit<AvatarBaseProps, 'children'> & {\n /**\n * Optional prop for the source of the image or SVG.\n */\n src?: ImageOrSvgSrc;\n /**\n * Optional prop to pass to the underlying ImageOrSvg element\n * Useful for overriding the default alt text which is the dapp name\n */\n imageOrSvgProps?: Partial<ImageOrSvgProps>;\n };\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AvatarToken = exports.AvatarTokenSize = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "AvatarTokenSize", { enumerable: true, get: function () { return
|
|
4
|
+
var design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
5
|
+
Object.defineProperty(exports, "AvatarTokenSize", { enumerable: true, get: function () { return design_system_shared_1.AvatarTokenSize; } });
|
|
6
6
|
var AvatarToken_1 = require("./AvatarToken.cjs");
|
|
7
7
|
Object.defineProperty(exports, "AvatarToken", { enumerable: true, get: function () { return AvatarToken_1.AvatarToken; } });
|
|
8
8
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":";;;AAAA,gFAA0E;AAAjE,uHAAA,eAAe,OAAA;AACxB,iDAA4C;AAAnC,0GAAA,WAAW,OAAA","sourcesContent":["export { AvatarTokenSize } from '@metamask-previews/design-system-shared';\nexport { AvatarToken } from './AvatarToken';\nexport type { AvatarTokenProps } from './AvatarToken.types';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AvatarTokenSize } from "
|
|
1
|
+
export { AvatarTokenSize } from "@metamask-previews/design-system-shared";
|
|
2
2
|
export { AvatarToken } from "./AvatarToken.cjs";
|
|
3
3
|
export type { AvatarTokenProps } from "./AvatarToken.types.cjs";
|
|
4
4
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gDAAgD;AAC1E,OAAO,EAAE,WAAW,EAAE,0BAAsB;AAC5C,YAAY,EAAE,gBAAgB,EAAE,gCAA4B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AvatarTokenSize } from "
|
|
1
|
+
export { AvatarTokenSize } from "@metamask-previews/design-system-shared";
|
|
2
2
|
export { AvatarToken } from "./AvatarToken.mjs";
|
|
3
3
|
export type { AvatarTokenProps } from "./AvatarToken.types.mjs";
|
|
4
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gDAAgD;AAC1E,OAAO,EAAE,WAAW,EAAE,0BAAsB;AAC5C,YAAY,EAAE,gBAAgB,EAAE,gCAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/AvatarToken/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gDAAgD;AAC1E,OAAO,EAAE,WAAW,EAAE,0BAAsB","sourcesContent":["export { AvatarTokenSize } from '@metamask-previews/design-system-shared';\nexport { AvatarToken } from './AvatarToken';\nexport type { AvatarTokenProps } from './AvatarToken.types';\n"]}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BannerBase = void 0;
|
|
7
|
+
const design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
7
8
|
const react_1 = __importDefault(require("react"));
|
|
8
9
|
const types_1 = require("../../types/index.cjs");
|
|
9
10
|
const Box_1 = require("../Box/index.cjs");
|
|
@@ -34,18 +35,18 @@ const BannerBase = ({ title, titleProps, description, descriptionProps, children
|
|
|
34
35
|
|
|
35
36
|
<Box_1.Box twClassName="flex-1">
|
|
36
37
|
{hasContent(title) &&
|
|
37
|
-
(isTextContent(title) ? (<Text_1.Text variant={
|
|
38
|
+
(isTextContent(title) ? (<Text_1.Text variant={design_system_shared_1.TextVariant.BodyMd} fontWeight={design_system_shared_1.FontWeight.Medium} {...titleProps}>
|
|
38
39
|
{title}
|
|
39
40
|
</Text_1.Text>) : (title))}
|
|
40
41
|
|
|
41
42
|
{hasContent(description) && (<Box_1.Box twClassName={hasContent(title) ? 'mt-1' : undefined}>
|
|
42
|
-
{isTextContent(description) ? (<Text_1.Text variant={
|
|
43
|
+
{isTextContent(description) ? (<Text_1.Text variant={design_system_shared_1.TextVariant.BodySm} {...descriptionProps}>
|
|
43
44
|
{description}
|
|
44
45
|
</Text_1.Text>) : (description)}
|
|
45
46
|
</Box_1.Box>)}
|
|
46
47
|
|
|
47
48
|
{hasContent(children) &&
|
|
48
|
-
(isTextContent(children) ? (<Text_1.Text variant={
|
|
49
|
+
(isTextContent(children) ? (<Text_1.Text variant={design_system_shared_1.TextVariant.BodyMd} {...childrenWrapperProps}>
|
|
49
50
|
{children}
|
|
50
51
|
</Text_1.Text>) : (children))}
|
|
51
52
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,
|
|
1
|
+
{"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,kFAAkF;AAClF,kDAA0B;AAG1B,iDAOqB;AACrB,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;AAErC,MAAM,UAAU,GAA8B,CAAC,EACpD,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iB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CACpB,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAC7B,IAAI,yBAAyB,CAAC,CAE9B;cAAA,CAAC,iBAAiB,CACpB;YAAA,EAAE,eAAM,CACV;UAAA,EAAE,SAAG,CAAC,CACP,CACH;MAAA,EAAE,SAAG,CAEL;;MAAA,CAAC,qBAAqB,IAAI,CACxB,CAAC,uBAAU,CACT,WAAW,CAAC,CAAC,4BAA4B,CAAC,CAC1C,QAAQ,CAAC,CAAC,gBAAQ,CAAC,KAAK,CAAC,CACzB,IAAI,CAAC,CAAC,sBAAc,CAAC,EAAE,CAAC,CACxB,kBAAkB,CAAC,CAAC,6BAA6B,CAAC,CAClD,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,IAAI,wBAAwB,CAAC,EAC7B,CACH,CACH;IAAA,EAAE,SAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAnHW,QAAA,UAAU,cAmHrB","sourcesContent":["import { FontWeight, TextVariant } from '@metamask-previews/design-system-shared';\nimport React from 'react';\nimport { GestureResponderEvent } from 'react-native';\n\nimport {\n BoxAlignItems,\n BoxBackgroundColor,\n ButtonIconSize,\n ButtonSize,\n BoxFlexDirection,\n IconName,\n} from '../../types';\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: React.FC<BannerBaseProps> = ({\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnPress,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n twClassName,\n ...props\n}) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n accessibilityLabel: closeButtonAccessibilityLabel = 'Close banner',\n onPress: closeButtonPropsOnPress,\n twClassName: closeButtonTwClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnPress);\n\n const handleClosePress =\n onClose || closeButtonPropsOnPress\n ? (event: GestureResponderEvent) => {\n if (onClose) {\n onClose();\n return;\n }\n closeButtonPropsOnPress?.(event);\n }\n : undefined;\n\n const mergedCloseButtonTwClassName = closeButtonTwClassName\n ? `ml-3 ${closeButtonTwClassName}`\n : 'ml-3';\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'}\n {...props}\n >\n {startAccessory}\n\n <Box twClassName=\"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 twClassName={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 twClassName=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onPress={actionButtonOnPress}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n twClassName={mergedCloseButtonTwClassName}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n accessibilityLabel={closeButtonAccessibilityLabel}\n onPress={handleClosePress}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BannerBase.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAgB1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAQ1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BannerBase.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAgB1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAQ1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHhD,CAAC"}
|
|
@@ -4,9 +4,10 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
+
import { FontWeight, TextVariant } from "@metamask-previews/design-system-shared";
|
|
7
8
|
import $React from "react";
|
|
8
9
|
const React = $importDefault($React);
|
|
9
|
-
import { BoxAlignItems, BoxBackgroundColor, ButtonIconSize, ButtonSize,
|
|
10
|
+
import { BoxAlignItems, BoxBackgroundColor, ButtonIconSize, ButtonSize, BoxFlexDirection, IconName } from "../../types/index.mjs";
|
|
10
11
|
import { Box } from "../Box/index.mjs";
|
|
11
12
|
import { Button } from "../Button/index.mjs";
|
|
12
13
|
import { ButtonIcon } from "../ButtonIcon/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,MAAK,cAAc;;AAG1B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,gDAAgD;AAClF,OAAO,MAAK,cAAc;;AAG1B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACT,8BAAoB;AACrB,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,GAA8B,CAAC,EACpD,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,yBAAyB,GAAG,iBAAiB,IAAI,EAAE,CAAC;IAE1D,MAAM,EACJ,kBAAkB,EAAE,6BAA6B,GAAG,cAAc,EAClE,OAAO,EAAE,uBAAuB,EAChC,WAAW,E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C,CAAC,4BAA4B,CAAC,CAC1C,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzB,IAAI,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CACxB,kBAAkB,CAAC,CAAC,6BAA6B,CAAC,CAClD,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,IAAI,wBAAwB,CAAC,EAC7B,CACH,CACH;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FontWeight, TextVariant } from '@metamask-previews/design-system-shared';\nimport React from 'react';\nimport { GestureResponderEvent } from 'react-native';\n\nimport {\n BoxAlignItems,\n BoxBackgroundColor,\n ButtonIconSize,\n ButtonSize,\n BoxFlexDirection,\n IconName,\n} from '../../types';\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: React.FC<BannerBaseProps> = ({\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnPress,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n twClassName,\n ...props\n}) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n accessibilityLabel: closeButtonAccessibilityLabel = 'Close banner',\n onPress: closeButtonPropsOnPress,\n twClassName: closeButtonTwClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnPress);\n\n const handleClosePress =\n onClose || closeButtonPropsOnPress\n ? (event: GestureResponderEvent) => {\n if (onClose) {\n onClose();\n return;\n }\n closeButtonPropsOnPress?.(event);\n }\n : undefined;\n\n const mergedCloseButtonTwClassName = closeButtonTwClassName\n ? `ml-3 ${closeButtonTwClassName}`\n : 'ml-3';\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'}\n {...props}\n >\n {startAccessory}\n\n <Box twClassName=\"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 twClassName={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 twClassName=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onPress={actionButtonOnPress}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n twClassName={mergedCloseButtonTwClassName}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n accessibilityLabel={closeButtonAccessibilityLabel}\n onPress={handleClosePress}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n};\n"]}
|
|
@@ -8,10 +8,11 @@ const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-t
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const types_1 = require("../../types/index.cjs");
|
|
10
10
|
const Icon_assets_1 = require("./Icon.assets.cjs");
|
|
11
|
+
const Icon_constants_1 = require("./Icon.constants.cjs");
|
|
11
12
|
const Icon = ({ size = types_1.IconSize.Md, name, color = types_1.IconColor.IconDefault, twClassName, style, ...props }) => {
|
|
12
13
|
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
13
14
|
const SVG = Icon_assets_1.assetByIconName[name];
|
|
14
|
-
const twStyle = tw.style(color,
|
|
15
|
+
const twStyle = tw.style(color, Icon_constants_1.TWCLASSMAP_ICON_SIZE_DIMENSION[size], twClassName);
|
|
15
16
|
return (<SVG name={name} fill="currentColor" style={[twStyle, style]} {...props}/>);
|
|
16
17
|
};
|
|
17
18
|
exports.Icon = Icon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.cjs","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";;;;;;AAAA,8FAA4E;AAC5E,kDAA0B;AAE1B,iDAAkD;AAElD,mDAAgD;
|
|
1
|
+
{"version":3,"file":"Icon.cjs","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";;;;;;AAAA,8FAA4E;AAC5E,kDAA0B;AAE1B,iDAAkD;AAElD,mDAAgD;AAChD,yDAAkE;AAG3D,MAAM,IAAI,GAAG,CAAC,EACnB,IAAI,GAAG,gBAAQ,CAAC,EAAE,EAClB,IAAI,EACJ,KAAK,GAAG,iBAAS,CAAC,WAAW,EAC7B,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACE,EAAE,EAAE;IACd,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,GAAG,GAAG,6BAAe,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CACtB,KAAK,EACL,+CAA8B,CAAC,IAAI,CAAC,EACpC,WAAW,CACZ,CAAC;IAEF,OAAO,CACL,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAC5E,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,IAAI,QAmBf","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\n\nimport { IconColor, IconSize } from '../../types';\n\nimport { assetByIconName } from './Icon.assets';\nimport { TWCLASSMAP_ICON_SIZE_DIMENSION } from './Icon.constants';\nimport type { IconProps } from './Icon.types';\n\nexport const Icon = ({\n size = IconSize.Md,\n name,\n color = IconColor.IconDefault,\n twClassName,\n style,\n ...props\n}: IconProps) => {\n const tw = useTailwind();\n const SVG = assetByIconName[name];\n const twStyle = tw.style(\n color,\n TWCLASSMAP_ICON_SIZE_DIMENSION[size],\n twClassName,\n );\n\n return (\n <SVG name={name} fill=\"currentColor\" style={[twStyle, style]} {...props} />\n );\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TWCLASSMAP_ICON_SIZE_DIMENSION = void 0;
|
|
4
|
+
const types_1 = require("../../types/index.cjs");
|
|
5
|
+
exports.TWCLASSMAP_ICON_SIZE_DIMENSION = {
|
|
6
|
+
[types_1.IconSize.Xs]: 'w-3 h-3',
|
|
7
|
+
[types_1.IconSize.Sm]: 'w-4 h-4',
|
|
8
|
+
[types_1.IconSize.Md]: 'w-5 h-5',
|
|
9
|
+
[types_1.IconSize.Lg]: 'w-6 h-6',
|
|
10
|
+
[types_1.IconSize.Xl]: 'w-8 h-8', // 32px
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=Icon.constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.constants.cjs","sourceRoot":"","sources":["../../../src/components/Icon/Icon.constants.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAE1B,QAAA,8BAA8B,GAA6B;IACtE,CAAC,gBAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,gBAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,gBAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,gBAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,gBAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO;CAClC,CAAC","sourcesContent":["import { IconSize } from '../../types';\n\nexport const TWCLASSMAP_ICON_SIZE_DIMENSION: Record<IconSize, string> = {\n [IconSize.Xs]: 'w-3 h-3', // 12px\n [IconSize.Sm]: 'w-4 h-4', // 16px\n [IconSize.Md]: 'w-5 h-5', // 20px\n [IconSize.Lg]: 'w-6 h-6', // 24px\n [IconSize.Xl]: 'w-8 h-8', // 32px\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.constants.d.cts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAAoB;AAEvC,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAMnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.constants.d.mts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAAoB;AAEvC,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAMnE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IconSize } from "../../types/index.mjs";
|
|
2
|
+
export const TWCLASSMAP_ICON_SIZE_DIMENSION = {
|
|
3
|
+
[IconSize.Xs]: 'w-3 h-3',
|
|
4
|
+
[IconSize.Sm]: 'w-4 h-4',
|
|
5
|
+
[IconSize.Md]: 'w-5 h-5',
|
|
6
|
+
[IconSize.Lg]: 'w-6 h-6',
|
|
7
|
+
[IconSize.Xl]: 'w-8 h-8', // 32px
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=Icon.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.constants.mjs","sourceRoot":"","sources":["../../../src/components/Icon/Icon.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,8BAAoB;AAEvC,MAAM,CAAC,MAAM,8BAA8B,GAA6B;IACtE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS;IACxB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO;CAClC,CAAC","sourcesContent":["import { IconSize } from '../../types';\n\nexport const TWCLASSMAP_ICON_SIZE_DIMENSION: Record<IconSize, string> = {\n [IconSize.Xs]: 'w-3 h-3', // 12px\n [IconSize.Sm]: 'w-4 h-4', // 16px\n [IconSize.Md]: 'w-5 h-5', // 20px\n [IconSize.Lg]: 'w-6 h-6', // 24px\n [IconSize.Xl]: 'w-8 h-8', // 32px\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.cts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;
|
|
1
|
+
{"version":3,"file":"Icon.d.cts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAE9C,eAAO,MAAM,IAAI,wDAOd,SAAS,sBAYX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.mts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;
|
|
1
|
+
{"version":3,"file":"Icon.d.mts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAE9C,eAAO,MAAM,IAAI,wDAOd,SAAS,sBAYX,CAAC"}
|
|
@@ -9,10 +9,11 @@ import $React from "react";
|
|
|
9
9
|
const React = $importDefault($React);
|
|
10
10
|
import { IconColor, IconSize } from "../../types/index.mjs";
|
|
11
11
|
import { assetByIconName } from "./Icon.assets.mjs";
|
|
12
|
+
import { TWCLASSMAP_ICON_SIZE_DIMENSION } from "./Icon.constants.mjs";
|
|
12
13
|
export const Icon = ({ size = IconSize.Md, name, color = IconColor.IconDefault, twClassName, style, ...props }) => {
|
|
13
14
|
const tw = useTailwind();
|
|
14
15
|
const SVG = assetByIconName[name];
|
|
15
|
-
const twStyle = tw.style(color,
|
|
16
|
+
const twStyle = tw.style(color, TWCLASSMAP_ICON_SIZE_DIMENSION[size], twClassName);
|
|
16
17
|
return (<SVG name={name} fill="currentColor" style={[twStyle, style]} {...props}/>);
|
|
17
18
|
};
|
|
18
19
|
//# sourceMappingURL=Icon.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.mjs","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,8BAAoB;AAElD,OAAO,EAAE,eAAe,EAAE,0BAAsB;
|
|
1
|
+
{"version":3,"file":"Icon.mjs","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,8BAAoB;AAElD,OAAO,EAAE,eAAe,EAAE,0BAAsB;AAChD,OAAO,EAAE,8BAA8B,EAAE,6BAAyB;AAGlE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,IAAI,GAAG,QAAQ,CAAC,EAAE,EAClB,IAAI,EACJ,KAAK,GAAG,SAAS,CAAC,WAAW,EAC7B,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACE,EAAE,EAAE;IACd,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CACtB,KAAK,EACL,8BAA8B,CAAC,IAAI,CAAC,EACpC,WAAW,CACZ,CAAC;IAEF,OAAO,CACL,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAC5E,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\n\nimport { IconColor, IconSize } from '../../types';\n\nimport { assetByIconName } from './Icon.assets';\nimport { TWCLASSMAP_ICON_SIZE_DIMENSION } from './Icon.constants';\nimport type { IconProps } from './Icon.types';\n\nexport const Icon = ({\n size = IconSize.Md,\n name,\n color = IconColor.IconDefault,\n twClassName,\n style,\n ...props\n}: IconProps) => {\n const tw = useTailwind();\n const SVG = assetByIconName[name];\n const twStyle = tw.style(\n color,\n TWCLASSMAP_ICON_SIZE_DIMENSION[size],\n twClassName,\n );\n\n return (\n <SVG name={name} fill=\"currentColor\" style={[twStyle, style]} {...props} />\n );\n};\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Input = void 0;
|
|
4
|
+
const design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
4
5
|
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
5
6
|
const design_tokens_1 = require("@metamask-previews/design-tokens");
|
|
6
7
|
const react_1 = require("react");
|
|
7
8
|
const react_native_1 = require("react-native/index.js");
|
|
8
|
-
const types_1 = require("../../types/index.cjs");
|
|
9
9
|
const Text_constants_1 = require("../Text/Text.constants.cjs");
|
|
10
10
|
const Input_constants_1 = require("./Input.constants.cjs");
|
|
11
|
-
exports.Input = (0, react_1.forwardRef)(({ style, textVariant =
|
|
11
|
+
exports.Input = (0, react_1.forwardRef)(({ style, textVariant = design_system_shared_1.TextVariant.BodyMd, isStateStylesDisabled, isDisabled = false, isReadonly = false, value, placeholder, twClassName, onBlur, onFocus, autoFocus = false, ...props }, ref) => {
|
|
12
12
|
const [isFocused, setIsFocused] = (0, react_1.useState)(autoFocus);
|
|
13
13
|
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
14
14
|
const theme = (0, design_system_twrnc_preset_1.useTheme)();
|
|
@@ -17,7 +17,7 @@ exports.Input = (0, react_1.forwardRef)(({ style, textVariant = types_1.TextVari
|
|
|
17
17
|
: design_tokens_1.darkTheme.colors.text.alternative, [theme]);
|
|
18
18
|
const finalFontWeight = Text_constants_1.MAP_TEXT_VARIANT_FONTWEIGHT[textVariant];
|
|
19
19
|
const fontSuffix = Text_constants_1.TWCLASSMAP_TEXT_FONTWEIGHT[finalFontWeight];
|
|
20
|
-
const fontClass = `font-${
|
|
20
|
+
const fontClass = `font-${design_system_shared_1.FontFamily.Default}${fontSuffix}`;
|
|
21
21
|
const hasPlaceholder = placeholder !== undefined && placeholder !== null && placeholder !== '';
|
|
22
22
|
// Only apply placeholder-mode styling when a placeholder is present and
|
|
23
23
|
// the controlled value is empty. This keeps the iOS lineHeight workaround
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.cjs","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":";;;AAAA,8FAIuD;AACvD,oEAAyE;AACzE,iCAAmE;AACnE,wDAAmD;AAEnD
|
|
1
|
+
{"version":3,"file":"Input.cjs","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":";;;AAAA,kFAAkF;AAClF,8FAIuD;AACvD,oEAAyE;AACzE,iCAAmE;AACnE,wDAAmD;AAEnD,+DAGgC;AAEhC,2DAAmE;AAGtD,QAAA,KAAK,GAAG,IAAA,kBAAU,EAC7B,CACE,EACE,KAAK,EACL,WAAW,GAAG,kCAAW,CAAC,MAAM,EAChC,qBAAqB,EACrB,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,KAAK,EACL,WAAW,EACX,WAAW,EACX,MAAM,EACN,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,SAAS,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,KAAK,GAAG,IAAA,qCAAQ,GAAE,CAAC;IAEzB,MAAM,oBAAoB,GAAG,IAAA,eAAO,EAClC,GAAG,EAAE,CACH,KAAK,KAAK,kCAAK,CAAC,KAAK;QACnB,CAAC,CAAC,0BAAU,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW;QACpC,CAAC,CAAC,yBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EACvC,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,eAAe,GAAG,4CAA2B,CAAC,WAAW,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,2CAA0B,CAAC,eAAe,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,QAAQ,iCAAU,CAA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,aAAa,GAAG;QACpB,UAAU;QACV,gBAAgB;QAChB,iEAAiE;QACjE,2DAA2D;QAC3D,yEAAyE;QACzE,uBAAQ,CAAC,EAAE,KAAK,KAAK;YACnB,oBAAoB,IAAI,EAAE,UAAU,EAAE,CAAU,EAAE;QACpD,KAAK;KACN,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,OAAO,CACL,CAAC,wBAAS,CACR,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,oBAAoB,CAAC,CAAC,oBAAoB,CAAC,CAC3C,IAAI,KAAK,CAAC,CACV,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,KAAK,CAAC,CAAC,aAAa,CAAC,CACrB,QAAQ,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,CACrC,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,MAAM,CAAC,CAAC,aAAa,CAAC,CACtB,OAAO,CAAC,CAAC,cAAc,CAAC,EACxB,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { FontFamily, TextVariant } from '@metamask-previews/design-system-shared';\nimport {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { darkTheme, lightTheme } from '@metamask-previews/design-tokens';\nimport { forwardRef, useCallback, useMemo, useState } from 'react';\nimport { Platform, TextInput } from 'react-native';\n\nimport {\n MAP_TEXT_VARIANT_FONTWEIGHT,\n TWCLASSMAP_TEXT_FONTWEIGHT,\n} from '../Text/Text.constants';\n\nimport { MAP_TEXT_VARIANT_INPUT_METRICS } from './Input.constants';\nimport type { InputProps } from './Input.types';\n\nexport const Input = forwardRef<TextInput, InputProps>(\n (\n {\n style,\n textVariant = TextVariant.BodyMd,\n isStateStylesDisabled,\n isDisabled = false,\n isReadonly = false,\n value,\n placeholder,\n twClassName,\n onBlur,\n onFocus,\n autoFocus = false,\n ...props\n },\n ref,\n ) => {\n const [isFocused, setIsFocused] = useState(autoFocus);\n const tw = useTailwind();\n const theme = useTheme();\n\n const placeholderTextColor = useMemo(\n () =>\n theme === Theme.Light\n ? lightTheme.colors.text.alternative\n : darkTheme.colors.text.alternative,\n [theme],\n );\n\n const finalFontWeight = MAP_TEXT_VARIANT_FONTWEIGHT[textVariant];\n const fontSuffix = TWCLASSMAP_TEXT_FONTWEIGHT[finalFontWeight];\n const fontClass = `font-${FontFamily.Default}${fontSuffix}`;\n const hasPlaceholder =\n placeholder !== undefined && placeholder !== null && placeholder !== '';\n // Only apply placeholder-mode styling when a placeholder is present and\n // the controlled value is empty. This keeps the iOS lineHeight workaround\n // scoped to the placeholder-visible state without affecting typed text.\n const isPlaceholderVisible = hasPlaceholder && value === '';\n\n const inputStyle = useMemo(\n () =>\n tw.style(\n fontClass,\n 'text-default',\n 'bg-default',\n 'border',\n 'border-transparent',\n !isStateStylesDisabled && isDisabled && 'opacity-50',\n !isStateStylesDisabled &&\n !isDisabled &&\n isFocused &&\n 'border-primary-default',\n twClassName,\n ),\n [\n fontClass,\n isStateStylesDisabled,\n isDisabled,\n isFocused,\n twClassName,\n tw,\n ],\n );\n\n const variantTextStyle = useMemo(\n () => MAP_TEXT_VARIANT_INPUT_METRICS[textVariant],\n [textVariant],\n );\n\n /* istanbul ignore next: handler body covered by focus/blur tests */\n const onBlurHandler = useCallback(\n (e: Parameters<NonNullable<InputProps['onBlur']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(false);\n onBlur?.(e);\n }\n },\n [isDisabled, onBlur],\n );\n\n /* istanbul ignore next: handler body covered by focus/blur tests */\n const onFocusHandler = useCallback(\n (e: Parameters<NonNullable<InputProps['onFocus']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(true);\n onFocus?.(e);\n }\n },\n [isDisabled, onFocus],\n );\n const resolvedStyle = [\n inputStyle,\n variantTextStyle,\n // iOS-only workaround: when a placeholder is visible, native iOS\n // TextInput can render placeholder text vertically offset.\n // Keep this iOS-only because lineHeight: 0 can collapse text on Android.\n Platform.OS === 'ios' &&\n isPlaceholderVisible && { lineHeight: 0 as const },\n style,\n ].filter(Boolean);\n\n return (\n <TextInput\n ref={ref}\n placeholderTextColor={placeholderTextColor}\n {...props}\n placeholder={placeholder}\n value={value}\n style={resolvedStyle}\n editable={!isDisabled && !isReadonly}\n autoFocus={autoFocus}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n />\n );\n },\n);\n"]}
|