@artsy/palette-mobile 13.2.13 → 13.2.14
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TextVariant } from "@artsy/palette-tokens/dist/typography/v3";
|
|
2
3
|
import { Insets, TouchableWithoutFeedbackProps } from "react-native";
|
|
3
4
|
import { FlexProps } from "../Flex";
|
|
4
5
|
export interface RadioButtonProps extends Omit<TouchableWithoutFeedbackProps, "hitSlop">, Omit<FlexProps, "hitSlop"> {
|
|
@@ -8,6 +9,7 @@ export interface RadioButtonProps extends Omit<TouchableWithoutFeedbackProps, "h
|
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
error?: boolean;
|
|
10
11
|
text?: React.ReactElement | string;
|
|
12
|
+
textVariant?: TextVariant;
|
|
11
13
|
subtitle?: React.ReactElement | string;
|
|
12
14
|
accessibilityState?: {
|
|
13
15
|
checked: boolean;
|
|
@@ -14,7 +14,7 @@ const Flex_1 = require("../Flex");
|
|
|
14
14
|
const Text_1 = require("../Text");
|
|
15
15
|
const RADIOBUTTON_SIZE = 20;
|
|
16
16
|
const DURATION = 150;
|
|
17
|
-
const RadioButton = ({ selected, disabled, error, onPress, text, subtitle, accessibilityState, ...restProps }) => {
|
|
17
|
+
const RadioButton = ({ selected, disabled, error, onPress, text, textVariant = "md", subtitle, accessibilityState, ...restProps }) => {
|
|
18
18
|
const { color, space } = (0, useTheme_1.useTheme)();
|
|
19
19
|
const fontScale = react_native_1.PixelRatio.getFontScale();
|
|
20
20
|
const radioButtonSize = RADIOBUTTON_SIZE * fontScale;
|
|
@@ -55,7 +55,7 @@ const RadioButton = ({ selected, disabled, error, onPress, text, subtitle, acces
|
|
|
55
55
|
{ marginRight: space(1) * fontScale },
|
|
56
56
|
radioButtonStyle,
|
|
57
57
|
], animate: ["borderColor"], duration: DURATION, children: !!selected &&
|
|
58
|
-
(!!disabled ? ((0, jsx_runtime_1.jsx)(exports.DisabledDot, { size: radioButtonSize })) : ((0, jsx_runtime_1.jsx)(exports.RadioDot, { size: radioButtonSize }))) }) }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { justifyContent: "center", children: !!text && ((0, jsx_runtime_1.jsx)(Text_1.Text, { variant:
|
|
58
|
+
(!!disabled ? ((0, jsx_runtime_1.jsx)(exports.DisabledDot, { size: radioButtonSize })) : ((0, jsx_runtime_1.jsx)(exports.RadioDot, { size: radioButtonSize }))) }) }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { justifyContent: "center", children: !!text && ((0, jsx_runtime_1.jsx)(Text_1.Text, { variant: textVariant, color: textColor, children: text })) })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { ml: `${(RADIOBUTTON_SIZE + space(1)) * fontScale}px`, mt: "6px", children: !!subtitle && ((0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "xs", color: subtitleColor, children: subtitle })) })] }) }));
|
|
59
59
|
};
|
|
60
60
|
exports.RadioButton = RadioButton;
|
|
61
61
|
// styled-component does not have support for Animated.View
|