@artsy/palette-mobile 19.18.0 → 19.19.0--canary.404.4759.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,8 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { animated, Spring, config } from "@react-spring/native";
3
2
  import { useState } from "react";
4
3
  import { Pressable } from "react-native";
5
4
  import Haptic from "react-native-haptic-feedback";
5
+ import { config } from "react-spring";
6
+ // @ts-ignore
7
+ import { animated, Spring } from "react-spring/renderprops-native";
6
8
  import styled from "styled-components/native";
7
9
  import { useColor } from "../../utils/hooks";
8
10
  import { isTestEnvironment } from "../../utils/tests/isTestEnvironment";
@@ -67,7 +69,7 @@ export const Button = ({ children, disabled, haptic, icon, iconPosition = "left"
67
69
  };
68
70
  const containerSize = getSize();
69
71
  const to = useStyleForVariantAndState(variant, testOnly_state ?? displayState);
70
- return (_jsx(Spring, { to: to, config: config.stiff, children: (springProps) => (_jsx(Pressable, { accessibilityLabel: rest.accessibilityLabel, accessibilityRole: "button", accessibilityState: {
72
+ return (_jsx(Spring, { native: true, to: to, config: config.stiff, children: (springProps) => (_jsx(Pressable, { accessibilityLabel: rest.accessibilityLabel, accessibilityRole: "button", accessibilityState: {
71
73
  disabled,
72
74
  }, hitSlop: hitSlop, testOnly_pressed: testOnly_state === DisplayState.Pressed, disabled: testOnly_state === DisplayState.Disabled || disabled, onPressIn: () => {
73
75
  if (displayState === DisplayState.Loading) {
@@ -1,23 +1,9 @@
1
- import { Button, ButtonProps } from "./Button";
2
- import { NoUndefined } from "../../utils/types";
3
- import type { StoryObj } from "@storybook/react";
1
+ import { ButtonProps } from "./Button";
4
2
  declare const _default: {
5
3
  title: string;
6
4
  component: import("react").FC<ButtonProps>;
7
- argTypes: {
8
- variant: {
9
- control: string;
10
- options: NoUndefined<"text" | "outline" | "fillDark" | "fillLight" | "fillGray" | "fillSuccess" | "outlineGray" | "outlineLight">[];
11
- };
12
- size: {
13
- control: string;
14
- options: NoUndefined<"small" | "large">[];
15
- };
16
- };
17
5
  };
18
6
  export default _default;
19
- type ButtonStory = StoryObj<typeof Button>;
20
- export declare const Default: ButtonStory;
21
7
  export declare const Sizes: () => import("react/jsx-runtime").JSX.Element;
22
8
  export declare const States: () => import("react/jsx-runtime").JSX.Element;
23
9
  export declare const Variants: () => import("react/jsx-runtime").JSX.Element;
@@ -20,24 +20,6 @@ const variants = [
20
20
  export default {
21
21
  title: "Button",
22
22
  component: Button,
23
- argTypes: {
24
- variant: {
25
- control: "select",
26
- options: variants,
27
- },
28
- size: {
29
- control: "select",
30
- options: sizes,
31
- },
32
- },
33
- };
34
- export const Default = {
35
- args: {
36
- variant: "fillDark",
37
- size: "large",
38
- children: "Press me",
39
- },
40
- render: (args) => _jsx(Button, { ...args }),
41
23
  };
42
24
  export const Sizes = () => (_jsx(DataList, { data: sizes, renderItem: ({ item: size }) => (_jsx(Button, { size: size, onPress: () => console.log(`tapped ${size}`), children: capitalize(size) })) }));
43
25
  export const States = () => {
@@ -1,15 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { fireEvent, screen, act } from "@testing-library/react-native";
2
+ import { fireEvent, screen } from "@testing-library/react-native";
3
3
  import { Dialog } from "./Dialog";
4
4
  import { renderWithWrappers } from "../../utils/tests/renderWithWrappers";
5
5
  describe("Dialog", () => {
6
- beforeEach(() => {
7
- jest.useFakeTimers();
8
- });
9
- afterEach(() => {
10
- jest.runOnlyPendingTimers();
11
- jest.useRealTimers();
12
- });
13
6
  it("renders without error", () => {
14
7
  renderWithWrappers(_jsx(Dialog, { title: "title", isVisible: true, primaryCta: {
15
8
  text: "Primary Action Button",
@@ -32,9 +25,6 @@ describe("Dialog", () => {
32
25
  } }));
33
26
  const primaryButton = screen.getByTestId("dialog-primary-action-button");
34
27
  fireEvent.press(primaryButton);
35
- act(() => {
36
- jest.runAllTimers();
37
- });
38
28
  expect(primaryActionMock).toHaveBeenCalled();
39
29
  expect(screen.getByText("Primary Action Button")).toBeOnTheScreen();
40
30
  });
@@ -49,7 +39,6 @@ describe("Dialog", () => {
49
39
  } }));
50
40
  const secondaryButton = screen.getByTestId("dialog-secondary-action-button");
51
41
  fireEvent.press(secondaryButton);
52
- jest.runAllTimers();
53
42
  expect(secondaryActionMock).toHaveBeenCalled();
54
43
  expect(screen.getByText("Secondary Action Button")).toBeOnTheScreen();
55
44
  });
@@ -60,9 +49,6 @@ describe("Dialog", () => {
60
49
  onPress: jest.fn(),
61
50
  } }));
62
51
  fireEvent.press(screen.getByTestId("dialog-backdrop"));
63
- act(() => {
64
- jest.runAllTimers();
65
- });
66
52
  expect(onBackgroundPressMock).toHaveBeenCalled();
67
53
  });
68
54
  });
@@ -1,14 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import AsyncStorage from "@react-native-async-storage/async-storage";
3
3
  import { useEffect, useState } from "react";
4
- import { Appearance } from "react-native";
4
+ import { Appearance, Platform, StatusBar } from "react-native";
5
5
  import { SafeAreaProvider } from "react-native-safe-area-context";
6
6
  import { Theme } from "../Theme";
7
- import { Flex } from "../elements/Flex";
8
- import { Pill } from "../elements/Pill";
9
- import { Text } from "../elements/Text";
7
+ import { Flex, Pill, Text } from "../elements";
10
8
  import { ScreenDimensionsProvider } from "../utils/hooks";
11
- export const withTheme = (story) => (_jsxs(Theme, { theme: "v3light", children: [_jsx(Text, { color: "red", children: "aaww" }), story()] }));
9
+ export const withTheme = (story) => _jsx(Theme, { theme: "v3light", children: story() });
12
10
  const DARK_MODE_STORAGE_KEY = "dark-mode-mode";
13
11
  export const useDarkModeSwitcher = (story) => {
14
12
  const [mode, setModeState] = useState("system");
@@ -39,5 +37,9 @@ export const useDarkModeSwitcher = (story) => {
39
37
  };
40
38
  const isDarkMode = mode === "dark" || (mode === "system" && systemMode === "dark");
41
39
  const theme = isDarkMode ? "v3dark" : "v3light";
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() })] }) }) }) }));
40
+ return (_jsx(ScreenDimensionsProvider, { children: _jsx(SafeAreaProvider, { children: _jsxs(Theme, { theme: theme, children: [_jsx(StatusBar
41
+ // We are keeping the status bar white on darkmode on ios because background isn't a supported prop on iOS
42
+ , {
43
+ // We are keeping the status bar white on darkmode on ios because background isn't a supported prop on iOS
44
+ barStyle: isDarkMode && Platform.OS === "android" ? "light-content" : "dark-content", backgroundColor: isDarkMode && Platform.OS === "android" ? "black" : "white", translucent: true }), _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() })] })] }) }) }));
43
45
  };
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useSpace } from "./hooks";
3
3
  import { bullet } from "./text";
4
- import { Box, Text } from "../elements";
5
4
  import { List } from "../storybook/helpers";
5
+ import { Box, Text } from "../elements";
6
6
  const SpaceLine = ({ space: theSpace }) => {
7
7
  const space = useSpace();
8
8
  return (_jsxs(Box, { children: [_jsx(Box, { width: space(theSpace), borderBottomWidth: 1, borderColor: "black", marginBottom: "4px" }), _jsx(Text, { color: "black", children: `${theSpace} ${bullet} ${space(theSpace)}px` })] }));
package/package.json CHANGED
@@ -1,31 +1,36 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "19.18.0",
3
+ "version": "19.19.0--canary.404.4759.0",
4
4
  "description": "Artsy's design system for React Native",
5
+ "workspaces": [
6
+ "Example"
7
+ ],
5
8
  "scripts": {
6
- "android": "expo run:android --port 8082",
9
+ "android": "yarn workspace palette-mobile-example android",
10
+ "android:prebuild": "yarn workspace palette-mobile-example android:prebuild",
7
11
  "beta:ios": "bundle e fastlane ios beta",
8
12
  "bundle-install": "bundle install",
9
13
  "clean": "rimraf dist",
10
14
  "compile": "tsc",
11
15
  "install:all": "yarn install && yarn postinstall && yarn bundle-install",
12
- "ios": "expo run:ios --port 8082",
16
+ "ios": "yarn workspace palette-mobile-example ios",
17
+ "ios:prebuild": "yarn workspace palette-mobile-example ios:prebuild",
13
18
  "lint:all": "yarn lint .",
14
19
  "lint": "eslint --cache --cache-location '.cache/eslint/' --ext .ts,.tsx --fix",
15
20
  "local-palette-dev": "./scripts/sync-after-change",
16
- "open-xcode": "open ios/PaletteMobile.xcworkspace",
21
+ "open-xcode": "open Example/ios/PaletteMobile.xcworkspace",
17
22
  "postinstall": "yarn patch-package",
18
- "prebuild": "npx expo prebuild",
23
+ "prebuild": "yarn workspace palette-mobile-example prebuild",
19
24
  "prepare": "patch-package && husky install",
20
25
  "prepublishOnly": "yarn clean && yarn compile",
21
- "prestart": "sb-rn-get-stories",
26
+ "prestart": "yarn workspace palette-mobile-example prestart",
22
27
  "prettier-write": "prettier --write --ignore-unknown",
23
28
  "release:canary": "auto canary",
24
29
  "release": "auto shipit",
25
30
  "setup:artsy": "./scripts/download-fonts",
26
- "start:reset-cache": "npx expo start -c --port 8082",
27
- "start": "npx expo start --port 8082",
28
- "storybook-watcher": "sb-rn-watcher",
31
+ "start:reset-cache": "yarn workspace palette-mobile-example start:reset-cache",
32
+ "start": "yarn workspace palette-mobile-example start",
33
+ "storybook-watcher": "yarn workspace palette-mobile-example storybook-watcher",
29
34
  "test": "jest --maxWorkers=2",
30
35
  "type-check": "tsc --noEmit"
31
36
  },
@@ -37,7 +42,6 @@
37
42
  "@artsy/icons": "^3.49.0",
38
43
  "@artsy/palette-tokens": "7.0.0",
39
44
  "@d11/react-native-fast-image": "8.12.0",
40
- "@react-spring/native": "^10.0.3",
41
45
  "@shopify/flash-list": "^1.8.3",
42
46
  "@styled-system/core": "^5.1.2",
43
47
  "@styled-system/theme-get": "^5.1.2",
@@ -49,6 +53,7 @@
49
53
  "react-native-collapsible-tab-view": "^8.0.1",
50
54
  "react-native-pager-view": "6.7.1",
51
55
  "react-native-popover-view": "^6.1.0",
56
+ "react-spring": "8.0.23",
52
57
  "styled-system": "^5.1.5"
53
58
  },
54
59
  "peerDependenciesComments": [
@@ -77,14 +82,7 @@
77
82
  "@babel/preset-react": "7.18.6",
78
83
  "@babel/preset-typescript": "7.18.6",
79
84
  "@babel/runtime": "^7.25.0",
80
- "@gorhom/bottom-sheet": "^4.6.4",
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",
84
85
  "@react-native/eslint-config": "0.76.9",
85
- "@storybook/addon-ondevice-actions": "^8.3.5",
86
- "@storybook/addon-ondevice-controls": "^8.3.5",
87
- "@storybook/react-native": "^8.6.2",
88
86
  "@testing-library/react-native": "13.2.0",
89
87
  "@types/events": "^3.0.0",
90
88
  "@types/jest": "29.4.0",
@@ -112,8 +110,6 @@
112
110
  "eslint-plugin-react-native-a11y": "^3.5.1",
113
111
  "eslint-plugin-storybook": "0.6.10",
114
112
  "eslint-plugin-testing-library": "6.4.0",
115
- "expo": "^53.0.0",
116
- "expo-dev-client": "~5.2.4",
117
113
  "husky": "^8.0.3",
118
114
  "jest": "~29.7.0",
119
115
  "jest-environment-jsdom": "29.4.2",
@@ -126,14 +122,10 @@
126
122
  "prettier": "^2.8.8",
127
123
  "pull-lock": "1.0.0",
128
124
  "react": "19.0.0",
129
- "react-dom": "19.0.0",
130
125
  "react-native": "0.79.6",
131
- "react-native-device-info": "14.0.4",
132
- "react-native-gesture-handler": "~2.22.1",
133
126
  "react-native-haptic-feedback": "1.14.0",
134
127
  "react-native-linear-gradient": "2.6.2",
135
128
  "react-native-reanimated": "3.17.5",
136
- "react-native-safe-area-context": "5.4.1",
137
129
  "react-native-svg": "15.12.0",
138
130
  "react-test-renderer": "19.0.0",
139
131
  "rimraf": "4.1.2",
@@ -161,7 +153,7 @@
161
153
  "author": "Pavlos Vinieratos <pvinis@gmail.com>",
162
154
  "license": "MIT",
163
155
  "pull-lock": {
164
- "ios/Podfile.lock": "echo \"🚨 New Podfile.lock detected!, you might need to run yarn install:all\" 🚨",
156
+ "Example/ios/Podfile.lock": "echo \"🚨 New Podfile.lock detected!, you might need to run yarn install:all\" 🚨",
165
157
  "yarn.lock": "yarn install"
166
158
  },
167
159
  "lint-staged": {