@stackflow/plugin-basic-ui 0.14.1 → 0.14.2
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/dist/basicUIPlugin.d.ts +10 -4
- package/dist/components/AppBar.d.ts +1 -1
- package/dist/components/BottomSheet.d.ts +1 -0
- package/dist/components/Modal.d.ts +1 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +4 -4
- package/dist/utils/RecursivePartial.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/basicUIPlugin.tsx +20 -9
- package/src/components/AppBar.tsx +15 -4
- package/src/components/AppScreen.tsx +10 -3
- package/src/components/BottomSheet.tsx +10 -2
- package/src/components/Modal.tsx +10 -2
- package/src/hooks/index.ts +0 -1
- package/src/utils/RecursivePartial.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/dist/hooks/useTheme.d.ts +0 -3
- package/src/hooks/useTheme.ts +0 -9
|
@@ -4,12 +4,12 @@ import { useActions, useActivity } from "@stackflow/react";
|
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import React, { useRef } from "react";
|
|
6
6
|
|
|
7
|
+
import { useGlobalOptions } from "../basicUIPlugin";
|
|
7
8
|
import {
|
|
8
9
|
useLazy,
|
|
9
10
|
useStyleEffectHide,
|
|
10
11
|
useStyleEffectOffset,
|
|
11
12
|
useStyleEffectSwipeBack,
|
|
12
|
-
useTheme,
|
|
13
13
|
} from "../hooks";
|
|
14
14
|
import type { GlobalVars } from "../theme.css";
|
|
15
15
|
import { globalVars } from "../theme.css";
|
|
@@ -24,8 +24,13 @@ type AppScreenProps = Partial<
|
|
|
24
24
|
appBar?: Omit<PropOf<typeof AppBar>, "theme" | "ref" | "key">;
|
|
25
25
|
children: React.ReactNode;
|
|
26
26
|
};
|
|
27
|
-
const AppScreen: React.FC<AppScreenProps> = ({
|
|
28
|
-
|
|
27
|
+
const AppScreen: React.FC<AppScreenProps> = ({
|
|
28
|
+
backgroundColor,
|
|
29
|
+
dimBackgroundColor,
|
|
30
|
+
appBar,
|
|
31
|
+
children,
|
|
32
|
+
}) => {
|
|
33
|
+
const { theme } = useGlobalOptions();
|
|
29
34
|
const activity = useActivity();
|
|
30
35
|
const { pop } = useActions();
|
|
31
36
|
|
|
@@ -72,6 +77,8 @@ const AppScreen: React.FC<AppScreenProps> = ({ appBar, children }) => {
|
|
|
72
77
|
})}
|
|
73
78
|
style={assignInlineVars(
|
|
74
79
|
compactMap({
|
|
80
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
81
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
75
82
|
[globalVars.appBar.height]: appBar?.height,
|
|
76
83
|
[css.vars.zIndexes.dim]: `${zIndexDim}`,
|
|
77
84
|
[css.vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
@@ -14,12 +14,14 @@ type BottomSheetProps = Partial<
|
|
|
14
14
|
Pick<GlobalVars, "backgroundColor" | "dimBackgroundColor">
|
|
15
15
|
> &
|
|
16
16
|
Partial<GlobalVars["bottomSheet"]> & {
|
|
17
|
+
onOutsideClick?: React.MouseEventHandler;
|
|
17
18
|
children: React.ReactNode;
|
|
18
19
|
};
|
|
19
20
|
const BottomSheet: React.FC<BottomSheetProps> = ({
|
|
20
21
|
borderRadius = "1rem",
|
|
21
22
|
backgroundColor,
|
|
22
23
|
dimBackgroundColor,
|
|
24
|
+
onOutsideClick,
|
|
23
25
|
children,
|
|
24
26
|
}) => {
|
|
25
27
|
const activity = useActivity();
|
|
@@ -43,13 +45,19 @@ const BottomSheet: React.FC<BottomSheetProps> = ({
|
|
|
43
45
|
|
|
44
46
|
const popLock = useRef(false);
|
|
45
47
|
|
|
46
|
-
const onDimClick = () => {
|
|
48
|
+
const onDimClick: React.MouseEventHandler = (e) => {
|
|
49
|
+
onOutsideClick?.(e);
|
|
50
|
+
|
|
51
|
+
if (e.defaultPrevented) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
if (popLock.current) {
|
|
48
56
|
return;
|
|
49
57
|
}
|
|
58
|
+
popLock.current = true;
|
|
50
59
|
|
|
51
60
|
pop();
|
|
52
|
-
popLock.current = true;
|
|
53
61
|
};
|
|
54
62
|
const onPaperClick: React.MouseEventHandler = (e) => {
|
|
55
63
|
e.stopPropagation();
|
package/src/components/Modal.tsx
CHANGED
|
@@ -14,12 +14,14 @@ type ModalProps = Partial<
|
|
|
14
14
|
Pick<GlobalVars, "backgroundColor" | "dimBackgroundColor">
|
|
15
15
|
> &
|
|
16
16
|
Partial<GlobalVars["modal"]> & {
|
|
17
|
+
onOutsideClick?: React.MouseEventHandler;
|
|
17
18
|
children: React.ReactNode;
|
|
18
19
|
};
|
|
19
20
|
const Modal: React.FC<ModalProps> = ({
|
|
20
21
|
backgroundColor,
|
|
21
22
|
dimBackgroundColor,
|
|
22
23
|
borderRadius = "1rem",
|
|
24
|
+
onOutsideClick,
|
|
23
25
|
children,
|
|
24
26
|
}) => {
|
|
25
27
|
const activity = useActivity();
|
|
@@ -43,13 +45,19 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
43
45
|
|
|
44
46
|
const popLock = useRef(false);
|
|
45
47
|
|
|
46
|
-
const onDimClick = () => {
|
|
48
|
+
const onDimClick: React.MouseEventHandler = (e) => {
|
|
49
|
+
onOutsideClick?.(e);
|
|
50
|
+
|
|
51
|
+
if (e.defaultPrevented) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
if (popLock.current) {
|
|
48
56
|
return;
|
|
49
57
|
}
|
|
58
|
+
popLock.current = true;
|
|
50
59
|
|
|
51
60
|
pop();
|
|
52
|
-
popLock.current = true;
|
|
53
61
|
};
|
|
54
62
|
const onPaperClick: React.MouseEventHandler = (e) => {
|
|
55
63
|
e.stopPropagation();
|
package/src/hooks/index.ts
CHANGED
package/src/utils/index.ts
CHANGED
package/dist/hooks/useTheme.d.ts
DELETED
package/src/hooks/useTheme.ts
DELETED