@artsy/palette-mobile 19.15.1 → 19.16.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,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export declare
|
|
1
|
+
import { Avatar } from "./Avatar";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
declare const meta: Meta<typeof Avatar>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type AvatarStory = StoryObj<typeof Avatar>;
|
|
6
|
+
export declare const Default: AvatarStory;
|
|
7
|
+
export declare const WithImage: AvatarStory;
|
|
8
|
+
export declare const WithInitials: AvatarStory;
|
|
9
|
+
export declare const Variants: AvatarStory;
|
|
@@ -1,11 +1,52 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar } from "./Avatar";
|
|
3
3
|
import { List, Row } from "../../storybook/helpers";
|
|
4
|
-
|
|
4
|
+
const meta = {
|
|
5
5
|
title: "Avatar",
|
|
6
6
|
component: Avatar,
|
|
7
|
+
argTypes: {
|
|
8
|
+
size: {
|
|
9
|
+
control: { type: "select" },
|
|
10
|
+
options: ["xxs", "xs", "sm", "md"],
|
|
11
|
+
description: "The size of the Avatar",
|
|
12
|
+
},
|
|
13
|
+
initials: {
|
|
14
|
+
control: { type: "text" },
|
|
15
|
+
description: "If an image is missing, show initials instead",
|
|
16
|
+
},
|
|
17
|
+
src: {
|
|
18
|
+
control: { type: "text" },
|
|
19
|
+
description: "URL of the avatar image",
|
|
20
|
+
},
|
|
21
|
+
blurhash: {
|
|
22
|
+
control: { type: "text" },
|
|
23
|
+
description: "Blurhash string for the image placeholder",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
7
26
|
};
|
|
27
|
+
export default meta;
|
|
8
28
|
const sizes = ["md", "sm", "xs", "xxs"];
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
29
|
+
export const Default = {
|
|
30
|
+
args: {
|
|
31
|
+
initials: "AB",
|
|
32
|
+
size: "md",
|
|
33
|
+
},
|
|
34
|
+
render: (args) => _jsx(Avatar, { ...args }),
|
|
35
|
+
};
|
|
36
|
+
export const WithImage = {
|
|
37
|
+
args: {
|
|
38
|
+
src: "https://placekitten.com/300/300",
|
|
39
|
+
size: "md",
|
|
40
|
+
},
|
|
41
|
+
render: (args) => _jsx(Avatar, { ...args }),
|
|
42
|
+
};
|
|
43
|
+
export const WithInitials = {
|
|
44
|
+
args: {
|
|
45
|
+
initials: "JD",
|
|
46
|
+
size: "md",
|
|
47
|
+
},
|
|
48
|
+
render: (args) => _jsx(Avatar, { ...args }),
|
|
49
|
+
};
|
|
50
|
+
export const Variants = {
|
|
51
|
+
render: () => (_jsxs(List, { children: [_jsx(Row, { children: sizes.map((s) => (_jsx(Avatar, { initials: "A", size: s }, s))) }), _jsx(Row, { children: sizes.map((s) => (_jsx(Avatar, { initials: "AA", size: s }, s))) }), _jsx(Row, { children: sizes.map((s) => (_jsx(Avatar, { src: "https://placekitten.com/300/300", size: s }, s))) })] })),
|
|
52
|
+
};
|
|
@@ -5,7 +5,8 @@ import { Appearance } from "react-native";
|
|
|
5
5
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
6
6
|
import { Theme } from "../Theme";
|
|
7
7
|
import { Flex } from "../elements/Flex";
|
|
8
|
-
import {
|
|
8
|
+
import { Pill } from "../elements/Pill";
|
|
9
|
+
import { Text } from "../elements/Text";
|
|
9
10
|
import { ScreenDimensionsProvider } from "../utils/hooks";
|
|
10
11
|
export const withTheme = (story) => (_jsxs(Theme, { theme: "v3light", children: [_jsx(Text, { color: "red", children: "aaww" }), story()] }));
|
|
11
12
|
const DARK_MODE_STORAGE_KEY = "dark-mode-mode";
|
|
@@ -38,5 +39,5 @@ export const useDarkModeSwitcher = (story) => {
|
|
|
38
39
|
};
|
|
39
40
|
const isDarkMode = mode === "dark" || (mode === "system" && systemMode === "dark");
|
|
40
41
|
const theme = isDarkMode ? "v3dark" : "v3light";
|
|
41
|
-
return (_jsx(ScreenDimensionsProvider, { children: _jsx(SafeAreaProvider, { children: _jsx(Theme, { theme: theme, children: _jsxs(Flex, { flex: 1, backgroundColor: "background", children: [_jsxs(Flex, { flexDirection: "row", justifyContent: "space-around", children: [
|
|
42
|
+
return (_jsx(ScreenDimensionsProvider, { children: _jsx(SafeAreaProvider, { children: _jsx(Theme, { theme: theme, children: _jsxs(Flex, { flex: 1, backgroundColor: "background", children: [_jsxs(Flex, { flexDirection: "row", justifyContent: "space-around", py: 1, backgroundColor: "mono5", children: [_jsx(Text, { color: "mono100", children: "Dark mode" }), _jsxs(Flex, { flexDirection: "row", gap: 1, children: [_jsx(Pill, { variant: "default", selected: mode === "light", onPress: () => setMode("light"), children: "Light" }), _jsx(Pill, { variant: "default", selected: mode === "dark", onPress: () => setMode("dark"), children: "Dark" }), _jsx(Pill, { variant: "default", selected: mode === "system", onPress: () => setMode("system"), children: "System" })] })] }), _jsx(Flex, { p: 2, children: story() })] }) }) }) }));
|
|
42
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artsy/palette-mobile",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.16.0",
|
|
4
4
|
"description": "Artsy's design system for React Native",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"android": "expo run:android --port 8082",
|
|
@@ -79,7 +79,11 @@
|
|
|
79
79
|
"@babel/runtime": "^7.25.0",
|
|
80
80
|
"@gorhom/bottom-sheet": "^4.6.4",
|
|
81
81
|
"@react-native-async-storage/async-storage": "2.2.0",
|
|
82
|
+
"@react-native-community/datetimepicker": "8.0.1",
|
|
83
|
+
"@react-native-community/slider": "4.5.2",
|
|
82
84
|
"@react-native/eslint-config": "0.76.9",
|
|
85
|
+
"@storybook/addon-ondevice-actions": "^8.3.5",
|
|
86
|
+
"@storybook/addon-ondevice-controls": "^8.3.5",
|
|
83
87
|
"@storybook/react-native": "^8.6.2",
|
|
84
88
|
"@testing-library/react-native": "13.2.0",
|
|
85
89
|
"@types/events": "^3.0.0",
|