tamagui 1.0.0-alpha.3 → 1.0.0-alpha.7
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/_jsx/index.js +7 -2
- package/_jsx/views/Hoverable.js +1 -1
- package/_jsx/views/HoverablePopover.js +1 -1
- package/_jsx/views/Modal.js +1 -1
- package/_jsx/views/Popper.js +2 -0
- package/_jsx/views/SafeAreaProvider.js +26 -0
- package/_jsx/views/Toast.js +1 -1
- package/_jsx/views/Tooltip.js +2 -2
- package/dist/index.cjs +184 -219
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +7 -2
- package/dist/index.js.map +2 -2
- package/dist/views/Hoverable.js +1 -1
- package/dist/views/Hoverable.js.map +2 -2
- package/dist/views/HoverablePopover.js +1 -1
- package/dist/views/HoverablePopover.js.map +2 -2
- package/dist/views/Modal.js +1 -1
- package/dist/views/Modal.js.map +2 -2
- package/dist/views/Popper.js +2 -0
- package/dist/views/Popper.js.map +2 -2
- package/dist/views/SafeAreaProvider.js +30 -0
- package/dist/views/SafeAreaProvider.js.map +7 -0
- package/dist/views/Toast.js +1 -1
- package/dist/views/Toast.js.map +1 -1
- package/dist/views/Tooltip.js +2 -2
- package/dist/views/Tooltip.js.map +2 -2
- package/package.json +8 -5
- package/types.d.ts +1749 -0
package/_jsx/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
1
2
|
export * from "@tamagui/helpers";
|
|
2
3
|
export * from "@tamagui/core";
|
|
3
4
|
export * from "./viewTypes";
|
|
4
|
-
export * from "
|
|
5
|
+
export * from "@tamagui/use-debounce";
|
|
6
|
+
export * from "@tamagui/use-force-update";
|
|
5
7
|
export * from "./hooks/useLayout";
|
|
6
|
-
export * from "./hooks/useSafeAreaInsets";
|
|
7
8
|
export * from "./hooks/useKeyboardDismissable";
|
|
8
9
|
export * from "./views/BlurView";
|
|
9
10
|
export * from "./views/Box";
|
|
@@ -31,4 +32,8 @@ export * from "./views/Tooltip";
|
|
|
31
32
|
export * from "./views/TouchableOpacity";
|
|
32
33
|
export * from "./views/Transitions";
|
|
33
34
|
export * from "./views/VisuallyHidden";
|
|
35
|
+
export * from "./views/SafeAreaProvider";
|
|
34
36
|
export * from "./helpers/prevent";
|
|
37
|
+
export {
|
|
38
|
+
useSafeAreaInsets
|
|
39
|
+
};
|
package/_jsx/views/Hoverable.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { isWeb } from "@tamagui/core";
|
|
4
|
+
import { useDebounce } from "@tamagui/use-debounce";
|
|
4
5
|
import React, { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
|
5
|
-
import { useDebounce } from "../hooks/useDebounce";
|
|
6
6
|
React["createElement"];
|
|
7
7
|
const Hoverable = forwardRef(({
|
|
8
8
|
onPressIn,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { useDebounce } from "@tamagui/use-debounce";
|
|
3
4
|
import React, { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
4
|
-
import { useDebounce } from "../hooks/useDebounce";
|
|
5
5
|
import { Hoverable } from "./Hoverable";
|
|
6
6
|
import { Popover } from "./Popover/Popover";
|
|
7
7
|
React["createElement"];
|
package/_jsx/views/Modal.js
CHANGED
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
styled,
|
|
9
9
|
useThemeName
|
|
10
10
|
} from "@tamagui/core";
|
|
11
|
+
import { useDebounceValue } from "@tamagui/use-debounce";
|
|
11
12
|
import { useLayoutEffect } from "react";
|
|
12
13
|
import { Modal as ModalNative } from "react-native";
|
|
13
14
|
import { prevent } from "../helpers/prevent";
|
|
14
|
-
import { useDebounceValue } from "../hooks/useDebounce";
|
|
15
15
|
import { YStack } from "./Stacks";
|
|
16
16
|
const Modal = /* @__PURE__ */ __name((props) => {
|
|
17
17
|
const {
|
package/_jsx/views/Popper.js
CHANGED
|
@@ -3,6 +3,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
import { useOverlayPosition } from "@react-native-aria/overlays";
|
|
4
4
|
import React, { createContext, useContext, useEffect, useRef } from "react";
|
|
5
5
|
import { StyleSheet, View } from "react-native";
|
|
6
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
7
|
import { YStack } from "./Stacks";
|
|
7
8
|
const defaultArrowHeight = 15;
|
|
8
9
|
const defaultArrowWidth = 15;
|
|
@@ -26,6 +27,7 @@ const PopperContent = React.forwardRef(({ children, style, ...rest }, ref) => {
|
|
|
26
27
|
setOverlayRef
|
|
27
28
|
} = context;
|
|
28
29
|
const overlayRef = useRef(null);
|
|
30
|
+
const { top } = useSafeAreaInsets();
|
|
29
31
|
const { overlayProps, rendered, arrowProps, placement } = useOverlayPosition({
|
|
30
32
|
targetRef: triggerRef,
|
|
31
33
|
overlayRef,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Platform } from "react-native";
|
|
4
|
+
import {
|
|
5
|
+
SafeAreaProvider as RNSafeAreaProvider,
|
|
6
|
+
initialWindowMetrics as defaultInitialWindowMetrics
|
|
7
|
+
} from "react-native-safe-area-context";
|
|
8
|
+
let defaultMetrics = null;
|
|
9
|
+
const SafeAreaProvider = /* @__PURE__ */ __name(({
|
|
10
|
+
initialWindowMetrics,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
if (!initialWindowMetrics && !defaultMetrics) {
|
|
14
|
+
defaultMetrics = Platform.select({
|
|
15
|
+
web: {
|
|
16
|
+
frame: { x: 0, y: 0, width: 0, height: 0 },
|
|
17
|
+
insets: { top: 0, left: 0, right: 0, bottom: 0 }
|
|
18
|
+
},
|
|
19
|
+
default: defaultInitialWindowMetrics
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return <RNSafeAreaProvider initialMetrics={initialWindowMetrics ?? defaultMetrics}>{children}</RNSafeAreaProvider>;
|
|
23
|
+
}, "SafeAreaProvider");
|
|
24
|
+
export {
|
|
25
|
+
SafeAreaProvider
|
|
26
|
+
};
|
package/_jsx/views/Toast.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { AnimatedStack, Text, isWeb } from "@tamagui/core";
|
|
4
|
-
import { useForceUpdate } from "@tamagui/
|
|
4
|
+
import { useForceUpdate } from "@tamagui/use-force-update";
|
|
5
5
|
import { memo, useCallback, useEffect, useRef } from "react";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
import { YStack } from "./Stacks";
|
package/_jsx/views/Tooltip.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { Text, Theme } from "@tamagui/core";
|
|
3
|
+
import { Text, Theme, isTamaguiElement } from "@tamagui/core";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { HoverablePopover } from "./HoverablePopover";
|
|
6
6
|
import { Paragraph } from "./Paragraph";
|
|
7
7
|
import { YStack } from "./Stacks";
|
|
8
8
|
const Tooltip = /* @__PURE__ */ __name(({ contents, tooltipFrameProps, ...props }) => {
|
|
9
|
-
return <HoverablePopover placement="bottom" delay={200} disableUntilSettled {...props} trigger={(triggerProps) =>
|
|
9
|
+
return <HoverablePopover placement="bottom" delay={200} disableUntilSettled {...props} trigger={(triggerProps) => isTamaguiElement(props.children) ? React.cloneElement(props.children, triggerProps) : <Text fontFamily="inherit" fontSize="inherit" {...triggerProps}>{props.children}</Text>}>{({ open }) => {
|
|
10
10
|
return open ? <Theme name="dark"><YStack margin={10} backgroundColor="$bg2" paddingHorizontal="$2" paddingVertical="$2" maxWidth={400} borderRadius="$2" shadowColor="$shadowColor" shadowRadius={2} shadowOffset={{ height: 2, width: 0 }} {...tooltipFrameProps}><Paragraph textAlign="center" fontSize={14} color="$color">{contents}</Paragraph></YStack></Theme> : null;
|
|
11
11
|
}}</HoverablePopover>;
|
|
12
12
|
}, "Tooltip");
|