@artsy/palette-mobile 22.2.0--canary.425.5168.0 → 22.2.0--canary.432.5184.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/dist/elements/Image/Image.js +3 -5
- package/dist/elements/Pill/Pill.js +3 -3
- package/dist/elements/Screen/Header.d.ts +0 -1
- package/dist/elements/Screen/Header.js +2 -2
- package/dist/elements/Skeleton/Skeleton.js +1 -1
- package/dist/elements/Tabs/TabMasonry.d.ts +3 -3
- package/dist/elements/Tabs/TabMasonry.js +1 -1
- package/dist/elements/Tabs/Tabs.stories.d.ts +1 -7
- package/dist/elements/Tabs/Tabs.stories.js +2 -17
- package/dist/elements/Tabs/TabsWithHeader.d.ts +1 -0
- package/dist/elements/Tabs/TabsWithHeader.js +2 -2
- package/dist/elements/Text/Text.js +2 -6
- package/dist/storybook/decorators.js +1 -1
- package/package.json +4 -5
|
@@ -3,8 +3,7 @@ import FastImage from "@d11/react-native-fast-image";
|
|
|
3
3
|
import { memo, useState } from "react";
|
|
4
4
|
// @ts-expect-error
|
|
5
5
|
import { Blurhash } from "react-native-blurhash";
|
|
6
|
-
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated";
|
|
7
|
-
import { scheduleOnRN } from "react-native-worklets";
|
|
6
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withSpring, } from "react-native-reanimated";
|
|
8
7
|
import { getImageURL } from "./helpers/getImageURL";
|
|
9
8
|
import { DEFAULT_ANIMATION_DURATION } from "../../constants";
|
|
10
9
|
import { useColor } from "../../utils/hooks";
|
|
@@ -18,7 +17,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
|
|
|
18
17
|
const color = useColor();
|
|
19
18
|
const onLoadEnd = () => {
|
|
20
19
|
opacity.value = withSpring(0, { duration: DEFAULT_ANIMATION_DURATION }, () => {
|
|
21
|
-
|
|
20
|
+
runOnJS(setIsLoading)(false);
|
|
22
21
|
});
|
|
23
22
|
};
|
|
24
23
|
const skeletonStyle = useAnimatedStyle(() => {
|
|
@@ -27,8 +26,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
|
|
|
27
26
|
};
|
|
28
27
|
});
|
|
29
28
|
if (showLoadingState) {
|
|
30
|
-
|
|
31
|
-
return _jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: { position: "absolute" } });
|
|
29
|
+
return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
|
|
32
30
|
}
|
|
33
31
|
return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(FastImage, { style: [
|
|
34
32
|
dimensions,
|
|
@@ -3,7 +3,7 @@ import { CloseIcon } from "@artsy/icons/native";
|
|
|
3
3
|
import themeGet from "@styled-system/theme-get";
|
|
4
4
|
import { MotiPressable } from "moti/interactions";
|
|
5
5
|
import { useMemo } from "react";
|
|
6
|
-
import { PixelRatio
|
|
6
|
+
import { PixelRatio } from "react-native";
|
|
7
7
|
import styled, { css } from "styled-components";
|
|
8
8
|
import { Flex } from "../Flex";
|
|
9
9
|
import { Image } from "../Image";
|
|
@@ -27,7 +27,7 @@ export const Pill = ({ variant = "default", src, selected, disabled, Icon, child
|
|
|
27
27
|
return {
|
|
28
28
|
opacity: hovered || pressed ? 0.5 : 1,
|
|
29
29
|
};
|
|
30
|
-
}, []), children: [variant === "profile" && src && (_jsx(Flex, { overflow: "hidden", borderRadius: 50, height: 30, width: 30, mr: 1, children: _jsx(Thumbnail, { src: src, height: 30, width: 30 }) })), Icon && _jsx(Icon, { fill: color, ml: -0.5, mr: 0.5 }), _jsx(
|
|
30
|
+
}, []), children: [variant === "profile" && src && (_jsx(Flex, { overflow: "hidden", borderRadius: 50, height: 30, width: 30, mr: 1, children: _jsx(Thumbnail, { src: src, height: 30, width: 30 }) })), Icon && _jsx(Icon, { fill: color, ml: -0.5, mr: 0.5 }), _jsx(Text, { variant: "xs", color: color, style: { marginBottom: 2 }, children: children }), showCloseIcon && _jsx(CloseIcon, { fill: color, ml: 0.5, width: 15, height: 15 })] }) }));
|
|
31
31
|
};
|
|
32
32
|
const Container = styled(MotiPressable) `
|
|
33
33
|
align-items: center;
|
|
@@ -52,7 +52,7 @@ const PILL_STATES = {
|
|
|
52
52
|
default: css `
|
|
53
53
|
border-radius: 15px;
|
|
54
54
|
height: ${PixelRatio.getFontScale() * 30}px;
|
|
55
|
-
padding
|
|
55
|
+
padding: 0 15px;
|
|
56
56
|
`,
|
|
57
57
|
selected: css `
|
|
58
58
|
border-color: ${themeGet("colors.blue100")};
|
|
@@ -11,13 +11,13 @@ import { Touchable } from "../Touchable";
|
|
|
11
11
|
export const AnimatedHeader = (props) => {
|
|
12
12
|
return _jsx(Header, { animated: true, ...props });
|
|
13
13
|
};
|
|
14
|
-
export const Header = ({ animated = false, hideLeftElements, hideRightElements, hideTitle, leftElements, onBack, rightElements, title, titleProps = {},
|
|
14
|
+
export const Header = ({ animated = false, hideLeftElements, hideRightElements, hideTitle, leftElements, onBack, rightElements, title, titleProps = {}, }) => {
|
|
15
15
|
const { width } = useScreenDimensions();
|
|
16
16
|
const space = useSpace();
|
|
17
17
|
// Assumes small left and right elements, it protects from overflowing
|
|
18
18
|
// but doesn't cover edge cases where right or left are bigger
|
|
19
19
|
const centerMaxWidth = width - space(4) - DEFAULT_ICON_SIZE * 2;
|
|
20
|
-
return (_jsxs(Flex, { height: NAVBAR_HEIGHT, flexDirection: "row", px: 2, zIndex:
|
|
20
|
+
return (_jsxs(Flex, { height: NAVBAR_HEIGHT, flexDirection: "row", px: 2, zIndex: ZINDEX.header, backgroundColor: "background", alignItems: "center", children: [_jsx(Flex, { flex: 1, children: _jsx(Left, { leftElements: leftElements, onBack: onBack, hideLeftElements: hideLeftElements }) }), _jsx(Flex, { maxWidth: centerMaxWidth, ...titleProps, children: _jsx(Center, { animated: animated, title: title, hideTitle: hideTitle }) }), _jsx(Flex, { flex: 1, alignItems: "flex-end", children: _jsx(Right, { rightElements: rightElements, hideRightElements: hideRightElements }) })] }));
|
|
21
21
|
};
|
|
22
22
|
const Right = ({ hideRightElements, rightElements }) => {
|
|
23
23
|
return _jsx(_Fragment, { children: !hideRightElements && rightElements });
|
|
@@ -29,7 +29,7 @@ export const Skeleton = ({ children }) => {
|
|
|
29
29
|
};
|
|
30
30
|
export const SkeletonText = ({ children, ...rest }) => {
|
|
31
31
|
const color = useColor();
|
|
32
|
-
return (_jsx(Flex, { alignSelf: "flex-start", children: _jsx(Text, { ...rest, bg: color("mono10"), color: "
|
|
32
|
+
return (_jsx(Flex, { alignSelf: "flex-start", children: _jsx(Text, { ...rest, bg: color("mono10"), color: "transparent", children: children }) }));
|
|
33
33
|
};
|
|
34
34
|
export const SkeletonBox = ({ children, ...rest }) => {
|
|
35
35
|
const color = useColor();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MasonryFlashListProps, MasonryFlashListRef } from "@shopify/flash-list";
|
|
2
2
|
import { Ref } from "react";
|
|
3
|
-
export declare function TabMasonry<T>(props:
|
|
4
|
-
innerRef?: Ref<
|
|
3
|
+
export declare function TabMasonry<T>(props: MasonryFlashListProps<T> & {
|
|
4
|
+
innerRef?: Ref<MasonryFlashListRef<T>> | null;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ export function TabMasonry(props) {
|
|
|
6
6
|
useListenForTabContentScroll();
|
|
7
7
|
const space = useSpace();
|
|
8
8
|
const contentContainerStyle = (props.contentContainerStyle ?? {});
|
|
9
|
-
return (_jsx(Tabs.
|
|
9
|
+
return (_jsx(Tabs.MasonryFlashList, { contentContainerStyle: {
|
|
10
10
|
paddingHorizontal: space(2),
|
|
11
11
|
...contentContainerStyle,
|
|
12
12
|
}, ...props, ref: props.innerRef }));
|
|
@@ -15,13 +15,7 @@ export declare const TabsWithAnimatedHeader: {
|
|
|
15
15
|
name: string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export declare const
|
|
19
|
-
(): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
story: {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare const MasonryTabsWithHeader: {
|
|
18
|
+
export declare const _TabsWithHeader: {
|
|
25
19
|
(): import("react/jsx-runtime").JSX.Element;
|
|
26
20
|
story: {
|
|
27
21
|
name: string;
|
|
@@ -15,22 +15,7 @@ export const TabsWithAnimatedHeader = () => (_jsxs(Screen, { children: [_jsx(Scr
|
|
|
15
15
|
TabsWithAnimatedHeader.story = {
|
|
16
16
|
name: "Tabs with AnimatedHeader",
|
|
17
17
|
};
|
|
18
|
-
export const
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
TabsWithHeader.story = {
|
|
18
|
+
export const _TabsWithHeader = () => (_jsxs(Tabs.TabsWithHeader, { title: "Artist Header", showLargeHeaderText: false, BelowTitleHeaderComponent: () => (_jsxs(Flex, { pointerEvents: "none", p: 2, children: [_jsx(Text, { children: "Info" }), _jsx(Text, { children: "More Info" })] })), children: [_jsx(Tabs.Tab, { name: "tab1", label: "Tab 1", children: _jsx(Tabs.ScrollView, { children: _jsx(Text, { children: "Some long text ".repeat(150) }) }) }), _jsx(Tabs.Tab, { name: "tab2", label: "Tab 2", children: _jsx(Text, { children: "Some long text ".repeat(150) }) })] }));
|
|
19
|
+
_TabsWithHeader.story = {
|
|
22
20
|
name: "Tabs with header",
|
|
23
21
|
};
|
|
24
|
-
export const MasonryTabsWithHeader = () => {
|
|
25
|
-
return (_jsxs(Tabs.TabsWithHeader, { title: "Tabs with Masonry", children: [_jsx(Tabs.Tab, { name: "tab1", label: "Tab 1", children: _jsx(Tabs.FlatList, { data: Array.from({ length: 20 }), contentContainerStyle: {
|
|
26
|
-
paddingHorizontal: 0,
|
|
27
|
-
}, renderItem: () => _jsx(Flex, { backgroundColor: randomHexColor(), height: 80, width: "100%" }) }) }), _jsx(Tabs.Tab, { name: "tab2", label: "Tab 2", children: _jsx(Tabs.FlatList, { contentContainerStyle: {
|
|
28
|
-
paddingHorizontal: 0,
|
|
29
|
-
}, data: Array.from({ length: 20 }), renderItem: () => _jsx(Flex, { backgroundColor: randomHexColor(), height: 80, width: "100%" }) }) })] }));
|
|
30
|
-
};
|
|
31
|
-
const randomHexColor = () => {
|
|
32
|
-
return `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
33
|
-
};
|
|
34
|
-
MasonryTabsWithHeader.story = {
|
|
35
|
-
name: "Masonry Tabs with header",
|
|
36
|
-
};
|
|
@@ -7,6 +7,7 @@ export interface TabsWithHeaderProps extends TabsContainerProps {
|
|
|
7
7
|
children: CollapsibleProps["children"];
|
|
8
8
|
headerProps?: HeaderProps;
|
|
9
9
|
hideScreen?: boolean;
|
|
10
|
+
disableKeyboardAvoidance?: boolean;
|
|
10
11
|
showLargeHeaderText?: boolean;
|
|
11
12
|
title: string | JSX.Element;
|
|
12
13
|
}
|
|
@@ -3,11 +3,11 @@ import { TabsContainer } from "./TabsContainer";
|
|
|
3
3
|
import { Flex } from "../Flex";
|
|
4
4
|
import { Screen } from "../Screen";
|
|
5
5
|
import { Text } from "../Text";
|
|
6
|
-
export const TabsWithHeader = ({ headerProps = {}, hideScreen = false, title, ...rest }) => {
|
|
6
|
+
export const TabsWithHeader = ({ headerProps = {}, hideScreen = false, disableKeyboardAvoidance = false, title, ...rest }) => {
|
|
7
7
|
if (hideScreen) {
|
|
8
8
|
return _jsx(Content, { title: title, ...rest });
|
|
9
9
|
}
|
|
10
|
-
return (_jsxs(Screen, { children: [_jsx(Screen.AnimatedHeader, { title: title, ...headerProps }), _jsx(Screen.Body, { fullwidth: true, children: _jsx(Content, { title: title, ...rest }) })] }));
|
|
10
|
+
return (_jsxs(Screen, { children: [_jsx(Screen.AnimatedHeader, { title: title, ...headerProps }), _jsx(Screen.Body, { fullwidth: true, disableKeyboardAvoidance: disableKeyboardAvoidance, children: _jsx(Content, { title: title, ...rest }) })] }));
|
|
11
11
|
};
|
|
12
12
|
const Content = ({ BelowTitleHeaderComponent, children, showLargeHeaderText = true, title, ...rest }) => {
|
|
13
13
|
const showTitle = showLargeHeaderText && !!title;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Text as RNText
|
|
3
|
+
import { Text as RNText } from "react-native";
|
|
4
4
|
import styled from "styled-components/native";
|
|
5
5
|
import { color, space, typography, } from "styled-system";
|
|
6
6
|
import { useFontFamilyFor } from "./helpers";
|
|
@@ -13,13 +13,9 @@ export const Text = forwardRef(({ variant = "sm", italic = false, color = "onBac
|
|
|
13
13
|
...nativeTextStyle,
|
|
14
14
|
{ textAlignVertical: "center" }, // android renders text higher by default, so we bring it down to be consistent with ios
|
|
15
15
|
{ textDecorationLine: !!underline ? "underline" : "none" },
|
|
16
|
-
{ fontStyle: italic ? "italic" : undefined },
|
|
17
16
|
!!maxWidth ? { width: "100%", maxWidth: 600, alignSelf: "center" } : {},
|
|
18
|
-
// Overriding the font family for the regular font to avoid breaking the layout (mainly on android)
|
|
19
|
-
// See: https://github.com/facebook/react-native/issues/53286
|
|
20
|
-
Platform.OS === "android" ? {} : { fontFamily },
|
|
21
17
|
style, // keep last so we can override
|
|
22
|
-
], ...fixTextTreatmentForStyledComponent(theme.textTreatments[variant]), children: children, color: color, ...restProps }));
|
|
18
|
+
], fontFamily: fontFamily, ...fixTextTreatmentForStyledComponent(theme.textTreatments[variant]), children: children, color: color, ...restProps }));
|
|
23
19
|
});
|
|
24
20
|
const fixTextTreatmentForStyledComponent = (treatment) => {
|
|
25
21
|
const treatmentWithUnits = { ...treatment };
|
|
@@ -41,5 +41,5 @@ export const useDarkModeSwitcher = (story) => {
|
|
|
41
41
|
// We are keeping the status bar white on darkmode on ios because background isn't a supported prop on iOS
|
|
42
42
|
, {
|
|
43
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, {
|
|
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() })] })] }) }) }));
|
|
45
45
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artsy/palette-mobile",
|
|
3
|
-
"version": "22.2.0--canary.
|
|
3
|
+
"version": "22.2.0--canary.432.5184.0",
|
|
4
4
|
"description": "Artsy's design system for React Native",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"Example"
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"@artsy/palette-tokens": "7.0.0",
|
|
46
46
|
"@d11/react-native-fast-image": "8.12.0",
|
|
47
47
|
"@react-spring/native": "^10.0.3",
|
|
48
|
-
"@shopify/flash-list": "
|
|
48
|
+
"@shopify/flash-list": "^1.8.3",
|
|
49
49
|
"@styled-system/theme-get": "^5.1.2",
|
|
50
50
|
"events": "^3.3.0",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"moti": "0.30.0",
|
|
53
53
|
"react-nanny": "^2.15.0",
|
|
54
54
|
"react-native-blurhash": "2.1.2",
|
|
55
|
-
"react-native-collapsible-tab-view": "
|
|
55
|
+
"react-native-collapsible-tab-view": "^8.0.1",
|
|
56
56
|
"react-native-pager-view": "6.7.1",
|
|
57
57
|
"react-native-popover-view": "^6.1.0",
|
|
58
58
|
"styled-system": "^5.1.5"
|
|
@@ -124,10 +124,9 @@
|
|
|
124
124
|
"react-native": "0.81.5",
|
|
125
125
|
"react-native-haptic-feedback": "1.14.0",
|
|
126
126
|
"react-native-linear-gradient": "2.6.2",
|
|
127
|
-
"react-native-reanimated": "
|
|
127
|
+
"react-native-reanimated": "3.19.4",
|
|
128
128
|
"react-native-safe-area-context": "5.6.0",
|
|
129
129
|
"react-native-svg": "15.12.1",
|
|
130
|
-
"react-native-worklets": "0.6.1",
|
|
131
130
|
"react-test-renderer": "19.1.0",
|
|
132
131
|
"rimraf": "4.1.2",
|
|
133
132
|
"styled-components": "6.1.19",
|