@artsy/palette-mobile 17.8.0 → 17.9.0
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/elements/Checkbox/Checkbox.d.ts +5 -4
- package/dist/elements/Checkbox/Checkbox.js +4 -6
- package/dist/elements/Checkbox/Checkbox.stories.d.ts +11 -1
- package/dist/elements/Radio/RadioButton.d.ts +1 -0
- package/dist/elements/Radio/RadioButton.js +2 -2
- package/dist/elements/Text/LinkText.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { Insets, TouchableOpacityProps } from "react-native";
|
|
3
3
|
import { FlexProps } from "../Flex";
|
|
4
|
-
|
|
4
|
+
type CheckboxProps = Omit<TouchableOpacityProps, "hitSlop"> & Omit<FlexProps, "hitSlop"> & {
|
|
5
5
|
hitSlop?: Insets;
|
|
6
6
|
checked?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
@@ -9,8 +9,9 @@ export interface CheckboxProps extends Omit<TouchableWithoutFeedbackProps, "hitS
|
|
|
9
9
|
text?: React.ReactElement | string;
|
|
10
10
|
subtitle?: React.ReactElement | string;
|
|
11
11
|
children?: React.ReactElement | string;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
accessibilityLabel?: string;
|
|
13
|
+
accessibilityHint?: string;
|
|
14
|
+
};
|
|
14
15
|
export declare const Checkbox: React.FC<CheckboxProps>;
|
|
15
16
|
interface CheckMarkProps {
|
|
16
17
|
size: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { themeGet } from "@styled-system/theme-get";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { PixelRatio,
|
|
4
|
+
import { PixelRatio, Pressable, StyleSheet } from "react-native";
|
|
5
5
|
import styled from "styled-components/native";
|
|
6
6
|
import { CssTransition } from "../../animation/CssTransition";
|
|
7
7
|
import { useTheme } from "../../utils/hooks/useTheme";
|
|
@@ -10,7 +10,7 @@ import { Flex } from "../Flex";
|
|
|
10
10
|
import { Text } from "../Text";
|
|
11
11
|
const CHECKBOX_SIZE = 20;
|
|
12
12
|
const DURATION = 250;
|
|
13
|
-
export const Checkbox = ({ checked: checkedProp, disabled, error, onPress, text, subtitle, children,
|
|
13
|
+
export const Checkbox = ({ checked: checkedProp, disabled, error, onPress, text, subtitle, children, accessibilityLabel, accessibilityHint, ...restProps }) => {
|
|
14
14
|
const { color, space } = useTheme();
|
|
15
15
|
const fontScale = PixelRatio.getFontScale();
|
|
16
16
|
const checkboxSize = CHECKBOX_SIZE * fontScale;
|
|
@@ -43,15 +43,13 @@ export const Checkbox = ({ checked: checkedProp, disabled, error, onPress, text,
|
|
|
43
43
|
: checkboxStyles[error ? "error" : "default"][isChecked ? "checked" : "unchecked"];
|
|
44
44
|
const textColor = error ? color("red100") : disabled ? color("mono30") : color("mono100");
|
|
45
45
|
const subtitleColor = error ? color("red100") : disabled ? color("mono30") : color("mono60");
|
|
46
|
-
|
|
47
|
-
// use the one from the community solutions - reasoning - this is an inaccessible component
|
|
48
|
-
return (_jsx(TouchableWithoutFeedback, { accessibilityRole: "checkbox", onPress: (event) => {
|
|
46
|
+
return (_jsx(Pressable, { accessibilityRole: "checkbox", accessibilityState: { checked: isChecked, disabled }, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, onPress: (event) => {
|
|
49
47
|
if (disabled) {
|
|
50
48
|
return;
|
|
51
49
|
}
|
|
52
50
|
setChecked(!checked);
|
|
53
51
|
onPress?.(event);
|
|
54
|
-
}, children: _jsxs(Flex, { flex: 1, ...restProps, children: [_jsxs(Flex, { flexDirection: "row", children: [_jsx(Flex, { mt: "2px",
|
|
52
|
+
}, children: _jsxs(Flex, { flex: 1, ...restProps, children: [_jsxs(Flex, { flexDirection: "row", children: [_jsx(Flex, { mt: "2px", children: _jsx(CssTransition, { style: [
|
|
55
53
|
styles(fontScale).container,
|
|
56
54
|
text || subtitle || children ? { marginRight: space(1) * fontScale } : {},
|
|
57
55
|
checkboxStyle,
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: import("react").FC<import("
|
|
4
|
+
component: import("react").FC<Omit<import("react-native/types").TouchableOpacityProps, "hitSlop"> & Omit<import("..").BoxProps, "hitSlop"> & {
|
|
5
|
+
hitSlop?: import("react-native/types").Insets | undefined;
|
|
6
|
+
checked?: boolean | undefined;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
error?: boolean | undefined;
|
|
9
|
+
text?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
10
|
+
subtitle?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
11
|
+
children?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
12
|
+
accessibilityLabel?: string | undefined;
|
|
13
|
+
accessibilityHint?: string | undefined;
|
|
14
|
+
}>;
|
|
5
15
|
};
|
|
6
16
|
export default _default;
|
|
7
17
|
export declare function Variants(): JSX.Element;
|
|
@@ -8,7 +8,7 @@ import { Flex } from "../Flex";
|
|
|
8
8
|
import { Text } from "../Text";
|
|
9
9
|
const RADIOBUTTON_SIZE = 20;
|
|
10
10
|
const DURATION = 150;
|
|
11
|
-
export const RadioButton = ({ accessibilityState, block, disabled, error, onPress, selected, subtitle, text, textVariant = "sm-display", ...restProps }) => {
|
|
11
|
+
export const RadioButton = ({ accessibilityState, accessibilityLabel, block, disabled, error, onPress, selected, subtitle, text, textVariant = "sm-display", ...restProps }) => {
|
|
12
12
|
const { color, space } = useTheme();
|
|
13
13
|
const fontScale = PixelRatio.getFontScale();
|
|
14
14
|
const radioButtonSize = RADIOBUTTON_SIZE * fontScale;
|
|
@@ -45,7 +45,7 @@ export const RadioButton = ({ accessibilityState, block, disabled, error, onPres
|
|
|
45
45
|
radioButtonStyle,
|
|
46
46
|
], animate: ["borderColor"], duration: DURATION, children: !!selected &&
|
|
47
47
|
(!!disabled ? (_jsx(DisabledDot, { size: radioButtonSize })) : (_jsx(RadioDot, { size: radioButtonSize }))) }) }));
|
|
48
|
-
return (_jsx(TouchableWithoutFeedback, { accessibilityRole: "radio", accessibilityState: accessibilityState, onPress: (event) => {
|
|
48
|
+
return (_jsx(TouchableWithoutFeedback, { accessibilityRole: "radio", accessibilityLabel: accessibilityLabel, accessibilityState: accessibilityState, onPress: (event) => {
|
|
49
49
|
if (disabled) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from "./Text";
|
|
3
|
-
export const LinkText = ({ style, ...props }) => (_jsx(Text, { color: "mono100", ...props, style: [style, { textDecorationLine: "underline" }] }));
|
|
3
|
+
export const LinkText = ({ style, ...props }) => (_jsx(Text, { accessibilityRole: "link", color: "mono100", ...props, style: [style, { textDecorationLine: "underline" }] }));
|
package/package.json
CHANGED