@artsy/palette-mobile 11.0.23 → 11.0.25

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/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v11.0.25 (Thu May 04 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - fix(legacy-screen): use legacy screen code from Eigen [#99](https://github.com/artsy/palette-mobile/pull/99) ([@damassi](https://github.com/damassi))
6
+
7
+ #### Authors: 1
8
+
9
+ - Christopher Pappas ([@damassi](https://github.com/damassi))
10
+
11
+ ---
12
+
13
+ # v11.0.24 (Thu May 04 2023)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - feat(screen): Add screen component from energy [#98](https://github.com/artsy/palette-mobile/pull/98) ([@damassi](https://github.com/damassi))
18
+
19
+ #### Authors: 1
20
+
21
+ - Christopher Pappas ([@damassi](https://github.com/damassi))
22
+
23
+ ---
24
+
1
25
  # v11.0.23 (Thu May 04 2023)
2
26
 
3
27
  #### 🐛 Bug Fix
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import { FlexProps } from "../Flex";
3
+ interface HeaderProps {
4
+ onBack?: () => void;
5
+ title?: string;
6
+ onSkip?: () => void;
7
+ }
8
+ export declare const Header: React.FC<HeaderProps>;
9
+ /**
10
+ * @deprecated Use `Screen.Header` instead.
11
+ */
12
+ export declare const FloatingHeader: React.FC<HeaderProps>;
13
+ interface BodyProps extends Pick<FlexProps, "backgroundColor"> {
14
+ children?: React.ReactNode;
15
+ scroll?: boolean;
16
+ noTopSafe?: boolean;
17
+ noBottomSafe?: boolean;
18
+ fullwidth?: boolean;
19
+ }
20
+ export declare const LegacyScreen: (({ children }: {
21
+ children?: React.ReactNode;
22
+ }) => JSX.Element) & {
23
+ Body: ({ scroll, noTopSafe, noBottomSafe, fullwidth, children, ...restFlexProps }: BodyProps) => JSX.Element;
24
+ Header: import("react").FC<HeaderProps>;
25
+ FloatingHeader: import("react").FC<HeaderProps>;
26
+ Background: import("react").FC<{
27
+ children?: import("react").ReactNode;
28
+ }>;
29
+ BottomView: import("react").FC<{
30
+ children?: import("react").ReactNode;
31
+ }>;
32
+ BodyXPadding: import("react").FC<import("..").BoxProps>;
33
+ SafeBottomPadding: () => JSX.Element | null;
34
+ };
35
+ export {};
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Screen = void 0;
6
+ exports.LegacyScreen = exports.FloatingHeader = exports.Header = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const react_nanny_1 = require("react-nanny");
@@ -15,11 +15,11 @@ const ArtsyKeyboardAvoidingView_1 = require("../ArtsyKeyboardAvoidingView");
15
15
  const BackButton_1 = require("../BackButton");
16
16
  const Flex_1 = require("../Flex");
17
17
  const Spacer_1 = require("../Spacer");
18
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
18
+ const Text_1 = require("../Text");
19
+ const Touchable_1 = require("../Touchable");
19
20
  const ScreenContext = (0, react_1.createContext)(null);
20
21
  function useScreenContext() {
21
22
  const context = (0, react_1.useContext)(ScreenContext);
22
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
23
23
  if (!context) {
24
24
  throw new Error("useScreenContext must be used within a Screen");
25
25
  }
@@ -36,25 +36,25 @@ const ScreenWrapper = ({ children }) => {
36
36
  }, children: (0, jsx_runtime_1.jsx)(ScreenRoot, { children: children }) }));
37
37
  };
38
38
  const ScreenRoot = ({ children }) => {
39
- const header = (0, react_nanny_1.getChildByType)(children, exports.Screen.Header);
40
- const headerFloating = (0, react_nanny_1.getChildByType)(children, exports.Screen.FloatingHeader);
41
- const rawHeader = (0, react_nanny_1.getChildByType)(children, exports.Screen.RawHeader);
42
- const background = (0, react_nanny_1.getChildByType)(children, exports.Screen.Background);
43
- const bodyChildren = (0, react_nanny_1.getChildrenByTypeDeep)(children, exports.Screen.Body);
44
- return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, backgroundColor: "background", children: [background /* fullscreen */, header, rawHeader, bodyChildren, headerFloating /* floating, so keep close to the bottom */] }));
39
+ const header = (0, react_nanny_1.getChildByType)(children, exports.LegacyScreen.Header);
40
+ const headerFloating = (0, react_nanny_1.getChildByType)(children, exports.LegacyScreen.FloatingHeader);
41
+ const background = (0, react_nanny_1.getChildByType)(children, exports.LegacyScreen.Background);
42
+ const bodyChildren = (0, react_nanny_1.getChildrenByTypeDeep)(children, exports.LegacyScreen.Body);
43
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, backgroundColor: "white100", children: [background /* fullscreen */, header, bodyChildren, headerFloating /* floating, so keep close to the bottom */] }));
45
44
  };
46
- const useUpdateScreenContext = ({ header, }) => {
45
+ const useUpdateScreenContext = ({ header }) => {
47
46
  const { setOptions } = useScreenContext();
48
- (0, react_1.useEffect)(() => void setOptions({
49
- handleTopSafeArea: header === "none" || header === "floating" || header === "raw-safe",
50
- }), [header]);
47
+ (0, react_1.useEffect)(() => void setOptions({ handleTopSafeArea: header === "none" || header === "floating" }),
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ [header]);
51
50
  };
52
51
  const NAVBAR_HEIGHT = 44;
53
- const Header = ({ onBack }) => {
52
+ const Header = ({ onBack, title, onSkip }) => {
54
53
  useUpdateScreenContext({ header: "regular" });
55
54
  const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
56
- return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mt: `${insets.top}px`, height: NAVBAR_HEIGHT, px: SCREEN_HORIZONTAL_PADDING, flexDirection: "row", alignItems: "center", children: (0, jsx_runtime_1.jsx)(BackButton_1.BackButton, { onPress: onBack }) }));
55
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { mt: `${insets.top}px`, height: NAVBAR_HEIGHT, flexDirection: "row", alignItems: "center", justifyContent: "space-between", px: SCREEN_HORIZONTAL_PADDING, children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { children: !!onBack && ((0, jsx_runtime_1.jsx)(BackButton_1.BackButton, { onPress: onBack, style: { flex: 1, justifyContent: "center" }, hitSlop: { left: 20, right: 20 } })) }), !!title && (0, jsx_runtime_1.jsx)(Text_1.Text, { children: title }), !!onSkip && ((0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { haptic: "impactLight", onPress: onSkip, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { height: "100%", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Text_1.Text, { textAlign: "right", variant: "xs", children: "Skip" }) }) }))] }));
57
56
  };
57
+ exports.Header = Header;
58
58
  /**
59
59
  * @deprecated Use `Screen.Header` instead.
60
60
  */
@@ -66,23 +66,16 @@ const FloatingHeader = ({ onBack }) => {
66
66
  }
67
67
  return null;
68
68
  };
69
- /**
70
- * Use `RawHeader` when you need to make a custom header that we have no support for yet.
71
- */
72
- const RawHeader = ({ children, nosafe = false }) => {
73
- useUpdateScreenContext({ header: nosafe ? "raw-nosafe" : "raw-safe" });
74
- const saInsets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
75
- return ((0, jsx_runtime_1.jsx)(Wrap_1.Wrap, { if: !nosafe, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { top: saInsets.top, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap.Content, { children: children }) }) }));
76
- };
69
+ exports.FloatingHeader = FloatingHeader;
77
70
  const SCREEN_HORIZONTAL_PADDING = 2;
78
- const Body = ({ scroll = false, nosafe = false, noTopSafe = false, noBottomSafe = false, fullwidth = false, children, ...restFlexProps }) => {
79
- const childrenExceptBottomView = (0, react_nanny_1.removeChildrenByType)(children, exports.Screen.BottomView);
80
- const bottomView = (0, react_nanny_1.getChildrenByType)(children, exports.Screen.BottomView);
71
+ const Body = ({ scroll = false, noTopSafe = false, noBottomSafe = false, fullwidth = false, children, ...restFlexProps }) => {
72
+ const childrenExceptBottomView = (0, react_nanny_1.removeChildrenByType)(children, exports.LegacyScreen.BottomView);
73
+ const bottomView = (0, react_nanny_1.getChildrenByType)(children, exports.LegacyScreen.BottomView);
81
74
  const { options } = useScreenContext();
82
75
  const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
83
76
  const withTopSafeArea = options.handleTopSafeArea && !noTopSafe;
84
77
  const withBottomSafeArea = !noBottomSafe;
85
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, mt: nosafe || withTopSafeArea ? `${insets.top}px` : undefined, mb: nosafe || withBottomSafeArea ? `${insets.bottom}px` : undefined, ...restFlexProps, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap, { if: scroll, children: (0, jsx_runtime_1.jsxs)(ArtsyKeyboardAvoidingView_1.ArtsyKeyboardAvoidingView, { children: [(0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentInset: { bottom: options.bottomViewHeight - insets.bottom }, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap.Content, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, px: fullwidth ? undefined : SCREEN_HORIZONTAL_PADDING, children: childrenExceptBottomView }) }) }), bottomView] }) }) }) }));
78
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, mt: withTopSafeArea ? `${insets.top}px` : undefined, mb: withBottomSafeArea ? `${insets.bottom}px` : undefined, ...restFlexProps, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap, { if: scroll, children: (0, jsx_runtime_1.jsxs)(ArtsyKeyboardAvoidingView_1.ArtsyKeyboardAvoidingView, { children: [(0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentInset: { bottom: options.bottomViewHeight - insets.bottom }, children: (0, jsx_runtime_1.jsx)(Wrap_1.Wrap.Content, { children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, px: fullwidth ? undefined : SCREEN_HORIZONTAL_PADDING, children: childrenExceptBottomView }) }) }), bottomView] }) }) }) }));
86
79
  };
87
80
  const Background = ({ children }) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", top: 0, bottom: 0, left: 0, right: 0, children: children }));
88
81
  const BottomView = ({ children }) => {
@@ -121,7 +114,7 @@ const BottomView = ({ children }) => {
121
114
  * One use case might be if you need to put an image background or something in the body,
122
115
  * but you also need some content with the right padding.
123
116
  */
124
- const BodyXPadding = (props) => (0, jsx_runtime_1.jsx)(Flex_1.Flex, { px: SCREEN_HORIZONTAL_PADDING, ...props });
117
+ const BodyXPadding = (props) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { px: SCREEN_HORIZONTAL_PADDING, ...props }));
125
118
  /**
126
119
  * If there is a bottom safe area, this will render nothing.
127
120
  * If there is no bottom safe area, this will render a small padding.
@@ -136,11 +129,10 @@ const SafeBottomPadding = () => {
136
129
  }
137
130
  return (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { y: 2 });
138
131
  };
139
- exports.Screen = Object.assign(ScreenWrapper, {
132
+ exports.LegacyScreen = Object.assign(ScreenWrapper, {
140
133
  Body,
141
- Header,
142
- FloatingHeader,
143
- RawHeader,
134
+ Header: exports.Header,
135
+ FloatingHeader: exports.FloatingHeader,
144
136
  Background,
145
137
  BottomView,
146
138
  BodyXPadding,
@@ -0,0 +1 @@
1
+ export * from "./LegacyScreen";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./LegacyScreen"), exports);
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const Background: React.FC<{
3
+ children: React.ReactNode;
4
+ }>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Background = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Flex_1 = require("../Flex");
6
+ const Background = ({ children }) => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", top: 0, bottom: 0, left: 0, right: 0, children: children }));
7
+ exports.Background = Background;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { FlexProps } from "../Flex";
3
+ export interface BodyProps extends FlexProps {
4
+ fullwidth?: boolean;
5
+ safeArea?: boolean;
6
+ scroll?: boolean;
7
+ }
8
+ export declare const Body: React.FC<BodyProps>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Body = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_1 = require("react-native");
6
+ const react_native_safe_area_context_1 = require("react-native-safe-area-context");
7
+ const constants_1 = require("./constants");
8
+ const Flex_1 = require("../Flex");
9
+ const Body = ({ children, fullwidth, safeArea = true, scroll, ...flexProps }) => {
10
+ const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
11
+ return ((0, jsx_runtime_1.jsx)(react_native_1.KeyboardAvoidingView, { style: { flex: 1 }, behavior: react_native_1.Platform.OS === "ios" ? "padding" : "height", children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, mt: `${insets.top}px`, pb: safeArea ? `${insets.bottom}px` : undefined, ...flexProps, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, px: fullwidth ? undefined : constants_1.SCREEN_HORIZONTAL_PADDING, children: scroll ? (0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { children: children }) : children }) }) }));
12
+ };
13
+ exports.Body = Body;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface BottomViewProps {
3
+ children: React.ReactNode;
4
+ darkMode?: boolean;
5
+ }
6
+ export declare const BottomView: React.FC<BottomViewProps>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BottomView = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_native_linear_gradient_1 = __importDefault(require("react-native-linear-gradient"));
9
+ const constants_1 = require("./constants");
10
+ const useColor_1 = require("../../utils/hooks/useColor");
11
+ const Flex_1 = require("../Flex");
12
+ const BottomView = ({ children, darkMode }) => {
13
+ const color = (0, useColor_1.useColor)();
14
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_linear_gradient_1.default, { colors: [darkMode ? "rgba(0,0,0,0)" : "rgba(255,255,255,0)", color("background")], start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, style: {
15
+ width: "100%",
16
+ height: 20,
17
+ }, pointerEvents: "none" }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { px: constants_1.SCREEN_HORIZONTAL_PADDING, pt: 1, pb: 1, backgroundColor: "background", children: children })] }));
18
+ };
19
+ exports.BottomView = BottomView;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface FloatingHeaderProps {
3
+ onBack?: () => void;
4
+ rightElements?: React.ReactNode;
5
+ }
6
+ export declare const FloatingHeader: ({ onBack, rightElements }: FloatingHeaderProps) => JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FloatingHeader = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_safe_area_context_1 = require("react-native-safe-area-context");
6
+ const constants_1 = require("./constants");
7
+ const BackButton_1 = require("../BackButton");
8
+ const Flex_1 = require("../Flex");
9
+ const Spacer_1 = require("../Spacer");
10
+ const FloatingHeader = ({ onBack, rightElements }) => {
11
+ const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
12
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { position: "absolute", pointerEvents: "box-none", top: insets.top, left: 0, right: 0, zIndex: constants_1.ZINDEX.floatingHeader, height: constants_1.NAVBAR_HEIGHT, px: 1, flexDirection: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(BackButton_1.BackButtonWithBackground, { onPress: onBack }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1 }), rightElements && ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 1 }), rightElements] }))] }));
13
+ };
14
+ exports.FloatingHeader = FloatingHeader;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { FlexProps } from "../Flex";
3
+ export declare const FullWidthDivider: React.FC<FlexProps>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FullWidthDivider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Screen_1 = require("../Screen");
6
+ const Separator_1 = require("../Separator");
7
+ const FullWidthDivider = (flexProps) => {
8
+ return ((0, jsx_runtime_1.jsx)(Screen_1.Screen.FullWidthItem, { children: (0, jsx_runtime_1.jsx)(Separator_1.Separator, { my: 2, ...flexProps }) }));
9
+ };
10
+ exports.FullWidthDivider = FullWidthDivider;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { FlexProps } from "../Flex";
3
+ export declare const FullWidthItem: React.FC<FlexProps>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FullWidthItem = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const constants_1 = require("./constants");
6
+ const Flex_1 = require("../Flex");
7
+ const FullWidthItem = (props) => {
8
+ return (0, jsx_runtime_1.jsx)(Flex_1.Flex, { ...props, mx: -constants_1.SCREEN_HORIZONTAL_PADDING });
9
+ };
10
+ exports.FullWidthItem = FullWidthItem;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ export interface HeaderProps {
3
+ animated?: boolean;
4
+ hideLeftElements?: boolean;
5
+ hideRightElements?: boolean;
6
+ hideTitle?: boolean;
7
+ leftElements?: React.ReactNode;
8
+ onBack?: () => void;
9
+ rightElements?: React.ReactNode;
10
+ scrollY?: number;
11
+ title?: string;
12
+ titleShown?: boolean;
13
+ }
14
+ export declare const Header: React.FC<HeaderProps>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Header = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_device_info_1 = require("react-native-device-info");
6
+ const react_native_safe_area_context_1 = require("react-native-safe-area-context");
7
+ const constants_1 = require("./constants");
8
+ const constants_2 = require("../../constants");
9
+ const ArrowLeftIcon_1 = require("../../svgs/ArrowLeftIcon");
10
+ const Flex_1 = require("../Flex");
11
+ const Spacer_1 = require("../Spacer");
12
+ const Text_1 = require("../Text");
13
+ const Touchable_1 = require("../Touchable");
14
+ const Header = ({ hideLeftElements, hideRightElements, hideTitle, leftElements, onBack, rightElements, title, }) => {
15
+ const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
16
+ const Left = () => {
17
+ if (hideLeftElements) {
18
+ return null;
19
+ }
20
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [leftElements ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: leftElements })) : (
21
+ // If no left elements passed, show back button
22
+ (0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { onPress: onBack, underlayColor: "transparent", hitSlop: constants_2.DEFAULT_HIT_SLOP, children: (0, jsx_runtime_1.jsx)(ArrowLeftIcon_1.ArrowLeftIcon, { fill: "onBackgroundHigh", marginLeft: "-4px", top: "1px" }) })), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 1 })] }));
23
+ };
24
+ const Center = () => {
25
+ if (hideTitle) {
26
+ return null;
27
+ }
28
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { width: (0, react_native_device_info_1.isTablet)() ? "100%" : "70%", flex: 1, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "md", numberOfLines: 1, children: title }) }));
29
+ };
30
+ const Right = () => {
31
+ if (hideRightElements) {
32
+ return null;
33
+ }
34
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 1 }), rightElements] }));
35
+ };
36
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { height: constants_1.NAVBAR_HEIGHT, flexDirection: "row", px: 2, top: insets.top, zIndex: constants_1.ZINDEX.header, backgroundColor: "background", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Left, {}), (0, jsx_runtime_1.jsx)(Center, {}), (0, jsx_runtime_1.jsx)(Right, {})] }));
37
+ };
38
+ exports.Header = Header;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const ScreenBase: React.FC<{
3
+ children: React.ReactNode;
4
+ }>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScreenBase = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_safe_area_context_1 = require("react-native-safe-area-context");
6
+ const Flex_1 = require("../Flex");
7
+ const ScreenBase = ({ children }) => {
8
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, backgroundColor: "background", children: [children, (0, jsx_runtime_1.jsx)(SafeAreaCover, {})] }));
9
+ };
10
+ exports.ScreenBase = ScreenBase;
11
+ const SafeAreaCover = () => {
12
+ const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
13
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", left: 0, right: 0, top: 0, height: insets.top, backgroundColor: "background" }));
14
+ };
@@ -0,0 +1,12 @@
1
+ import { SpacingUnitDSValueNumber } from "../../types";
2
+ export declare const LARGE_TITLE_HEIGHT = 64;
3
+ export declare const NAVBAR_HEIGHT = 44;
4
+ export declare const SCREEN_HORIZONTAL_PADDING: SpacingUnitDSValueNumber;
5
+ export declare const SCREEN_TRANSITION_TIME = 400;
6
+ export declare const ZINDEX: {
7
+ artworkContent: number;
8
+ bottomSheetModalView: number;
9
+ floatingHeader: number;
10
+ header: number;
11
+ selectMode: number;
12
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZINDEX = exports.SCREEN_TRANSITION_TIME = exports.SCREEN_HORIZONTAL_PADDING = exports.NAVBAR_HEIGHT = exports.LARGE_TITLE_HEIGHT = void 0;
4
+ exports.LARGE_TITLE_HEIGHT = 64;
5
+ exports.NAVBAR_HEIGHT = 44;
6
+ exports.SCREEN_HORIZONTAL_PADDING = 2;
7
+ exports.SCREEN_TRANSITION_TIME = 400;
8
+ exports.ZINDEX = {
9
+ artworkContent: 10,
10
+ bottomSheetModalView: 1,
11
+ floatingHeader: 2,
12
+ header: 1,
13
+ selectMode: 1,
14
+ };
@@ -1 +1,14 @@
1
- export * from "./Screen";
1
+ /// <reference types="react" />
2
+ export declare const Screen: import("react").FC<{
3
+ children: import("react").ReactNode;
4
+ }> & {
5
+ Background: import("react").FC<{
6
+ children: import("react").ReactNode;
7
+ }>;
8
+ Body: import("react").FC<import("./Body").BodyProps>;
9
+ BottomView: import("react").FC<import("./BottomView").BottomViewProps>;
10
+ FloatingHeader: ({ onBack, rightElements }: import("./FloatingHeader").FloatingHeaderProps) => JSX.Element;
11
+ FullWidthDivider: import("react").FC<import("..").BoxProps>;
12
+ FullWidthItem: import("react").FC<import("..").BoxProps>;
13
+ Header: import("react").FC<import("./Header").HeaderProps>;
14
+ };
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Screen"), exports);
3
+ exports.Screen = void 0;
4
+ const Background_1 = require("./Background");
5
+ const Body_1 = require("./Body");
6
+ const BottomView_1 = require("./BottomView");
7
+ const FloatingHeader_1 = require("./FloatingHeader");
8
+ const FullWidthDivider_1 = require("./FullWidthDivider");
9
+ const FullWidthItem_1 = require("./FullWidthItem");
10
+ const Header_1 = require("./Header");
11
+ const ScreenBase_1 = require("./ScreenBase");
12
+ exports.Screen = Object.assign(ScreenBase_1.ScreenBase, {
13
+ Background: Background_1.Background,
14
+ Body: Body_1.Body,
15
+ BottomView: BottomView_1.BottomView,
16
+ FloatingHeader: FloatingHeader_1.FloatingHeader,
17
+ FullWidthDivider: FullWidthDivider_1.FullWidthDivider,
18
+ FullWidthItem: FullWidthItem_1.FullWidthItem,
19
+ Header: Header_1.Header,
20
+ });
@@ -17,6 +17,7 @@ export * from "./Header";
17
17
  export * from "./Histogram";
18
18
  export * from "./Input";
19
19
  export * from "./Join";
20
+ export * from "./LegacyScreen";
20
21
  export * from "./List";
21
22
  export * from "./Message";
22
23
  export * from "./MeasuredView";
@@ -33,6 +33,7 @@ __exportStar(require("./Header"), exports);
33
33
  __exportStar(require("./Histogram"), exports);
34
34
  __exportStar(require("./Input"), exports);
35
35
  __exportStar(require("./Join"), exports);
36
+ __exportStar(require("./LegacyScreen"), exports);
36
37
  __exportStar(require("./List"), exports);
37
38
  __exportStar(require("./Message"), exports);
38
39
  __exportStar(require("./MeasuredView"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "11.0.23",
3
+ "version": "11.0.25",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",
@@ -108,6 +108,7 @@
108
108
  "react": "18.2.0",
109
109
  "react-dom": "18.2.0",
110
110
  "react-native": "0.70.8",
111
+ "react-native-device-info": "10.3.0",
111
112
  "react-native-flipper": "0.178.1",
112
113
  "react-native-haptic-feedback": "1.14.0",
113
114
  "react-native-linear-gradient": "2.6.2",
@@ -1,34 +0,0 @@
1
- import { FC, ReactNode } from "react";
2
- import { FlexProps } from "../Flex";
3
- interface HeaderProps {
4
- onBack?: () => void;
5
- }
6
- interface RawHeaderProps {
7
- children: ReactNode;
8
- nosafe?: boolean;
9
- }
10
- interface BodyProps extends Partial<Pick<FlexProps, "backgroundColor">> {
11
- children?: ReactNode;
12
- scroll?: boolean;
13
- nosafe?: boolean;
14
- noTopSafe?: boolean;
15
- noBottomSafe?: boolean;
16
- fullwidth?: boolean;
17
- }
18
- export declare const Screen: (({ children }: {
19
- children?: ReactNode;
20
- }) => JSX.Element) & {
21
- Body: ({ scroll, nosafe, noTopSafe, noBottomSafe, fullwidth, children, ...restFlexProps }: BodyProps) => JSX.Element;
22
- Header: ({ onBack }: HeaderProps) => JSX.Element;
23
- FloatingHeader: FC<HeaderProps>;
24
- RawHeader: ({ children, nosafe }: RawHeaderProps) => JSX.Element;
25
- Background: ({ children }: {
26
- children?: ReactNode;
27
- }) => JSX.Element;
28
- BottomView: ({ children }: {
29
- children?: ReactNode;
30
- }) => JSX.Element;
31
- BodyXPadding: FC<import("..").BoxProps>;
32
- SafeBottomPadding: () => JSX.Element | null;
33
- };
34
- export {};