@stackflow/plugin-basic-ui 1.10.1-canary.3 → 1.11.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.
- package/dist/assets/IconBack.d.ts.map +1 -1
- package/dist/assets/IconClose.d.ts.map +1 -1
- package/dist/basicUIPlugin.css.d.ts +2 -0
- package/dist/basicUIPlugin.css.d.ts.map +1 -1
- package/dist/components/AppBar.css.d.ts +1 -11
- package/dist/components/AppBar.css.d.ts.map +1 -1
- package/dist/components/AppBar.d.ts.map +1 -1
- package/dist/components/AppScreen.css.d.ts +8 -2
- package/dist/components/AppScreen.css.d.ts.map +1 -1
- package/dist/components/AppScreen.d.ts.map +1 -1
- package/dist/components/Modal.css.d.ts.map +1 -1
- package/dist/components/Modal.d.ts.map +1 -1
- package/dist/index.css +41 -26
- package/dist/index.css.map +3 -3
- package/dist/index.js +69 -60
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +84 -72
- package/dist/index.mjs.map +3 -3
- package/package.json +2 -2
- package/src/assets/IconBack.tsx +3 -1
- package/src/assets/IconClose.tsx +1 -5
- package/src/basicUIPlugin.css.ts +3 -1
- package/src/components/AppBar.css.ts +52 -50
- package/src/components/AppBar.tsx +10 -15
- package/src/components/AppScreen.css.ts +8 -2
- package/src/components/AppScreen.tsx +25 -12
- package/src/components/Modal.css.ts +1 -0
- package/src/components/Modal.tsx +3 -1
|
@@ -126,15 +126,21 @@ export const paper = recipe({
|
|
|
126
126
|
vars: {
|
|
127
127
|
[vars.appBar.topMargin]: globalVars.appBar.height,
|
|
128
128
|
},
|
|
129
|
+
/**
|
|
130
|
+
* When `max()` and `env()` (or `constant()`) supported
|
|
131
|
+
*
|
|
132
|
+
* - https://caniuse.com/css-env-function
|
|
133
|
+
* - https://caniuse.com/css-math-functions
|
|
134
|
+
*/
|
|
129
135
|
"@supports": {
|
|
130
|
-
"(padding: max(0px)) and (
|
|
136
|
+
"(padding: max(0px)) and (padding: constant(safe-area-inset-top))":
|
|
131
137
|
{
|
|
132
138
|
vars: {
|
|
133
139
|
[vars.appBar.topMargin]:
|
|
134
140
|
`calc(${globalVars.appBar.height} + max(${globalVars.appBar.minSafeAreaInsetTop}, constant(safe-area-inset-top)))`,
|
|
135
141
|
},
|
|
136
142
|
},
|
|
137
|
-
"(padding: max(0px)) and (
|
|
143
|
+
"(padding: max(0px)) and (padding: env(safe-area-inset-top))": {
|
|
138
144
|
vars: {
|
|
139
145
|
[vars.appBar.topMargin]:
|
|
140
146
|
`calc(${globalVars.appBar.height} + max(${globalVars.appBar.minSafeAreaInsetTop}, env(safe-area-inset-top)))`,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useActions } from "@stackflow/react";
|
|
2
|
-
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
3
|
-
import { createContext, useContext, useMemo, useRef } from "react";
|
|
4
|
-
|
|
5
2
|
import {
|
|
3
|
+
useActivityDataAttributes,
|
|
6
4
|
useLazy,
|
|
7
5
|
useMounted,
|
|
8
6
|
useNullableActivity,
|
|
@@ -11,6 +9,8 @@ import {
|
|
|
11
9
|
useStyleEffectSwipeBack,
|
|
12
10
|
useZIndexBase,
|
|
13
11
|
} from "@stackflow/react-ui-core";
|
|
12
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
13
|
+
import { createContext, useContext, useMemo, useRef } from "react";
|
|
14
14
|
import { useGlobalOptions } from "../basicUIPlugin";
|
|
15
15
|
import type { GlobalVars } from "../basicUIPlugin.css";
|
|
16
16
|
import { globalVars } from "../basicUIPlugin.css";
|
|
@@ -60,6 +60,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
|
|
|
60
60
|
}) => {
|
|
61
61
|
const globalOptions = useGlobalOptions();
|
|
62
62
|
const activity = useNullableActivity();
|
|
63
|
+
const activityDataAttributes = useActivityDataAttributes();
|
|
63
64
|
const mounted = useMounted();
|
|
64
65
|
|
|
65
66
|
const { pop } = useActions();
|
|
@@ -146,6 +147,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
|
|
|
146
147
|
dimRef,
|
|
147
148
|
edgeRef,
|
|
148
149
|
paperRef,
|
|
150
|
+
appBarRef,
|
|
149
151
|
offset: OFFSET_PX_CUPERTINO,
|
|
150
152
|
transitionDuration: globalVars.transitionDuration,
|
|
151
153
|
preventSwipeBack:
|
|
@@ -173,8 +175,10 @@ const AppScreen: React.FC<AppScreenProps> = ({
|
|
|
173
175
|
|
|
174
176
|
return null;
|
|
175
177
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
onSwipeEnd({ swiped }) {
|
|
179
|
+
if (swiped) {
|
|
180
|
+
pop();
|
|
181
|
+
}
|
|
178
182
|
},
|
|
179
183
|
});
|
|
180
184
|
|
|
@@ -236,13 +240,15 @@ const AppScreen: React.FC<AppScreenProps> = ({
|
|
|
236
240
|
}),
|
|
237
241
|
)}
|
|
238
242
|
data-stackflow-component-name="AppScreen"
|
|
239
|
-
|
|
240
|
-
data-stackflow-activity-is-active={
|
|
241
|
-
mounted ? activity?.isActive : undefined
|
|
242
|
-
}
|
|
243
|
+
{...activityDataAttributes}
|
|
243
244
|
>
|
|
244
245
|
{activityEnterStyle !== "slideInLeft" && (
|
|
245
|
-
<div
|
|
246
|
+
<div
|
|
247
|
+
ref={dimRef}
|
|
248
|
+
className={css.dim}
|
|
249
|
+
data-part="dim"
|
|
250
|
+
{...activityDataAttributes}
|
|
251
|
+
/>
|
|
246
252
|
)}
|
|
247
253
|
{appBar && (
|
|
248
254
|
<AppBar
|
|
@@ -255,19 +261,26 @@ const AppScreen: React.FC<AppScreenProps> = ({
|
|
|
255
261
|
)}
|
|
256
262
|
<div
|
|
257
263
|
key={activity?.id}
|
|
264
|
+
ref={paperRef}
|
|
258
265
|
className={css.paper({
|
|
259
266
|
hasAppBar,
|
|
260
267
|
modalPresentationStyle,
|
|
261
268
|
activityEnterStyle,
|
|
262
269
|
})}
|
|
263
|
-
|
|
270
|
+
data-part="paper"
|
|
271
|
+
{...activityDataAttributes}
|
|
264
272
|
>
|
|
265
273
|
{children}
|
|
266
274
|
</div>
|
|
267
275
|
{!activity?.isRoot &&
|
|
268
276
|
globalOptions.theme === "cupertino" &&
|
|
269
277
|
!isSwipeBackPrevented && (
|
|
270
|
-
<div
|
|
278
|
+
<div
|
|
279
|
+
ref={edgeRef}
|
|
280
|
+
className={css.edge({ hasAppBar })}
|
|
281
|
+
data-part="edge"
|
|
282
|
+
{...activityDataAttributes}
|
|
283
|
+
/>
|
|
271
284
|
)}
|
|
272
285
|
</div>
|
|
273
286
|
</Context.Provider>
|
|
@@ -62,6 +62,7 @@ export const paper = style([
|
|
|
62
62
|
{
|
|
63
63
|
backgroundColor: globalVars.backgroundColor,
|
|
64
64
|
width: "100%",
|
|
65
|
+
maxWidth: globalVars.modal.maxWidth,
|
|
65
66
|
margin: "0 2.5rem",
|
|
66
67
|
boxShadow:
|
|
67
68
|
"0px 0.625rem 2.375rem rgba(0, 0, 0, 0.15), 0px .5625rem 2.875rem rgba(0, 0, 0, 0.12), 0px .3125rem .9375rem rgba(0, 0, 0, 0.1)",
|
package/src/components/Modal.tsx
CHANGED
|
@@ -24,6 +24,7 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
24
24
|
backgroundColor,
|
|
25
25
|
dimBackgroundColor,
|
|
26
26
|
borderRadius = "1rem",
|
|
27
|
+
maxWidth,
|
|
27
28
|
onOutsideClick,
|
|
28
29
|
children,
|
|
29
30
|
}) => {
|
|
@@ -78,9 +79,10 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
78
79
|
ref={containerRef}
|
|
79
80
|
style={assignInlineVars(
|
|
80
81
|
compactMap({
|
|
81
|
-
[globalVars.bottomSheet.borderRadius]: borderRadius,
|
|
82
82
|
[globalVars.backgroundColor]: backgroundColor,
|
|
83
83
|
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
84
|
+
[globalVars.modal.borderRadius]: borderRadius,
|
|
85
|
+
[globalVars.modal.maxWidth]: maxWidth,
|
|
84
86
|
[css.vars.zIndexes.dim]: `${zIndexBase}`,
|
|
85
87
|
[css.vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
86
88
|
[css.vars.transitionDuration]:
|