@artsy/palette-mobile 11.0.26 → 11.0.27

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,19 @@
1
+ # v11.0.27 (Fri May 12 2023)
2
+
3
+ :tada: This release contains work from a new contributor! :tada:
4
+
5
+ Thank you, Mounir Dhahri ([@MounirDhahri](https://github.com/MounirDhahri)), for all your work!
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - feat: add right button support to entity header [#101](https://github.com/artsy/palette-mobile/pull/101) ([@MounirDhahri](https://github.com/MounirDhahri))
10
+
11
+ #### Authors: 1
12
+
13
+ - Mounir Dhahri ([@MounirDhahri](https://github.com/MounirDhahri))
14
+
15
+ ---
16
+
1
17
  # v11.0.26 (Fri May 05 2023)
2
18
 
3
19
  #### 🐛 Bug Fix
@@ -1,5 +1,5 @@
1
1
  import { ImgHTMLAttributes } from "react";
2
- type AvatarSize = "xxs" | "xs" | "sm" | "md";
2
+ export type AvatarSize = "xxs" | "xs" | "sm" | "md";
3
3
  export interface AvatarProps extends ImgHTMLAttributes<any> {
4
4
  src?: string;
5
5
  /** If an image is missing, show initials instead */
@@ -9,4 +9,3 @@ export interface AvatarProps extends ImgHTMLAttributes<any> {
9
9
  }
10
10
  /** A circular Avatar component containing an image or initials */
11
11
  export declare const Avatar: ({ src, initials, size }: AvatarProps) => JSX.Element;
12
- export {};
@@ -1,13 +1,15 @@
1
1
  /// <reference types="react" />
2
+ import { AvatarSize } from "../Avatar";
2
3
  import { FlexProps } from "../Flex";
3
4
  interface EntityHeaderProps extends FlexProps {
4
- smallVariant?: boolean;
5
- href?: string;
5
+ avatarSize?: AvatarSize;
6
+ FollowButton?: JSX.Element;
7
+ RightButton?: JSX.Element;
6
8
  imageUrl?: string;
7
9
  initials?: string;
8
- meta?: string;
10
+ meta?: string | JSX.Element;
9
11
  name: string;
10
- FollowButton?: JSX.Element;
12
+ smallVariant?: boolean;
11
13
  }
12
- export declare const EntityHeader: ({ smallVariant, href, imageUrl, initials, name, meta, FollowButton, ...restProps }: EntityHeaderProps) => JSX.Element;
14
+ export declare const EntityHeader: ({ avatarSize, FollowButton, RightButton, imageUrl, initials, meta, name, smallVariant, ...restProps }: EntityHeaderProps) => JSX.Element;
13
15
  export {};
@@ -2,14 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EntityHeader = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
5
6
  const text_1 = require("../../utils/text");
6
7
  const Avatar_1 = require("../Avatar");
7
8
  const Flex_1 = require("../Flex");
8
9
  const Text_1 = require("../Text");
9
- const EntityHeader = ({ smallVariant = false, href, imageUrl, initials, name, meta, FollowButton, ...restProps }) => {
10
- const followButton = FollowButton && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { ml: smallVariant ? 0.5 : 1, flexDirection: "row", alignItems: "center", justifyContent: "flex-end", children: FollowButton }));
10
+ const EntityHeader = ({ avatarSize = "xs", FollowButton, RightButton, imageUrl, initials, meta, name, smallVariant = false, ...restProps }) => {
11
+ const rightButton = (RightButton || FollowButton) && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { ml: smallVariant ? 0.5 : 1, flexDirection: "row", alignItems: "center", justifyContent: "flex-end", children: RightButton || FollowButton }));
11
12
  const headerName = ((0, jsx_runtime_1.jsx)(Text_1.Text, { ellipsizeMode: "tail", numberOfLines: 1, variant: "sm", style: { flexShrink: 1 }, children: name }));
12
- const headerMeta = !!meta && ((0, jsx_runtime_1.jsx)(Text_1.Text, { ellipsizeMode: "tail", numberOfLines: 1, variant: "xs", color: "black60", style: { flexShrink: 1 }, children: meta }));
13
- return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", flexWrap: "nowrap", ...restProps, children: [!!(imageUrl || initials) && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mr: 1, justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Avatar_1.Avatar, { size: "xs", src: imageUrl, initials: initials }) })), smallVariant ? ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", justifyContent: "flex-start", flexGrow: 1, alignItems: "center", children: [headerName, (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", ml: "0.5", children: text_1.bullet }), followButton] })) : ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { justifyContent: "space-between", width: 0, flexGrow: 1, flexDirection: "row", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignSelf: "center", flexShrink: 1, children: [headerName, headerMeta] }), followButton] }))] }));
13
+ const headerMeta = (0, react_1.useMemo)(() => {
14
+ if (meta) {
15
+ if ((0, react_1.isValidElement)(meta)) {
16
+ return meta;
17
+ }
18
+ return ((0, jsx_runtime_1.jsx)(Text_1.Text, { ellipsizeMode: "tail", numberOfLines: 1, variant: "xs", color: "black60", style: { flexShrink: 1 }, children: meta }));
19
+ }
20
+ return null;
21
+ }, [meta]);
22
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", flexWrap: "nowrap", ...restProps, children: [!!(imageUrl || initials) && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mr: 1, justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Avatar_1.Avatar, { size: avatarSize, src: imageUrl, initials: initials }) })), smallVariant ? ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", justifyContent: "flex-start", flexGrow: 1, alignItems: "center", children: [headerName, (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "sm", ml: "0.5", children: text_1.bullet }), rightButton] })) : ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { justifyContent: "space-between", width: 0, flexGrow: 1, flexDirection: "row", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { alignSelf: "center", flexShrink: 1, children: [headerName, headerMeta] }), rightButton] }))] }));
14
23
  };
15
24
  exports.EntityHeader = EntityHeader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "11.0.26",
3
+ "version": "11.0.27",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",