@artsy/palette-mobile 11.0.27 → 11.0.28

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,15 @@
1
+ # v11.0.28 (Sat May 13 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - chore(screen): make stuff consistent [#102](https://github.com/artsy/palette-mobile/pull/102) ([@damassi](https://github.com/damassi))
6
+
7
+ #### Authors: 1
8
+
9
+ - Christopher Pappas ([@damassi](https://github.com/damassi))
10
+
11
+ ---
12
+
1
13
  # v11.0.27 (Fri May 12 2023)
2
14
 
3
15
  :tada: This release contains work from a new contributor! :tada:
@@ -2,7 +2,6 @@
2
2
  import { FlexProps } from "../Flex";
3
3
  export interface BodyProps extends FlexProps {
4
4
  fullwidth?: boolean;
5
- safeArea?: boolean;
6
5
  scroll?: boolean;
7
6
  }
8
7
  export declare const Body: React.FC<BodyProps>;
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Body = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_native_1 = require("react-native");
6
- const react_native_safe_area_context_1 = require("react-native-safe-area-context");
7
6
  const constants_1 = require("./constants");
8
7
  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 }) }) }));
8
+ const Body = ({ children, fullwidth, scroll, ...flexProps }) => {
9
+ 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, ...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
10
  };
13
11
  exports.Body = Body;
@@ -14,6 +14,6 @@ const BottomView = ({ children, darkMode }) => {
14
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
15
  width: "100%",
16
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 })] }));
17
+ }, pointerEvents: "none" }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { px: constants_1.SCREEN_HORIZONTAL_PADDING, pt: 1, pb: 4, backgroundColor: "background", children: children })] }));
18
18
  };
19
19
  exports.BottomView = BottomView;
@@ -9,6 +9,6 @@ const Flex_1 = require("../Flex");
9
9
  const Spacer_1 = require("../Spacer");
10
10
  const FloatingHeader = ({ onBack, rightElements }) => {
11
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] }))] }));
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, px: 1, py: 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
13
  };
14
14
  exports.FloatingHeader = FloatingHeader;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { FlexProps } from "../Flex";
2
3
  export interface HeaderProps {
3
4
  animated?: boolean;
4
5
  hideLeftElements?: boolean;
@@ -9,6 +10,7 @@ export interface HeaderProps {
9
10
  rightElements?: React.ReactNode;
10
11
  scrollY?: number;
11
12
  title?: string;
13
+ titleProps?: FlexProps;
12
14
  titleShown?: boolean;
13
15
  }
14
16
  export declare const Header: React.FC<HeaderProps>;
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Header = void 0;
4
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
5
  const constants_1 = require("./constants");
8
6
  const constants_2 = require("../../constants");
9
7
  const ArrowLeftIcon_1 = require("../../svgs/ArrowLeftIcon");
@@ -11,21 +9,20 @@ const Flex_1 = require("../Flex");
11
9
  const Spacer_1 = require("../Spacer");
12
10
  const Text_1 = require("../Text");
13
11
  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)();
12
+ const Header = ({ hideLeftElements, hideRightElements, leftElements, rightElements, onBack, title, hideTitle, titleProps = {}, }) => {
16
13
  const Left = () => {
17
14
  if (hideLeftElements) {
18
15
  return null;
19
16
  }
20
17
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [leftElements ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: leftElements })) : (
21
18
  // 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 })] }));
19
+ (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", top: "2px" }) })), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 1 })] }));
23
20
  };
24
21
  const Center = () => {
25
22
  if (hideTitle) {
26
23
  return null;
27
24
  }
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 }) }));
25
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, ...titleProps, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "md", numberOfLines: 1, children: title }) }));
29
26
  };
30
27
  const Right = () => {
31
28
  if (hideRightElements) {
@@ -33,6 +30,6 @@ const Header = ({ hideLeftElements, hideRightElements, hideTitle, leftElements,
33
30
  }
34
31
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_1.Spacer, { x: 1 }), rightElements] }));
35
32
  };
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, {})] }));
33
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { height: constants_1.NAVBAR_HEIGHT, flexDirection: "row", px: 2, py: 1, 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
34
  };
38
35
  exports.Header = Header;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const ScreenBase: React.FC<{
2
+ export interface ScreenBaseProps {
3
3
  children: React.ReactNode;
4
- }>;
4
+ safeArea?: boolean;
5
+ }
6
+ export declare const ScreenBase: React.FC<ScreenBaseProps>;
@@ -4,10 +4,12 @@ exports.ScreenBase = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
6
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, {})] }));
7
+ const ScreenBase = ({ children, safeArea = true }) => {
8
+ const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
9
+ return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { flex: 1, backgroundColor: "background", mt: safeArea ? insets.top : 0, children: children }));
9
10
  };
10
11
  exports.ScreenBase = ScreenBase;
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
13
  const SafeAreaCover = () => {
12
14
  const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
13
15
  return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", left: 0, right: 0, top: 0, height: insets.top, backgroundColor: "background" }));
@@ -1,6 +1,6 @@
1
1
  import { SpacingUnitDSValueNumber } from "../../types";
2
2
  export declare const LARGE_TITLE_HEIGHT = 64;
3
- export declare const NAVBAR_HEIGHT = 44;
3
+ export declare const NAVBAR_HEIGHT = 50;
4
4
  export declare const SCREEN_HORIZONTAL_PADDING: SpacingUnitDSValueNumber;
5
5
  export declare const SCREEN_TRANSITION_TIME = 400;
6
6
  export declare const ZINDEX: {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZINDEX = exports.SCREEN_TRANSITION_TIME = exports.SCREEN_HORIZONTAL_PADDING = exports.NAVBAR_HEIGHT = exports.LARGE_TITLE_HEIGHT = void 0;
4
4
  exports.LARGE_TITLE_HEIGHT = 64;
5
- exports.NAVBAR_HEIGHT = 44;
5
+ exports.NAVBAR_HEIGHT = 50;
6
6
  exports.SCREEN_HORIZONTAL_PADDING = 2;
7
7
  exports.SCREEN_TRANSITION_TIME = 400;
8
8
  exports.ZINDEX = {
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const Screen: import("react").FC<{
3
- children: import("react").ReactNode;
4
- }> & {
2
+ export * from "./constants";
3
+ export declare const Screen: import("react").FC<import("./ScreenBase").ScreenBaseProps> & {
5
4
  Background: import("react").FC<{
6
5
  children: import("react").ReactNode;
7
6
  }>;
@@ -1,4 +1,18 @@
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.Screen = void 0;
4
18
  const Background_1 = require("./Background");
@@ -9,6 +23,7 @@ const FullWidthDivider_1 = require("./FullWidthDivider");
9
23
  const FullWidthItem_1 = require("./FullWidthItem");
10
24
  const Header_1 = require("./Header");
11
25
  const ScreenBase_1 = require("./ScreenBase");
26
+ __exportStar(require("./constants"), exports);
12
27
  exports.Screen = Object.assign(ScreenBase_1.ScreenBase, {
13
28
  Background: Background_1.Background,
14
29
  Body: Body_1.Body,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "11.0.27",
3
+ "version": "11.0.28",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",