@artsy/palette-mobile 13.0.12 → 13.0.14
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
|
+
# v13.0.14 (Thu Sep 28 2023)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- fix: remove unnecessary padding from IconComponent in Message [#157](https://github.com/artsy/palette-mobile/pull/157) ([@MounirDhahri](https://github.com/MounirDhahri))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Mounir Dhahri ([@MounirDhahri](https://github.com/MounirDhahri))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# v13.0.13 (Thu Sep 28 2023)
|
|
14
|
+
|
|
15
|
+
#### 🐛 Bug Fix
|
|
16
|
+
|
|
17
|
+
- feat(DIA-110): remove artist variant and replaces with profile on Pill element [#155](https://github.com/artsy/palette-mobile/pull/155) ([@araujobarret](https://github.com/araujobarret))
|
|
18
|
+
|
|
19
|
+
#### Authors: 1
|
|
20
|
+
|
|
21
|
+
- Carlos Alberto de Araujo Barreto ([@araujobarret](https://github.com/araujobarret))
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
1
25
|
# v13.0.12 (Tue Sep 19 2023)
|
|
2
26
|
|
|
3
27
|
#### 🐛 Bug Fix
|
|
@@ -33,7 +33,7 @@ const Message = ({ bodyTextStyle, containerStyle, IconComponent, iconPosition =
|
|
|
33
33
|
}),
|
|
34
34
|
},
|
|
35
35
|
],
|
|
36
|
-
}, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { backgroundColor: color(colors[variant].background), ...containerStyle, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { px: 2, py: 1, flexDirection: "row", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [!!IconComponent && iconPosition === "left" && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mr: 1, children: (0, jsx_runtime_1.jsx)(IconComponent, {}) })), (0, jsx_runtime_1.jsx)(Text_1.Text, { pr: 2, variant: "xs", color: color(colors[variant].title), ...titleStyle, children: title })] }), !!text && ((0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "xs", color: color(colors[variant].text), ...bodyTextStyle, children: text }))] }), !!IconComponent && iconPosition === "right" && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mr: 1, justifyContent: "center", children: (0, jsx_runtime_1.jsx)(IconComponent, {}) })), !!showCloseButton && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { style: { marginTop: 2 }, children: (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { testID: "Message-close-button", onPress: handleClose, hitSlop: { bottom: 10, right: 10, left: 10, top: 10 }, children: (0, jsx_runtime_1.jsx)(svgs_1.CloseIcon, { fill: color("black100") }) }) }))] }) }) }));
|
|
36
|
+
}, children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { backgroundColor: color(colors[variant].background), ...containerStyle, children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { px: 2, py: 1, flexDirection: "row", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [!!IconComponent && iconPosition === "left" && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mr: 1, children: (0, jsx_runtime_1.jsx)(IconComponent, {}) })), (0, jsx_runtime_1.jsx)(Text_1.Text, { pr: 2, variant: "xs", color: color(colors[variant].title), ...titleStyle, children: title })] }), !!text && ((0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "xs", color: color(colors[variant].text), ...bodyTextStyle, children: text }))] }), !!IconComponent && iconPosition === "right" && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { mr: showCloseButton ? 1 : 0, justifyContent: "center", children: (0, jsx_runtime_1.jsx)(IconComponent, {}) })), !!showCloseButton && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { style: { marginTop: 2 }, children: (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { testID: "Message-close-button", onPress: handleClose, hitSlop: { bottom: 10, right: 10, left: 10, top: 10 }, children: (0, jsx_runtime_1.jsx)(svgs_1.CloseIcon, { fill: color("black100") }) }) }))] }) }) }));
|
|
37
37
|
};
|
|
38
38
|
exports.Message = Message;
|
|
39
39
|
const colors = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { MotiPressableProps } from "moti/interactions";
|
|
3
3
|
import { IconProps } from "../../svgs/Icon";
|
|
4
4
|
import { FlexProps } from "../Flex";
|
|
5
|
-
export declare const PILL_VARIANT_NAMES: readonly ["default", "search", "filter", "
|
|
5
|
+
export declare const PILL_VARIANT_NAMES: readonly ["default", "search", "filter", "profile", "badge"];
|
|
6
6
|
export type PillState = "default" | "selected" | "disabled";
|
|
7
7
|
export type PillVariant = typeof PILL_VARIANT_NAMES[number];
|
|
8
8
|
export type PillProps = (FlexProps & {
|
|
@@ -14,7 +14,7 @@ export type PillProps = (FlexProps & {
|
|
|
14
14
|
variant?: Extract<PillVariant, "default" | "filter" | "badge" | "search">;
|
|
15
15
|
src?: never;
|
|
16
16
|
} | {
|
|
17
|
-
variant: Extract<PillVariant, "
|
|
17
|
+
variant: Extract<PillVariant, "profile">;
|
|
18
18
|
src?: string;
|
|
19
19
|
});
|
|
20
20
|
export declare const Pill: React.FC<PillProps>;
|
|
@@ -36,16 +36,17 @@ const svgs_1 = require("../../svgs");
|
|
|
36
36
|
const Flex_1 = require("../Flex");
|
|
37
37
|
const Image_1 = require("../Image");
|
|
38
38
|
const Text_1 = require("../Text");
|
|
39
|
-
exports.PILL_VARIANT_NAMES = ["default", "search", "filter", "
|
|
39
|
+
exports.PILL_VARIANT_NAMES = ["default", "search", "filter", "profile", "badge"];
|
|
40
40
|
const Pill = ({ variant = "default", src, selected, disabled, Icon, children, onPress, ...rest }) => {
|
|
41
41
|
const stateString = selected ? "selected" : disabled ? "disabled" : "default";
|
|
42
42
|
const color = TEXT_COLOR[variant][stateString];
|
|
43
|
+
const showCloseIcon = (variant === "filter" && !disabled) || (["profile"].includes(variant) && selected);
|
|
43
44
|
return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { ...rest, children: (0, jsx_runtime_1.jsxs)(Container, { variant: variant, selected: selected, disabled: disabled, onPress: onPress, animate: (0, react_1.useMemo)(() => ({ hovered, pressed }) => {
|
|
44
45
|
"worklet";
|
|
45
46
|
return {
|
|
46
47
|
opacity: hovered || pressed ? 0.5 : 1,
|
|
47
48
|
};
|
|
48
|
-
}, []), children: [variant === "
|
|
49
|
+
}, []), children: [variant === "profile" && src && ((0, jsx_runtime_1.jsx)(Thumbnail, { src: src, height: 30, width: 30, style: { overflow: "hidden" } })), Icon && (0, jsx_runtime_1.jsx)(Icon, { fill: color, ml: -0.5, mr: 0.5 }), (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "xs", color: color, children: children }), showCloseIcon && (0, jsx_runtime_1.jsx)(svgs_1.CloseIcon, { fill: color, ml: 0.5, width: 15, height: 15 })] }) }));
|
|
49
50
|
};
|
|
50
51
|
exports.Pill = Pill;
|
|
51
52
|
const Container = (0, styled_components_1.default)(interactions_1.MotiPressable) `
|
|
@@ -93,11 +94,13 @@ const PILL_VARIANTS = {
|
|
|
93
94
|
${PILL_STATES.default}
|
|
94
95
|
`,
|
|
95
96
|
},
|
|
96
|
-
|
|
97
|
+
profile: {
|
|
97
98
|
default: (0, styled_components_1.css) `
|
|
99
|
+
background-color: ${(0, theme_get_1.default)("colors.black5")};
|
|
100
|
+
border-color: ${(0, theme_get_1.default)("colors.black5")};
|
|
98
101
|
border-radius: 25px;
|
|
99
102
|
height: 50px;
|
|
100
|
-
padding: 0 ${(0, theme_get_1.default)("space.2")}
|
|
103
|
+
padding: 0 ${(0, theme_get_1.default)("space.2")}};
|
|
101
104
|
`,
|
|
102
105
|
selected: (0, styled_components_1.css) `
|
|
103
106
|
border-color: ${(0, theme_get_1.default)("colors.blue100")};
|
|
@@ -140,7 +143,7 @@ const defaultColors = {
|
|
|
140
143
|
const TEXT_COLOR = {
|
|
141
144
|
default: defaultColors,
|
|
142
145
|
search: defaultColors,
|
|
143
|
-
|
|
146
|
+
profile: {
|
|
144
147
|
...defaultColors,
|
|
145
148
|
selected: "black100",
|
|
146
149
|
},
|
|
@@ -16,8 +16,8 @@ exports.default = {
|
|
|
16
16
|
marginHorizontal: 20,
|
|
17
17
|
justifyContent: "flex-start",
|
|
18
18
|
alignItems: "flex-start",
|
|
19
|
-
}, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { children: "Default" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { disabled: true, ml: 1, children: "Disabled" })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "filter", children: "Filter" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "filter", selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "filter", disabled: true, ml: 1, children: "Disabled" })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { Icon: svgs_1.GraphIcon, variant: "badge", children: "Badge" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { Icon: svgs_1.GraphIcon, variant: "badge", selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { Icon: svgs_1.GraphIcon, variant: "badge", disabled: true, ml: 1, children: "Disabled" })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "
|
|
20
|
-
.add("
|
|
19
|
+
}, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { children: "Default" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { disabled: true, ml: 1, children: "Disabled" })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "filter", children: "Filter" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "filter", selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "filter", disabled: true, ml: 1, children: "Disabled" })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { Icon: svgs_1.GraphIcon, variant: "badge", children: "Badge" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { Icon: svgs_1.GraphIcon, variant: "badge", selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { Icon: svgs_1.GraphIcon, variant: "badge", disabled: true, ml: 1, children: "Disabled" })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "profile", children: "Profile" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "profile", selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "profile", disabled: true, ml: 1, children: "Disabled" })] }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "search", children: "Search" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "search", selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "search", disabled: true, ml: 1, children: "Search" })] })] })))
|
|
20
|
+
.add("Profile with image", () => ((0, jsx_runtime_1.jsxs)(helpers_1.List, { contentContainerStyle: { marginHorizontal: 20 }, children: [(0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "profile", src: src, children: "Artist" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "profile", src: src, selected: true, ml: 1, children: "Selected" }), (0, jsx_runtime_1.jsx)(Pill_1.Pill, { variant: "profile", src: src, disabled: true, ml: 1, children: "Disabled" })] })))
|
|
21
21
|
.add("Controlled state", () => {
|
|
22
22
|
const [selected, setSelected] = (0, react_1.useState)(false);
|
|
23
23
|
return ((0, jsx_runtime_1.jsx)(helpers_1.List, { contentContainerStyle: { marginHorizontal: 20 }, children: (0, jsx_runtime_1.jsx)(Pill_1.Pill, { selected: selected, onPress: () => setSelected((prev) => !prev), children: "Pill" }) }));
|