@stackflow/plugin-basic-ui 0.21.3 → 1.0.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/README.md +1 -1
- package/dist/assets/IconBack.d.ts +1 -1
- package/dist/assets/IconClose.d.ts +1 -1
- package/dist/basicUIPlugin.d.ts +2 -2
- package/dist/components/AppBar.d.ts +5 -4
- package/dist/components/AppScreen.d.ts +2 -2
- package/dist/components/BottomSheet.d.ts +1 -1
- package/dist/components/Modal.d.ts +1 -1
- package/dist/hooks/useMaxWidth.d.ts +1 -1
- package/dist/hooks/useStyleEffect.d.ts +4 -4
- package/dist/hooks/useStyleEffectHide.d.ts +1 -1
- package/dist/index.css +57 -46
- package/dist/index.css.map +3 -3
- package/dist/index.js +342 -280
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +320 -252
- package/dist/index.mjs.map +4 -4
- package/dist/theme.css.d.ts +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/isBrowser.d.ts +5 -0
- package/dist/utils/isServer.d.ts +5 -0
- package/package.json +5 -5
- package/src/assets/IconBack.tsx +0 -2
- package/src/assets/IconClose.tsx +0 -2
- package/src/basicUIPlugin.tsx +7 -3
- package/src/components/AppBar.css.ts +9 -6
- package/src/components/AppBar.tsx +8 -2
- package/src/components/AppScreen.tsx +6 -3
- package/src/components/BottomSheet.tsx +2 -2
- package/src/components/Modal.tsx +2 -2
- package/src/hooks/useMaxWidth.ts +0 -1
- package/src/hooks/useStyleEffect.ts +8 -8
- package/src/hooks/useStyleEffectHide.ts +2 -3
- package/src/hooks/useStyleEffectOffset.ts +6 -5
- package/src/hooks/useStyleEffectSwipeBack.ts +7 -7
- package/src/theme.css.ts +5 -1
- package/src/utils/index.ts +2 -0
- package/src/utils/isBrowser.ts +9 -0
- package/src/utils/isServer.ts +7 -0
package/dist/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -34,10 +32,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
34
32
|
}
|
|
35
33
|
return to;
|
|
36
34
|
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
-
mod
|
|
40
|
-
));
|
|
41
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
36
|
|
|
43
37
|
// src/index.ts
|
|
@@ -54,7 +48,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
54
48
|
|
|
55
49
|
// src/basicUIPlugin.tsx
|
|
56
50
|
var import_dynamic = require("@vanilla-extract/dynamic");
|
|
57
|
-
var import_react =
|
|
51
|
+
var import_react = require("react");
|
|
58
52
|
|
|
59
53
|
// src/theme.css.ts
|
|
60
54
|
var theme_css_exports = {};
|
|
@@ -67,7 +61,7 @@ __export(theme_css_exports, {
|
|
|
67
61
|
});
|
|
68
62
|
var android = "theme__1coppmz0";
|
|
69
63
|
var cupertino = "theme__1coppmz1";
|
|
70
|
-
var globalVars = { backgroundColor: "var(--stackflow-plugin-basic-ui-background-color)", dimBackgroundColor: "var(--stackflow-plugin-basic-ui-dim-background-color)", appBar: { borderColor: "var(--stackflow-plugin-basic-ui-app-bar-border-color)", borderSize: "var(--stackflow-plugin-basic-ui-app-bar-border-size)", height: "var(--stackflow-plugin-basic-ui-app-bar-height)", heightTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-height-transition-duration)", minHeight: "var(--stackflow-plugin-basic-ui-app-bar-min-height)", iconColor: "var(--stackflow-plugin-basic-ui-app-bar-icon-color)", textColor: "var(--stackflow-plugin-basic-ui-app-bar-text-color)", backgroundColor: "var(--stackflow-plugin-basic-ui-app-bar-background-color)" }, bottomSheet: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" }, modal: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" } };
|
|
64
|
+
var globalVars = { backgroundColor: "var(--stackflow-plugin-basic-ui-background-color)", dimBackgroundColor: "var(--stackflow-plugin-basic-ui-dim-background-color)", transitionDuration: "var(--stackflow-plugin-basic-ui-transition-duration)", appBar: { borderColor: "var(--stackflow-plugin-basic-ui-app-bar-border-color)", borderSize: "var(--stackflow-plugin-basic-ui-app-bar-border-size)", height: "var(--stackflow-plugin-basic-ui-app-bar-height)", heightTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-height-transition-duration)", minHeight: "var(--stackflow-plugin-basic-ui-app-bar-min-height)", iconColor: "var(--stackflow-plugin-basic-ui-app-bar-icon-color)", textColor: "var(--stackflow-plugin-basic-ui-app-bar-text-color)", backgroundColor: "var(--stackflow-plugin-basic-ui-app-bar-background-color)", overflow: "var(--stackflow-plugin-basic-ui-app-bar-overflow)" }, bottomSheet: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" }, modal: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" } };
|
|
71
65
|
var rootAndroid = ":root[data-stackflow-plugin-basic-ui-theme=android]";
|
|
72
66
|
var rootCupertino = ":root[data-stackflow-plugin-basic-ui-theme=cupertino]";
|
|
73
67
|
|
|
@@ -88,6 +82,16 @@ function compactMap(obj) {
|
|
|
88
82
|
}, {});
|
|
89
83
|
}
|
|
90
84
|
|
|
85
|
+
// src/utils/isServer.ts
|
|
86
|
+
function isServer() {
|
|
87
|
+
return typeof window === "undefined";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/utils/isBrowser.ts
|
|
91
|
+
function isBrowser() {
|
|
92
|
+
return !isServer();
|
|
93
|
+
}
|
|
94
|
+
|
|
91
95
|
// src/utils/listenOnce.ts
|
|
92
96
|
function listenOnce(el, type, cb) {
|
|
93
97
|
const listener = () => {
|
|
@@ -120,6 +124,7 @@ function requestNextFrame(cb) {
|
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
// src/basicUIPlugin.tsx
|
|
127
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
123
128
|
var GlobalOptionsContext = (0, import_react.createContext)({
|
|
124
129
|
theme: "android"
|
|
125
130
|
});
|
|
@@ -131,31 +136,34 @@ var basicUIPlugin = (options) => () => ({
|
|
|
131
136
|
key: "basic-ui",
|
|
132
137
|
wrapStack({ stack }) {
|
|
133
138
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
134
|
-
return /* @__PURE__ */
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GlobalOptionsProvider, { value: options, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
className: isBrowser() ? compact([theme_css_exports[options.theme], options.rootClassName]).join(" ") : options.rootClassName,
|
|
143
|
+
style: (0, import_dynamic.assignInlineVars)(
|
|
144
|
+
compactMap({
|
|
145
|
+
[globalVars.backgroundColor]: options.backgroundColor,
|
|
146
|
+
[globalVars.dimBackgroundColor]: options.dimBackgroundColor,
|
|
147
|
+
[globalVars.transitionDuration]: stack.globalTransitionState === "loading" ? `${stack.transitionDuration}ms` : "0ms",
|
|
148
|
+
[globalVars.appBar.borderColor]: (_a = options.appBar) == null ? void 0 : _a.borderColor,
|
|
149
|
+
[globalVars.appBar.borderSize]: (_b = options.appBar) == null ? void 0 : _b.borderSize,
|
|
150
|
+
[globalVars.appBar.height]: (_c = options.appBar) == null ? void 0 : _c.height,
|
|
151
|
+
[globalVars.appBar.iconColor]: (_d = options.appBar) == null ? void 0 : _d.iconColor,
|
|
152
|
+
[globalVars.appBar.textColor]: (_e = options.appBar) == null ? void 0 : _e.textColor,
|
|
153
|
+
[globalVars.bottomSheet.borderRadius]: (_f = options.bottomSheet) == null ? void 0 : _f.borderRadius,
|
|
154
|
+
[globalVars.modal.borderRadius]: (_g = options.modal) == null ? void 0 : _g.borderRadius
|
|
155
|
+
})
|
|
156
|
+
),
|
|
157
|
+
children: stack.render()
|
|
158
|
+
}
|
|
159
|
+
) });
|
|
152
160
|
}
|
|
153
161
|
});
|
|
154
162
|
|
|
155
163
|
// src/components/AppScreen.tsx
|
|
156
|
-
var
|
|
164
|
+
var import_react8 = require("@stackflow/react");
|
|
157
165
|
var import_dynamic3 = require("@vanilla-extract/dynamic");
|
|
158
|
-
var
|
|
166
|
+
var import_react9 = require("react");
|
|
159
167
|
|
|
160
168
|
// src/hooks/useLazy.tsx
|
|
161
169
|
var import_react2 = require("react");
|
|
@@ -216,8 +224,7 @@ function useStyleEffect({
|
|
|
216
224
|
const activity = useNullableActivity();
|
|
217
225
|
(0, import_react5.useEffect)(() => {
|
|
218
226
|
if (!activity) {
|
|
219
|
-
return
|
|
220
|
-
};
|
|
227
|
+
return noop;
|
|
221
228
|
}
|
|
222
229
|
if (!connections[styleName]) {
|
|
223
230
|
connections[styleName] = /* @__PURE__ */ new Map();
|
|
@@ -232,12 +239,10 @@ function useStyleEffect({
|
|
|
232
239
|
}, [activity == null ? void 0 : activity.id, refs, effect]);
|
|
233
240
|
(0, import_react5.useEffect)(() => {
|
|
234
241
|
if (!activity) {
|
|
235
|
-
return
|
|
236
|
-
};
|
|
242
|
+
return noop;
|
|
237
243
|
}
|
|
238
244
|
if (!effect) {
|
|
239
|
-
return
|
|
240
|
-
};
|
|
245
|
+
return noop;
|
|
241
246
|
}
|
|
242
247
|
const refs2 = (() => {
|
|
243
248
|
let arr = [];
|
|
@@ -295,8 +300,7 @@ function useStyleEffectHide({
|
|
|
295
300
|
}
|
|
296
301
|
default: {
|
|
297
302
|
cleanup();
|
|
298
|
-
return
|
|
299
|
-
};
|
|
303
|
+
return noop;
|
|
300
304
|
}
|
|
301
305
|
}
|
|
302
306
|
} : void 0
|
|
@@ -337,7 +341,7 @@ function useStyleEffectOffset({
|
|
|
337
341
|
if (!ref.current) {
|
|
338
342
|
return;
|
|
339
343
|
}
|
|
340
|
-
ref.current.style.transition =
|
|
344
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
341
345
|
ref.current.style.transform = transform;
|
|
342
346
|
});
|
|
343
347
|
switch (activityTransitionState) {
|
|
@@ -347,8 +351,7 @@ function useStyleEffectOffset({
|
|
|
347
351
|
};
|
|
348
352
|
case "enter-active":
|
|
349
353
|
default:
|
|
350
|
-
return
|
|
351
|
-
};
|
|
354
|
+
return noop;
|
|
352
355
|
}
|
|
353
356
|
}
|
|
354
357
|
case "exit-active":
|
|
@@ -356,12 +359,10 @@ function useStyleEffectOffset({
|
|
|
356
359
|
requestNextFrame(() => {
|
|
357
360
|
cleanup();
|
|
358
361
|
});
|
|
359
|
-
return
|
|
360
|
-
};
|
|
362
|
+
return noop;
|
|
361
363
|
}
|
|
362
364
|
default: {
|
|
363
|
-
return
|
|
364
|
-
};
|
|
365
|
+
return noop;
|
|
365
366
|
}
|
|
366
367
|
}
|
|
367
368
|
} : void 0
|
|
@@ -383,12 +384,10 @@ function useStyleEffectSwipeBack({
|
|
|
383
384
|
refs: [paperRef],
|
|
384
385
|
effect: hasEffect ? ({ refs }) => {
|
|
385
386
|
if (theme !== "cupertino") {
|
|
386
|
-
return
|
|
387
|
-
};
|
|
387
|
+
return noop;
|
|
388
388
|
}
|
|
389
389
|
if (!dimRef.current || !edgeRef.current || !paperRef.current) {
|
|
390
|
-
return
|
|
391
|
-
};
|
|
390
|
+
return noop;
|
|
392
391
|
}
|
|
393
392
|
const $dim = dimRef.current;
|
|
394
393
|
const $edge = edgeRef.current;
|
|
@@ -433,15 +432,15 @@ function useStyleEffectSwipeBack({
|
|
|
433
432
|
return new Promise((resolve) => {
|
|
434
433
|
requestAnimationFrame(() => {
|
|
435
434
|
$dim.style.opacity = `${swiped ? 0 : 1}`;
|
|
436
|
-
$dim.style.transition =
|
|
435
|
+
$dim.style.transition = globalVars.transitionDuration;
|
|
437
436
|
$paper.style.overflowY = "hidden";
|
|
438
437
|
$paper.style.transform = `translateX(${swiped ? "100%" : "0"})`;
|
|
439
|
-
$paper.style.transition =
|
|
438
|
+
$paper.style.transition = globalVars.transitionDuration;
|
|
440
439
|
refs.forEach((ref) => {
|
|
441
440
|
if (!ref.current) {
|
|
442
441
|
return;
|
|
443
442
|
}
|
|
444
|
-
ref.current.style.transition =
|
|
443
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
445
444
|
ref.current.style.transform = `translate3d(${swiped ? "0" : `-${OFFSET_PX_CUPERTINO / 16}rem`}, 0, 0)`;
|
|
446
445
|
});
|
|
447
446
|
const _cachedRefs = [...cachedRefs];
|
|
@@ -538,56 +537,76 @@ function useStyleEffectSwipeBack({
|
|
|
538
537
|
}
|
|
539
538
|
|
|
540
539
|
// src/components/AppBar.tsx
|
|
541
|
-
var
|
|
540
|
+
var import_react6 = require("@stackflow/react");
|
|
542
541
|
var import_dynamic2 = require("@vanilla-extract/dynamic");
|
|
543
|
-
var
|
|
542
|
+
var import_react7 = require("react");
|
|
544
543
|
|
|
545
544
|
// src/assets/IconBack.tsx
|
|
546
|
-
var
|
|
547
|
-
var IconBack = (props) => /* @__PURE__ */
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
545
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
546
|
+
var IconBack = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
547
|
+
"svg",
|
|
548
|
+
{
|
|
549
|
+
className: props.className,
|
|
550
|
+
width: "24",
|
|
551
|
+
height: "24",
|
|
552
|
+
viewBox: "0 0 24 24",
|
|
553
|
+
fill: "none",
|
|
554
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
555
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
556
|
+
"path",
|
|
557
|
+
{
|
|
558
|
+
d: "M11.5659 5.56564C11.8783 5.25322 11.8783 4.74669 11.5659 4.43427C11.2535 4.12185 10.7469 4.12185 10.4345 4.43427L3.43451 11.4343C3.12209 11.7467 3.12209 12.2532 3.43451 12.5656L10.4345 19.5656C10.7469 19.8781 11.2535 19.8781 11.5659 19.5656C11.8783 19.2532 11.8783 18.7467 11.5659 18.4343L5.93157 12.8H20.0002C20.442 12.8 20.8002 12.4418 20.8002 12C20.8002 11.5581 20.442 11.2 20.0002 11.2H5.93157L11.5659 5.56564Z",
|
|
559
|
+
fill: "currentColor"
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
}
|
|
563
|
+
);
|
|
558
564
|
var IconBack_default = IconBack;
|
|
559
565
|
|
|
560
566
|
// src/assets/IconClose.tsx
|
|
561
|
-
var
|
|
562
|
-
var IconClose = (props) => /* @__PURE__ */
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
567
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
568
|
+
var IconClose = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
569
|
+
"svg",
|
|
570
|
+
{
|
|
571
|
+
className: props.className,
|
|
572
|
+
width: "24",
|
|
573
|
+
height: "24",
|
|
574
|
+
viewBox: "0 0 24 24",
|
|
575
|
+
fill: "none",
|
|
576
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
577
|
+
children: [
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
579
|
+
"path",
|
|
580
|
+
{
|
|
581
|
+
d: "M6.56588 5.43433C6.25346 5.12191 5.74693 5.12191 5.43451 5.43433C5.12209 5.74675 5.12209 6.25328 5.43451 6.5657L10.8688 12L5.43451 17.4343C5.12209 17.7467 5.12209 18.2533 5.43451 18.5657C5.74693 18.8781 6.25346 18.8781 6.56588 18.5657L12.0002 13.1314L17.4345 18.5657C17.7469 18.8781 18.2535 18.8781 18.5659 18.5657C18.8783 18.2533 18.8783 17.7467 18.5659 17.4343L13.1316 12L18.5659 6.5657C18.8783 6.25328 18.8783 5.74675 18.5659 5.43433C18.2535 5.12191 17.7469 5.12191 17.4345 5.43433L12.0002 10.8686L6.56588 5.43433Z",
|
|
582
|
+
fill: "currentColor"
|
|
583
|
+
}
|
|
584
|
+
),
|
|
585
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
586
|
+
"path",
|
|
587
|
+
{
|
|
588
|
+
d: "M6.56588 5.43433C6.25346 5.12191 5.74693 5.12191 5.43451 5.43433C5.12209 5.74675 5.12209 6.25328 5.43451 6.5657L10.8688 12L5.43451 17.4343C5.12209 17.7467 5.12209 18.2533 5.43451 18.5657C5.74693 18.8781 6.25346 18.8781 6.56588 18.5657L12.0002 13.1314L17.4345 18.5657C17.7469 18.8781 18.2535 18.8781 18.5659 18.5657C18.8783 18.2533 18.8783 17.7467 18.5659 17.4343L13.1316 12L18.5659 6.5657C18.8783 6.25328 18.8783 5.74675 18.5659 5.43433C18.2535 5.12191 17.7469 5.12191 17.4345 5.43433L12.0002 10.8686L6.56588 5.43433Z",
|
|
589
|
+
fill: "currentColor"
|
|
590
|
+
}
|
|
591
|
+
)
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
);
|
|
576
595
|
var IconClose_default = IconClose;
|
|
577
596
|
|
|
578
597
|
// src/components/AppBar.css.ts
|
|
579
598
|
var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
580
|
-
var appBar = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "
|
|
581
|
-
var backButton = "
|
|
599
|
+
var appBar = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "AppBar__1yk3a452 f__dhthxq4 f__dhthxq0 f__dhthxqh AppScreen__1dlf4347 AppBar__1yk3a451", variantClassNames: { border: { true: "AppBar_border_true__1yk3a453" }, presentModalFullScreen: { true: "AppBar_presentModalFullScreen_true__1yk3a454" } }, defaultVariants: {}, compoundVariants: [] });
|
|
600
|
+
var backButton = "AppBar__1yk3a458 f__dhthxq9 f__dhthxq7 f__dhthxqb f__dhthxqf f__dhthxqi";
|
|
582
601
|
var center = "f__dhthxq9 f__dhthxq7 f__dhthxq8 AppBar__1yk3a450";
|
|
583
|
-
var centerMain = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "
|
|
584
|
-
var centerMainEdge = "
|
|
585
|
-
var centerText = "
|
|
586
|
-
var closeButton = "
|
|
587
|
-
var container = "
|
|
588
|
-
var left = "
|
|
589
|
-
var right = "
|
|
590
|
-
var safeArea = "
|
|
602
|
+
var centerMain = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "AppBar__1yk3a45b", variantClassNames: { hasLeft: { true: "AppBar_hasLeft_true__1yk3a45c" } }, defaultVariants: {}, compoundVariants: [] });
|
|
603
|
+
var centerMainEdge = "AppBar__1yk3a45d f__dhthxqi f__dhthxq4 f__dhthxq2 f__dhthxqf";
|
|
604
|
+
var centerText = "AppBar__1yk3a45e f__dhthxqc f__dhthxqd f__dhthxq0";
|
|
605
|
+
var closeButton = "AppBar__1yk3a458 f__dhthxq9 f__dhthxq7 f__dhthxqb f__dhthxqf f__dhthxqi";
|
|
606
|
+
var container = "AppBar__1yk3a456 f__dhthxqa f__dhthxq7 AppBar__1yk3a451";
|
|
607
|
+
var left = "AppBar__1yk3a457 f__dhthxq9 f__dhthxq7 f__dhthxq1 AppBar__1yk3a450";
|
|
608
|
+
var right = "AppBar__1yk3a45f f__dhthxq9 f__dhthxq7 f__dhthxq1 f__dhthxq5 AppBar__1yk3a450";
|
|
609
|
+
var safeArea = "AppBar__1yk3a455";
|
|
591
610
|
|
|
592
611
|
// src/components/AppScreen.css.ts
|
|
593
612
|
var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -598,7 +617,8 @@ var paper = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "Ap
|
|
|
598
617
|
var vars = { transitionDuration: "var(--transitionDuration__1dlf4340)", zIndexes: { dim: "var(--zIndexes-dim__1dlf4341)", paper: "var(--zIndexes-paper__1dlf4342)", edge: "var(--zIndexes-edge__1dlf4343)", appBar: "var(--zIndexes-appBar__1dlf4344)" }, appBar: { center: { mainWidth: "var(--appBar-center-mainWidth__1dlf4345)" } } };
|
|
599
618
|
|
|
600
619
|
// src/components/AppBar.tsx
|
|
601
|
-
var
|
|
620
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
621
|
+
var AppBar = (0, import_react7.forwardRef)(
|
|
602
622
|
({
|
|
603
623
|
title,
|
|
604
624
|
appendLeft,
|
|
@@ -613,16 +633,18 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
613
633
|
borderColor,
|
|
614
634
|
borderSize,
|
|
615
635
|
height,
|
|
636
|
+
heightTransitionDuration,
|
|
637
|
+
overflow,
|
|
616
638
|
backgroundColor,
|
|
617
639
|
onTopClick
|
|
618
640
|
}, ref) => {
|
|
619
641
|
var _a, _b;
|
|
620
|
-
const actions = (0,
|
|
642
|
+
const actions = (0, import_react6.useActions)();
|
|
621
643
|
const activity = useNullableActivity();
|
|
622
644
|
const globalOptions = useGlobalOptions();
|
|
623
645
|
const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
|
|
624
646
|
const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
|
|
625
|
-
const centerRef = (0,
|
|
647
|
+
const centerRef = (0, import_react7.useRef)(null);
|
|
626
648
|
const { maxWidth } = useMaxWidth({
|
|
627
649
|
outerRef: ref,
|
|
628
650
|
innerRef: centerRef,
|
|
@@ -646,11 +668,15 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
646
668
|
return null;
|
|
647
669
|
}
|
|
648
670
|
if (!backButton2 && !globalBackButton) {
|
|
649
|
-
return /* @__PURE__ */
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
672
|
+
"button",
|
|
673
|
+
{
|
|
674
|
+
type: "button",
|
|
675
|
+
className: backButton,
|
|
676
|
+
onClick: onBackClick,
|
|
677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBack_default, {})
|
|
678
|
+
}
|
|
679
|
+
);
|
|
654
680
|
}
|
|
655
681
|
if (backButton2 && "render" in backButton2 && backButton2.render) {
|
|
656
682
|
return (_a2 = backButton2.render) == null ? void 0 : _a2.call(backButton2);
|
|
@@ -658,23 +684,27 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
658
684
|
if (globalBackButton && "render" in globalBackButton && globalBackButton.render) {
|
|
659
685
|
return (_b2 = globalBackButton.render) == null ? void 0 : _b2.call(globalBackButton);
|
|
660
686
|
}
|
|
661
|
-
return /* @__PURE__ */
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
688
|
+
"button",
|
|
689
|
+
{
|
|
690
|
+
type: "button",
|
|
691
|
+
className: backButton,
|
|
692
|
+
"aria-label": backButton2 && "ariaLabel" in backButton2 ? backButton2.ariaLabel : globalBackButton && "ariaLabel" in globalBackButton ? globalBackButton.ariaLabel : void 0,
|
|
693
|
+
onClick: onBackClick,
|
|
694
|
+
children: (() => {
|
|
695
|
+
if (backButton2 && "renderIcon" in backButton2 && backButton2.renderIcon) {
|
|
696
|
+
return backButton2.renderIcon();
|
|
697
|
+
}
|
|
698
|
+
if (globalBackButton && "renderIcon" in globalBackButton && globalBackButton.renderIcon) {
|
|
699
|
+
return globalBackButton.renderIcon();
|
|
700
|
+
}
|
|
701
|
+
if (presentModalFullScreen) {
|
|
702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconClose_default, {});
|
|
703
|
+
}
|
|
704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBack_default, {});
|
|
705
|
+
})()
|
|
675
706
|
}
|
|
676
|
-
|
|
677
|
-
})());
|
|
707
|
+
);
|
|
678
708
|
};
|
|
679
709
|
const onCloseClick = (e) => {
|
|
680
710
|
var _a2;
|
|
@@ -698,71 +728,93 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
698
728
|
if (globalCloseButton && "render" in globalCloseButton && globalCloseButton.render) {
|
|
699
729
|
return globalCloseButton.render();
|
|
700
730
|
}
|
|
701
|
-
return /* @__PURE__ */
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
732
|
+
"button",
|
|
733
|
+
{
|
|
734
|
+
type: "button",
|
|
735
|
+
className: closeButton,
|
|
736
|
+
"aria-label": closeButton2 && "ariaLabel" in closeButton2 ? closeButton2.ariaLabel : globalCloseButton && "ariaLabel" in globalCloseButton ? globalCloseButton.ariaLabel : void 0,
|
|
737
|
+
onClick: onCloseClick,
|
|
738
|
+
children: (() => {
|
|
739
|
+
if (closeButton2 && "renderIcon" in closeButton2 && closeButton2.renderIcon) {
|
|
740
|
+
return closeButton2.renderIcon();
|
|
741
|
+
}
|
|
742
|
+
if (globalCloseButton && "renderIcon" in globalCloseButton && globalCloseButton.renderIcon) {
|
|
743
|
+
return globalCloseButton.renderIcon();
|
|
744
|
+
}
|
|
745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconClose_default, {});
|
|
746
|
+
})()
|
|
712
747
|
}
|
|
713
|
-
|
|
714
|
-
})());
|
|
748
|
+
);
|
|
715
749
|
};
|
|
716
750
|
const hasLeft = !!(closeButtonLocation === "left" && closeButton2 || backButton2 || appendLeft);
|
|
717
|
-
return /* @__PURE__ */
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
752
|
+
"div",
|
|
753
|
+
{
|
|
754
|
+
ref,
|
|
755
|
+
className: appBar({
|
|
756
|
+
border,
|
|
757
|
+
presentModalFullScreen
|
|
758
|
+
}),
|
|
759
|
+
style: (0, import_dynamic2.assignInlineVars)(
|
|
760
|
+
compactMap({
|
|
761
|
+
[globalVars.appBar.iconColor]: iconColor,
|
|
762
|
+
[globalVars.appBar.textColor]: textColor,
|
|
763
|
+
[globalVars.appBar.borderColor]: borderColor,
|
|
764
|
+
[globalVars.appBar.borderSize]: borderSize,
|
|
765
|
+
[globalVars.appBar.height]: height,
|
|
766
|
+
[globalVars.appBar.heightTransitionDuration]: heightTransitionDuration,
|
|
767
|
+
[globalVars.appBar.overflow]: overflow,
|
|
768
|
+
[globalVars.appBar.backgroundColor]: backgroundColor || globalVars.backgroundColor,
|
|
769
|
+
[vars.appBar.center.mainWidth]: `${maxWidth}px`
|
|
770
|
+
})
|
|
771
|
+
),
|
|
772
|
+
children: [
|
|
773
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: safeArea }),
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: container, children: [
|
|
775
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: left, children: [
|
|
776
|
+
closeButtonLocation === "left" && renderCloseButton(),
|
|
777
|
+
renderBackButton(),
|
|
778
|
+
appendLeft == null ? void 0 : appendLeft()
|
|
779
|
+
] }),
|
|
780
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: centerRef, className: center, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
781
|
+
"div",
|
|
782
|
+
{
|
|
783
|
+
className: centerMain({
|
|
784
|
+
hasLeft
|
|
785
|
+
}),
|
|
786
|
+
children: [
|
|
787
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: centerText, children: title }) : title,
|
|
788
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
789
|
+
"button",
|
|
790
|
+
{
|
|
791
|
+
className: centerMainEdge,
|
|
792
|
+
type: "button",
|
|
793
|
+
"aria-hidden": "true",
|
|
794
|
+
onClick: onTopClick
|
|
795
|
+
}
|
|
796
|
+
)
|
|
797
|
+
]
|
|
798
|
+
}
|
|
799
|
+
) }),
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: right, children: [
|
|
801
|
+
appendRight == null ? void 0 : appendRight(),
|
|
802
|
+
closeButtonLocation === "right" && renderCloseButton()
|
|
803
|
+
] })
|
|
804
|
+
] })
|
|
805
|
+
]
|
|
806
|
+
}
|
|
807
|
+
);
|
|
757
808
|
}
|
|
758
809
|
);
|
|
759
810
|
AppBar.displayName = "AppBar";
|
|
760
811
|
var AppBar_default = AppBar;
|
|
761
812
|
|
|
762
813
|
// src/components/AppScreen.tsx
|
|
763
|
-
var
|
|
814
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
815
|
+
var Context = (0, import_react9.createContext)(null);
|
|
764
816
|
function useAppScreen() {
|
|
765
|
-
return (0,
|
|
817
|
+
return (0, import_react9.useContext)(Context);
|
|
766
818
|
}
|
|
767
819
|
var AppScreen = ({
|
|
768
820
|
backgroundColor,
|
|
@@ -775,12 +827,12 @@ var AppScreen = ({
|
|
|
775
827
|
var _a, _b;
|
|
776
828
|
const globalOptions = useGlobalOptions();
|
|
777
829
|
const activity = useNullableActivity();
|
|
778
|
-
const { pop } = (0,
|
|
779
|
-
const appScreenRef = (0,
|
|
780
|
-
const dimRef = (0,
|
|
781
|
-
const paperRef = (0,
|
|
782
|
-
const edgeRef = (0,
|
|
783
|
-
const appBarRef = (0,
|
|
830
|
+
const { pop } = (0, import_react8.useActions)();
|
|
831
|
+
const appScreenRef = (0, import_react9.useRef)(null);
|
|
832
|
+
const dimRef = (0, import_react9.useRef)(null);
|
|
833
|
+
const paperRef = (0, import_react9.useRef)(null);
|
|
834
|
+
const edgeRef = (0, import_react9.useRef)(null);
|
|
835
|
+
const appBarRef = (0, import_react9.useRef)(null);
|
|
784
836
|
const presentModalFullScreen = modalPresentationStyle === "fullScreen";
|
|
785
837
|
const swipeBackPrevented = preventSwipeBack || presentModalFullScreen;
|
|
786
838
|
useStyleEffectHide({
|
|
@@ -821,63 +873,77 @@ var AppScreen = ({
|
|
|
821
873
|
});
|
|
822
874
|
}
|
|
823
875
|
};
|
|
824
|
-
return /* @__PURE__ */
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
(
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
877
|
+
Context.Provider,
|
|
878
|
+
{
|
|
879
|
+
value: (0, import_react9.useMemo)(
|
|
880
|
+
() => ({
|
|
881
|
+
scroll({ top }) {
|
|
882
|
+
var _a2;
|
|
883
|
+
(_a2 = paperRef == null ? void 0 : paperRef.current) == null ? void 0 : _a2.scroll({
|
|
884
|
+
top,
|
|
885
|
+
behavior: "smooth"
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
}),
|
|
889
|
+
[paperRef]
|
|
890
|
+
),
|
|
891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
892
|
+
"div",
|
|
893
|
+
{
|
|
894
|
+
ref: appScreenRef,
|
|
895
|
+
className: appScreen({
|
|
896
|
+
transitionState: transitionState === "enter-done" || transitionState === "exit-done" ? transitionState : lazyTransitionState
|
|
897
|
+
}),
|
|
898
|
+
style: (0, import_dynamic3.assignInlineVars)(
|
|
899
|
+
compactMap({
|
|
900
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
901
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
902
|
+
[globalVars.appBar.height]: appBar2 == null ? void 0 : appBar2.height,
|
|
903
|
+
[globalVars.appBar.heightTransitionDuration]: appBar2 == null ? void 0 : appBar2.heightTransitionDuration,
|
|
904
|
+
[vars.zIndexes.dim]: `${zIndexDim}`,
|
|
905
|
+
[vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
906
|
+
[vars.zIndexes.edge]: `${zIndexEdge}`,
|
|
907
|
+
[vars.zIndexes.appBar]: `${zIndexAppBar}`,
|
|
908
|
+
[vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
909
|
+
})
|
|
910
|
+
),
|
|
911
|
+
children: [
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
|
|
913
|
+
appBar2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
914
|
+
AppBar_default,
|
|
915
|
+
__spreadProps(__spreadValues({}, appBar2), {
|
|
916
|
+
ref: appBarRef,
|
|
917
|
+
modalPresentationStyle,
|
|
918
|
+
onTopClick: onAppBarTopClick
|
|
919
|
+
})
|
|
920
|
+
),
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
922
|
+
"div",
|
|
923
|
+
{
|
|
924
|
+
className: paper({
|
|
925
|
+
hasAppBar,
|
|
926
|
+
presentModalFullScreen
|
|
927
|
+
}),
|
|
928
|
+
ref: paperRef,
|
|
929
|
+
children
|
|
930
|
+
},
|
|
931
|
+
activity == null ? void 0 : activity.id
|
|
932
|
+
),
|
|
933
|
+
!(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: edge({ hasAppBar }), ref: edgeRef })
|
|
934
|
+
]
|
|
833
935
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}, /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
838
|
-
ref: appScreenRef,
|
|
839
|
-
className: appScreen({
|
|
840
|
-
transitionState: transitionState === "enter-done" || transitionState === "exit-done" ? transitionState : lazyTransitionState
|
|
841
|
-
}),
|
|
842
|
-
style: (0, import_dynamic3.assignInlineVars)(
|
|
843
|
-
compactMap({
|
|
844
|
-
[globalVars.backgroundColor]: backgroundColor,
|
|
845
|
-
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
846
|
-
[globalVars.appBar.height]: appBar2 == null ? void 0 : appBar2.height,
|
|
847
|
-
[globalVars.appBar.heightTransitionDuration]: appBar2 == null ? void 0 : appBar2.heightTransitionDuration,
|
|
848
|
-
[vars.zIndexes.dim]: `${zIndexDim}`,
|
|
849
|
-
[vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
850
|
-
[vars.zIndexes.edge]: `${zIndexEdge}`,
|
|
851
|
-
[vars.zIndexes.appBar]: `${zIndexAppBar}`,
|
|
852
|
-
[vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? `var(--stackflow-transition-duration)` : "0ms"
|
|
853
|
-
})
|
|
854
|
-
)
|
|
855
|
-
}, /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
856
|
-
className: dim,
|
|
857
|
-
ref: dimRef
|
|
858
|
-
}), appBar2 && /* @__PURE__ */ import_react11.default.createElement(AppBar_default, __spreadProps(__spreadValues({}, appBar2), {
|
|
859
|
-
ref: appBarRef,
|
|
860
|
-
modalPresentationStyle,
|
|
861
|
-
onTopClick: onAppBarTopClick
|
|
862
|
-
})), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
863
|
-
key: activity == null ? void 0 : activity.id,
|
|
864
|
-
className: paper({
|
|
865
|
-
hasAppBar,
|
|
866
|
-
presentModalFullScreen
|
|
867
|
-
}),
|
|
868
|
-
ref: paperRef
|
|
869
|
-
}, children), !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
870
|
-
className: edge({ hasAppBar }),
|
|
871
|
-
ref: edgeRef
|
|
872
|
-
})));
|
|
936
|
+
)
|
|
937
|
+
}
|
|
938
|
+
);
|
|
873
939
|
};
|
|
874
940
|
AppScreen.displayName = "AppScreen";
|
|
875
941
|
var AppScreen_default = AppScreen;
|
|
876
942
|
|
|
877
943
|
// src/components/BottomSheet.tsx
|
|
878
|
-
var
|
|
944
|
+
var import_react10 = require("@stackflow/react");
|
|
879
945
|
var import_dynamic4 = require("@vanilla-extract/dynamic");
|
|
880
|
-
var
|
|
946
|
+
var import_react11 = require("react");
|
|
881
947
|
|
|
882
948
|
// src/components/BottomSheet.css.ts
|
|
883
949
|
var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -887,6 +953,7 @@ var paper2 = "BottomSheet__1ht38h0e f__dhthxqc BottomSheet__1ht38h03";
|
|
|
887
953
|
var vars2 = { transitionDuration: "var(--transitionDuration__1ht38h00)", zIndexes: { dim: "var(--zIndexes-dim__1ht38h01)", paper: "var(--zIndexes-paper__1ht38h02)" } };
|
|
888
954
|
|
|
889
955
|
// src/components/BottomSheet.tsx
|
|
956
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
890
957
|
var BottomSheet = ({
|
|
891
958
|
borderRadius = "1rem",
|
|
892
959
|
backgroundColor,
|
|
@@ -896,9 +963,9 @@ var BottomSheet = ({
|
|
|
896
963
|
}) => {
|
|
897
964
|
var _a, _b, _c;
|
|
898
965
|
const activity = useNullableActivity();
|
|
899
|
-
const { pop } = (0,
|
|
900
|
-
const containerRef = (0,
|
|
901
|
-
const paperRef = (0,
|
|
966
|
+
const { pop } = (0, import_react10.useActions)();
|
|
967
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
968
|
+
const paperRef = (0, import_react11.useRef)(null);
|
|
902
969
|
useStyleEffect({
|
|
903
970
|
styleName: "hide",
|
|
904
971
|
refs: [containerRef]
|
|
@@ -911,7 +978,7 @@ var BottomSheet = ({
|
|
|
911
978
|
styleName: "swipe-back",
|
|
912
979
|
refs: [paperRef]
|
|
913
980
|
});
|
|
914
|
-
const popLock = (0,
|
|
981
|
+
const popLock = (0, import_react11.useRef)(false);
|
|
915
982
|
const onDimClick = (e) => {
|
|
916
983
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
917
984
|
if (e.defaultPrevented) {
|
|
@@ -929,37 +996,34 @@ var BottomSheet = ({
|
|
|
929
996
|
const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
|
|
930
997
|
const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
|
|
931
998
|
const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
|
|
932
|
-
return /* @__PURE__ */
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
className: paper2,
|
|
953
|
-
onClick: onPaperClick
|
|
954
|
-
}, children)));
|
|
999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1000
|
+
"div",
|
|
1001
|
+
{
|
|
1002
|
+
className: container2({
|
|
1003
|
+
transitionState: useLazy(transitionState)
|
|
1004
|
+
}),
|
|
1005
|
+
ref: containerRef,
|
|
1006
|
+
style: (0, import_dynamic4.assignInlineVars)(
|
|
1007
|
+
compactMap({
|
|
1008
|
+
[globalVars.bottomSheet.borderRadius]: borderRadius,
|
|
1009
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
1010
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
1011
|
+
[vars2.zIndexes.dim]: `${zIndexBase}`,
|
|
1012
|
+
[vars2.zIndexes.paper]: `${zIndexPaper}`,
|
|
1013
|
+
[vars2.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
1014
|
+
})
|
|
1015
|
+
),
|
|
1016
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: dim2, ref: paperRef, onClick: onDimClick, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: paper2, onClick: onPaperClick, children }) })
|
|
1017
|
+
}
|
|
1018
|
+
);
|
|
955
1019
|
};
|
|
956
1020
|
BottomSheet.displayName = "BottomSheet";
|
|
957
1021
|
var BottomSheet_default = BottomSheet;
|
|
958
1022
|
|
|
959
1023
|
// src/components/Modal.tsx
|
|
960
|
-
var
|
|
1024
|
+
var import_react12 = require("@stackflow/react");
|
|
961
1025
|
var import_dynamic5 = require("@vanilla-extract/dynamic");
|
|
962
|
-
var
|
|
1026
|
+
var import_react13 = require("react");
|
|
963
1027
|
|
|
964
1028
|
// src/components/Modal.css.ts
|
|
965
1029
|
var import_createRuntimeFn4 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
@@ -969,6 +1033,7 @@ var paper3 = "Modal__5ozg8ce f__dhthxqc Modal__5ozg8c3";
|
|
|
969
1033
|
var vars3 = { transitionDuration: "var(--transitionDuration__5ozg8c0)", zIndexes: { dim: "var(--zIndexes-dim__5ozg8c1)", paper: "var(--zIndexes-paper__5ozg8c2)" } };
|
|
970
1034
|
|
|
971
1035
|
// src/components/Modal.tsx
|
|
1036
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
972
1037
|
var Modal = ({
|
|
973
1038
|
backgroundColor,
|
|
974
1039
|
dimBackgroundColor,
|
|
@@ -978,9 +1043,9 @@ var Modal = ({
|
|
|
978
1043
|
}) => {
|
|
979
1044
|
var _a, _b, _c;
|
|
980
1045
|
const activity = useNullableActivity();
|
|
981
|
-
const { pop } = (0,
|
|
982
|
-
const containerRef = (0,
|
|
983
|
-
const paperRef = (0,
|
|
1046
|
+
const { pop } = (0, import_react12.useActions)();
|
|
1047
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
1048
|
+
const paperRef = (0, import_react13.useRef)(null);
|
|
984
1049
|
useStyleEffect({
|
|
985
1050
|
styleName: "hide",
|
|
986
1051
|
refs: [containerRef]
|
|
@@ -993,7 +1058,7 @@ var Modal = ({
|
|
|
993
1058
|
styleName: "swipe-back",
|
|
994
1059
|
refs: [paperRef]
|
|
995
1060
|
});
|
|
996
|
-
const popLock = (0,
|
|
1061
|
+
const popLock = (0, import_react13.useRef)(false);
|
|
997
1062
|
const onDimClick = (e) => {
|
|
998
1063
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
999
1064
|
if (e.defaultPrevented) {
|
|
@@ -1011,29 +1076,26 @@ var Modal = ({
|
|
|
1011
1076
|
const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
|
|
1012
1077
|
const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
|
|
1013
1078
|
const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
|
|
1014
|
-
return /* @__PURE__ */
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
className: paper3,
|
|
1035
|
-
onClick: onPaperClick
|
|
1036
|
-
}, children)));
|
|
1079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1080
|
+
"div",
|
|
1081
|
+
{
|
|
1082
|
+
className: container3({
|
|
1083
|
+
transitionState: useLazy(transitionState)
|
|
1084
|
+
}),
|
|
1085
|
+
ref: containerRef,
|
|
1086
|
+
style: (0, import_dynamic5.assignInlineVars)(
|
|
1087
|
+
compactMap({
|
|
1088
|
+
[globalVars.bottomSheet.borderRadius]: borderRadius,
|
|
1089
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
1090
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
1091
|
+
[vars3.zIndexes.dim]: `${zIndexBase}`,
|
|
1092
|
+
[vars3.zIndexes.paper]: `${zIndexPaper}`,
|
|
1093
|
+
[vars3.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
1094
|
+
})
|
|
1095
|
+
),
|
|
1096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: dim3, ref: paperRef, onClick: onDimClick, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: paper3, onClick: onPaperClick, children }) })
|
|
1097
|
+
}
|
|
1098
|
+
);
|
|
1037
1099
|
};
|
|
1038
1100
|
Modal.displayName = "Modal";
|
|
1039
1101
|
var Modal_default = Modal;
|