@artsy/palette-mobile 11.0.34 → 11.0.36

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.36 (Wed Jun 07 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - fix(touchable): underlayColor replace white100 to transparent [#110](https://github.com/artsy/palette-mobile/pull/110) ([@gkartalis](https://github.com/gkartalis))
6
+
7
+ #### Authors: 1
8
+
9
+ - George Kartalis ([@gkartalis](https://github.com/gkartalis))
10
+
11
+ ---
12
+
13
+ # v11.0.35 (Tue Jun 06 2023)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - feat(tabs): Add support for Indicators [#109](https://github.com/artsy/palette-mobile/pull/109) ([@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.34 (Tue Jun 06 2023)
2
26
 
3
27
  #### 🐛 Bug Fix
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_native_1 = require("@storybook/react-native");
5
+ const Tabs_1 = require("./Tabs");
6
+ const Flex_1 = require("../Flex");
7
+ const Text_1 = require("../Text");
8
+ (0, react_native_1.storiesOf)("Tabs", module)
9
+ .add("Simple Tabs", () => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", alignItems: "center", flexWrap: "wrap", children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { children: [(0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { name: "Tab 1", label: "Tab 1", children: (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.ScrollView, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Tab 1 content" }) }) }), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { name: "Tab 2", label: "Tab 2", children: (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.ScrollView, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Tab 2 content" }) }) })] }) })))
10
+ .add("Tabs with Indicator", () => ((0, jsx_runtime_1.jsx)(Flex_1.Flex, { alignSelf: "center", mt: "200px", flexWrap: "wrap", children: (0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { indicators: [{ tabName: "tab1", Component: () => (0, jsx_runtime_1.jsx)(Text_1.Text, { textAlign: "right", children: "hi" }) }], children: [(0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { name: "tab1", label: "Tab 1", children: (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.ScrollView, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Tab 1 content" }) }) }), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.Tab, { name: "tab2", label: "Tab 2", children: (0, jsx_runtime_1.jsx)(Tabs_1.Tabs.ScrollView, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { children: "Tab 2 content" }) }) })] }) })));
@@ -1,7 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { CollapsibleProps } from "react-native-collapsible-tab-view";
2
+ import { CollapsibleProps, TabItemProps } from "react-native-collapsible-tab-view";
3
+ interface Indicator {
4
+ tabName: string;
5
+ Component: React.FC<TabItemProps<string>>;
6
+ }
3
7
  export interface TabsContainerProps extends CollapsibleProps {
8
+ indicators?: Indicator[];
4
9
  onTabPress?: (tabName: string) => void;
5
10
  tabScrollEnabled?: boolean;
6
11
  }
7
12
  export declare const TabsContainer: React.FC<TabsContainerProps>;
13
+ export {};
@@ -5,8 +5,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_native_collapsible_tab_view_1 = require("react-native-collapsible-tab-view");
6
6
  const useColor_1 = require("../../utils/hooks/useColor");
7
7
  const useSpace_1 = require("../../utils/hooks/useSpace");
8
+ const Box_1 = require("../Box");
9
+ const Flex_1 = require("../Flex");
8
10
  const TAB_BAR_HEIGHT = 50;
9
- const TabsContainer = ({ children, initialTabName, renderHeader, tabScrollEnabled = false, onTabPress, ...tabContainerProps }) => {
11
+ const TabsContainer = ({ children, indicators = [], initialTabName, renderHeader, tabScrollEnabled = false, onTabPress, ...tabContainerProps }) => {
10
12
  const space = (0, useSpace_1.useSpace)();
11
13
  const color = (0, useColor_1.useColor)();
12
14
  return ((0, jsx_runtime_1.jsx)(react_native_collapsible_tab_view_1.Tabs.Container, { ...tabContainerProps, renderHeader: renderHeader, headerContainerStyle: {
@@ -24,6 +26,11 @@ const TabsContainer = ({ children, initialTabName, renderHeader, tabScrollEnable
24
26
  height: TAB_BAR_HEIGHT,
25
27
  borderBottomWidth: 1,
26
28
  borderColor: color("black30"),
29
+ }, TabItemComponent: (props) => {
30
+ const Indicator = indicators.find((indicator) => {
31
+ return indicator.tabName === props.name;
32
+ });
33
+ 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?.Component && (0, jsx_runtime_1.jsx)(Indicator.Component, { ...props }) }), (0, jsx_runtime_1.jsx)(react_native_collapsible_tab_view_1.MaterialTabItem, { ...props, children: "hi 2" })] }));
27
34
  }, contentContainerStyle: {}, activeColor: color("onBackground"), inactiveColor: color("onBackgroundMedium"), labelStyle: { marginTop: 0 }, indicatorStyle: {
28
35
  backgroundColor: color("onBackground"),
29
36
  height: 1,
@@ -28,6 +28,6 @@ const Touchable = ({ children, flex, haptic, noFeedback, onPress, underlayColor,
28
28
  }
29
29
  onPress(evt);
30
30
  };
31
- return noFeedback ? ((0, jsx_runtime_1.jsx)(react_native_1.TouchableWithoutFeedback, { ...props, onPress: onPressWrapped, children: inner })) : ((0, jsx_runtime_1.jsx)(react_native_1.TouchableHighlight, { underlayColor: underlayColor ?? color("white100"), activeOpacity: 0.8, ...props, onPress: onPressWrapped, children: inner }));
31
+ return noFeedback ? ((0, jsx_runtime_1.jsx)(react_native_1.TouchableWithoutFeedback, { ...props, onPress: onPressWrapped, children: inner })) : ((0, jsx_runtime_1.jsx)(react_native_1.TouchableHighlight, { underlayColor: underlayColor ?? "transparent", activeOpacity: 0.8, ...props, onPress: onPressWrapped, children: inner }));
32
32
  };
33
33
  exports.Touchable = Touchable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "11.0.34",
3
+ "version": "11.0.36",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",