@artsy/palette-mobile 17.8.0 → 17.10.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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { AccessibilityProps, Insets, TouchableWithoutFeedbackProps } from "react-native";
2
+ import { Insets, TouchableWithoutFeedbackProps } from "react-native";
3
3
  import { FlexProps } from "../Flex";
4
- export interface CheckboxProps extends Omit<TouchableWithoutFeedbackProps, "hitSlop">, Omit<FlexProps, "hitSlop"> {
4
+ type CheckboxProps = Omit<TouchableWithoutFeedbackProps, "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
- checkboxAccessibilityProps?: AccessibilityProps;
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;
@@ -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, checkboxAccessibilityProps, ...restProps }) => {
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
- // TODO: migrate away from using this checkbox implementation and
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(TouchableWithoutFeedback, { 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", ...checkboxAccessibilityProps, children: _jsx(CssTransition, { style: [
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("./Checkbox").CheckboxProps>;
4
+ component: import("react").FC<Omit<import("react-native/types").TouchableWithoutFeedbackProps, "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;
@@ -6,6 +6,7 @@ export interface RadioButtonProps extends Omit<TouchableWithoutFeedbackProps, "h
6
6
  accessibilityState?: {
7
7
  checked: boolean;
8
8
  };
9
+ accessibilityLabel?: string;
9
10
  block?: boolean;
10
11
  disabled?: boolean;
11
12
  error?: boolean;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "17.8.0",
3
+ "version": "17.10.0",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "RCT_METRO_PORT=8082 react-native run-android --port 8082 --terminal terminal",