@artsy/palette-mobile 20.2.0 → 20.4.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/README.md +1 -9
- package/dist/elements/BorderBox/BorderBox.d.ts +1 -3
- package/dist/elements/EntityHeader/EntityHeader.d.ts +1 -0
- package/dist/elements/Input/Input.d.ts +1 -0
- package/dist/elements/Input/Input.js +1 -1
- package/dist/elements/Screen/Header.d.ts +1 -1
- package/dist/elements/Separator/ShadowSeparator.d.ts +1 -3
- package/dist/elements/Tabs/TabsWithHeader.d.ts +1 -0
- package/dist/storybook/decorators.js +8 -6
- package/dist/utils/space.stories.js +1 -1
- package/dist/utils/tests/flattenChildren.tests.d.ts +1 -0
- package/dist/utils/tests/flattenChildren.tests.js +9 -0
- package/package.json +15 -25
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ yarn add @artsy/palette-mobile
|
|
|
36
36
|
- Install native peer deps
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
yarn add react-native-haptic-feedback react-native-linear-gradient react-native-reanimated react-native-svg
|
|
39
|
+
yarn add react-native-haptic-feedback react-native-linear-gradient react-native-reanimated react-native-svg react-native-safe-area-context
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## How to contribute
|
|
@@ -75,14 +75,6 @@ or
|
|
|
75
75
|
yarn android
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
⚠️ Temporary workaround until we move Expo into an example directory:
|
|
79
|
-
|
|
80
|
-
For local development, remove the line from package.json:
|
|
81
|
-
|
|
82
|
-
`"main": "dist/index.js"`
|
|
83
|
-
|
|
84
|
-
Make sure to add it back before committing.
|
|
85
|
-
|
|
86
78
|
## Developing Features using Local Versions of Palette
|
|
87
79
|
|
|
88
80
|
When developing new components in Palette, it's often useful to test those components in consuming apps (such as Eigen). However, due to the poor support for symlinks in React Native, this can be difficult. Enter [yalc](https://github.com/wclr/yalc). Yalc is a mini package manager that one can publish to and install from, which makes it easy to test code in realtime from outside of your app.
|
|
@@ -8,6 +8,4 @@ export interface BorderBoxProps extends FlexProps, SpaceProps<SpacingUnitsTheme>
|
|
|
8
8
|
* A `View` or `div` (depending on the platform) that has a common border
|
|
9
9
|
* and padding set by default
|
|
10
10
|
*/
|
|
11
|
-
export declare const BorderBox: import("styled-components/native/dist/types").IStyledComponentBase<"native", import("styled-components/native/dist/types").Substitute<
|
|
12
|
-
ref?: import("react").Ref<import("react-native").View>;
|
|
13
|
-
}, BorderBoxProps>>;
|
|
11
|
+
export declare const BorderBox: import("styled-components/native/dist/types").IStyledComponentBase<"native", import("styled-components/native/dist/types").Substitute<import("..").BoxProps & import("react").RefAttributes<import("react-native").View>, BorderBoxProps>>;
|
|
@@ -41,7 +41,7 @@ export const Input = forwardRef(({ addClearListener = false, defaultValue, disab
|
|
|
41
41
|
const [inputWidth, setInputWidth] = useState(0);
|
|
42
42
|
const placeholderWidths = useRef([]);
|
|
43
43
|
const rightComponentRef = useRef(null);
|
|
44
|
-
const inputRef = useRef();
|
|
44
|
+
const inputRef = useRef(null);
|
|
45
45
|
const variant = getInputVariant({
|
|
46
46
|
hasError: !!props.error,
|
|
47
47
|
disabled: disabled,
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export declare const ShadowSeparator: import("styled-components/native/dist/types").IStyledComponentBase<"native", import("styled-components/native/dist/types").FastOmit<
|
|
2
|
-
ref?: import("react").Ref<import("react-native").View>;
|
|
3
|
-
}, never>>;
|
|
1
|
+
export declare const ShadowSeparator: import("styled-components/native/dist/types").IStyledComponentBase<"native", import("styled-components/native/dist/types").FastOmit<import("styled-components/native/dist/types").FastOmit<import("styled-components/native/dist/types").Substitute<import("styled-components/native/dist/types").Substitute<import("react-native").ViewProps, import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>>, import("./Separator").SeparatorProps>, keyof import("./Separator").SeparatorProps> & import("./Separator").SeparatorProps, never>>;
|
|
@@ -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
|
|
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) => (
|
|
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:
|
|
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` })] }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { flattenChildren } from "../flattenChildren";
|
|
4
|
+
describe("flattenChildren", () => {
|
|
5
|
+
it("flattens the children", () => {
|
|
6
|
+
const flattened = flattenChildren(_jsxs(_Fragment, { children: [_jsx(View, { children: "one" }), _jsx(View, { children: "two" }), _jsxs(_Fragment, { children: [_jsx(View, { children: "three" }), _jsx(_Fragment, { children: _jsx(View, { children: "four" }) })] })] }));
|
|
7
|
+
expect(flattened).toHaveLength(4);
|
|
8
|
+
});
|
|
9
|
+
});
|
package/package.json
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artsy/palette-mobile",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.4.0",
|
|
4
4
|
"description": "Artsy's design system for React Native",
|
|
5
|
+
"workspaces": [
|
|
6
|
+
"Example"
|
|
7
|
+
],
|
|
5
8
|
"scripts": {
|
|
6
|
-
"android": "
|
|
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": "
|
|
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": "
|
|
23
|
+
"prebuild": "yarn workspace palette-mobile-example prebuild",
|
|
19
24
|
"prepare": "patch-package && husky install",
|
|
20
25
|
"prepublishOnly": "yarn clean && yarn compile",
|
|
21
|
-
"prestart": "
|
|
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": "
|
|
27
|
-
"start": "
|
|
28
|
-
"storybook-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
|
},
|
|
@@ -76,14 +81,7 @@
|
|
|
76
81
|
"@babel/preset-react": "7.18.6",
|
|
77
82
|
"@babel/preset-typescript": "7.18.6",
|
|
78
83
|
"@babel/runtime": "^7.25.0",
|
|
79
|
-
"@gorhom/bottom-sheet": "^4.6.4",
|
|
80
|
-
"@react-native-async-storage/async-storage": "2.2.0",
|
|
81
|
-
"@react-native-community/datetimepicker": "8.0.1",
|
|
82
|
-
"@react-native-community/slider": "4.5.2",
|
|
83
84
|
"@react-native/eslint-config": "0.76.9",
|
|
84
|
-
"@storybook/addon-ondevice-actions": "^8.3.5",
|
|
85
|
-
"@storybook/addon-ondevice-controls": "^8.3.5",
|
|
86
|
-
"@storybook/react-native": "^8.6.2",
|
|
87
85
|
"@testing-library/react-native": "13.2.0",
|
|
88
86
|
"@types/events": "^3.0.0",
|
|
89
87
|
"@types/jest": "29.4.0",
|
|
@@ -108,8 +106,6 @@
|
|
|
108
106
|
"eslint-plugin-react-native-a11y": "^3.5.1",
|
|
109
107
|
"eslint-plugin-storybook": "0.6.10",
|
|
110
108
|
"eslint-plugin-testing-library": "6.4.0",
|
|
111
|
-
"expo": "^53.0.0",
|
|
112
|
-
"expo-dev-client": "~5.2.4",
|
|
113
109
|
"husky": "^8.0.3",
|
|
114
110
|
"jest": "~29.7.0",
|
|
115
111
|
"jest-environment-jsdom": "29.4.2",
|
|
@@ -122,10 +118,7 @@
|
|
|
122
118
|
"prettier": "^2.8.8",
|
|
123
119
|
"pull-lock": "1.0.0",
|
|
124
120
|
"react": "19.0.0",
|
|
125
|
-
"react-dom": "19.0.0",
|
|
126
121
|
"react-native": "0.79.6",
|
|
127
|
-
"react-native-device-info": "14.0.4",
|
|
128
|
-
"react-native-gesture-handler": "~2.22.1",
|
|
129
122
|
"react-native-haptic-feedback": "1.14.0",
|
|
130
123
|
"react-native-linear-gradient": "2.6.2",
|
|
131
124
|
"react-native-reanimated": "3.17.5",
|
|
@@ -136,9 +129,6 @@
|
|
|
136
129
|
"styled-components": "6.1.19",
|
|
137
130
|
"typescript": "5.8.3"
|
|
138
131
|
},
|
|
139
|
-
"resolutions": {
|
|
140
|
-
"@types/react": "18.3.12"
|
|
141
|
-
},
|
|
142
132
|
"engines": {
|
|
143
133
|
"yarn": "4.x"
|
|
144
134
|
},
|
|
@@ -157,7 +147,7 @@
|
|
|
157
147
|
"author": "Pavlos Vinieratos <pvinis@gmail.com>",
|
|
158
148
|
"license": "MIT",
|
|
159
149
|
"pull-lock": {
|
|
160
|
-
"ios/Podfile.lock": "echo \"🚨 New Podfile.lock detected!, you might need to run yarn install:all\" 🚨",
|
|
150
|
+
"Example/ios/Podfile.lock": "echo \"🚨 New Podfile.lock detected!, you might need to run yarn install:all\" 🚨",
|
|
161
151
|
"yarn.lock": "yarn install"
|
|
162
152
|
},
|
|
163
153
|
"lint-staged": {
|