@artsy/palette-mobile 13.2.36 → 13.2.37

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.
@@ -0,0 +1,8 @@
1
+ import { FC } from "react";
2
+ export interface ChipProps {
3
+ title: string;
4
+ subtitle?: string;
5
+ image?: string;
6
+ onPress?: () => void;
7
+ }
8
+ export declare const Chip: FC<ChipProps>;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAnimationState, View } from "moti";
3
+ import { useColor, useSpace } from "../../utils/hooks";
4
+ import { Flex } from "../Flex";
5
+ import { Image } from "../Image";
6
+ import { Text } from "../Text";
7
+ import { Touchable } from "../Touchable";
8
+ export const Chip = ({ image, title, subtitle, onPress }) => {
9
+ const color = useColor();
10
+ const space = useSpace();
11
+ const animatedState = useAnimationState({
12
+ from: { backgroundColor: color("black10") },
13
+ to: { backgroundColor: color("black5") },
14
+ });
15
+ const handleOnPressIn = () => {
16
+ animatedState.transitionTo("from");
17
+ };
18
+ const handleOnPressOut = () => {
19
+ animatedState.transitionTo("to");
20
+ };
21
+ return (_jsx(Touchable, { onPress: onPress, onPressIn: handleOnPressIn, onPressOut: handleOnPressOut, noFeedback: true, children: _jsxs(Flex, { flexDirection: "row", minWidth: 200, height: 70, overflow: "hidden", borderRadius: 5, children: [!!image && _jsx(Image, { src: image, width: 70, height: 70 }), _jsxs(View, { state: animatedState, style: {
22
+ flex: 1,
23
+ padding: space(1),
24
+ justifyContent: "center",
25
+ }, children: [!!subtitle && (_jsx(Text, { variant: "xs", color: "black60", selectable: false, children: subtitle })), _jsx(Text, { variant: "sm-display", selectable: false, children: title })] })] }) }));
26
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ title: string;
4
+ component: import("react").FC<import("./Chip").ChipProps>;
5
+ };
6
+ export default _default;
7
+ export declare const Variations: () => JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Alert } from "react-native";
3
+ import { Chip } from "./Chip";
4
+ import { Flex } from "../Flex";
5
+ export default {
6
+ title: "Chip",
7
+ component: Chip,
8
+ };
9
+ export const Variations = () => {
10
+ return (_jsxs(Flex, { p: 2, justifyContent: "center", alignItems: "center", gap: 20, children: [_jsx(Chip, { title: "Only title" }), _jsx(Chip, { title: "Title and subtitle", subtitle: "Subtitle" }), _jsx(Chip, { title: "Title and image", image: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }), _jsx(Chip, { title: "Title, subtitle and image", subtitle: "Cow image", image: "https://d32dm0rphc51dk.cloudfront.net/A983VUIZusVBKy420xP3ow/normalized.jpg" }), _jsx(Chip, { title: "Press me", subtitle: "Pressing alerts something", onPress: () => Alert.alert("Pressed") })] }));
11
+ };
@@ -0,0 +1 @@
1
+ export * from "./Chip";
@@ -0,0 +1 @@
1
+ export * from "./Chip";
@@ -7,6 +7,7 @@ export * from "./BorderBox";
7
7
  export * from "./Box";
8
8
  export * from "./Button";
9
9
  export * from "./Checkbox";
10
+ export * from "./Chip";
10
11
  export * from "./ClassTheme";
11
12
  export * from "./Collapse";
12
13
  export * from "./CollapsibleMenuItem";
@@ -7,6 +7,7 @@ export * from "./BorderBox";
7
7
  export * from "./Box";
8
8
  export * from "./Button";
9
9
  export * from "./Checkbox";
10
+ export * from "./Chip";
10
11
  export * from "./ClassTheme";
11
12
  export * from "./Collapse";
12
13
  export * from "./CollapsibleMenuItem";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "13.2.36",
3
+ "version": "13.2.37",
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",