@metamask-previews/design-system-react-native 0.0.0-preview.f4da8f1 → 0.0.0-preview.fbd1fe9
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/dist/components/Button/Button.constants.d.ts +2 -0
- package/dist/components/Button/Button.constants.d.ts.map +1 -0
- package/dist/components/Button/Button.constants.js +7 -0
- package/dist/components/Button/Button.constants.js.map +1 -0
- package/dist/components/Button/Button.d.ts +5 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +25 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.types.d.ts +23 -0
- package/dist/components/Button/Button.types.d.ts.map +1 -0
- package/dist/components/Button/Button.types.js +15 -0
- package/dist/components/Button/Button.types.js.map +1 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +12 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.d.ts +3 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.js +29 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.constants.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.ts +5 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.js +97 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.d.ts +17 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.js +3 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.types.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.d.ts +78 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.js +122 -0
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.utilities.js.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/index.d.ts +4 -0
- package/dist/components/Button/variants/ButtonPrimary/index.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonPrimary/index.js +11 -0
- package/dist/components/Button/variants/ButtonPrimary/index.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.d.ts +3 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.js +29 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.constants.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.ts +5 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.js +90 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.d.ts +17 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.js +3 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.types.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.d.ts +90 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.js +145 -0
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.utilities.js.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/index.d.ts +4 -0
- package/dist/components/Button/variants/ButtonSecondary/index.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonSecondary/index.js +11 -0
- package/dist/components/Button/variants/ButtonSecondary/index.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.d.ts +3 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.js +29 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.constants.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.ts +5 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.js +90 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.d.ts +17 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.js +3 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.types.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.d.ts +88 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.js +147 -0
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.utilities.js.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/index.d.ts +4 -0
- package/dist/components/Button/variants/ButtonTertiary/index.d.ts.map +1 -0
- package/dist/components/Button/variants/ButtonTertiary/index.js +11 -0
- package/dist/components/Button/variants/ButtonTertiary/index.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.d.ts +6 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.js +20 -0
- package/dist/components/ButtonIcon/ButtonIcon.constants.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.d.ts +5 -0
- package/dist/components/ButtonIcon/ButtonIcon.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.js +72 -0
- package/dist/components/ButtonIcon/ButtonIcon.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.d.ts +60 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.js +19 -0
- package/dist/components/ButtonIcon/ButtonIcon.types.js.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.d.ts +55 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.d.ts.map +1 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.js +73 -0
- package/dist/components/ButtonIcon/ButtonIcon.utilities.js.map +1 -0
- package/dist/components/ButtonIcon/index.d.ts +4 -0
- package/dist/components/ButtonIcon/index.d.ts.map +1 -0
- package/dist/components/ButtonIcon/index.js +11 -0
- package/dist/components/ButtonIcon/index.js.map +1 -0
- package/dist/components/Icon/Icon.assets.d.ts +6 -0
- package/dist/components/Icon/Icon.assets.d.ts.map +1 -0
- package/dist/components/Icon/Icon.assets.js +324 -0
- package/dist/components/Icon/Icon.assets.js.map +1 -0
- package/dist/components/Icon/Icon.constants.d.ts +7 -0
- package/dist/components/Icon/Icon.constants.d.ts.map +1 -0
- package/dist/components/Icon/Icon.constants.js +15 -0
- package/dist/components/Icon/Icon.constants.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +5 -0
- package/dist/components/Icon/Icon.d.ts.map +1 -0
- package/dist/components/Icon/Icon.js +45 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Icon/Icon.types.d.ts +254 -0
- package/dist/components/Icon/Icon.types.d.ts.map +1 -0
- package/dist/components/Icon/Icon.types.js +229 -0
- package/dist/components/Icon/Icon.types.js.map +1 -0
- package/dist/components/Icon/Icon.utilities.d.ts +22 -0
- package/dist/components/Icon/Icon.utilities.d.ts.map +1 -0
- package/dist/components/Icon/Icon.utilities.js +31 -0
- package/dist/components/Icon/Icon.utilities.js.map +1 -0
- package/dist/components/Icon/index.d.ts +4 -0
- package/dist/components/Icon/index.d.ts.map +1 -0
- package/dist/components/Icon/index.js +13 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Text/Text.constants.d.ts +9 -0
- package/dist/components/Text/Text.constants.d.ts.map +1 -0
- package/dist/components/Text/Text.constants.js +21 -0
- package/dist/components/Text/Text.constants.js.map +1 -0
- package/dist/components/Text/Text.d.ts +5 -0
- package/dist/components/Text/Text.d.ts.map +1 -0
- package/dist/components/Text/Text.js +26 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/Text.types.d.ts +110 -0
- package/dist/components/Text/Text.types.d.ts.map +1 -0
- package/dist/components/Text/Text.types.js +89 -0
- package/dist/components/Text/Text.types.js.map +1 -0
- package/dist/components/Text/Text.utilities.d.ts +30 -0
- package/dist/components/Text/Text.utilities.d.ts.map +1 -0
- package/dist/components/Text/Text.utilities.js +45 -0
- package/dist/components/Text/Text.utilities.js.map +1 -0
- package/dist/components/Text/index.d.ts +4 -0
- package/dist/components/Text/index.d.ts.map +1 -0
- package/dist/components/Text/index.js +14 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/TextButton/TextButton.constants.d.ts +3 -0
- package/dist/components/TextButton/TextButton.constants.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.constants.js +29 -0
- package/dist/components/TextButton/TextButton.constants.js.map +1 -0
- package/dist/components/TextButton/TextButton.d.ts +5 -0
- package/dist/components/TextButton/TextButton.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.js +187 -0
- package/dist/components/TextButton/TextButton.js.map +1 -0
- package/dist/components/TextButton/TextButton.types.d.ts +73 -0
- package/dist/components/TextButton/TextButton.types.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.types.js +3 -0
- package/dist/components/TextButton/TextButton.types.js.map +1 -0
- package/dist/components/TextButton/TextButton.utilities.d.ts +55 -0
- package/dist/components/TextButton/TextButton.utilities.d.ts.map +1 -0
- package/dist/components/TextButton/TextButton.utilities.js +77 -0
- package/dist/components/TextButton/TextButton.utilities.js.map +1 -0
- package/dist/components/TextButton/index.d.ts +3 -0
- package/dist/components/TextButton/index.d.ts.map +1 -0
- package/dist/components/TextButton/index.js +9 -0
- package/dist/components/TextButton/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.d.ts +5 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.d.ts.map +1 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.js +58 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.js.map +1 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.d.ts +6 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.d.ts.map +1 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.js +3 -0
- package/dist/primitives/ButtonAnimated/ButtonAnimated.types.js.map +1 -0
- package/dist/primitives/ButtonAnimated/index.d.ts +2 -0
- package/dist/primitives/ButtonAnimated/index.d.ts.map +1 -0
- package/dist/primitives/ButtonAnimated/index.js +9 -0
- package/dist/primitives/ButtonAnimated/index.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.d.ts +3 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.js +32 -0
- package/dist/primitives/ButtonBase/ButtonBase.constants.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.d.ts +5 -0
- package/dist/primitives/ButtonBase/ButtonBase.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.js +84 -0
- package/dist/primitives/ButtonBase/ButtonBase.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.d.ts +93 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.js +19 -0
- package/dist/primitives/ButtonBase/ButtonBase.types.js.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.d.ts +28 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.js +41 -0
- package/dist/primitives/ButtonBase/ButtonBase.utilities.js.map +1 -0
- package/dist/primitives/ButtonBase/index.d.ts +4 -0
- package/dist/primitives/ButtonBase/index.d.ts.map +1 -0
- package/dist/primitives/ButtonBase/index.js +11 -0
- package/dist/primitives/ButtonBase/index.js.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.d.ts +5 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.d.ts.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.js +15 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.js.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.d.ts +15 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.d.ts.map +1 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.js +3 -0
- package/dist/primitives/TextOrChildren/TextOrChildren.types.js.map +1 -0
- package/dist/temp-components/Spinner/Spinner.constants.d.ts +3 -0
- package/dist/temp-components/Spinner/Spinner.constants.d.ts.map +1 -0
- package/dist/temp-components/Spinner/Spinner.constants.js +21 -0
- package/dist/temp-components/Spinner/Spinner.constants.js.map +1 -0
- package/dist/temp-components/Spinner/Spinner.d.ts +5 -0
- package/dist/temp-components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/temp-components/Spinner/Spinner.js +68 -0
- package/dist/temp-components/Spinner/Spinner.js.map +1 -0
- package/dist/temp-components/Spinner/Spinner.types.d.ts +30 -0
- package/dist/temp-components/Spinner/Spinner.types.d.ts.map +1 -0
- package/dist/temp-components/Spinner/Spinner.types.js +3 -0
- package/dist/temp-components/Spinner/Spinner.types.js.map +1 -0
- package/dist/temp-components/Spinner/index.d.ts +3 -0
- package/dist/temp-components/Spinner/index.d.ts.map +1 -0
- package/dist/temp-components/Spinner/index.js +9 -0
- package/dist/temp-components/Spinner/index.js.map +1 -0
- package/package.json +12 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextButton.js","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAiE;AACjE,8FAA4E;AAC5E,+CAAiD;AAEjD,+CAAoC;AAGpC,4EAAoD;AAEpD,mDAA2B;AAC3B,wDAAgC;AAEhC,iEAAkE;AAElE,iEAGgC;AAEhC,MAAM,UAAU,GAAG,CAAC,EAClB,QAAQ,EACR,SAAS,EACT,SAAS,GAAG,+CAAwB,CAAC,SAAS,EAC9C,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,GAAG,+CAAwB,CAAC,UAAU,EAChD,SAAS,GAAG,+CAAwB,CAAC,SAAS,EAC9C,OAAO,EACP,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,GAAG,KAAK,EACQ,EAAE,EAAE;IACpB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAClD,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IAEzB,wCAAwC;IACxC,MAAM,qBAAqB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACzC,OAAO,IAAA,4DAAqC,EAAC;YAC3C,SAAS;Y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AI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useMemo, useState } from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { View } from 'react-native';\n\nimport type { SpinnerProps } from '../../temp-components/Spinner';\nimport Spinner from '../../temp-components/Spinner';\nimport type { IconProps, IconColor } from '../Icon';\nimport Icon from '../Icon';\nimport Text from '../Text/Text';\nimport type { TextProps } from '../Text/Text.types';\nimport { DEFAULT_TEXTBUTTON_PROPS } from './TextButton.constants';\nimport type { TextButtonProps } from './TextButton.types';\nimport {\n generateTextButtonContainerClassNames,\n generateTextButtonTextClassNames,\n} from './TextButton.utilities';\n\nconst TextButton = ({\n children,\n textProps,\n isLoading = DEFAULT_TEXTBUTTON_PROPS.isLoading,\n loadingText,\n spinnerProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n isDisabled = DEFAULT_TEXTBUTTON_PROPS.isDisabled,\n isInverse = DEFAULT_TEXTBUTTON_PROPS.isInverse,\n onPress,\n onPressIn,\n onPressOut,\n onLongPress,\n twClassName,\n accessibilityRole,\n accessibilityLabel,\n style,\n ...props\n}: TextButtonProps) => {\n const [isPressed, setIsPressed] = useState(false);\n const tw = useTailwind();\n\n // Styling calculation for state changes\n const twContainerClassNames = useMemo(() => {\n return generateTextButtonContainerClassNames({\n isPressed,\n isLoading,\n isDisabled,\n twClassName,\n });\n }, [isPressed, isLoading, isDisabled, twClassName]);\n\n const twTextClassNames = useMemo(() => {\n return generateTextButtonTextClassNames({\n isPressed,\n isInverse,\n isLoading,\n });\n }, [isPressed, isInverse, isLoading]);\n\n // Merging default settings for Icons with passed in props\n const finalStartIconProps: Partial<IconProps> = {\n ...DEFAULT_TEXTBUTTON_PROPS.startIconProps,\n ...startIconProps,\n twClassName: `${twTextClassNames} ${startIconProps?.twClassName ?? ''}`,\n };\n const finalStartIconName = startIconName ?? startIconProps?.name;\n\n const finalEndIconProps: Partial<IconProps> = {\n ...DEFAULT_TEXTBUTTON_PROPS.endIconProps,\n ...endIconProps,\n twClassName: `${twTextClassNames} ${endIconProps?.twClassName ?? ''}`,\n };\n const finalEndIconName = endIconName ?? endIconProps?.name;\n\n const finalTextProps: Omit<Partial<TextProps>, 'children'> = {\n ...DEFAULT_TEXTBUTTON_PROPS.textProps,\n ...textProps,\n twClassName: `${twTextClassNames} ${textProps?.twClassName ?? ''}`,\n };\n\n // Merging spinner settings for Icons with passed in props\n const finalSpinnerProps: SpinnerProps = {\n ...DEFAULT_TEXTBUTTON_PROPS.spinnerProps,\n loadingText,\n color: twTextClassNames as IconColor,\n loadingTextProps: {\n twClassName: `${twTextClassNames} mt-[2.5px]`,\n },\n ...spinnerProps,\n };\n const onPressHandler = (event: GestureResponderEvent) => {\n if (!isDisabled && !isLoading) {\n onPress?.(event);\n }\n };\n\n const onPressInHandler = (event: GestureResponderEvent) => {\n if (!isDisabled && !isLoading) {\n setIsPressed(true);\n onPressIn?.(event);\n }\n };\n\n const onPressOutHandler = (event: GestureResponderEvent) => {\n if (!isDisabled && !isLoading) {\n setIsPressed(false);\n onPressOut?.(event);\n }\n };\n\n const onLongPressHandler = (event: GestureResponderEvent) => {\n if (!isDisabled && !isLoading) {\n onLongPress?.(event);\n }\n };\n\n /**\n * Design Requirements\n * TextButton needs to be able to be placed inline with other Texts along with\n * accompanying icons.\n *\n * Limitations\n * React Native renders Texts and components nested inside Texts very differently.\n * In order to fulfil design requirements\n * - TextButton needs to be built using Text wrapping the component to ensure\n * when placed in line with other Texts, it can be properly displayed inline\n * with other Texts.\n * - Due to React Native Texts calculating the layout of nested components\n * differently, there needs to be a few styling hacks applied below\n */\n\n // Get the line height of the text, which is also the height of the component\n const finalVariant =\n textProps?.variant || DEFAULT_TEXTBUTTON_PROPS.textProps.variant;\n const { lineHeight } = tw`text-${finalVariant as string}`;\n const componentHeight = Number(lineHeight);\n\n // Due to React Native rendering Views slightly above Texts, any non-texts\n // need to be moved down\n const nonTextOffSet = 2.5;\n\n // Get the final sizes of Icons to help with manual alignments\n const finalStartIconSize =\n startIconProps?.size || DEFAULT_TEXTBUTTON_PROPS.startIconProps.size;\n const finalEndIconSize =\n endIconProps?.size || DEFAULT_TEXTBUTTON_PROPS.endIconProps.size;\n\n // Offsets to vertically center the Icon\n const finalStartIconOffset =\n (Number(lineHeight) - Number(finalStartIconSize)) / 2;\n const finalEndIconOffset =\n (Number(lineHeight) - Number(finalEndIconSize)) / 2;\n\n /**\n * Due to Texts restricting nested components to manipulating layout with\n * margins/paddings, we needed to add Nested Views in order to properly add\n * additional margins/paddings. However, this causes the Text component to\n * somehow not include the Icons as part of the calculation for displaying\n * a change in background color onPress. Because of that, we need to mimic\n * the behavior on the Icon wrappers by baking the margins into the Icon\n * wrappers in order to display the background change properly\n */\n const marginsBetweenIconAndText = 4;\n const startIconWrapperWidth =\n Number(finalStartIconSize) + marginsBetweenIconAndText;\n const endIconWrapperWidth =\n Number(finalEndIconSize) + marginsBetweenIconAndText;\n\n return (\n <Text>\n {finalStartIconName && <Text style={tw`hidden`}> </Text>}\n {isLoading && (\n <View style={tw`${twContainerClassNames}`}>\n <Spinner {...finalSpinnerProps} />\n </View>\n )}\n <Text\n onPress={onPressHandler}\n onPressIn={onPressInHandler}\n onPressOut={onPressOutHandler}\n onLongPress={onLongPressHandler}\n accessible\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n style={[tw`${twContainerClassNames}`, style]}\n testID=\"text-button\"\n suppressHighlighting\n {...props}\n >\n {!isLoading && (\n <>\n {finalStartIconName ? (\n // This additional View is needed, otherwise things are rendered\n // VERY funkily\n <View style={tw`h-[${componentHeight}px]`}>\n <View\n style={tw`\n ${twContainerClassNames} \n items-start mt-[${nonTextOffSet}px] \n pt-[${finalStartIconOffset}px] \n h-[${componentHeight}px] \n w-[${startIconWrapperWidth}px]\n `}\n >\n <Icon name={finalStartIconName} {...finalStartIconProps} />\n </View>\n </View>\n ) : (\n startAccessory\n )}\n <Text {...finalTextProps}>{children}</Text>\n {finalEndIconName ? (\n // This additional View is needed, otherwise things are rendered\n // VERY funkily\n <View style={tw`h-[${componentHeight}px]`}>\n <View\n style={tw`\n ${twContainerClassNames} \n items-end \n mt-[${nonTextOffSet}px] \n pt-[${finalEndIconOffset}px] \n h-[${componentHeight}px] w-[${endIconWrapperWidth}px]`}\n >\n <Icon name={finalEndIconName} {...finalEndIconProps} />\n </View>\n </View>\n ) : (\n endAccessory\n )}\n </>\n )}\n </Text>\n {finalEndIconName && <Text style={tw`hidden`}> </Text>}\n </Text>\n );\n};\n\nexport default TextButton;\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { PressableProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { TextProps } from 'src/components/Text/Text.types';
|
|
3
|
+
import type { SpinnerProps } from '../../temp-components/Spinner';
|
|
4
|
+
import type { IconProps, IconName } from '../Icon';
|
|
5
|
+
/**
|
|
6
|
+
* TextButton component props.
|
|
7
|
+
*/
|
|
8
|
+
export type TextButtonProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Required prop for the content to be rendered within the TextButton
|
|
11
|
+
*/
|
|
12
|
+
children: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional props to be passed to the Text component when children is a string
|
|
15
|
+
*/
|
|
16
|
+
textProps?: Omit<Partial<TextProps>, 'children'>;
|
|
17
|
+
/**
|
|
18
|
+
* Optional prop that when true, shows a loading spinner
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Optional prop for text to display when button is in loading state
|
|
24
|
+
*/
|
|
25
|
+
loadingText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional prop to pass additional properties to the end icon
|
|
28
|
+
*/
|
|
29
|
+
spinnerProps?: Partial<SpinnerProps>;
|
|
30
|
+
/**
|
|
31
|
+
* Optional prop to specify an icon to show at the start of the button
|
|
32
|
+
*/
|
|
33
|
+
startIconName?: IconName;
|
|
34
|
+
/**
|
|
35
|
+
* Optional prop to pass additional properties to the start icon
|
|
36
|
+
*/
|
|
37
|
+
startIconProps?: Partial<IconProps>;
|
|
38
|
+
/**
|
|
39
|
+
* Optional prop for a custom element to show at the start of the button
|
|
40
|
+
*/
|
|
41
|
+
startAccessory?: React.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Optional prop to specify an icon to show at the end of the button
|
|
44
|
+
*/
|
|
45
|
+
endIconName?: IconName;
|
|
46
|
+
/**
|
|
47
|
+
* Optional prop to pass additional properties to the end icon
|
|
48
|
+
*/
|
|
49
|
+
endIconProps?: Partial<IconProps>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional prop for a custom element to show at the end of the button
|
|
52
|
+
*/
|
|
53
|
+
endAccessory?: React.ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Optional prop that when true, disables the button
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
isDisabled?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Optional prop to show the inverse state of the button, which is reserved for buttons on colored backgrounds.
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
isInverse?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Optional prop to add twrnc overriding classNames.
|
|
66
|
+
*/
|
|
67
|
+
twClassName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Optional prop to control the style.
|
|
70
|
+
*/
|
|
71
|
+
style?: StyleProp<ViewStyle>;
|
|
72
|
+
} & Omit<PressableProps, 'disabled'>;
|
|
73
|
+
//# sourceMappingURL=TextButton.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE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{"version":3,"file":"TextButton.types.js","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PressableProps, StyleProp, ViewStyle } from 'react-native';\nimport type { TextProps } from 'src/components/Text/Text.types';\n\nimport type { SpinnerProps } from '../../temp-components/Spinner';\nimport type { IconProps, IconName } from '../Icon';\n\n/**\n * TextButton component props.\n */\nexport type TextButtonProps = {\n /**\n * Required prop for the content to be rendered within the TextButton\n */\n children: 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 that when true, shows a loading spinner\n * @default false\n */\n isLoading?: boolean;\n /**\n * Optional prop for text to display when button is in loading state\n */\n loadingText?: string;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n spinnerProps?: Partial<SpinnerProps>;\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 that when true, disables the button\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Optional prop to show the inverse state of the button, which is reserved for buttons on colored backgrounds.\n * @default false\n */\n isInverse?: boolean;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n} & Omit<PressableProps, 'disabled'>;\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { TextButtonProps } from './TextButton.types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a Tailwind class name for the text button container based on its state and optional additional classes.
|
|
4
|
+
*
|
|
5
|
+
* This function computes the appropriate background class name for a text button's container, considering its
|
|
6
|
+
* `isPressed` and `isLoading` states. Additional Tailwind class names can also be appended using the `twClassName` parameter.
|
|
7
|
+
*
|
|
8
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
9
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
10
|
+
* @param isDisabled - Indicates whether the button is in a disabled state.
|
|
11
|
+
* @param twClassName - Additional Tailwind class names for customization.
|
|
12
|
+
* @returns A combined string of Tailwind class names for the container's background styling.
|
|
13
|
+
*
|
|
14
|
+
* Example:
|
|
15
|
+
* ```
|
|
16
|
+
* const classNames = generateTextButtonContainerClassNames({
|
|
17
|
+
* isPressed: true,
|
|
18
|
+
* isLoading: false,
|
|
19
|
+
* twClassName: 'rounded-full',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* console.log(classNames);
|
|
23
|
+
* // Output: "bg-background-pressed rounded-full"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const generateTextButtonContainerClassNames: ({ isPressed, isLoading, isDisabled, twClassName, }: Partial<TextButtonProps> & {
|
|
27
|
+
isPressed?: boolean | undefined;
|
|
28
|
+
}) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Generates a Tailwind class name for the text button's text based on its state.
|
|
31
|
+
*
|
|
32
|
+
* This function computes the appropriate text color and style class names for a text button,
|
|
33
|
+
* considering its `isPressed`, `isInverse`, and `isLoading` states.
|
|
34
|
+
*
|
|
35
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
36
|
+
* @param isInverse - Indicates whether the button is using an "inverse" theme.
|
|
37
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
38
|
+
* @returns A combined string of Tailwind class names for the text's color and style.
|
|
39
|
+
*
|
|
40
|
+
* Example:
|
|
41
|
+
* ```
|
|
42
|
+
* const classNames = generateTextButtonTextClassNames({
|
|
43
|
+
* isPressed: true,
|
|
44
|
+
* isInverse: false,
|
|
45
|
+
* isLoading: false,
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* console.log(classNames);
|
|
49
|
+
* // Output: "text-primary-defaultPressed underline"
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const generateTextButtonTextClassNames: ({ isPressed, isInverse, isLoading, }: Partial<TextButtonProps> & {
|
|
53
|
+
isPressed?: boolean | undefined;
|
|
54
|
+
}) => string;
|
|
55
|
+
//# sourceMappingURL=TextButton.utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextButton.utilities.d.ts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.utilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,qCAAqC;;MAO9C,MAQH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,gCAAgC;;MAMzC,MAeH,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTextButtonTextClassNames = exports.generateTextButtonContainerClassNames = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a Tailwind class name for the text button container based on its state and optional additional classes.
|
|
6
|
+
*
|
|
7
|
+
* This function computes the appropriate background class name for a text button's container, considering its
|
|
8
|
+
* `isPressed` and `isLoading` states. Additional Tailwind class names can also be appended using the `twClassName` parameter.
|
|
9
|
+
*
|
|
10
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
11
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
12
|
+
* @param isDisabled - Indicates whether the button is in a disabled state.
|
|
13
|
+
* @param twClassName - Additional Tailwind class names for customization.
|
|
14
|
+
* @returns A combined string of Tailwind class names for the container's background styling.
|
|
15
|
+
*
|
|
16
|
+
* Example:
|
|
17
|
+
* ```
|
|
18
|
+
* const classNames = generateTextButtonContainerClassNames({
|
|
19
|
+
* isPressed: true,
|
|
20
|
+
* isLoading: false,
|
|
21
|
+
* twClassName: 'rounded-full',
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* console.log(classNames);
|
|
25
|
+
* // Output: "bg-background-pressed rounded-full"
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
const generateTextButtonContainerClassNames = ({ isPressed = false, isLoading = false, isDisabled = false, twClassName = '', }) => {
|
|
29
|
+
const isPressedOrLoading = isPressed || isLoading;
|
|
30
|
+
const backgroundStyle = isPressedOrLoading
|
|
31
|
+
? 'bg-background-pressed'
|
|
32
|
+
: 'bg-transparent';
|
|
33
|
+
const opacityStyle = `opacity-${isDisabled ? 50 : 100}`;
|
|
34
|
+
return `${backgroundStyle} ${opacityStyle} ${twClassName}`;
|
|
35
|
+
};
|
|
36
|
+
exports.generateTextButtonContainerClassNames = generateTextButtonContainerClassNames;
|
|
37
|
+
/**
|
|
38
|
+
* Generates a Tailwind class name for the text button's text based on its state.
|
|
39
|
+
*
|
|
40
|
+
* This function computes the appropriate text color and style class names for a text button,
|
|
41
|
+
* considering its `isPressed`, `isInverse`, and `isLoading` states.
|
|
42
|
+
*
|
|
43
|
+
* @param isPressed - Indicates whether the button is currently being pressed.
|
|
44
|
+
* @param isInverse - Indicates whether the button is using an "inverse" theme.
|
|
45
|
+
* @param isLoading - Indicates whether the button is in a loading state.
|
|
46
|
+
* @returns A combined string of Tailwind class names for the text's color and style.
|
|
47
|
+
*
|
|
48
|
+
* Example:
|
|
49
|
+
* ```
|
|
50
|
+
* const classNames = generateTextButtonTextClassNames({
|
|
51
|
+
* isPressed: true,
|
|
52
|
+
* isInverse: false,
|
|
53
|
+
* isLoading: false,
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* console.log(classNames);
|
|
57
|
+
* // Output: "text-primary-defaultPressed underline"
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
const generateTextButtonTextClassNames = ({ isPressed = false, isInverse = false, isLoading = false, }) => {
|
|
61
|
+
let textColor, textStyle;
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
63
|
+
const isPressedOrLoading = isPressed || isLoading;
|
|
64
|
+
if (isInverse) {
|
|
65
|
+
textColor = 'text-primary-inverse';
|
|
66
|
+
textStyle = 'underline';
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
textColor = isPressedOrLoading
|
|
70
|
+
? 'text-primary-defaultPressed'
|
|
71
|
+
: 'text-primary-default';
|
|
72
|
+
textStyle = isPressedOrLoading ? 'underline' : 'no-underline';
|
|
73
|
+
}
|
|
74
|
+
return `${textColor} ${textStyle}`;
|
|
75
|
+
};
|
|
76
|
+
exports.generateTextButtonTextClassNames = generateTextButtonTextClassNames;
|
|
77
|
+
//# sourceMappingURL=TextButton.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextButton.utilities.js","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.utilities.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,qCAAqC,GAAG,CAAC,EACpD,SAAS,GAAG,KAAK,EACjB,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,EAAE,GAGjB,EAAU,EAAE;IACX,MAAM,kBAAkB,GAAG,SAAS,IAAI,SAAS,CAAC;IAClD,MAAM,eAAe,GAAG,kBAAkB;QACxC,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,gBAAgB,CAAC;IACrB,MAAM,YAAY,GAAG,WAAW,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAExD,OAAO,GAAG,eAAe,IAAI,YAAY,IAAI,WAAW,EAAE,CAAC;AAC7D,CAAC,CAAC;AAfW,QAAA,qCAAqC,yCAehD;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,MAAM,gCAAgC,GAAG,CAAC,EAC/C,SAAS,GAAG,KAAK,EACjB,SAAS,GAAG,KAAK,EACjB,SAAS,GAAG,KAAK,GAGlB,EAAU,EAAE;IACX,IAAI,SAAS,EAAE,SAAS,CAAC;IACzB,wEAAwE;IACxE,MAAM,kBAAkB,GAAG,SAAS,IAAI,SAAS,CAAC;IAClD,IAAI,SAAS,EAAE;QACb,SAAS,GAAG,sBAAsB,CAAC;QACnC,SAAS,GAAG,WAAW,CAAC;KACzB;SAAM;QACL,SAAS,GAAG,kBAAkB;YAC5B,CAAC,CAAC,6BAA6B;YAC/B,CAAC,CAAC,sBAAsB,CAAC;QAC3B,SAAS,GAAG,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC;KAC/D;IAED,OAAO,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC;AACrC,CAAC,CAAC;AArBW,QAAA,gCAAgC,oCAqB3C","sourcesContent":["/* eslint-disable jsdoc/check-param-names */\n/* eslint-disable jsdoc/require-param */\nimport type { TextButtonProps } from './TextButton.types';\n\n/**\n * Generates a Tailwind class name for the text button container based on its state and optional additional classes.\n *\n * This function computes the appropriate background class name for a text button's container, considering its\n * `isPressed` and `isLoading` states. Additional Tailwind class names can also be appended using the `twClassName` parameter.\n *\n * @param isPressed - Indicates whether the button is currently being pressed.\n * @param isLoading - Indicates whether the button is in a loading state.\n * @param isDisabled - Indicates whether the button is in a disabled state.\n * @param twClassName - Additional Tailwind class names for customization.\n * @returns A combined string of Tailwind class names for the container's background styling.\n *\n * Example:\n * ```\n * const classNames = generateTextButtonContainerClassNames({\n * isPressed: true,\n * isLoading: false,\n * twClassName: 'rounded-full',\n * });\n *\n * console.log(classNames);\n * // Output: \"bg-background-pressed rounded-full\"\n * ```\n */\nexport const generateTextButtonContainerClassNames = ({\n isPressed = false,\n isLoading = false,\n isDisabled = false,\n twClassName = '',\n}: Partial<TextButtonProps> & {\n isPressed?: boolean;\n}): string => {\n const isPressedOrLoading = isPressed || isLoading;\n const backgroundStyle = isPressedOrLoading\n ? 'bg-background-pressed'\n : 'bg-transparent';\n const opacityStyle = `opacity-${isDisabled ? 50 : 100}`;\n\n return `${backgroundStyle} ${opacityStyle} ${twClassName}`;\n};\n\n/**\n * Generates a Tailwind class name for the text button's text based on its state.\n *\n * This function computes the appropriate text color and style class names for a text button,\n * considering its `isPressed`, `isInverse`, and `isLoading` states.\n *\n * @param isPressed - Indicates whether the button is currently being pressed.\n * @param isInverse - Indicates whether the button is using an \"inverse\" theme.\n * @param isLoading - Indicates whether the button is in a loading state.\n * @returns A combined string of Tailwind class names for the text's color and style.\n *\n * Example:\n * ```\n * const classNames = generateTextButtonTextClassNames({\n * isPressed: true,\n * isInverse: false,\n * isLoading: false,\n * });\n *\n * console.log(classNames);\n * // Output: \"text-primary-defaultPressed underline\"\n * ```\n */\nexport const generateTextButtonTextClassNames = ({\n isPressed = false,\n isInverse = false,\n isLoading = false,\n}: Partial<TextButtonProps> & {\n isPressed?: boolean;\n}): string => {\n let textColor, textStyle;\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const isPressedOrLoading = isPressed || isLoading;\n if (isInverse) {\n textColor = 'text-primary-inverse';\n textStyle = 'underline';\n } else {\n textColor = isPressedOrLoading\n ? 'text-primary-defaultPressed'\n : 'text-primary-default';\n textStyle = isPressedOrLoading ? 'underline' : 'no-underline';\n }\n\n return `${textColor} ${textStyle}`;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var TextButton_1 = require("./TextButton");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(TextButton_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/TextButton/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAuC;AAA9B,sHAAA,OAAO,OAAA","sourcesContent":["export { default } from './TextButton';\nexport type { TextButtonProps } from './TextButton.types';\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const Text: import("react").ForwardRefExoticComponent<{
|
|
2
|
+
variant?: import("./components/Text").TextVariant | undefined;
|
|
3
|
+
children: import("react").ReactNode;
|
|
4
|
+
color?: import("./components/Text").TextColor | undefined;
|
|
5
|
+
fontWeight?: import("./components/Text").FontWeight | undefined;
|
|
6
|
+
fontStyle?: import("./components/Text").FontStyle | undefined;
|
|
7
|
+
twClassName?: string | undefined;
|
|
8
|
+
} & import("react-native").TextProps & import("react").RefAttributes<any>>;
|
|
9
|
+
export { TextVariant, TextColor, FontWeight, FontStyle, } from './components/Text';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI;;;;;;;0EAAmC,CAAC;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FontStyle = exports.FontWeight = exports.TextColor = exports.TextVariant = exports.Text = void 0;
|
|
7
|
+
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
8
|
+
const Text_1 = __importDefault(require("./components/Text"));
|
|
9
|
+
exports.Text = (0, design_system_twrnc_preset_1.withThemeProvider)(Text_1.default);
|
|
10
|
+
var Text_2 = require("./components/Text");
|
|
11
|
+
Object.defineProperty(exports, "TextVariant", { enumerable: true, get: function () { return Text_2.TextVariant; } });
|
|
12
|
+
Object.defineProperty(exports, "TextColor", { enumerable: true, get: function () { return Text_2.TextColor; } });
|
|
13
|
+
Object.defineProperty(exports, "FontWeight", { enumerable: true, get: function () { return Text_2.FontWeight; } });
|
|
14
|
+
Object.defineProperty(exports, "FontStyle", { enumerable: true, get: function () { return Text_2.FontStyle; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,8FAAkF;AAElF,6DAA8C;AAEjC,QAAA,IAAI,GAAG,IAAA,8CAAiB,EAAC,cAAa,CAAC,CAAC;AACrD,0CAK2B;AAJzB,mGAAA,WAAW,OAAA;AACX,iGAAA,SAAS,OAAA;AACT,kGAAA,UAAU,OAAA;AACV,iGAAA,SAAS,OAAA","sourcesContent":["import { withThemeProvider } from '@metamask-previews/design-system-twrnc-preset';\n\nimport TextComponent from './components/Text';\n\nexport const Text = withThemeProvider(TextComponent);\nexport {\n TextVariant,\n TextColor,\n FontWeight,\n FontStyle,\n} from './components/Text';\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonAnimatedProps } from './ButtonAnimated.types';
|
|
3
|
+
declare const ButtonAnimated: ({ onPressIn, onPressOut, disabled, ...props }: ButtonAnimatedProps) => React.JSX.Element;
|
|
4
|
+
export default ButtonAnimated;
|
|
5
|
+
//# sourceMappingURL=ButtonAnimated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonAnimated.d.ts","sourceRoot":"","sources":["../../../src/primitives/ButtonAnimated/ButtonAnimated.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,QAAA,MAAM,cAAc,kDAKjB,mBAAmB,sBAoCrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importDefault(require("react"));
|
|
30
|
+
const react_native_1 = require("react-native");
|
|
31
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
32
|
+
const ButtonAnimated = ({ onPressIn, onPressOut, disabled, ...props }) => {
|
|
33
|
+
const animation = (0, react_native_reanimated_1.useSharedValue)(1);
|
|
34
|
+
const scaleStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
35
|
+
return {
|
|
36
|
+
transform: [{ scale: animation.value }],
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
const onPressInHandler = (event) => {
|
|
40
|
+
animation.value = (0, react_native_reanimated_1.withTiming)(0.97, {
|
|
41
|
+
duration: 100,
|
|
42
|
+
easing: react_native_reanimated_1.Easing.bezier(0.3, 0.8, 0.3, 1),
|
|
43
|
+
});
|
|
44
|
+
onPressIn?.(event);
|
|
45
|
+
};
|
|
46
|
+
const onPressOutHandler = (event) => {
|
|
47
|
+
animation.value = (0, react_native_reanimated_1.withTiming)(1, {
|
|
48
|
+
duration: 100,
|
|
49
|
+
easing: react_native_reanimated_1.Easing.bezier(0.3, 0.8, 0.3, 1),
|
|
50
|
+
});
|
|
51
|
+
onPressOut?.(event);
|
|
52
|
+
};
|
|
53
|
+
return (<react_native_reanimated_1.default.View style={[scaleStyle, { alignItems: 'center', justifyContent: 'center' }]}>
|
|
54
|
+
<react_native_1.Pressable onPressIn={onPressInHandler} onPressOut={onPressOutHandler} disabled={disabled} {...props}/>
|
|
55
|
+
</react_native_reanimated_1.default.View>);
|
|
56
|
+
};
|
|
57
|
+
exports.default = ButtonAnimated;
|
|
58
|
+
//# sourceMappingURL=ButtonAnimated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonAnimated.js","sourceRoot":"","sources":["../../../src/primitives/ButtonAnimated/ButtonAnimated.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,+CAAyC;AACzC,mFAKiC;AAIjC,MAAM,cAAc,GAAG,CAAC,EACtB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACY,EAAE,EAAE;IACxB,MAAM,SAAS,GAAG,IAAA,wCAAc,EAAC,CAAC,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,IAAA,0CAAgB,EAAC,GAAG,EAAE;QACvC,OAAO;YACL,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;QACxD,SAAS,CAAC,KAAK,GAAG,IAAA,oCAAU,EAAC,IAAI,EAAE;YACjC,QAAQ,EAAE,GAAG;YACb,MAAM,EAAE,gCAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;SACxC,CAAC,CAAC;QACH,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,KAA4B,EAAE,EAAE;QACzD,SAAS,CAAC,KAAK,GAAG,IAAA,oCAAU,EAAC,CAAC,EAAE;YAC9B,QAAQ,EAAE,GAAG;YACb,MAAM,EAAE,gCAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;SACxC,CAAC,CAAC;QACH,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,iCAAQ,CAAC,IAAI,CACZ,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,CAAC,CAExE;MAAA,CAAC,wBAAS,CACR,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAC5B,UAAU,CAAC,CAAC,iBAAiB,CAAC,CAC9B,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,IAAI,KAAK,CAAC,EAEd;IAAA,EAAE,iCAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC","sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { Pressable } from 'react-native';\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n withTiming,\n Easing,\n} from 'react-native-reanimated';\n\nimport type { ButtonAnimatedProps } from './ButtonAnimated.types';\n\nconst ButtonAnimated = ({\n onPressIn,\n onPressOut,\n disabled,\n ...props\n}: ButtonAnimatedProps) => {\n const animation = useSharedValue(1);\n const scaleStyle = useAnimatedStyle(() => {\n return {\n transform: [{ scale: animation.value }],\n };\n });\n\n const onPressInHandler = (event: GestureResponderEvent) => {\n animation.value = withTiming(0.97, {\n duration: 100,\n easing: Easing.bezier(0.3, 0.8, 0.3, 1),\n });\n onPressIn?.(event);\n };\n\n const onPressOutHandler = (event: GestureResponderEvent) => {\n animation.value = withTiming(1, {\n duration: 100,\n easing: Easing.bezier(0.3, 0.8, 0.3, 1),\n });\n onPressOut?.(event);\n };\n\n return (\n <Animated.View\n style={[scaleStyle, { alignItems: 'center', justifyContent: 'center' }]}\n >\n <Pressable\n onPressIn={onPressInHandler}\n onPressOut={onPressOutHandler}\n disabled={disabled}\n {...props}\n />\n </Animated.View>\n );\n};\n\nexport default ButtonAnimated;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonAnimated.types.d.ts","sourceRoot":"","sources":["../../../src/primitives/ButtonAnimated/ButtonAnimated.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonAnimated.types.js","sourceRoot":"","sources":["../../../src/primitives/ButtonAnimated/ButtonAnimated.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PressableProps } from 'react-native';\n\n/**\n * ButtonAnimated component props.\n */\nexport type ButtonAnimatedProps = PressableProps;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/ButtonAnimated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ButtonAnimated_1 = require("./ButtonAnimated");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ButtonAnimated_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/ButtonAnimated/index.ts"],"names":[],"mappings":";;;;;;AAAA,mDAA2C;AAAlC,0HAAA,OAAO,OAAA","sourcesContent":["export { default } from './ButtonAnimated';\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ButtonBaseProps } from './ButtonBase.types';
|
|
2
|
+
export declare const DEFAULT_BUTTONBASE_PROPS: Pick<ButtonBaseProps, 'textProps' | 'size' | 'isLoading' | 'spinnerProps' | 'startIconProps' | 'endIconProps' | 'isDisabled' | 'isFullWidth'>;
|
|
3
|
+
//# sourceMappingURL=ButtonBase.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonBase.constants.d.ts","sourceRoot":"","sources":["../../../src/primitives/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI1D,eAAO,MAAM,wBAAwB,EAAE,IAAI,CACzC,eAAe,EACb,WAAW,GACX,MAAM,GACN,WAAW,GACX,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,YAAY,GACZ,aAAa,CAwBhB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_BUTTONBASE_PROPS = void 0;
|
|
4
|
+
const Icon_1 = require("../../components/Icon");
|
|
5
|
+
const Text_1 = require("../../components/Text");
|
|
6
|
+
const ButtonBase_types_1 = require("./ButtonBase.types");
|
|
7
|
+
// Defaults
|
|
8
|
+
exports.DEFAULT_BUTTONBASE_PROPS = {
|
|
9
|
+
textProps: {
|
|
10
|
+
variant: Text_1.TextVariant.BodyMd,
|
|
11
|
+
fontWeight: Text_1.FontWeight.Medium,
|
|
12
|
+
color: Text_1.TextColor.TextDefault,
|
|
13
|
+
numberOfLines: 1,
|
|
14
|
+
ellipsizeMode: 'clip',
|
|
15
|
+
},
|
|
16
|
+
size: ButtonBase_types_1.ButtonBaseSize.Lg,
|
|
17
|
+
isLoading: false,
|
|
18
|
+
spinnerProps: {
|
|
19
|
+
color: Icon_1.IconColor.IconDefault,
|
|
20
|
+
},
|
|
21
|
+
startIconProps: {
|
|
22
|
+
size: Icon_1.IconSize.Sm,
|
|
23
|
+
testID: 'start-icon',
|
|
24
|
+
},
|
|
25
|
+
endIconProps: {
|
|
26
|
+
size: Icon_1.IconSize.Sm,
|
|
27
|
+
testID: 'end-icon',
|
|
28
|
+
},
|
|
29
|
+
isDisabled: false,
|
|
30
|
+
isFullWidth: false,
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=ButtonBase.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonBase.constants.js","sourceRoot":"","sources":["../../../src/primitives/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":";;;AAAA,gDAA4D;AAC5D,gDAA2E;AAE3E,yDAAoD;AAEpD,WAAW;AACE,QAAA,wBAAwB,GAUjC;IACF,SAAS,EAAE;QACT,OAAO,EAAE,kBAAW,CAAC,MAAM;QAC3B,UAAU,EAAE,iBAAU,CAAC,MAAM;QAC7B,KAAK,EAAE,gBAAS,CAAC,WAAW;QAC5B,aAAa,EAAE,CAAC;QAChB,aAAa,EAAE,MAAM;KACtB;IACD,IAAI,EAAE,iCAAc,CAAC,EAAE;IACvB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE;QACZ,KAAK,EAAE,gBAAS,CAAC,WAAW;KAC7B;IACD,cAAc,EAAE;QACd,IAAI,EAAE,eAAQ,CAAC,EAAE;QACjB,MAAM,EAAE,YAAY;KACrB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,eAAQ,CAAC,EAAE;QACjB,MAAM,EAAE,UAAU;KACnB;IACD,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,KAAK;CACnB,CAAC","sourcesContent":["import { IconSize, IconColor } from '../../components/Icon';\nimport { TextColor, TextVariant, FontWeight } from '../../components/Text';\nimport type { ButtonBaseProps } from './ButtonBase.types';\nimport { ButtonBaseSize } from './ButtonBase.types';\n\n// Defaults\nexport const DEFAULT_BUTTONBASE_PROPS: Pick<\n ButtonBaseProps,\n | 'textProps'\n | 'size'\n | 'isLoading'\n | 'spinnerProps'\n | 'startIconProps'\n | 'endIconProps'\n | 'isDisabled'\n | 'isFullWidth'\n> = {\n textProps: {\n variant: TextVariant.BodyMd,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n numberOfLines: 1,\n ellipsizeMode: 'clip',\n },\n size: ButtonBaseSize.Lg,\n isLoading: false,\n spinnerProps: {\n color: IconColor.IconDefault,\n },\n startIconProps: {\n size: IconSize.Sm,\n testID: 'start-icon',\n },\n endIconProps: {\n size: IconSize.Sm,\n testID: 'end-icon',\n },\n isDisabled: false,\n isFullWidth: false,\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonBaseProps } from './ButtonBase.types';
|
|
3
|
+
declare const ButtonBase: ({ children, textProps, size, isLoading, loadingText, spinnerProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, style, ...props }: ButtonBaseProps) => React.JSX.Element;
|
|
4
|
+
export default ButtonBase;
|
|
5
|
+
//# sourceMappingURL=ButtonBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../../src/primitives/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAWvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,QAAA,MAAM,UAAU,uNAkBb,eAAe,sBAyEjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
30
|
+
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const react_native_1 = require("react-native");
|
|
33
|
+
const Icon_1 = __importDefault(require("../../components/Icon"));
|
|
34
|
+
const Spinner_1 = __importDefault(require("../../temp-components/Spinner"));
|
|
35
|
+
const ButtonAnimated_1 = __importDefault(require("../ButtonAnimated"));
|
|
36
|
+
const TextOrChildren_1 = __importDefault(require("../TextOrChildren/TextOrChildren"));
|
|
37
|
+
const ButtonBase_constants_1 = require("./ButtonBase.constants");
|
|
38
|
+
const ButtonBase_utilities_1 = require("./ButtonBase.utilities");
|
|
39
|
+
const ButtonBase = ({ children, textProps, size = ButtonBase_constants_1.DEFAULT_BUTTONBASE_PROPS.size, isLoading, loadingText, spinnerProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, style, ...props }) => {
|
|
40
|
+
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
41
|
+
const twContainerClassNames = (0, react_1.useMemo)(() => {
|
|
42
|
+
return (0, ButtonBase_utilities_1.generateButtonBaseContainerClassNames)({
|
|
43
|
+
size,
|
|
44
|
+
twClassName,
|
|
45
|
+
isLoading,
|
|
46
|
+
isDisabled,
|
|
47
|
+
isFullWidth,
|
|
48
|
+
});
|
|
49
|
+
}, [size, twClassName, isLoading, isDisabled, isFullWidth]);
|
|
50
|
+
const finalTextProps = {
|
|
51
|
+
...ButtonBase_constants_1.DEFAULT_BUTTONBASE_PROPS.textProps,
|
|
52
|
+
...textProps,
|
|
53
|
+
};
|
|
54
|
+
const finalStartIconName = startIconName ?? startIconProps?.name;
|
|
55
|
+
const finalStartIconProps = {
|
|
56
|
+
...ButtonBase_constants_1.DEFAULT_BUTTONBASE_PROPS.startIconProps,
|
|
57
|
+
...startIconProps,
|
|
58
|
+
};
|
|
59
|
+
const finalEndIconName = endIconName ?? endIconProps?.name;
|
|
60
|
+
const finalEndIconProps = {
|
|
61
|
+
...ButtonBase_constants_1.DEFAULT_BUTTONBASE_PROPS.endIconProps,
|
|
62
|
+
...endIconProps,
|
|
63
|
+
};
|
|
64
|
+
const finalSpinnerProps = {
|
|
65
|
+
...ButtonBase_constants_1.DEFAULT_BUTTONBASE_PROPS.spinnerProps,
|
|
66
|
+
loadingText,
|
|
67
|
+
loadingTextProps: {
|
|
68
|
+
numberOfLines: 1,
|
|
69
|
+
},
|
|
70
|
+
...spinnerProps,
|
|
71
|
+
};
|
|
72
|
+
return (<ButtonAnimated_1.default disabled={isDisabled || isLoading} accessibilityRole="button" accessible style={[tw `${twContainerClassNames}`, style]} {...props}>
|
|
73
|
+
<react_native_1.View style={tw `absolute inset-0 flex items-center justify-center ${isLoading ? 'opacity-100' : 'opacity-0'}`} testID="spinner-container">
|
|
74
|
+
<Spinner_1.default {...finalSpinnerProps}/>
|
|
75
|
+
</react_native_1.View>
|
|
76
|
+
<react_native_1.View style={tw `flex-row items-center justify-center gap-x-2 ${isLoading ? 'opacity-0' : 'opacity-100'}`} testID="content-container">
|
|
77
|
+
{finalStartIconName ? (<Icon_1.default name={finalStartIconName} {...finalStartIconProps}/>) : (startAccessory)}
|
|
78
|
+
<TextOrChildren_1.default textProps={finalTextProps}>{children}</TextOrChildren_1.default>
|
|
79
|
+
{finalEndIconName ? (<Icon_1.default name={finalEndIconName} {...finalEndIconProps}/>) : (endAccessory)}
|
|
80
|
+
</react_native_1.View>
|
|
81
|
+
</ButtonAnimated_1.default>);
|
|
82
|
+
};
|
|
83
|
+
exports.default = ButtonBase;
|
|
84
|
+
//# sourceMappingURL=ButtonBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/primitives/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAiE;AACjE,8FAA4E;AAC5E,+CAAuC;AACvC,+CAAoC;AAGpC,iEAAyC;AAGzC,4EAAoD;AACpD,uEAA+C;AAC/C,sFAA8D;AAC9D,iEAAkE;AAElE,iEAA+E;AAE/E,MAAM,UAAU,GAAG,CAAC,EAClB,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,+CAAwB,CAAC,IAAI,EACpC,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,KAAK,EACL,GAAG,KAAK,EACQ,EAAE,EAAE;IACpB,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,qBAAqB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACzC,OAAO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CACH,KAAK,CAAC,CAAC,EAAE,CAAA,gDACP,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAC5B,EAAE,CAAC,CACH,MAAM,CAAC,mBAAmB,CAE1B;QAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC,CACpB,CAAC,cAAI,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,CAAC,IAAI,mBAAmB,CAAC,EAAG,CAC5D,CAAC,CAAC,CAAC,CACF,cAAc,CACf,CACD;QAAA,CAAC,wBAAc,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,wBAAc,CACrE;QAAA,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAClB,CAAC,cAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,iBAAiB,CAAC,EAAG,CACxD,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CACH;MAAA,EAAE,mBAAI,CACR;IAAA,EAAE,wBAAc,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useMemo } from 'react';\nimport { View } from 'react-native';\n\nimport type { IconProps } from '../../components/Icon';\nimport Icon from '../../components/Icon';\nimport type { TextProps } from '../../components/Text/Text.types';\nimport type { SpinnerProps } from '../../temp-components/Spinner';\nimport Spinner from '../../temp-components/Spinner';\nimport ButtonAnimated from '../ButtonAnimated';\nimport TextOrChildren from '../TextOrChildren/TextOrChildren';\nimport { DEFAULT_BUTTONBASE_PROPS } from './ButtonBase.constants';\nimport type { ButtonBaseProps } from './ButtonBase.types';\nimport { generateButtonBaseContainerClassNames } from './ButtonBase.utilities';\n\nconst ButtonBase = ({\n children,\n textProps,\n size = DEFAULT_BUTTONBASE_PROPS.size,\n isLoading,\n loadingText,\n spinnerProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n isDisabled,\n isFullWidth,\n twClassName,\n style,\n ...props\n}: ButtonBaseProps) => {\n const tw = useTailwind();\n const twContainerClassNames = useMemo(() => {\n return generateButtonBaseContainerClassNames({\n size,\n twClassName,\n isLoading,\n isDisabled,\n isFullWidth,\n });\n }, [size, twClassName, isLoading, isDisabled, isFullWidth]);\n\n const finalTextProps: Omit<Partial<TextProps>, 'children'> = {\n ...DEFAULT_BUTTONBASE_PROPS.textProps,\n ...textProps,\n };\n const finalStartIconName = startIconName ?? startIconProps?.name;\n const finalStartIconProps: Partial<IconProps> = {\n ...DEFAULT_BUTTONBASE_PROPS.startIconProps,\n ...startIconProps,\n };\n\n const finalEndIconName = endIconName ?? endIconProps?.name;\n const finalEndIconProps: Partial<IconProps> = {\n ...DEFAULT_BUTTONBASE_PROPS.endIconProps,\n ...endIconProps,\n };\n\n const finalSpinnerProps: SpinnerProps = {\n ...DEFAULT_BUTTONBASE_PROPS.spinnerProps,\n loadingText,\n loadingTextProps: {\n numberOfLines: 1,\n },\n ...spinnerProps,\n };\n\n return (\n <ButtonAnimated\n disabled={isDisabled || isLoading}\n accessibilityRole=\"button\"\n accessible\n style={[tw`${twContainerClassNames}`, style]}\n {...props}\n >\n <View\n style={tw`absolute inset-0 flex items-center justify-center ${\n isLoading ? 'opacity-100' : 'opacity-0'\n }`}\n testID=\"spinner-container\"\n >\n <Spinner {...finalSpinnerProps} />\n </View>\n <View\n style={tw`flex-row items-center justify-center gap-x-2 ${\n isLoading ? 'opacity-0' : 'opacity-100'\n }`}\n testID=\"content-container\"\n >\n {finalStartIconName ? (\n <Icon name={finalStartIconName} {...finalStartIconProps} />\n ) : (\n startAccessory\n )}\n <TextOrChildren textProps={finalTextProps}>{children}</TextOrChildren>\n {finalEndIconName ? (\n <Icon name={finalEndIconName} {...finalEndIconProps} />\n ) : (\n endAccessory\n )}\n </View>\n </ButtonAnimated>\n );\n};\n\nexport default ButtonBase;\n"]}
|