@artsy/palette-mobile 24.15.0 → 24.17.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.
|
@@ -28,11 +28,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
exports.Popover = void 0;
|
|
29
29
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
30
|
var native_1 = require("@artsy/icons/native");
|
|
31
|
+
var react_native_1 = require("react-native");
|
|
31
32
|
var react_native_popover_view_1 = __importDefault(require("react-native-popover-view"));
|
|
32
33
|
var react_native_reanimated_1 = require("react-native-reanimated");
|
|
33
34
|
var hooks_1 = require("../../utils/hooks");
|
|
34
35
|
var Flex_1 = require("../Flex");
|
|
35
36
|
var Touchable_1 = require("../Touchable");
|
|
37
|
+
// Apps targeting SDK 35+ are edge-to-edge from Android 15 (API 35), so the anchor rect already
|
|
38
|
+
// includes the status bar and react-native-popover-view must not add StatusBar.currentHeight to it.
|
|
39
|
+
var IS_ANDROID_EDGE_TO_EDGE = react_native_1.Platform.OS === "android" && Number(react_native_1.Platform.Version) >= 35;
|
|
36
40
|
var Popover = function (_a) {
|
|
37
41
|
var _b = _a.variant, variant = _b === void 0 ? "dark" : _b, children = _a.children, visible = _a.visible, onOpenComplete = _a.onOpenComplete, onPressOutside = _a.onPressOutside, onDismiss = _a.onDismiss, onCloseComplete = _a.onCloseComplete, _c = _a.placement, placement = _c === void 0 ? "top" : _c, title = _a.title, content = _a.content, noCloseIcon = _a.noCloseIcon, rest = __rest(_a, ["variant", "children", "visible", "onOpenComplete", "onPressOutside", "onDismiss", "onCloseComplete", "placement", "title", "content", "noCloseIcon"]);
|
|
38
42
|
var color = (0, hooks_1.useColor)();
|
|
@@ -58,7 +62,7 @@ var Popover = function (_a) {
|
|
|
58
62
|
},
|
|
59
63
|
};
|
|
60
64
|
var style = POPOVER_VARIANTS[variant];
|
|
61
|
-
return ((0, jsx_runtime_1.jsx)(react_native_popover_view_1.default, __assign({ backgroundStyle: { opacity: 0.5, backgroundColor: color("mono100") }, popoverStyle: [{ backgroundColor: style.backgroundColor }, style.shadow], from: children, isVisible: visible, onCloseComplete: onCloseComplete, onOpenComplete: onOpenComplete, onRequestClose: onPressOutside, placement: placement, arrowSize: { height: 11, width: 22 }, animationConfig: {
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(react_native_popover_view_1.default, __assign({ backgroundStyle: { opacity: 0.5, backgroundColor: color("mono100") }, popoverStyle: [{ backgroundColor: style.backgroundColor }, style.shadow], from: children, isVisible: visible, onCloseComplete: onCloseComplete, onOpenComplete: onOpenComplete, onRequestClose: onPressOutside, placement: placement, statusBarTranslucent: !IS_ANDROID_EDGE_TO_EDGE, arrowSize: { height: 11, width: 22 }, animationConfig: {
|
|
62
66
|
duration: 400,
|
|
63
67
|
easing: react_native_reanimated_1.Easing.out(react_native_reanimated_1.Easing.exp),
|
|
64
68
|
} }, rest, { children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { backgroundColor: POPOVER_VARIANTS[variant].backgroundColor, p: 1, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [title ? title : (0, jsx_runtime_1.jsx)(Flex_1.Flex, {}), !noCloseIcon && ((0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { onPress: onDismiss, accessibilityRole: "button", "aria-label": "Dismiss popover", children: (0, jsx_runtime_1.jsx)(Flex_1.Flex, { ml: 0.5, children: (0, jsx_runtime_1.jsx)(native_1.CloseIcon, { width: 18, height: 18, fill: style.fill }) }) }))] }), content] }) })));
|
|
@@ -48,10 +48,10 @@ var DefaultTabItem = function (props) {
|
|
|
48
48
|
return ((0, jsx_runtime_1.jsxs)(Box_1.Box, { flex: 1, children: [(0, jsx_runtime_1.jsx)(Flex_1.Flex, { position: "absolute", width: "100%", children: !!(Indicator === null || Indicator === void 0 ? void 0 : Indicator.Component) && (0, jsx_runtime_1.jsx)(Indicator.Component, __assign({}, props)) }), (0, jsx_runtime_1.jsx)(react_native_collapsible_tab_view_1.MaterialTabItem, __assign({ pressOpacity: constants_1.DEFAULT_ACTIVE_OPACITY }, props))] }));
|
|
49
49
|
};
|
|
50
50
|
var TabsContainer = function (_a) {
|
|
51
|
-
var children = _a.children, _b = _a.indicators, indicators = _b === void 0 ? [] : _b, initialTabName = _a.initialTabName, onTabPress = _a.onTabPress, renderHeader = _a.renderHeader, stickyTabBarComponent = _a.stickyTabBarComponent, _c = _a.tabScrollEnabled, tabScrollEnabled = _c === void 0 ? false : _c, _d = _a.variant, variant = _d === void 0 ? "tabs" : _d, tabContainerProps = __rest(_a, ["children", "indicators", "initialTabName", "onTabPress", "renderHeader", "stickyTabBarComponent", "tabScrollEnabled", "variant"]);
|
|
51
|
+
var children = _a.children, _b = _a.indicators, indicators = _b === void 0 ? [] : _b, initialTabName = _a.initialTabName, onTabPress = _a.onTabPress, renderHeader = _a.renderHeader, stickyTabBarComponent = _a.stickyTabBarComponent, _c = _a.tabScrollEnabled, tabScrollEnabled = _c === void 0 ? false : _c, _d = _a.variant, variant = _d === void 0 ? "tabs" : _d, _e = _a.allowHeaderOverscroll, allowHeaderOverscroll = _e === void 0 ? true : _e, tabContainerProps = __rest(_a, ["children", "indicators", "initialTabName", "onTabPress", "renderHeader", "stickyTabBarComponent", "tabScrollEnabled", "variant", "allowHeaderOverscroll"]);
|
|
52
52
|
var space = (0, useSpace_1.useSpace)();
|
|
53
53
|
var color = (0, useColor_1.useColor)();
|
|
54
|
-
var
|
|
54
|
+
var _f = (0, react_1.useState)(initialTabName), focusedTabState = _f[0], setFocusedTabState = _f[1];
|
|
55
55
|
var isIOS = react_native_1.Platform.OS === "ios";
|
|
56
56
|
return ((0, jsx_runtime_1.jsx)(react_native_collapsible_tab_view_1.Tabs.Container, __assign({ renderHeader: renderHeader, headerContainerStyle: {
|
|
57
57
|
shadowOpacity: 0,
|
|
@@ -85,6 +85,6 @@ var TabsContainer = function (_a) {
|
|
|
85
85
|
// to prevent linebreaks on the tab titles
|
|
86
86
|
paddingHorizontal: 0,
|
|
87
87
|
} })) }));
|
|
88
|
-
} }, tabContainerProps, { children: children })));
|
|
88
|
+
}, allowHeaderOverscroll: allowHeaderOverscroll }, tabContainerProps, { children: children })));
|
|
89
89
|
};
|
|
90
90
|
exports.TabsContainer = TabsContainer;
|
|
@@ -37,9 +37,9 @@ var TabsWithHeader = function (_a) {
|
|
|
37
37
|
};
|
|
38
38
|
exports.TabsWithHeader = TabsWithHeader;
|
|
39
39
|
var Content = function (_a) {
|
|
40
|
-
var BelowTitleHeaderComponent = _a.BelowTitleHeaderComponent, children = _a.children, _b = _a.showLargeHeaderText, showLargeHeaderText = _b === void 0 ? true : _b, title = _a.title,
|
|
40
|
+
var BelowTitleHeaderComponent = _a.BelowTitleHeaderComponent, children = _a.children, _b = _a.showLargeHeaderText, showLargeHeaderText = _b === void 0 ? true : _b, title = _a.title, rest = __rest(_a, ["BelowTitleHeaderComponent", "children", "showLargeHeaderText", "title"]);
|
|
41
41
|
var showTitle = showLargeHeaderText && !!title;
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(TabsContainer_1.TabsContainer, __assign({
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(TabsContainer_1.TabsContainer, __assign({}, rest, { renderHeader: function () {
|
|
43
43
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!showTitle && ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { my: 1, px: 2, justifyContent: "center", pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "lg-display", numberOfLines: 2, children: title }) })), !!BelowTitleHeaderComponent && (0, jsx_runtime_1.jsx)(BelowTitleHeaderComponent, {})] }));
|
|
44
44
|
}, children: children })));
|
|
45
45
|
};
|