@draftbit/core 50.2.3-ad4d9d.2 → 50.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "50.2.3-ad4d9d.2+ad4d9d7",
3
+ "version": "50.2.3",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "types": "lib/typescript/src/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/theme": "^50.2.3-ad4d9d.2+ad4d9d7",
44
+ "@draftbit/theme": "50.2.3",
45
45
  "@expo/vector-icons": "^14.0.0",
46
46
  "@gorhom/bottom-sheet": "5.0.0-alpha.7",
47
47
  "@material-ui/core": "^4.11.0",
@@ -118,5 +118,5 @@
118
118
  ],
119
119
  "testEnvironment": "node"
120
120
  },
121
- "gitHead": "ad4d9d7257b66d68d5eb9935dacc377d71095c08"
121
+ "gitHead": "991a711255ddc6cf8e12e64060b789392b5f100a"
122
122
  }
@@ -1,12 +1,14 @@
1
1
  import React from "react";
2
2
  import { StyleSheet, Dimensions, } from "react-native";
3
3
  import BottomSheetComponent, { BottomSheetScrollView, } from "@gorhom/bottom-sheet";
4
+ import { useTheme } from "@draftbit/theme";
4
5
  import { useDeepCompareMemo } from "../../utilities";
5
6
  const windowHeight = Dimensions.get("window").height;
6
7
  // Clarification:
7
8
  // Input of snap points is sorted top -> bottom where each value represents distance from top
8
9
  // Implementation using `@gorhom/bottom-sheet` is sorted bottom -> top where each value represents distance from bottom
9
- const BottomSheet = React.forwardRef(({ theme, snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor = theme.colors.border.brand, topBorderRadius = 20, borderWidth = 1, borderColor = theme.colors.border.brand, onSettle, style, children, ...rest }, ref) => {
10
+ const BottomSheet = React.forwardRef(({ snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor, topBorderRadius = 20, borderWidth = 1, borderColor, onSettle, style, children, ...rest }, ref) => {
11
+ const theme = useTheme();
10
12
  const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background.brand;
11
13
  const snapPoints = snapPointsProp !== null && snapPointsProp !== void 0 ? snapPointsProp : [
12
14
  topSnapPosition,
@@ -27,14 +29,14 @@ const BottomSheet = React.forwardRef(({ theme, snapPoints: snapPointsProp, topSn
27
29
  return (React.createElement(BottomSheetComponent, { ref: ref, snapPoints: mappedSnapPoints, index: initialSnapIndex !== undefined
28
30
  ? mappedSnapPoints.length - initialSnapIndex - 1
29
31
  : getSnapIndexFromPosition(initialSnapPosition), handleIndicatorStyle: [
30
- { backgroundColor: handleColor },
32
+ { backgroundColor: handleColor !== null && handleColor !== void 0 ? handleColor : theme.colors.border.brand },
31
33
  !showHandle ? { display: "none" } : {},
32
34
  ], backgroundStyle: {
33
35
  backgroundColor,
34
36
  borderTopLeftRadius: topBorderRadius,
35
37
  borderTopRightRadius: topBorderRadius,
36
38
  borderWidth,
37
- borderColor,
39
+ borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : theme.colors.border.brand,
38
40
  }, onChange: (index) => onSettle === null || onSettle === void 0 ? void 0 : onSettle(mappedSnapPoints.length - index - 1) },
39
41
  React.createElement(BottomSheetScrollView, { contentContainerStyle: [styles.contentContainerStyle, style], ...rest }, children)));
40
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,EAIV,UAAU,GACX,MAAM,cA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E;YACpC,OAAO,YAAY,GAAG,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAAC,aAAqB;IACjD,MAAM,YAAY,GAAG,SAAS,CAAC;IAC/B,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,EAAE;QACnB,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,aAAa,CAAC;SACtB;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,qBAAqB,EAAE;QACrB,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;KACpB;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -10,7 +10,7 @@ import {
10
10
  import BottomSheetComponent, {
11
11
  BottomSheetScrollView,
12
12
  } from "@gorhom/bottom-sheet";
13
- import type { ReadTheme } from "@draftbit/theme";
13
+ import { useTheme } from "@draftbit/theme";
14
14
  import { useDeepCompareMemo } from "../../utilities";
15
15
 
16
16
  type SnapPosition = "top" | "middle" | "bottom";
@@ -37,7 +37,6 @@ export interface BottomSheetProps extends ScrollViewProps {
37
37
  borderColor?: string;
38
38
  onSettle?: (index: number) => void;
39
39
  style?: StyleProp<ViewStyle>;
40
- theme: ReadTheme;
41
40
  }
42
41
 
43
42
  // Clarification:
@@ -46,7 +45,6 @@ export interface BottomSheetProps extends ScrollViewProps {
46
45
  const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
47
46
  (
48
47
  {
49
- theme,
50
48
  snapPoints: snapPointsProp,
51
49
  topSnapPosition = "10%",
52
50
  middleSnapPosition = "50%",
@@ -54,10 +52,10 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
54
52
  initialSnapIndex,
55
53
  initialSnapPosition = "bottom",
56
54
  showHandle = true,
57
- handleColor = theme.colors.border.brand,
55
+ handleColor,
58
56
  topBorderRadius = 20,
59
57
  borderWidth = 1,
60
- borderColor = theme.colors.border.brand,
58
+ borderColor,
61
59
  onSettle,
62
60
  style,
63
61
  children,
@@ -65,6 +63,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
65
63
  },
66
64
  ref
67
65
  ) => {
66
+ const theme = useTheme();
68
67
  const backgroundColor =
69
68
  (style as ViewStyle)?.backgroundColor || theme.colors.background.brand;
70
69
 
@@ -100,7 +99,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
100
99
  : getSnapIndexFromPosition(initialSnapPosition)
101
100
  }
102
101
  handleIndicatorStyle={[
103
- { backgroundColor: handleColor },
102
+ { backgroundColor: handleColor ?? theme.colors.border.brand },
104
103
  !showHandle ? { display: "none" } : {},
105
104
  ]}
106
105
  backgroundStyle={{
@@ -108,7 +107,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
108
107
  borderTopLeftRadius: topBorderRadius,
109
108
  borderTopRightRadius: topBorderRadius,
110
109
  borderWidth,
111
- borderColor,
110
+ borderColor: borderColor ?? theme.colors.border.brand,
112
111
  }}
113
112
  onChange={(index) => onSettle?.(mappedSnapPoints.length - index - 1)}
114
113
  >