@metamask-previews/design-system-react-native 0.56.1-preview-7d5964a → 0.56.2-preview-91ce2ce2
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 +13 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.cjs +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.cjs.map +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.mjs +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.mjs.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.cjs +13 -0
- package/dist/components/BoxColumn/BoxColumn.cjs.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.d.cts +13 -0
- package/dist/components/BoxColumn/BoxColumn.d.cts.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.d.mts +13 -0
- package/dist/components/BoxColumn/BoxColumn.d.mts.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.mjs +13 -0
- package/dist/components/BoxColumn/BoxColumn.mjs.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.types.cjs.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.types.d.cts +2 -0
- package/dist/components/BoxColumn/BoxColumn.types.d.cts.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.types.d.mts +2 -0
- package/dist/components/BoxColumn/BoxColumn.types.d.mts.map +1 -1
- package/dist/components/BoxColumn/BoxColumn.types.mjs.map +1 -1
- package/dist/components/BoxRow/BoxRow.cjs +13 -0
- package/dist/components/BoxRow/BoxRow.cjs.map +1 -1
- package/dist/components/BoxRow/BoxRow.d.cts +13 -0
- package/dist/components/BoxRow/BoxRow.d.cts.map +1 -1
- package/dist/components/BoxRow/BoxRow.d.mts +13 -0
- package/dist/components/BoxRow/BoxRow.d.mts.map +1 -1
- package/dist/components/BoxRow/BoxRow.mjs +13 -0
- package/dist/components/BoxRow/BoxRow.mjs.map +1 -1
- package/dist/components/BoxRow/BoxRow.types.cjs.map +1 -1
- package/dist/components/BoxRow/BoxRow.types.d.cts +2 -0
- package/dist/components/BoxRow/BoxRow.types.d.cts.map +1 -1
- package/dist/components/BoxRow/BoxRow.types.d.mts +2 -0
- package/dist/components/BoxRow/BoxRow.types.d.mts.map +1 -1
- package/dist/components/BoxRow/BoxRow.types.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.cjs +9 -5
- package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.mjs +10 -6
- package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.cts +2 -3
- package/dist/components/ButtonBase/ButtonBase.types.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.mts +2 -3
- package/dist/components/ButtonBase/ButtonBase.types.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.mjs.map +1 -1
- package/dist/components/Content/Content.cjs +40 -32
- package/dist/components/Content/Content.cjs.map +1 -1
- package/dist/components/Content/Content.d.cts.map +1 -1
- package/dist/components/Content/Content.d.mts.map +1 -1
- package/dist/components/Content/Content.mjs +40 -32
- package/dist/components/Content/Content.mjs.map +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.cjs +8 -5
- package/dist/components/HeaderRoot/HeaderRoot.cjs.map +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.d.cts.map +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.d.mts.map +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.mjs +8 -5
- package/dist/components/HeaderRoot/HeaderRoot.mjs.map +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.cjs +21 -12
- package/dist/components/KeyValueColumn/KeyValueColumn.cjs.map +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.d.cts.map +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.d.mts.map +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.mjs +22 -13
- package/dist/components/KeyValueColumn/KeyValueColumn.mjs.map +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.cjs +19 -10
- package/dist/components/KeyValueRow/KeyValueRow.cjs.map +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.d.cts.map +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.d.mts.map +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.mjs +20 -11
- package/dist/components/KeyValueRow/KeyValueRow.mjs.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.cjs.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.cts +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.cts.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.mts +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.mts.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.mjs.map +1 -1
- package/dist/components/ListItem/ListItem.cjs +4 -3
- package/dist/components/ListItem/ListItem.cjs.map +1 -1
- package/dist/components/ListItem/ListItem.d.cts.map +1 -1
- package/dist/components/ListItem/ListItem.d.mts.map +1 -1
- package/dist/components/ListItem/ListItem.mjs +5 -4
- package/dist/components/ListItem/ListItem.mjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.cjs +17 -10
- package/dist/components/SectionHeader/SectionHeader.cjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.d.cts +2 -2
- package/dist/components/SectionHeader/SectionHeader.d.cts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.d.mts +2 -2
- package/dist/components/SectionHeader/SectionHeader.d.mts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.mjs +18 -11
- package/dist/components/SectionHeader/SectionHeader.mjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.cjs.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.d.cts +5 -5
- package/dist/components/SectionHeader/SectionHeader.types.d.cts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.d.mts +5 -5
- package/dist/components/SectionHeader/SectionHeader.types.d.mts.map +1 -1
- package/dist/components/SectionHeader/SectionHeader.types.mjs.map +1 -1
- package/dist/components/SelectButton/SelectButton.cjs +10 -3
- package/dist/components/SelectButton/SelectButton.cjs.map +1 -1
- package/dist/components/SelectButton/SelectButton.d.cts +1 -1
- package/dist/components/SelectButton/SelectButton.d.cts.map +1 -1
- package/dist/components/SelectButton/SelectButton.d.mts +1 -1
- package/dist/components/SelectButton/SelectButton.d.mts.map +1 -1
- package/dist/components/SelectButton/SelectButton.mjs +10 -3
- package/dist/components/SelectButton/SelectButton.mjs.map +1 -1
- package/dist/components/Switch/Switch.cjs +4 -2
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.d.cts +1 -1
- package/dist/components/Switch/Switch.d.cts.map +1 -1
- package/dist/components/Switch/Switch.d.mts +1 -1
- package/dist/components/Switch/Switch.d.mts.map +1 -1
- package/dist/components/Switch/Switch.mjs +4 -2
- package/dist/components/Switch/Switch.mjs.map +1 -1
- package/dist/components/Tag/Tag.cjs +12 -18
- package/dist/components/Tag/Tag.cjs.map +1 -1
- package/dist/components/Tag/Tag.d.cts.map +1 -1
- package/dist/components/Tag/Tag.d.mts.map +1 -1
- package/dist/components/Tag/Tag.mjs +13 -19
- package/dist/components/Tag/Tag.mjs.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.cjs +20 -18
- package/dist/components/TitleAlert/TitleAlert.cjs.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.d.cts +3 -3
- package/dist/components/TitleAlert/TitleAlert.d.cts.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.d.mts +3 -3
- package/dist/components/TitleAlert/TitleAlert.d.mts.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.mjs +21 -19
- package/dist/components/TitleAlert/TitleAlert.mjs.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.types.cjs.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.types.d.cts +6 -7
- package/dist/components/TitleAlert/TitleAlert.types.d.cts.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.types.d.mts +6 -7
- package/dist/components/TitleAlert/TitleAlert.types.d.mts.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.types.mjs.map +1 -1
- package/dist/components/TitleHub/TitleHub.cjs +22 -13
- package/dist/components/TitleHub/TitleHub.cjs.map +1 -1
- package/dist/components/TitleHub/TitleHub.d.cts +3 -3
- package/dist/components/TitleHub/TitleHub.d.cts.map +1 -1
- package/dist/components/TitleHub/TitleHub.d.mts +3 -3
- package/dist/components/TitleHub/TitleHub.d.mts.map +1 -1
- package/dist/components/TitleHub/TitleHub.mjs +23 -14
- package/dist/components/TitleHub/TitleHub.mjs.map +1 -1
- package/dist/components/TitleHub/TitleHub.types.cjs.map +1 -1
- package/dist/components/TitleHub/TitleHub.types.d.cts +10 -10
- package/dist/components/TitleHub/TitleHub.types.d.cts.map +1 -1
- package/dist/components/TitleHub/TitleHub.types.d.mts +10 -10
- package/dist/components/TitleHub/TitleHub.types.d.mts.map +1 -1
- package/dist/components/TitleHub/TitleHub.types.mjs.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.cjs +15 -9
- package/dist/components/TitleStandard/TitleStandard.cjs.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.d.cts +2 -2
- package/dist/components/TitleStandard/TitleStandard.d.cts.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.d.mts +2 -2
- package/dist/components/TitleStandard/TitleStandard.d.mts.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.mjs +16 -10
- package/dist/components/TitleStandard/TitleStandard.mjs.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.cjs.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.d.cts +7 -7
- package/dist/components/TitleStandard/TitleStandard.types.d.cts.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.d.mts +7 -7
- package/dist/components/TitleStandard/TitleStandard.types.d.mts.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.mjs.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.cjs +31 -18
- package/dist/components/TitleSubpage/TitleSubpage.cjs.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.d.cts +3 -3
- package/dist/components/TitleSubpage/TitleSubpage.d.cts.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.d.mts +3 -3
- package/dist/components/TitleSubpage/TitleSubpage.d.mts.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.mjs +32 -19
- package/dist/components/TitleSubpage/TitleSubpage.mjs.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.cjs.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.d.cts +8 -9
- package/dist/components/TitleSubpage/TitleSubpage.types.d.cts.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.d.mts +8 -9
- package/dist/components/TitleSubpage/TitleSubpage.types.d.mts.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.mjs.map +1 -1
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.cjs +9 -7
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.cjs.map +1 -1
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.d.cts.map +1 -1
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.d.mts.map +1 -1
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.mjs +10 -8
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.mjs.map +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.cjs +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.cjs.map +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.mjs +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.mjs.map +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.cjs.map +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.cts +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.mts +1 -1
- package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -4,15 +4,15 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
-
import { ButtonBaseSize, FontWeight, mergeTwClassName, TextColor } from "@metamask-previews/design-system-shared";
|
|
7
|
+
import { BoxAlignItems, BoxFlexDirection, ButtonBaseSize, FontWeight, mergeTwClassName, TextColor } from "@metamask-previews/design-system-shared";
|
|
8
8
|
import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
|
|
9
9
|
import $React, { useMemo } from "react";
|
|
10
10
|
const React = $importDefault($React);
|
|
11
11
|
import { Box } from "../Box/index.mjs";
|
|
12
|
-
import { BoxRow } from "../BoxRow/index.mjs";
|
|
13
12
|
import { Icon, IconColor } from "../Icon/index.mjs";
|
|
14
13
|
import { Spinner } from "../Spinner/index.mjs";
|
|
15
14
|
import { ButtonAnimated } from "../temp-components/ButtonAnimated/index.mjs";
|
|
15
|
+
import { TextOrChildren } from "../temp-components/TextOrChildren/index.mjs";
|
|
16
16
|
import { MAP_BUTTONBASE_SIZE_ICONSIZE, MAP_BUTTONBASE_SIZE_TEXT_VARIANT, getButtonBaseHorizontalPaddingTwClasses, TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION } from "./ButtonBase.constants.mjs";
|
|
17
17
|
export const ButtonBase = ({ children, textProps, size = ButtonBaseSize.Lg, isLoading, loadingText, spinnerProps, loadingWrapperProps, contentWrapperProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, textClassName, iconClassName, style, accessibilityLabel, accessibilityHint, accessibilityRole = 'button', accessibilityActions, onAccessibilityAction, ...props }) => {
|
|
18
18
|
const tw = useTailwind();
|
|
@@ -105,9 +105,11 @@ export const ButtonBase = ({ children, textProps, size = ButtonBaseSize.Lg, isLo
|
|
|
105
105
|
}}/>
|
|
106
106
|
</Box>)}
|
|
107
107
|
|
|
108
|
-
<
|
|
108
|
+
<Box flexDirection={BoxFlexDirection.Row} alignItems={BoxAlignItems.Center} gap={hasAccessories ? 1 : 0} {...restContentWrapper} twClassName={isLoading
|
|
109
109
|
? mergeTwClassName('opacity-0', contentWrapperTw)
|
|
110
|
-
: contentWrapperTw}
|
|
110
|
+
: contentWrapperTw}>
|
|
111
|
+
{finalStartIconName ? (<Icon name={finalStartIconName} size={iconSize} {...startIconProps} twClassName={mergeTwClassName(mergeTwClassName('shrink-0', iconClassName ? iconClassName(pressed) : undefined), startIconProps?.twClassName)}/>) : (startAccessory)}
|
|
112
|
+
<TextOrChildren textProps={{
|
|
111
113
|
variant: labelTextVariant,
|
|
112
114
|
fontWeight: FontWeight.Medium,
|
|
113
115
|
color: TextColor.TextDefault,
|
|
@@ -116,8 +118,10 @@ export const ButtonBase = ({ children, textProps, size = ButtonBaseSize.Lg, isLo
|
|
|
116
118
|
...textProps,
|
|
117
119
|
twClassName: mergeTwClassName(mergeTwClassName('shrink grow-0 flex-wrap text-center', textClassName ? textClassName(pressed) : undefined), textProps?.twClassName),
|
|
118
120
|
}}>
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
{children}
|
|
122
|
+
</TextOrChildren>
|
|
123
|
+
{finalEndIconName ? (<Icon name={finalEndIconName} size={iconSize} {...endIconProps} twClassName={mergeTwClassName(mergeTwClassName('shrink-0', iconClassName ? iconClassName(pressed) : undefined), endIconProps?.twClassName)}/>) : (endAccessory)}
|
|
124
|
+
</Box>
|
|
121
125
|
</>);
|
|
122
126
|
}}
|
|
123
127
|
</ButtonAnimated>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,SAAS,EACV,gDAAgD;AACjD,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EAAE,OAAO,EAAE,cAAc;;AAGvC,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,0BAAgB;AAC1C,OAAO,EAAE,OAAO,EAAE,6BAAmB;AACrC,OAAO,EAAE,cAAc,EAAE,oDAA0C;AAEnE,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,uCAAuC,EACvC,oCAAoC,EACrC,mCAA+B;AAGhC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,cAAc,CAAC,EAAE,EACxB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,KAAK,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAAG,QAAQ,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,GAAG,KAAK,EACQ,EAAE,EAAE;IACpB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,MAAM,kBAAkB,GAAG,aAAa,IAAI,cAAc,EAAE,IAAI,CAAC;IACjE,MAAM,gBAAgB,GAAG,WAAW,IAAI,YAAY,EAAE,IAAI,CAAC;IAE3D,MAAM,QAAQ,GAAG,OAAO,CAAC,kBAAkB,IAAI,cAAc,CAA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ACrC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CACnD,EACD,SAAS,EAAE,WAAW,CACvB;iBACF,CAAC,CAEF;cAAA,CAAC,QAAQ,CACX;YAAA,EAAE,MAAM,CACV;UAAA,GAAG,CACJ,CAAC;QACJ,CAAC,CACH;IAAA,EAAE,cAAc,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n ButtonBaseSize,\n FontWeight,\n mergeTwClassName,\n TextColor,\n} from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useMemo } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { Box } from '../Box';\nimport { BoxRow } from '../BoxRow';\nimport { Icon, IconColor } from '../Icon';\nimport { Spinner } from '../Spinner';\nimport { ButtonAnimated } from '../temp-components/ButtonAnimated';\n\nimport {\n MAP_BUTTONBASE_SIZE_ICONSIZE,\n MAP_BUTTONBASE_SIZE_TEXT_VARIANT,\n getButtonBaseHorizontalPaddingTwClasses,\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION,\n} from './ButtonBase.constants';\nimport type { ButtonBaseProps } from './ButtonBase.types';\n\nexport const ButtonBase = ({\n children,\n textProps,\n size = ButtonBaseSize.Lg,\n isLoading,\n loadingText,\n spinnerProps,\n loadingWrapperProps,\n contentWrapperProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n isDisabled,\n isFullWidth,\n twClassName,\n textClassName,\n iconClassName,\n style,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n accessibilityActions,\n onAccessibilityAction,\n ...props\n}: ButtonBaseProps) => {\n const tw = useTailwind();\n\n const finalStartIconName = startIconName ?? startIconProps?.name;\n const finalEndIconName = endIconName ?? endIconProps?.name;\n\n const hasStart = Boolean(finalStartIconName || startAccessory);\n const hasEnd = Boolean(finalEndIconName || endAccessory);\n const hasAccessories = hasStart || hasEnd;\n\n const iconSize = MAP_BUTTONBASE_SIZE_ICONSIZE[size];\n const labelTextVariant = MAP_BUTTONBASE_SIZE_TEXT_VARIANT[size];\n\n // Generate accessibility label if not provided\n const finalAccessibilityLabel = useMemo(() => {\n if (accessibilityLabel) {\n return accessibilityLabel;\n }\n\n // For loading state with loadingText, prioritize loadingText\n if (isLoading && loadingText) {\n return loadingText;\n }\n\n // If children is a string, use it as the label\n if (typeof children === 'string') {\n return children;\n }\n\n return undefined;\n }, [accessibilityLabel, children, isLoading, loadingText]);\n\n // Generate accessibility hint for loading state if not provided\n const finalAccessibilityHint = useMemo(() => {\n if (accessibilityHint) {\n return accessibilityHint;\n }\n\n if (isLoading) {\n return 'Button is currently loading';\n }\n\n return undefined;\n }, [accessibilityHint, isLoading]);\n\n // Create accessibilityState object with only truthy values\n const accessibilityState = useMemo(() => {\n const state: { disabled?: boolean; busy?: boolean } = {};\n\n if (isDisabled || isLoading) {\n state.disabled = true;\n }\n\n if (isLoading) {\n state.busy = true;\n }\n\n return state;\n }, [isDisabled, isLoading]);\n\n return (\n <ButtonAnimated\n disabled={isDisabled || isLoading}\n accessibilityRole={accessibilityRole}\n accessibilityLabel={finalAccessibilityLabel}\n accessibilityHint={finalAccessibilityHint}\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={onAccessibilityAction}\n accessibilityState={accessibilityState}\n accessible\n style={({ pressed }) => {\n // Evaluate custom className if it's a function\n const customClassName =\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName;\n\n // Build button container styles\n const buttonStyles = tw.style(\n // Base layout - flex container for button content\n 'flex-row items-center justify-center rounded-full',\n // Visual styling\n 'bg-muted overflow-hidden',\n getButtonBaseHorizontalPaddingTwClasses(hasStart, hasEnd),\n // Size\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION[size],\n // State-based opacity\n isDisabled ? 'opacity-50' : 'opacity-100',\n // Width - use self-start to prevent stretching when not full width\n isFullWidth ? 'w-full' : 'self-start',\n // Custom classes\n customClassName,\n );\n\n // Merge with additional styles if provided\n const computedStyle: StyleProp<ViewStyle>[] = [buttonStyles];\n\n const additionalStyle =\n typeof style === 'function' ? style({ pressed }) : style;\n\n if (additionalStyle) {\n computedStyle.push(additionalStyle);\n }\n\n return computedStyle;\n }}\n {...props}\n >\n {({ pressed }) => {\n const { twClassName: loadingWrapperTw, ...restLoadingWrapper } =\n loadingWrapperProps ?? {};\n const { twClassName: contentWrapperTw, ...restContentWrapper } =\n contentWrapperProps ?? {};\n\n return (\n <>\n {/* Loading spinner overlay */}\n {isLoading && (\n <Box\n {...restLoadingWrapper}\n twClassName={mergeTwClassName(\n 'absolute inset-0 flex items-center justify-center',\n loadingWrapperTw,\n )}\n >\n <Spinner\n color={\n textClassName\n ? (textClassName(pressed) as IconColor)\n : IconColor.IconDefault\n }\n loadingText={loadingText}\n {...spinnerProps}\n spinnerIconProps={{\n size: iconSize,\n ...spinnerProps?.spinnerIconProps,\n }}\n loadingTextProps={{\n numberOfLines: 1,\n variant: labelTextVariant,\n twClassName: textClassName ? textClassName(pressed) : '',\n ...spinnerProps?.loadingTextProps,\n }}\n />\n </Box>\n )}\n\n <BoxRow\n {...restContentWrapper}\n twClassName={\n isLoading\n ? mergeTwClassName('opacity-0', contentWrapperTw)\n : contentWrapperTw\n }\n gap={hasAccessories ? 1 : 0}\n startAccessory={\n finalStartIconName ? (\n <Icon\n name={finalStartIconName}\n size={iconSize}\n {...startIconProps}\n twClassName={mergeTwClassName(\n mergeTwClassName(\n 'shrink-0',\n iconClassName ? iconClassName(pressed) : undefined,\n ),\n startIconProps?.twClassName,\n )}\n />\n ) : (\n startAccessory\n )\n }\n endAccessory={\n finalEndIconName ? (\n <Icon\n name={finalEndIconName}\n size={iconSize}\n {...endIconProps}\n twClassName={mergeTwClassName(\n mergeTwClassName(\n 'shrink-0',\n iconClassName ? iconClassName(pressed) : undefined,\n ),\n endIconProps?.twClassName,\n )}\n />\n ) : (\n endAccessory\n )\n }\n textProps={{\n variant: labelTextVariant,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n numberOfLines: 1,\n ellipsizeMode: 'clip',\n ...textProps,\n twClassName: mergeTwClassName(\n mergeTwClassName(\n 'shrink grow-0 flex-wrap text-center',\n textClassName ? textClassName(pressed) : undefined,\n ),\n textProps?.twClassName,\n ),\n }}\n >\n {children}\n </BoxRow>\n </>\n );\n }}\n </ButtonAnimated>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ButtonBase.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,SAAS,EACV,gDAAgD;AACjD,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EAAE,OAAO,EAAE,cAAc;;AAGvC,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,0BAAgB;AAC1C,OAAO,EAAE,OAAO,EAAE,6BAAmB;AACrC,OAAO,EAAE,cAAc,EAAE,oDAA0C;AACnE,OAAO,EAAE,cAAc,EAAE,oDAA0C;AAEnE,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,uCAAuC,EACvC,oCAAoC,EACrC,mCAA+B;AAGhC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,cAAc,CAAC,EAAE,EACxB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,KAAK,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAAG,QAAQ,EAC5B,oBAAoB,EAC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aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CACnD,EACD,SAAS,EAAE,WAAW,CACvB;iBACF,CAAC,CAEF;gBAAA,CAAC,QAAQ,CACX;cAAA,EAAE,cAAc,CAChB;cAAA,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAClB,CAAC,IAAI,CACH,IAAI,CAAC,CAAC,gBAAgB,CAAC,CACvB,IAAI,CAAC,CAAC,QAAQ,CAAC,CACf,IAAI,YAAY,CAAC,CACjB,WAAW,CAAC,CAAC,gBAAgB,CAC3B,gBAAgB,CACd,UAAU,EACV,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CACnD,EACD,YAAY,EAAE,WAAW,CAC1B,CAAC,EACF,CACH,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CACH;YAAA,EAAE,GAAG,CACP;UAAA,GAAG,CACJ,CAAC;QACJ,CAAC,CACH;IAAA,EAAE,cAAc,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n BoxAlignItems,\n BoxFlexDirection,\n ButtonBaseSize,\n FontWeight,\n mergeTwClassName,\n TextColor,\n} from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useMemo } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { Box } from '../Box';\nimport { Icon, IconColor } from '../Icon';\nimport { Spinner } from '../Spinner';\nimport { ButtonAnimated } from '../temp-components/ButtonAnimated';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport {\n MAP_BUTTONBASE_SIZE_ICONSIZE,\n MAP_BUTTONBASE_SIZE_TEXT_VARIANT,\n getButtonBaseHorizontalPaddingTwClasses,\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION,\n} from './ButtonBase.constants';\nimport type { ButtonBaseProps } from './ButtonBase.types';\n\nexport const ButtonBase = ({\n children,\n textProps,\n size = ButtonBaseSize.Lg,\n isLoading,\n loadingText,\n spinnerProps,\n loadingWrapperProps,\n contentWrapperProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n isDisabled,\n isFullWidth,\n twClassName,\n textClassName,\n iconClassName,\n style,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n accessibilityActions,\n onAccessibilityAction,\n ...props\n}: ButtonBaseProps) => {\n const tw = useTailwind();\n\n const finalStartIconName = startIconName ?? startIconProps?.name;\n const finalEndIconName = endIconName ?? endIconProps?.name;\n\n const hasStart = Boolean(finalStartIconName || startAccessory);\n const hasEnd = Boolean(finalEndIconName || endAccessory);\n const hasAccessories = hasStart || hasEnd;\n\n const iconSize = MAP_BUTTONBASE_SIZE_ICONSIZE[size];\n const labelTextVariant = MAP_BUTTONBASE_SIZE_TEXT_VARIANT[size];\n\n // Generate accessibility label if not provided\n const finalAccessibilityLabel = useMemo(() => {\n if (accessibilityLabel) {\n return accessibilityLabel;\n }\n\n // For loading state with loadingText, prioritize loadingText\n if (isLoading && loadingText) {\n return loadingText;\n }\n\n // If children is a string, use it as the label\n if (typeof children === 'string') {\n return children;\n }\n\n return undefined;\n }, [accessibilityLabel, children, isLoading, loadingText]);\n\n // Generate accessibility hint for loading state if not provided\n const finalAccessibilityHint = useMemo(() => {\n if (accessibilityHint) {\n return accessibilityHint;\n }\n\n if (isLoading) {\n return 'Button is currently loading';\n }\n\n return undefined;\n }, [accessibilityHint, isLoading]);\n\n // Create accessibilityState object with only truthy values\n const accessibilityState = useMemo(() => {\n const state: { disabled?: boolean; busy?: boolean } = {};\n\n if (isDisabled || isLoading) {\n state.disabled = true;\n }\n\n if (isLoading) {\n state.busy = true;\n }\n\n return state;\n }, [isDisabled, isLoading]);\n\n return (\n <ButtonAnimated\n disabled={isDisabled || isLoading}\n accessibilityRole={accessibilityRole}\n accessibilityLabel={finalAccessibilityLabel}\n accessibilityHint={finalAccessibilityHint}\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={onAccessibilityAction}\n accessibilityState={accessibilityState}\n accessible\n style={({ pressed }) => {\n // Evaluate custom className if it's a function\n const customClassName =\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName;\n\n // Build button container styles\n const buttonStyles = tw.style(\n // Base layout - flex container for button content\n 'flex-row items-center justify-center rounded-full',\n // Visual styling\n 'bg-muted overflow-hidden',\n getButtonBaseHorizontalPaddingTwClasses(hasStart, hasEnd),\n // Size\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION[size],\n // State-based opacity\n isDisabled ? 'opacity-50' : 'opacity-100',\n // Width - use self-start to prevent stretching when not full width\n isFullWidth ? 'w-full' : 'self-start',\n // Custom classes\n customClassName,\n );\n\n // Merge with additional styles if provided\n const computedStyle: StyleProp<ViewStyle>[] = [buttonStyles];\n\n const additionalStyle =\n typeof style === 'function' ? style({ pressed }) : style;\n\n if (additionalStyle) {\n computedStyle.push(additionalStyle);\n }\n\n return computedStyle;\n }}\n {...props}\n >\n {({ pressed }) => {\n const { twClassName: loadingWrapperTw, ...restLoadingWrapper } =\n loadingWrapperProps ?? {};\n const { twClassName: contentWrapperTw, ...restContentWrapper } =\n contentWrapperProps ?? {};\n\n return (\n <>\n {/* Loading spinner overlay */}\n {isLoading && (\n <Box\n {...restLoadingWrapper}\n twClassName={mergeTwClassName(\n 'absolute inset-0 flex items-center justify-center',\n loadingWrapperTw,\n )}\n >\n <Spinner\n color={\n textClassName\n ? (textClassName(pressed) as IconColor)\n : IconColor.IconDefault\n }\n loadingText={loadingText}\n {...spinnerProps}\n spinnerIconProps={{\n size: iconSize,\n ...spinnerProps?.spinnerIconProps,\n }}\n loadingTextProps={{\n numberOfLines: 1,\n variant: labelTextVariant,\n twClassName: textClassName ? textClassName(pressed) : '',\n ...spinnerProps?.loadingTextProps,\n }}\n />\n </Box>\n )}\n\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={hasAccessories ? 1 : 0}\n {...restContentWrapper}\n twClassName={\n isLoading\n ? mergeTwClassName('opacity-0', contentWrapperTw)\n : contentWrapperTw\n }\n >\n {finalStartIconName ? (\n <Icon\n name={finalStartIconName}\n size={iconSize}\n {...startIconProps}\n twClassName={mergeTwClassName(\n mergeTwClassName(\n 'shrink-0',\n iconClassName ? iconClassName(pressed) : undefined,\n ),\n startIconProps?.twClassName,\n )}\n />\n ) : (\n startAccessory\n )}\n <TextOrChildren\n textProps={{\n variant: labelTextVariant,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n numberOfLines: 1,\n ellipsizeMode: 'clip',\n ...textProps,\n twClassName: mergeTwClassName(\n mergeTwClassName(\n 'shrink grow-0 flex-wrap text-center',\n textClassName ? textClassName(pressed) : undefined,\n ),\n textProps?.twClassName,\n ),\n }}\n >\n {children}\n </TextOrChildren>\n {finalEndIconName ? (\n <Icon\n name={finalEndIconName}\n size={iconSize}\n {...endIconProps}\n twClassName={mergeTwClassName(\n mergeTwClassName(\n 'shrink-0',\n iconClassName ? iconClassName(pressed) : undefined,\n ),\n endIconProps?.twClassName,\n )}\n />\n ) : (\n endAccessory\n )}\n </Box>\n </>\n );\n }}\n </ButtonAnimated>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type {
|
|
1
|
+
{"version":3,"file":"ButtonBase.types.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type { IconProps } from '../Icon';\nimport type { SpinnerProps } from '../Spinner';\nimport type { TextProps } from '../Text';\n\n/**\n * ButtonBase component props.\n */\nexport type ButtonBaseProps = ButtonBasePropsShared & {\n /**\n * Required prop for the content to be rendered within the ButtonBase\n */\n children: React.ReactNode | string;\n /**\n * Optional props to be passed to the Text component when children is a string\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n spinnerProps?: Partial<SpinnerProps>;\n /**\n * Props passed to the loading overlay wrapper (`Box` around the spinner).\n * Defaults include `twClassName` for full-area centered layout; merge your own `twClassName` to extend.\n * Pass `testID` here for tests — there is no default test id on this wrapper.\n */\n loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;\n /**\n * Props passed to the label row (`Box`). Defaults to a row with centered items and `gap={1}` when accessories are present; values here override those defaults. Label typography remains controlled via `textProps` on ButtonBase.\n */\n contentWrapperProps?: Omit<Partial<BoxProps>, 'children'>;\n /**\n * Optional prop to specify an icon to show at the start of the button\n */\n startIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the start icon\n */\n startIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the start of the button\n */\n startAccessory?: React.ReactNode;\n /**\n * Optional prop to specify an icon to show at the end of the button\n */\n endIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n endIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the end of the button\n */\n endAccessory?: React.ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n * Can be a string or a function that receives pressed state and returns a string.\n */\n twClassName?: string | ((pressed: boolean) => string);\n /**\n * Optional prop to control text className based on pressed state.\n */\n textClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control icon className based on pressed state.\n */\n iconClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional accessibility label to describe the button for screen readers.\n * If not provided, the button content will be used as the label.\n */\n accessibilityLabel?: string;\n /**\n * Optional accessibility hint to provide additional context about the button's action.\n * Should describe what happens when the button is pressed.\n */\n accessibilityHint?: string;\n /**\n * Optional accessibility role. Defaults to 'button'.\n * Can be overridden for specific use cases.\n */\n accessibilityRole?: 'button' | 'link' | 'menuitem' | 'tab' | 'none';\n /**\n * Optional accessibility actions for custom interactions.\n * Use sparingly and only when default button behavior is insufficient.\n */\n accessibilityActions?: {\n name: string;\n label?: string;\n }[];\n /**\n * Optional callback for handling accessibility action events.\n */\n onAccessibilityAction?: (event: {\n nativeEvent: { actionName: string };\n }) => void;\n} & Omit<\n PressableProps,\n | 'accessibilityRole'\n | 'accessibilityLabel'\n | 'accessibilityHint'\n | 'accessibilityActions'\n | 'onAccessibilityAction'\n >;\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ButtonBasePropsShared, IconName } from "@metamask-previews/design-system-shared";
|
|
2
2
|
import type { PressableProps, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import type { BoxProps } from "../Box/Box.types.cjs";
|
|
4
|
-
import type { BoxRowProps } from "../BoxRow/BoxRow.types.cjs";
|
|
5
4
|
import type { IconProps } from "../Icon/index.cjs";
|
|
6
5
|
import type { SpinnerProps } from "../Spinner/index.cjs";
|
|
7
6
|
import type { TextProps } from "../Text/index.cjs";
|
|
@@ -28,9 +27,9 @@ export type ButtonBaseProps = ButtonBasePropsShared & {
|
|
|
28
27
|
*/
|
|
29
28
|
loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;
|
|
30
29
|
/**
|
|
31
|
-
* Props passed to the label row (`
|
|
30
|
+
* Props passed to the label row (`Box`). Defaults to a row with centered items and `gap={1}` when accessories are present; values here override those defaults. Label typography remains controlled via `textProps` on ButtonBase.
|
|
32
31
|
*/
|
|
33
|
-
contentWrapperProps?: Omit<Partial<
|
|
32
|
+
contentWrapperProps?: Omit<Partial<BoxProps>, 'children'>;
|
|
34
33
|
/**
|
|
35
34
|
* Optional prop to specify an icon to show at the start of the button
|
|
36
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACT,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAE,6BAAyB;AACjD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ButtonBase.types.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACT,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAE,6BAAyB;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,6BAAmB;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG;IACpD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IACnC;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;IACjD;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1D;;OAEG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC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Ac,EACZ,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,GACtB,uBAAuB,CAC1B,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ButtonBasePropsShared, IconName } from "@metamask-previews/design-system-shared";
|
|
2
2
|
import type { PressableProps, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import type { BoxProps } from "../Box/Box.types.mjs";
|
|
4
|
-
import type { BoxRowProps } from "../BoxRow/BoxRow.types.mjs";
|
|
5
4
|
import type { IconProps } from "../Icon/index.mjs";
|
|
6
5
|
import type { SpinnerProps } from "../Spinner/index.mjs";
|
|
7
6
|
import type { TextProps } from "../Text/index.mjs";
|
|
@@ -28,9 +27,9 @@ export type ButtonBaseProps = ButtonBasePropsShared & {
|
|
|
28
27
|
*/
|
|
29
28
|
loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;
|
|
30
29
|
/**
|
|
31
|
-
* Props passed to the label row (`
|
|
30
|
+
* Props passed to the label row (`Box`). Defaults to a row with centered items and `gap={1}` when accessories are present; values here override those defaults. Label typography remains controlled via `textProps` on ButtonBase.
|
|
32
31
|
*/
|
|
33
|
-
contentWrapperProps?: Omit<Partial<
|
|
32
|
+
contentWrapperProps?: Omit<Partial<BoxProps>, 'children'>;
|
|
34
33
|
/**
|
|
35
34
|
* Optional prop to specify an icon to show at the start of the button
|
|
36
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACT,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAE,6BAAyB;AACjD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ButtonBase.types.d.m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ACH,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC;IACtD;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC;IAC7C;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC;IAC7C;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;IACpE;;;OAGG;IACH,oBAAoB,CAAC,EAAE;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;IACJ;;OAEG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC9B,WAAW,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC;KACrC,KAAK,IAAI,CAAC;CACZ,GAAG,IAAI,CACJ,cAAc,EACZ,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,GACtB,uBAAuB,CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type {
|
|
1
|
+
{"version":3,"file":"ButtonBase.types.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type { IconProps } from '../Icon';\nimport type { SpinnerProps } from '../Spinner';\nimport type { TextProps } from '../Text';\n\n/**\n * ButtonBase component props.\n */\nexport type ButtonBaseProps = ButtonBasePropsShared & {\n /**\n * Required prop for the content to be rendered within the ButtonBase\n */\n children: React.ReactNode | string;\n /**\n * Optional props to be passed to the Text component when children is a string\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n spinnerProps?: Partial<SpinnerProps>;\n /**\n * Props passed to the loading overlay wrapper (`Box` around the spinner).\n * Defaults include `twClassName` for full-area centered layout; merge your own `twClassName` to extend.\n * Pass `testID` here for tests — there is no default test id on this wrapper.\n */\n loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;\n /**\n * Props passed to the label row (`Box`). Defaults to a row with centered items and `gap={1}` when accessories are present; values here override those defaults. Label typography remains controlled via `textProps` on ButtonBase.\n */\n contentWrapperProps?: Omit<Partial<BoxProps>, 'children'>;\n /**\n * Optional prop to specify an icon to show at the start of the button\n */\n startIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the start icon\n */\n startIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the start of the button\n */\n startAccessory?: React.ReactNode;\n /**\n * Optional prop to specify an icon to show at the end of the button\n */\n endIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n endIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the end of the button\n */\n endAccessory?: React.ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n * Can be a string or a function that receives pressed state and returns a string.\n */\n twClassName?: string | ((pressed: boolean) => string);\n /**\n * Optional prop to control text className based on pressed state.\n */\n textClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control icon className based on pressed state.\n */\n iconClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional accessibility label to describe the button for screen readers.\n * If not provided, the button content will be used as the label.\n */\n accessibilityLabel?: string;\n /**\n * Optional accessibility hint to provide additional context about the button's action.\n * Should describe what happens when the button is pressed.\n */\n accessibilityHint?: string;\n /**\n * Optional accessibility role. Defaults to 'button'.\n * Can be overridden for specific use cases.\n */\n accessibilityRole?: 'button' | 'link' | 'menuitem' | 'tab' | 'none';\n /**\n * Optional accessibility actions for custom interactions.\n * Use sparingly and only when default button behavior is insufficient.\n */\n accessibilityActions?: {\n name: string;\n label?: string;\n }[];\n /**\n * Optional callback for handling accessibility action events.\n */\n onAccessibilityAction?: (event: {\n nativeEvent: { actionName: string };\n }) => void;\n} & Omit<\n PressableProps,\n | 'accessibilityRole'\n | 'accessibilityLabel'\n | 'accessibilityHint'\n | 'accessibilityActions'\n | 'onAccessibilityAction'\n >;\n"]}
|
|
@@ -7,8 +7,6 @@ exports.Content = void 0;
|
|
|
7
7
|
const design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const Box_1 = require("../Box/index.cjs");
|
|
10
|
-
const BoxColumn_1 = require("../BoxColumn/index.cjs");
|
|
11
|
-
const BoxRow_1 = require("../BoxRow/index.cjs");
|
|
12
10
|
const TextOrChildren_1 = require("../temp-components/TextOrChildren/index.cjs");
|
|
13
11
|
const Content = ({ variant = design_system_shared_1.ContentVariant.TwoLines, avatar, twClassName, title, titleProps, titleStartAccessory, titleEndAccessory, description, descriptionProps, descriptionStartAccessory, descriptionEndAccessory, value, valueProps, valueStartAccessory, valueEndAccessory, subvalue, subvalueProps, subvalueStartAccessory, subvalueEndAccessory, ...props }) => {
|
|
14
12
|
const isOneLine = variant === design_system_shared_1.ContentVariant.OneLine;
|
|
@@ -26,19 +24,9 @@ const Content = ({ variant = design_system_shared_1.ContentVariant.TwoLines, ava
|
|
|
26
24
|
}
|
|
27
25
|
return (<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Row} alignItems={alignItems} gap={4} twClassName={twClassName} {...props}>
|
|
28
26
|
{avatar}
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
variant: design_system_shared_1.TextVariant.BodySm,
|
|
33
|
-
fontWeight: design_system_shared_1.FontWeight.Medium,
|
|
34
|
-
color: design_system_shared_1.TextColor.TextAlternative,
|
|
35
|
-
...descriptionProps,
|
|
36
|
-
}}>
|
|
37
|
-
{description}
|
|
38
|
-
</TextOrChildren_1.TextOrChildren>
|
|
39
|
-
</BoxColumn_1.BoxColumn>
|
|
40
|
-
</BoxRow_1.BoxRow>) : null}>
|
|
41
|
-
{title ? (<BoxRow_1.BoxRow twClassName="w-full" startAccessory={titleStartAccessory} endAccessory={titleEndAccessory} gap={1}>
|
|
27
|
+
<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Column} twClassName="flex-1 min-w-0">
|
|
28
|
+
{title ? (<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Row} alignItems={design_system_shared_1.BoxAlignItems.Center} gap={1} twClassName="w-full">
|
|
29
|
+
{titleStartAccessory}
|
|
42
30
|
<TextOrChildren_1.TextOrChildren textProps={{
|
|
43
31
|
variant: design_system_shared_1.TextVariant.BodyMd,
|
|
44
32
|
fontWeight: design_system_shared_1.FontWeight.Medium,
|
|
@@ -47,21 +35,26 @@ const Content = ({ variant = design_system_shared_1.ContentVariant.TwoLines, ava
|
|
|
47
35
|
}}>
|
|
48
36
|
{title}
|
|
49
37
|
</TextOrChildren_1.TextOrChildren>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
38
|
+
{titleEndAccessory}
|
|
39
|
+
</Box_1.Box>) : null}
|
|
40
|
+
{showDescription ? (<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Row} alignItems={alignItems} gap={1} twClassName="w-full">
|
|
41
|
+
{descriptionStartAccessory}
|
|
42
|
+
<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Column} twClassName="min-w-0">
|
|
43
|
+
<TextOrChildren_1.TextOrChildren textProps={{
|
|
44
|
+
variant: design_system_shared_1.TextVariant.BodySm,
|
|
45
|
+
fontWeight: design_system_shared_1.FontWeight.Medium,
|
|
46
|
+
color: design_system_shared_1.TextColor.TextAlternative,
|
|
47
|
+
...descriptionProps,
|
|
48
|
+
}}>
|
|
49
|
+
{description}
|
|
50
|
+
</TextOrChildren_1.TextOrChildren>
|
|
51
|
+
</Box_1.Box>
|
|
52
|
+
{descriptionEndAccessory}
|
|
53
|
+
</Box_1.Box>) : null}
|
|
54
|
+
</Box_1.Box>
|
|
55
|
+
{value || showSubvalue ? (<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Column} alignItems={design_system_shared_1.BoxAlignItems.End} twClassName="min-w-0">
|
|
56
|
+
{value ? (<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Row} alignItems={design_system_shared_1.BoxAlignItems.Center} gap={1}>
|
|
57
|
+
{valueStartAccessory}
|
|
65
58
|
<TextOrChildren_1.TextOrChildren textProps={{
|
|
66
59
|
variant: design_system_shared_1.TextVariant.BodyMd,
|
|
67
60
|
fontWeight: design_system_shared_1.FontWeight.Medium,
|
|
@@ -70,8 +63,23 @@ const Content = ({ variant = design_system_shared_1.ContentVariant.TwoLines, ava
|
|
|
70
63
|
}}>
|
|
71
64
|
{value}
|
|
72
65
|
</TextOrChildren_1.TextOrChildren>
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
{valueEndAccessory}
|
|
67
|
+
</Box_1.Box>) : null}
|
|
68
|
+
{showSubvalue ? (<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Row} alignItems={alignItems} gap={1}>
|
|
69
|
+
{subvalueStartAccessory}
|
|
70
|
+
<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Column} twClassName="min-w-0">
|
|
71
|
+
<TextOrChildren_1.TextOrChildren textProps={{
|
|
72
|
+
variant: design_system_shared_1.TextVariant.BodySm,
|
|
73
|
+
fontWeight: design_system_shared_1.FontWeight.Medium,
|
|
74
|
+
color: design_system_shared_1.TextColor.TextAlternative,
|
|
75
|
+
...subvalueProps,
|
|
76
|
+
}}>
|
|
77
|
+
{subvalue}
|
|
78
|
+
</TextOrChildren_1.TextOrChildren>
|
|
79
|
+
</Box_1.Box>
|
|
80
|
+
{subvalueEndAccessory}
|
|
81
|
+
</Box_1.Box>) : null}
|
|
82
|
+
</Box_1.Box>) : null}
|
|
75
83
|
</Box_1.Box>);
|
|
76
84
|
};
|
|
77
85
|
exports.Content = Content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.cjs","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":";;;;;;AAAA,kFAOiD;AACjD,kDAA0B;AAE1B,0CAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"Content.cjs","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":";;;;;;AAAA,kFAOiD;AACjD,kDAA0B;AAE1B,0CAA6B;AAC7B,gFAAmE;AAI5D,MAAM,OAAO,GAA2B,CAAC,EAC9C,OAAO,GAAG,qCAAc,CAAC,QAAQ,EACjC,MAAM,EACN,WAAW,EACX,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,GAAG,KAAK,EACT,EA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IAAA,EAAE,SAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAvJW,QAAA,OAAO,WAuJlB;AAEF,eAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["import {\n BoxAlignItems,\n BoxFlexDirection,\n ContentVariant,\n FontWeight,\n TextColor,\n TextVariant,\n} from '@metamask-previews/design-system-shared';\nimport React from 'react';\n\nimport { Box } from '../Box';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { ContentProps } from './Content.types';\n\nexport const Content: React.FC<ContentProps> = ({\n variant = ContentVariant.TwoLines,\n avatar,\n twClassName,\n title,\n titleProps,\n titleStartAccessory,\n titleEndAccessory,\n description,\n descriptionProps,\n descriptionStartAccessory,\n descriptionEndAccessory,\n value,\n valueProps,\n valueStartAccessory,\n valueEndAccessory,\n subvalue,\n subvalueProps,\n subvalueStartAccessory,\n subvalueEndAccessory,\n ...props\n}) => {\n const isOneLine = variant === ContentVariant.OneLine;\n const isMultiLine = variant === ContentVariant.MultiLine;\n const showDescription = !isOneLine && description;\n const showSubvalue = !isOneLine && subvalue;\n const alignItems = isMultiLine ? BoxAlignItems.Start : BoxAlignItems.Center;\n\n if (__DEV__) {\n if (isOneLine && description) {\n console.warn(\n 'Content: `description` is ignored when `variant` is `ContentVariant.OneLine`.',\n );\n }\n if (isOneLine && subvalue) {\n console.warn(\n 'Content: `subvalue` is ignored when `variant` is `ContentVariant.OneLine`.',\n );\n }\n }\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={alignItems}\n gap={4}\n twClassName={twClassName}\n {...props}\n >\n {avatar}\n <Box flexDirection={BoxFlexDirection.Column} twClassName=\"flex-1 min-w-0\">\n {title ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={1}\n twClassName=\"w-full\"\n >\n {titleStartAccessory}\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodyMd,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n ...titleProps,\n }}\n >\n {title}\n </TextOrChildren>\n {titleEndAccessory}\n </Box>\n ) : null}\n {showDescription ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={alignItems}\n gap={1}\n twClassName=\"w-full\"\n >\n {descriptionStartAccessory}\n <Box flexDirection={BoxFlexDirection.Column} twClassName=\"min-w-0\">\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodySm,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextAlternative,\n ...descriptionProps,\n }}\n >\n {description}\n </TextOrChildren>\n </Box>\n {descriptionEndAccessory}\n </Box>\n ) : null}\n </Box>\n {value || showSubvalue ? (\n <Box\n flexDirection={BoxFlexDirection.Column}\n alignItems={BoxAlignItems.End}\n twClassName=\"min-w-0\"\n >\n {value ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={1}\n >\n {valueStartAccessory}\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodyMd,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n ...valueProps,\n }}\n >\n {value}\n </TextOrChildren>\n {valueEndAccessory}\n </Box>\n ) : null}\n {showSubvalue ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={alignItems}\n gap={1}\n >\n {subvalueStartAccessory}\n <Box\n flexDirection={BoxFlexDirection.Column}\n twClassName=\"min-w-0\"\n >\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodySm,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextAlternative,\n ...subvalueProps,\n }}\n >\n {subvalue}\n </TextOrChildren>\n </Box>\n {subvalueEndAccessory}\n </Box>\n ) : null}\n </Box>\n ) : null}\n </Box>\n );\n};\n\nContent.displayName = 'Content';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.d.cts","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,cAAc;
|
|
1
|
+
{"version":3,"file":"Content.d.cts","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,cAAc;AAK1B,OAAO,KAAK,EAAE,YAAY,EAAE,4BAAwB;AAEpD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAuJ1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.d.mts","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,cAAc;
|
|
1
|
+
{"version":3,"file":"Content.d.mts","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,cAAc;AAK1B,OAAO,KAAK,EAAE,YAAY,EAAE,4BAAwB;AAEpD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAuJ1C,CAAC"}
|
|
@@ -8,8 +8,6 @@ import { BoxAlignItems, BoxFlexDirection, ContentVariant, FontWeight, TextColor,
|
|
|
8
8
|
import $React from "react";
|
|
9
9
|
const React = $importDefault($React);
|
|
10
10
|
import { Box } from "../Box/index.mjs";
|
|
11
|
-
import { BoxColumn } from "../BoxColumn/index.mjs";
|
|
12
|
-
import { BoxRow } from "../BoxRow/index.mjs";
|
|
13
11
|
import { TextOrChildren } from "../temp-components/TextOrChildren/index.mjs";
|
|
14
12
|
export const Content = ({ variant = ContentVariant.TwoLines, avatar, twClassName, title, titleProps, titleStartAccessory, titleEndAccessory, description, descriptionProps, descriptionStartAccessory, descriptionEndAccessory, value, valueProps, valueStartAccessory, valueEndAccessory, subvalue, subvalueProps, subvalueStartAccessory, subvalueEndAccessory, ...props }) => {
|
|
15
13
|
const isOneLine = variant === ContentVariant.OneLine;
|
|
@@ -27,19 +25,9 @@ export const Content = ({ variant = ContentVariant.TwoLines, avatar, twClassName
|
|
|
27
25
|
}
|
|
28
26
|
return (<Box flexDirection={BoxFlexDirection.Row} alignItems={alignItems} gap={4} twClassName={twClassName} {...props}>
|
|
29
27
|
{avatar}
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
variant: TextVariant.BodySm,
|
|
34
|
-
fontWeight: FontWeight.Medium,
|
|
35
|
-
color: TextColor.TextAlternative,
|
|
36
|
-
...descriptionProps,
|
|
37
|
-
}}>
|
|
38
|
-
{description}
|
|
39
|
-
</TextOrChildren>
|
|
40
|
-
</BoxColumn>
|
|
41
|
-
</BoxRow>) : null}>
|
|
42
|
-
{title ? (<BoxRow twClassName="w-full" startAccessory={titleStartAccessory} endAccessory={titleEndAccessory} gap={1}>
|
|
28
|
+
<Box flexDirection={BoxFlexDirection.Column} twClassName="flex-1 min-w-0">
|
|
29
|
+
{title ? (<Box flexDirection={BoxFlexDirection.Row} alignItems={BoxAlignItems.Center} gap={1} twClassName="w-full">
|
|
30
|
+
{titleStartAccessory}
|
|
43
31
|
<TextOrChildren textProps={{
|
|
44
32
|
variant: TextVariant.BodyMd,
|
|
45
33
|
fontWeight: FontWeight.Medium,
|
|
@@ -48,21 +36,26 @@ export const Content = ({ variant = ContentVariant.TwoLines, avatar, twClassName
|
|
|
48
36
|
}}>
|
|
49
37
|
{title}
|
|
50
38
|
</TextOrChildren>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
39
|
+
{titleEndAccessory}
|
|
40
|
+
</Box>) : null}
|
|
41
|
+
{showDescription ? (<Box flexDirection={BoxFlexDirection.Row} alignItems={alignItems} gap={1} twClassName="w-full">
|
|
42
|
+
{descriptionStartAccessory}
|
|
43
|
+
<Box flexDirection={BoxFlexDirection.Column} twClassName="min-w-0">
|
|
44
|
+
<TextOrChildren textProps={{
|
|
45
|
+
variant: TextVariant.BodySm,
|
|
46
|
+
fontWeight: FontWeight.Medium,
|
|
47
|
+
color: TextColor.TextAlternative,
|
|
48
|
+
...descriptionProps,
|
|
49
|
+
}}>
|
|
50
|
+
{description}
|
|
51
|
+
</TextOrChildren>
|
|
52
|
+
</Box>
|
|
53
|
+
{descriptionEndAccessory}
|
|
54
|
+
</Box>) : null}
|
|
55
|
+
</Box>
|
|
56
|
+
{value || showSubvalue ? (<Box flexDirection={BoxFlexDirection.Column} alignItems={BoxAlignItems.End} twClassName="min-w-0">
|
|
57
|
+
{value ? (<Box flexDirection={BoxFlexDirection.Row} alignItems={BoxAlignItems.Center} gap={1}>
|
|
58
|
+
{valueStartAccessory}
|
|
66
59
|
<TextOrChildren textProps={{
|
|
67
60
|
variant: TextVariant.BodyMd,
|
|
68
61
|
fontWeight: FontWeight.Medium,
|
|
@@ -71,8 +64,23 @@ export const Content = ({ variant = ContentVariant.TwoLines, avatar, twClassName
|
|
|
71
64
|
}}>
|
|
72
65
|
{value}
|
|
73
66
|
</TextOrChildren>
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
{valueEndAccessory}
|
|
68
|
+
</Box>) : null}
|
|
69
|
+
{showSubvalue ? (<Box flexDirection={BoxFlexDirection.Row} alignItems={alignItems} gap={1}>
|
|
70
|
+
{subvalueStartAccessory}
|
|
71
|
+
<Box flexDirection={BoxFlexDirection.Column} twClassName="min-w-0">
|
|
72
|
+
<TextOrChildren textProps={{
|
|
73
|
+
variant: TextVariant.BodySm,
|
|
74
|
+
fontWeight: FontWeight.Medium,
|
|
75
|
+
color: TextColor.TextAlternative,
|
|
76
|
+
...subvalueProps,
|
|
77
|
+
}}>
|
|
78
|
+
{subvalue}
|
|
79
|
+
</TextOrChildren>
|
|
80
|
+
</Box>
|
|
81
|
+
{subvalueEndAccessory}
|
|
82
|
+
</Box>) : null}
|
|
83
|
+
</Box>) : null}
|
|
76
84
|
</Box>);
|
|
77
85
|
};
|
|
78
86
|
Content.displayName = 'Content';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.mjs","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,SAAS,EACT,WAAW,EACZ,gDAAgD;AACjD,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Content.mjs","sourceRoot":"","sources":["../../../src/components/Content/Content.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,SAAS,EACT,WAAW,EACZ,gDAAgD;AACjD,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,cAAc,EAAE,oDAA0C;AAInE,MAAM,CAAC,MAAM,OAAO,GAA2B,CAAC,EAC9C,OAAO,GAAG,cAAc,CAAC,QAAQ,EACjC,MAAM,EACN,WAAW,EACX,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,OAAO,KAAK,cAAc,CAAC,OAAO,CAAC;IACrD,MAAM,WAAW,GAAG,OAAO,KAAK,cAAc,CAAC,SAAS,CAAC;IACzD,MAAM,eAAe,GAAG,CAAC,SAAS,IAAI,WAAW,CAAC;IAClD,MAAM,YAAY,GAAG,CAAC,SAAS,IAAI,QAAQ,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,M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BACd,CAAC,CAEF;gBAAA,CAAC,KAAK,CACR;cAAA,EAAE,cAAc,CAChB;cAAA,CAAC,iBAAiB,CACpB;YAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACR;UAAA,CAAC,YAAY,CAAC,CAAC,CAAC,CACd,CAAC,GAAG,CACF,aAAa,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CACpC,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,GAAG,CAAC,CAAC,CAAC,CAAC,CAEP;cAAA,CAAC,sBAAsB,CACvB;cAAA,CAAC,GAAG,CACF,aAAa,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CACvC,WAAW,CAAC,SAAS,CAErB;gBAAA,CAAC,cAAc,CACb,SAAS,CAAC,CAAC;oBACT,OAAO,EAAE,WAAW,CAAC,MAAM;oBAC3B,UAAU,EAAE,UAAU,CAAC,MAAM;oBAC7B,KAAK,EAAE,SAAS,CAAC,eAAe;oBAChC,GAAG,aAAa;iBACjB,CAAC,CAEF;kBAAA,CAAC,QAAQ,CACX;gBAAA,EAAE,cAAc,CAClB;cAAA,EAAE,GAAG,CACL;cAAA,CAAC,oBAAoB,CACvB;YAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACV;QAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["import {\n BoxAlignItems,\n BoxFlexDirection,\n ContentVariant,\n FontWeight,\n TextColor,\n TextVariant,\n} from '@metamask-previews/design-system-shared';\nimport React from 'react';\n\nimport { Box } from '../Box';\nimport { TextOrChildren } from '../temp-components/TextOrChildren';\n\nimport type { ContentProps } from './Content.types';\n\nexport const Content: React.FC<ContentProps> = ({\n variant = ContentVariant.TwoLines,\n avatar,\n twClassName,\n title,\n titleProps,\n titleStartAccessory,\n titleEndAccessory,\n description,\n descriptionProps,\n descriptionStartAccessory,\n descriptionEndAccessory,\n value,\n valueProps,\n valueStartAccessory,\n valueEndAccessory,\n subvalue,\n subvalueProps,\n subvalueStartAccessory,\n subvalueEndAccessory,\n ...props\n}) => {\n const isOneLine = variant === ContentVariant.OneLine;\n const isMultiLine = variant === ContentVariant.MultiLine;\n const showDescription = !isOneLine && description;\n const showSubvalue = !isOneLine && subvalue;\n const alignItems = isMultiLine ? BoxAlignItems.Start : BoxAlignItems.Center;\n\n if (__DEV__) {\n if (isOneLine && description) {\n console.warn(\n 'Content: `description` is ignored when `variant` is `ContentVariant.OneLine`.',\n );\n }\n if (isOneLine && subvalue) {\n console.warn(\n 'Content: `subvalue` is ignored when `variant` is `ContentVariant.OneLine`.',\n );\n }\n }\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={alignItems}\n gap={4}\n twClassName={twClassName}\n {...props}\n >\n {avatar}\n <Box flexDirection={BoxFlexDirection.Column} twClassName=\"flex-1 min-w-0\">\n {title ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={1}\n twClassName=\"w-full\"\n >\n {titleStartAccessory}\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodyMd,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n ...titleProps,\n }}\n >\n {title}\n </TextOrChildren>\n {titleEndAccessory}\n </Box>\n ) : null}\n {showDescription ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={alignItems}\n gap={1}\n twClassName=\"w-full\"\n >\n {descriptionStartAccessory}\n <Box flexDirection={BoxFlexDirection.Column} twClassName=\"min-w-0\">\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodySm,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextAlternative,\n ...descriptionProps,\n }}\n >\n {description}\n </TextOrChildren>\n </Box>\n {descriptionEndAccessory}\n </Box>\n ) : null}\n </Box>\n {value || showSubvalue ? (\n <Box\n flexDirection={BoxFlexDirection.Column}\n alignItems={BoxAlignItems.End}\n twClassName=\"min-w-0\"\n >\n {value ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Center}\n gap={1}\n >\n {valueStartAccessory}\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodyMd,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n ...valueProps,\n }}\n >\n {value}\n </TextOrChildren>\n {valueEndAccessory}\n </Box>\n ) : null}\n {showSubvalue ? (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={alignItems}\n gap={1}\n >\n {subvalueStartAccessory}\n <Box\n flexDirection={BoxFlexDirection.Column}\n twClassName=\"min-w-0\"\n >\n <TextOrChildren\n textProps={{\n variant: TextVariant.BodySm,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextAlternative,\n ...subvalueProps,\n }}\n >\n {subvalue}\n </TextOrChildren>\n </Box>\n {subvalueEndAccessory}\n </Box>\n ) : null}\n </Box>\n ) : null}\n </Box>\n );\n};\n\nContent.displayName = 'Content';\n"]}
|
|
@@ -10,8 +10,8 @@ const react_1 = __importDefault(require("react"));
|
|
|
10
10
|
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
11
11
|
// External dependencies.
|
|
12
12
|
const Box_1 = require("../Box/index.cjs");
|
|
13
|
-
const BoxRow_1 = require("../BoxRow/index.cjs");
|
|
14
13
|
const ButtonIcon_1 = require("../ButtonIcon/index.cjs");
|
|
14
|
+
const TextOrChildren_1 = require("../temp-components/TextOrChildren/index.cjs");
|
|
15
15
|
const Text_1 = require("../Text/index.cjs");
|
|
16
16
|
const HeaderRoot = ({ children, title, titleProps, titleAccessory, endAccessory, endButtonIconProps, includesTopInset = false, style, testID, twClassName, ...viewProps }) => {
|
|
17
17
|
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
@@ -32,12 +32,15 @@ const HeaderRoot = ({ children, title, titleProps, titleAccessory, endAccessory,
|
|
|
32
32
|
return children;
|
|
33
33
|
}
|
|
34
34
|
if (title) {
|
|
35
|
-
return (<
|
|
35
|
+
return (<Box_1.Box flexDirection={Box_1.BoxFlexDirection.Row} alignItems={Box_1.BoxAlignItems.Center} gap={1} twClassName="flex-1">
|
|
36
|
+
<TextOrChildren_1.TextOrChildren textProps={{
|
|
36
37
|
variant: Text_1.TextVariant.HeadingLg,
|
|
37
38
|
...titleProps,
|
|
38
|
-
}}
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
}}>
|
|
40
|
+
{title}
|
|
41
|
+
</TextOrChildren_1.TextOrChildren>
|
|
42
|
+
{titleAccessory}
|
|
43
|
+
</Box_1.Box>);
|
|
41
44
|
}
|
|
42
45
|
return null;
|
|
43
46
|
};
|