@artsy/palette-mobile 13.1.21 → 13.1.22
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.
|
@@ -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,
|
|
17
|
+
const RadioButton = ({ selected, disabled, error, onPress, text, 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;
|
|
@@ -50,7 +50,7 @@ const RadioButton = ({ selected, disabled, error, onPress, style, text, subtitle
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
onPress?.(event);
|
|
53
|
-
}, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { ...restProps, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { mt: "2px", children: (0, jsx_runtime_1.jsx)(animation_1.CssTransition, { style: [
|
|
53
|
+
}, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { ...restProps, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { mt: "2px", children: (0, jsx_runtime_1.jsx)(animation_1.CssTransition, { style: [
|
|
54
54
|
styles(fontScale).container,
|
|
55
55
|
{ marginRight: space(1) * fontScale },
|
|
56
56
|
radioButtonStyle,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_native_1 = require("@storybook/react-native");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const RadioButton_1 = require("./RadioButton");
|
|
7
|
+
const helpers_1 = require("../../storybook/helpers");
|
|
8
|
+
const Flex_1 = require("../Flex");
|
|
9
|
+
exports.default = {
|
|
10
|
+
title: "RadioButton",
|
|
11
|
+
component: RadioButton_1.RadioButton,
|
|
12
|
+
};
|
|
13
|
+
(0, react_native_1.storiesOf)("RadioButton", module).add("Default", () => {
|
|
14
|
+
const [metric, setMetric] = (0, react_1.useState)("cm");
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(helpers_1.List, { contentContainerStyle: {
|
|
16
|
+
marginHorizontal: 20,
|
|
17
|
+
justifyContent: "flex-start",
|
|
18
|
+
alignItems: "flex-start",
|
|
19
|
+
}, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", gap: 20, children: [(0, jsx_runtime_1.jsx)(RadioButton_1.RadioButton, { onPress: () => {
|
|
20
|
+
setMetric("cm");
|
|
21
|
+
}, selected: metric === "cm", text: "centimeters" }), (0, jsx_runtime_1.jsx)(RadioButton_1.RadioButton, { onPress: () => {
|
|
22
|
+
setMetric("in");
|
|
23
|
+
}, selected: metric === "in", text: "inches" })] }) }));
|
|
24
|
+
});
|