@stackflow/plugin-basic-ui 0.21.4-alpha.4 → 1.0.1
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/{theme.css.d.ts → basicUIPlugin.css.d.ts} +12 -0
- package/dist/basicUIPlugin.d.ts +4 -4
- package/dist/components/AppBar.d.ts +3 -3
- package/dist/components/AppScreen.d.ts +3 -3
- package/dist/components/BottomSheet.d.ts +2 -2
- package/dist/components/Modal.d.ts +2 -2
- package/dist/hooks/useMaxWidth.d.ts +1 -1
- package/dist/hooks/useStyleEffect.d.ts +1 -1
- package/dist/hooks/useStyleEffectHide.d.ts +1 -1
- package/dist/index.css +150 -143
- package/dist/index.css.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +348 -295
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +327 -272
- package/dist/index.mjs.map +4 -4
- package/package.json +8 -8
- package/src/assets/IconBack.tsx +0 -2
- package/src/assets/IconClose.tsx +0 -2
- package/src/{theme.css.ts → basicUIPlugin.css.ts} +27 -9
- package/src/basicUIPlugin.tsx +23 -19
- package/src/components/AppBar.css.ts +2 -2
- package/src/components/AppBar.tsx +4 -4
- package/src/components/AppScreen.css.ts +2 -2
- package/src/components/AppScreen.tsx +8 -5
- package/src/components/BottomSheet.css.ts +1 -1
- package/src/components/BottomSheet.tsx +4 -4
- package/src/components/Modal.css.ts +1 -1
- package/src/components/Modal.tsx +4 -4
- package/src/hooks/useMaxWidth.ts +0 -1
- package/src/hooks/useStyleEffect.ts +0 -1
- package/src/hooks/useStyleEffectHide.ts +0 -2
- package/src/hooks/useStyleEffectOffset.ts +2 -1
- package/src/hooks/useStyleEffectSwipeBack.ts +4 -4
- package/src/index.ts +1 -1
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,22 +48,12 @@ 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
|
-
// src/
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
cupertino: () => cupertino,
|
|
64
|
-
globalVars: () => globalVars,
|
|
65
|
-
rootAndroid: () => rootAndroid,
|
|
66
|
-
rootCupertino: () => rootCupertino
|
|
67
|
-
});
|
|
68
|
-
var android = "theme__1coppmz0";
|
|
69
|
-
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)", 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
|
-
var rootAndroid = ":root[data-stackflow-plugin-basic-ui-theme=android]";
|
|
72
|
-
var rootCupertino = ":root[data-stackflow-plugin-basic-ui-theme=cupertino]";
|
|
53
|
+
// src/basicUIPlugin.css.ts
|
|
54
|
+
var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
55
|
+
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)" } };
|
|
56
|
+
var stackWrapper = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_1q6dj2j2", variantClassNames: { theme: { android: "_1q6dj2j0", cupertino: "_1q6dj2j1" }, loading: { true: "_1q6dj2j5" } }, defaultVariants: {}, compoundVariants: [] });
|
|
73
57
|
|
|
74
58
|
// src/utils/compact.ts
|
|
75
59
|
function compact(arr) {
|
|
@@ -130,6 +114,7 @@ function requestNextFrame(cb) {
|
|
|
130
114
|
}
|
|
131
115
|
|
|
132
116
|
// src/basicUIPlugin.tsx
|
|
117
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
133
118
|
var GlobalOptionsContext = (0, import_react.createContext)({
|
|
134
119
|
theme: "android"
|
|
135
120
|
});
|
|
@@ -141,31 +126,40 @@ var basicUIPlugin = (options) => () => ({
|
|
|
141
126
|
key: "basic-ui",
|
|
142
127
|
wrapStack({ stack }) {
|
|
143
128
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
144
|
-
return /* @__PURE__ */
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GlobalOptionsProvider, { value: options, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: compact([
|
|
133
|
+
stackWrapper({
|
|
134
|
+
theme: isBrowser() ? options.theme : void 0,
|
|
135
|
+
loading: stack.globalTransitionState === "loading"
|
|
136
|
+
}),
|
|
137
|
+
options.rootClassName
|
|
138
|
+
]).join(" "),
|
|
139
|
+
style: (0, import_dynamic.assignInlineVars)(
|
|
140
|
+
compactMap({
|
|
141
|
+
[globalVars.backgroundColor]: options.backgroundColor,
|
|
142
|
+
[globalVars.dimBackgroundColor]: options.dimBackgroundColor,
|
|
143
|
+
[globalVars.transitionDuration]: stack.globalTransitionState === "loading" ? `${stack.transitionDuration}ms` : "0ms",
|
|
144
|
+
[globalVars.appBar.borderColor]: (_a = options.appBar) == null ? void 0 : _a.borderColor,
|
|
145
|
+
[globalVars.appBar.borderSize]: (_b = options.appBar) == null ? void 0 : _b.borderSize,
|
|
146
|
+
[globalVars.appBar.height]: (_c = options.appBar) == null ? void 0 : _c.height,
|
|
147
|
+
[globalVars.appBar.iconColor]: (_d = options.appBar) == null ? void 0 : _d.iconColor,
|
|
148
|
+
[globalVars.appBar.textColor]: (_e = options.appBar) == null ? void 0 : _e.textColor,
|
|
149
|
+
[globalVars.bottomSheet.borderRadius]: (_f = options.bottomSheet) == null ? void 0 : _f.borderRadius,
|
|
150
|
+
[globalVars.modal.borderRadius]: (_g = options.modal) == null ? void 0 : _g.borderRadius
|
|
151
|
+
})
|
|
152
|
+
),
|
|
153
|
+
children: stack.render()
|
|
154
|
+
}
|
|
155
|
+
) });
|
|
162
156
|
}
|
|
163
157
|
});
|
|
164
158
|
|
|
165
159
|
// src/components/AppScreen.tsx
|
|
166
|
-
var
|
|
160
|
+
var import_react8 = require("@stackflow/react");
|
|
167
161
|
var import_dynamic3 = require("@vanilla-extract/dynamic");
|
|
168
|
-
var
|
|
162
|
+
var import_react9 = require("react");
|
|
169
163
|
|
|
170
164
|
// src/hooks/useLazy.tsx
|
|
171
165
|
var import_react2 = require("react");
|
|
@@ -343,7 +337,7 @@ function useStyleEffectOffset({
|
|
|
343
337
|
if (!ref.current) {
|
|
344
338
|
return;
|
|
345
339
|
}
|
|
346
|
-
ref.current.style.transition =
|
|
340
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
347
341
|
ref.current.style.transform = transform;
|
|
348
342
|
});
|
|
349
343
|
switch (activityTransitionState) {
|
|
@@ -434,15 +428,15 @@ function useStyleEffectSwipeBack({
|
|
|
434
428
|
return new Promise((resolve) => {
|
|
435
429
|
requestAnimationFrame(() => {
|
|
436
430
|
$dim.style.opacity = `${swiped ? 0 : 1}`;
|
|
437
|
-
$dim.style.transition =
|
|
431
|
+
$dim.style.transition = globalVars.transitionDuration;
|
|
438
432
|
$paper.style.overflowY = "hidden";
|
|
439
433
|
$paper.style.transform = `translateX(${swiped ? "100%" : "0"})`;
|
|
440
|
-
$paper.style.transition =
|
|
434
|
+
$paper.style.transition = globalVars.transitionDuration;
|
|
441
435
|
refs.forEach((ref) => {
|
|
442
436
|
if (!ref.current) {
|
|
443
437
|
return;
|
|
444
438
|
}
|
|
445
|
-
ref.current.style.transition =
|
|
439
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
446
440
|
ref.current.style.transform = `translate3d(${swiped ? "0" : `-${OFFSET_PX_CUPERTINO / 16}rem`}, 0, 0)`;
|
|
447
441
|
});
|
|
448
442
|
const _cachedRefs = [...cachedRefs];
|
|
@@ -539,67 +533,88 @@ function useStyleEffectSwipeBack({
|
|
|
539
533
|
}
|
|
540
534
|
|
|
541
535
|
// src/components/AppBar.tsx
|
|
542
|
-
var
|
|
536
|
+
var import_react6 = require("@stackflow/react");
|
|
543
537
|
var import_dynamic2 = require("@vanilla-extract/dynamic");
|
|
544
|
-
var
|
|
538
|
+
var import_react7 = require("react");
|
|
545
539
|
|
|
546
540
|
// src/assets/IconBack.tsx
|
|
547
|
-
var
|
|
548
|
-
var IconBack = (props) => /* @__PURE__ */
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
541
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
542
|
+
var IconBack = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
543
|
+
"svg",
|
|
544
|
+
{
|
|
545
|
+
className: props.className,
|
|
546
|
+
width: "24",
|
|
547
|
+
height: "24",
|
|
548
|
+
viewBox: "0 0 24 24",
|
|
549
|
+
fill: "none",
|
|
550
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
552
|
+
"path",
|
|
553
|
+
{
|
|
554
|
+
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",
|
|
555
|
+
fill: "currentColor"
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
}
|
|
559
|
+
);
|
|
559
560
|
var IconBack_default = IconBack;
|
|
560
561
|
|
|
561
562
|
// src/assets/IconClose.tsx
|
|
562
|
-
var
|
|
563
|
-
var IconClose = (props) => /* @__PURE__ */
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
563
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
564
|
+
var IconClose = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
565
|
+
"svg",
|
|
566
|
+
{
|
|
567
|
+
className: props.className,
|
|
568
|
+
width: "24",
|
|
569
|
+
height: "24",
|
|
570
|
+
viewBox: "0 0 24 24",
|
|
571
|
+
fill: "none",
|
|
572
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
573
|
+
children: [
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
575
|
+
"path",
|
|
576
|
+
{
|
|
577
|
+
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",
|
|
578
|
+
fill: "currentColor"
|
|
579
|
+
}
|
|
580
|
+
),
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
582
|
+
"path",
|
|
583
|
+
{
|
|
584
|
+
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",
|
|
585
|
+
fill: "currentColor"
|
|
586
|
+
}
|
|
587
|
+
)
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
);
|
|
577
591
|
var IconClose_default = IconClose;
|
|
578
592
|
|
|
579
593
|
// src/components/AppBar.css.ts
|
|
580
|
-
var
|
|
581
|
-
var appBar = (0,
|
|
582
|
-
var backButton = "
|
|
583
|
-
var center = "
|
|
584
|
-
var centerMain = (0,
|
|
585
|
-
var centerMainEdge = "
|
|
586
|
-
var centerText = "
|
|
587
|
-
var closeButton = "
|
|
588
|
-
var container = "
|
|
589
|
-
var left = "
|
|
590
|
-
var right = "
|
|
591
|
-
var safeArea = "
|
|
594
|
+
var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
595
|
+
var appBar = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4347 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, presentModalFullScreen: { true: "_1yk3a454" } }, defaultVariants: {}, compoundVariants: [] });
|
|
596
|
+
var backButton = "_1yk3a458 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
|
|
597
|
+
var center = "dhthxq9 dhthxq7 dhthxq8 _1yk3a450";
|
|
598
|
+
var centerMain = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1yk3a45b", variantClassNames: { hasLeft: { true: "_1yk3a45c" } }, defaultVariants: {}, compoundVariants: [] });
|
|
599
|
+
var centerMainEdge = "_1yk3a45d dhthxqi dhthxq4 dhthxq2 dhthxqf";
|
|
600
|
+
var centerText = "_1yk3a45e dhthxqc dhthxqd dhthxq0";
|
|
601
|
+
var closeButton = "_1yk3a458 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
|
|
602
|
+
var container = "_1yk3a456 dhthxqa dhthxq7 _1yk3a451";
|
|
603
|
+
var left = "_1yk3a457 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
|
|
604
|
+
var right = "_1yk3a45f dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
|
|
605
|
+
var safeArea = "_1yk3a455";
|
|
592
606
|
|
|
593
607
|
// src/components/AppScreen.css.ts
|
|
594
|
-
var
|
|
595
|
-
var appScreen = (0,
|
|
596
|
-
var dim = "
|
|
597
|
-
var edge = (0,
|
|
598
|
-
var paper = (0,
|
|
599
|
-
var vars = { transitionDuration: "var(--
|
|
608
|
+
var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
609
|
+
var appScreen = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1dlf4349", "enter-done": "_1dlf434a", "exit-active": "_1dlf434b", "exit-done": "_1dlf434c" } }, defaultVariants: {}, compoundVariants: [] });
|
|
610
|
+
var dim = "_1dlf434i dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4346 _1dlf4348";
|
|
611
|
+
var edge = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1dlf434m dhthxq4 dhthxq2 dhthxq3 dhthxq1", variantClassNames: { hasAppBar: { true: "_1dlf434n" } }, defaultVariants: {}, compoundVariants: [] });
|
|
612
|
+
var paper = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1dlf434j dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 _1dlf4347 _1dlf4348", variantClassNames: { hasAppBar: { true: "_1dlf434k dhthxqg" }, presentModalFullScreen: { true: "_1dlf434l" } }, defaultVariants: {}, compoundVariants: [] });
|
|
613
|
+
var vars = { transitionDuration: "var(--_1dlf4340)", zIndexes: { dim: "var(--_1dlf4341)", paper: "var(--_1dlf4342)", edge: "var(--_1dlf4343)", appBar: "var(--_1dlf4344)" }, appBar: { center: { mainWidth: "var(--_1dlf4345)" } } };
|
|
600
614
|
|
|
601
615
|
// src/components/AppBar.tsx
|
|
602
|
-
var
|
|
616
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
617
|
+
var AppBar = (0, import_react7.forwardRef)(
|
|
603
618
|
({
|
|
604
619
|
title,
|
|
605
620
|
appendLeft,
|
|
@@ -620,12 +635,12 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
620
635
|
onTopClick
|
|
621
636
|
}, ref) => {
|
|
622
637
|
var _a, _b;
|
|
623
|
-
const actions = (0,
|
|
638
|
+
const actions = (0, import_react6.useActions)();
|
|
624
639
|
const activity = useNullableActivity();
|
|
625
640
|
const globalOptions = useGlobalOptions();
|
|
626
641
|
const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
|
|
627
642
|
const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
|
|
628
|
-
const centerRef = (0,
|
|
643
|
+
const centerRef = (0, import_react7.useRef)(null);
|
|
629
644
|
const { maxWidth } = useMaxWidth({
|
|
630
645
|
outerRef: ref,
|
|
631
646
|
innerRef: centerRef,
|
|
@@ -649,11 +664,15 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
649
664
|
return null;
|
|
650
665
|
}
|
|
651
666
|
if (!backButton2 && !globalBackButton) {
|
|
652
|
-
return /* @__PURE__ */
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
668
|
+
"button",
|
|
669
|
+
{
|
|
670
|
+
type: "button",
|
|
671
|
+
className: backButton,
|
|
672
|
+
onClick: onBackClick,
|
|
673
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBack_default, {})
|
|
674
|
+
}
|
|
675
|
+
);
|
|
657
676
|
}
|
|
658
677
|
if (backButton2 && "render" in backButton2 && backButton2.render) {
|
|
659
678
|
return (_a2 = backButton2.render) == null ? void 0 : _a2.call(backButton2);
|
|
@@ -661,23 +680,27 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
661
680
|
if (globalBackButton && "render" in globalBackButton && globalBackButton.render) {
|
|
662
681
|
return (_b2 = globalBackButton.render) == null ? void 0 : _b2.call(globalBackButton);
|
|
663
682
|
}
|
|
664
|
-
return /* @__PURE__ */
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
684
|
+
"button",
|
|
685
|
+
{
|
|
686
|
+
type: "button",
|
|
687
|
+
className: backButton,
|
|
688
|
+
"aria-label": backButton2 && "ariaLabel" in backButton2 ? backButton2.ariaLabel : globalBackButton && "ariaLabel" in globalBackButton ? globalBackButton.ariaLabel : void 0,
|
|
689
|
+
onClick: onBackClick,
|
|
690
|
+
children: (() => {
|
|
691
|
+
if (backButton2 && "renderIcon" in backButton2 && backButton2.renderIcon) {
|
|
692
|
+
return backButton2.renderIcon();
|
|
693
|
+
}
|
|
694
|
+
if (globalBackButton && "renderIcon" in globalBackButton && globalBackButton.renderIcon) {
|
|
695
|
+
return globalBackButton.renderIcon();
|
|
696
|
+
}
|
|
697
|
+
if (presentModalFullScreen) {
|
|
698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconClose_default, {});
|
|
699
|
+
}
|
|
700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBack_default, {});
|
|
701
|
+
})()
|
|
678
702
|
}
|
|
679
|
-
|
|
680
|
-
})());
|
|
703
|
+
);
|
|
681
704
|
};
|
|
682
705
|
const onCloseClick = (e) => {
|
|
683
706
|
var _a2;
|
|
@@ -701,73 +724,93 @@ var AppBar = import_react9.default.forwardRef(
|
|
|
701
724
|
if (globalCloseButton && "render" in globalCloseButton && globalCloseButton.render) {
|
|
702
725
|
return globalCloseButton.render();
|
|
703
726
|
}
|
|
704
|
-
return /* @__PURE__ */
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
728
|
+
"button",
|
|
729
|
+
{
|
|
730
|
+
type: "button",
|
|
731
|
+
className: closeButton,
|
|
732
|
+
"aria-label": closeButton2 && "ariaLabel" in closeButton2 ? closeButton2.ariaLabel : globalCloseButton && "ariaLabel" in globalCloseButton ? globalCloseButton.ariaLabel : void 0,
|
|
733
|
+
onClick: onCloseClick,
|
|
734
|
+
children: (() => {
|
|
735
|
+
if (closeButton2 && "renderIcon" in closeButton2 && closeButton2.renderIcon) {
|
|
736
|
+
return closeButton2.renderIcon();
|
|
737
|
+
}
|
|
738
|
+
if (globalCloseButton && "renderIcon" in globalCloseButton && globalCloseButton.renderIcon) {
|
|
739
|
+
return globalCloseButton.renderIcon();
|
|
740
|
+
}
|
|
741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconClose_default, {});
|
|
742
|
+
})()
|
|
715
743
|
}
|
|
716
|
-
|
|
717
|
-
})());
|
|
744
|
+
);
|
|
718
745
|
};
|
|
719
746
|
const hasLeft = !!(closeButtonLocation === "left" && closeButton2 || backButton2 || appendLeft);
|
|
720
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
748
|
+
"div",
|
|
749
|
+
{
|
|
750
|
+
ref,
|
|
751
|
+
className: appBar({
|
|
752
|
+
border,
|
|
753
|
+
presentModalFullScreen
|
|
754
|
+
}),
|
|
755
|
+
style: (0, import_dynamic2.assignInlineVars)(
|
|
756
|
+
compactMap({
|
|
757
|
+
[globalVars.appBar.iconColor]: iconColor,
|
|
758
|
+
[globalVars.appBar.textColor]: textColor,
|
|
759
|
+
[globalVars.appBar.borderColor]: borderColor,
|
|
760
|
+
[globalVars.appBar.borderSize]: borderSize,
|
|
761
|
+
[globalVars.appBar.height]: height,
|
|
762
|
+
[globalVars.appBar.heightTransitionDuration]: heightTransitionDuration,
|
|
763
|
+
[globalVars.appBar.overflow]: overflow,
|
|
764
|
+
[globalVars.appBar.backgroundColor]: backgroundColor || globalVars.backgroundColor,
|
|
765
|
+
[vars.appBar.center.mainWidth]: `${maxWidth}px`
|
|
766
|
+
})
|
|
767
|
+
),
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: safeArea }),
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: container, children: [
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: left, children: [
|
|
772
|
+
closeButtonLocation === "left" && renderCloseButton(),
|
|
773
|
+
renderBackButton(),
|
|
774
|
+
appendLeft == null ? void 0 : appendLeft()
|
|
775
|
+
] }),
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: centerRef, className: center, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
777
|
+
"div",
|
|
778
|
+
{
|
|
779
|
+
className: centerMain({
|
|
780
|
+
hasLeft
|
|
781
|
+
}),
|
|
782
|
+
children: [
|
|
783
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: centerText, children: title }) : title,
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
785
|
+
"button",
|
|
786
|
+
{
|
|
787
|
+
className: centerMainEdge,
|
|
788
|
+
type: "button",
|
|
789
|
+
"aria-hidden": "true",
|
|
790
|
+
onClick: onTopClick
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
]
|
|
794
|
+
}
|
|
795
|
+
) }),
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: right, children: [
|
|
797
|
+
appendRight == null ? void 0 : appendRight(),
|
|
798
|
+
closeButtonLocation === "right" && renderCloseButton()
|
|
799
|
+
] })
|
|
800
|
+
] })
|
|
801
|
+
]
|
|
802
|
+
}
|
|
803
|
+
);
|
|
762
804
|
}
|
|
763
805
|
);
|
|
764
806
|
AppBar.displayName = "AppBar";
|
|
765
807
|
var AppBar_default = AppBar;
|
|
766
808
|
|
|
767
809
|
// src/components/AppScreen.tsx
|
|
768
|
-
var
|
|
810
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
811
|
+
var Context = (0, import_react9.createContext)(null);
|
|
769
812
|
function useAppScreen() {
|
|
770
|
-
return (0,
|
|
813
|
+
return (0, import_react9.useContext)(Context);
|
|
771
814
|
}
|
|
772
815
|
var AppScreen = ({
|
|
773
816
|
backgroundColor,
|
|
@@ -780,12 +823,12 @@ var AppScreen = ({
|
|
|
780
823
|
var _a, _b;
|
|
781
824
|
const globalOptions = useGlobalOptions();
|
|
782
825
|
const activity = useNullableActivity();
|
|
783
|
-
const { pop } = (0,
|
|
784
|
-
const appScreenRef = (0,
|
|
785
|
-
const dimRef = (0,
|
|
786
|
-
const paperRef = (0,
|
|
787
|
-
const edgeRef = (0,
|
|
788
|
-
const appBarRef = (0,
|
|
826
|
+
const { pop } = (0, import_react8.useActions)();
|
|
827
|
+
const appScreenRef = (0, import_react9.useRef)(null);
|
|
828
|
+
const dimRef = (0, import_react9.useRef)(null);
|
|
829
|
+
const paperRef = (0, import_react9.useRef)(null);
|
|
830
|
+
const edgeRef = (0, import_react9.useRef)(null);
|
|
831
|
+
const appBarRef = (0, import_react9.useRef)(null);
|
|
789
832
|
const presentModalFullScreen = modalPresentationStyle === "fullScreen";
|
|
790
833
|
const swipeBackPrevented = preventSwipeBack || presentModalFullScreen;
|
|
791
834
|
useStyleEffectHide({
|
|
@@ -826,72 +869,87 @@ var AppScreen = ({
|
|
|
826
869
|
});
|
|
827
870
|
}
|
|
828
871
|
};
|
|
829
|
-
return /* @__PURE__ */
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
(
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
873
|
+
Context.Provider,
|
|
874
|
+
{
|
|
875
|
+
value: (0, import_react9.useMemo)(
|
|
876
|
+
() => ({
|
|
877
|
+
scroll({ top }) {
|
|
878
|
+
var _a2;
|
|
879
|
+
(_a2 = paperRef == null ? void 0 : paperRef.current) == null ? void 0 : _a2.scroll({
|
|
880
|
+
top,
|
|
881
|
+
behavior: "smooth"
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
}),
|
|
885
|
+
[paperRef]
|
|
886
|
+
),
|
|
887
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
888
|
+
"div",
|
|
889
|
+
{
|
|
890
|
+
ref: appScreenRef,
|
|
891
|
+
className: appScreen({
|
|
892
|
+
transitionState: transitionState === "enter-done" || transitionState === "exit-done" ? transitionState : lazyTransitionState
|
|
893
|
+
}),
|
|
894
|
+
style: (0, import_dynamic3.assignInlineVars)(
|
|
895
|
+
compactMap({
|
|
896
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
897
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
898
|
+
[globalVars.appBar.height]: appBar2 == null ? void 0 : appBar2.height,
|
|
899
|
+
[globalVars.appBar.heightTransitionDuration]: appBar2 == null ? void 0 : appBar2.heightTransitionDuration,
|
|
900
|
+
[vars.zIndexes.dim]: `${zIndexDim}`,
|
|
901
|
+
[vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
902
|
+
[vars.zIndexes.edge]: `${zIndexEdge}`,
|
|
903
|
+
[vars.zIndexes.appBar]: `${zIndexAppBar}`,
|
|
904
|
+
[vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
905
|
+
})
|
|
906
|
+
),
|
|
907
|
+
children: [
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
|
|
909
|
+
appBar2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
910
|
+
AppBar_default,
|
|
911
|
+
__spreadProps(__spreadValues({}, appBar2), {
|
|
912
|
+
ref: appBarRef,
|
|
913
|
+
modalPresentationStyle,
|
|
914
|
+
onTopClick: onAppBarTopClick
|
|
915
|
+
})
|
|
916
|
+
),
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
918
|
+
"div",
|
|
919
|
+
{
|
|
920
|
+
className: paper({
|
|
921
|
+
hasAppBar,
|
|
922
|
+
presentModalFullScreen
|
|
923
|
+
}),
|
|
924
|
+
ref: paperRef,
|
|
925
|
+
children
|
|
926
|
+
},
|
|
927
|
+
activity == null ? void 0 : activity.id
|
|
928
|
+
),
|
|
929
|
+
!(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: edge({ hasAppBar }), ref: edgeRef })
|
|
930
|
+
]
|
|
838
931
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
}, /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
843
|
-
ref: appScreenRef,
|
|
844
|
-
className: appScreen({
|
|
845
|
-
transitionState: transitionState === "enter-done" || transitionState === "exit-done" ? transitionState : lazyTransitionState
|
|
846
|
-
}),
|
|
847
|
-
style: (0, import_dynamic3.assignInlineVars)(
|
|
848
|
-
compactMap({
|
|
849
|
-
[globalVars.backgroundColor]: backgroundColor,
|
|
850
|
-
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
851
|
-
[globalVars.appBar.height]: appBar2 == null ? void 0 : appBar2.height,
|
|
852
|
-
[globalVars.appBar.heightTransitionDuration]: appBar2 == null ? void 0 : appBar2.heightTransitionDuration,
|
|
853
|
-
[vars.zIndexes.dim]: `${zIndexDim}`,
|
|
854
|
-
[vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
855
|
-
[vars.zIndexes.edge]: `${zIndexEdge}`,
|
|
856
|
-
[vars.zIndexes.appBar]: `${zIndexAppBar}`,
|
|
857
|
-
[vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? `var(--stackflow-transition-duration)` : "0ms"
|
|
858
|
-
})
|
|
859
|
-
)
|
|
860
|
-
}, /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
861
|
-
className: dim,
|
|
862
|
-
ref: dimRef
|
|
863
|
-
}), appBar2 && /* @__PURE__ */ import_react11.default.createElement(AppBar_default, __spreadProps(__spreadValues({}, appBar2), {
|
|
864
|
-
ref: appBarRef,
|
|
865
|
-
modalPresentationStyle,
|
|
866
|
-
onTopClick: onAppBarTopClick
|
|
867
|
-
})), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
868
|
-
key: activity == null ? void 0 : activity.id,
|
|
869
|
-
className: paper({
|
|
870
|
-
hasAppBar,
|
|
871
|
-
presentModalFullScreen
|
|
872
|
-
}),
|
|
873
|
-
ref: paperRef
|
|
874
|
-
}, children), !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
875
|
-
className: edge({ hasAppBar }),
|
|
876
|
-
ref: edgeRef
|
|
877
|
-
})));
|
|
932
|
+
)
|
|
933
|
+
}
|
|
934
|
+
);
|
|
878
935
|
};
|
|
879
936
|
AppScreen.displayName = "AppScreen";
|
|
880
937
|
var AppScreen_default = AppScreen;
|
|
881
938
|
|
|
882
939
|
// src/components/BottomSheet.tsx
|
|
883
|
-
var
|
|
940
|
+
var import_react10 = require("@stackflow/react");
|
|
884
941
|
var import_dynamic4 = require("@vanilla-extract/dynamic");
|
|
885
|
-
var
|
|
942
|
+
var import_react11 = require("react");
|
|
886
943
|
|
|
887
944
|
// src/components/BottomSheet.css.ts
|
|
888
|
-
var
|
|
889
|
-
var container2 = (0,
|
|
890
|
-
var dim2 = "
|
|
891
|
-
var paper2 = "
|
|
892
|
-
var vars2 = { transitionDuration: "var(--
|
|
945
|
+
var import_createRuntimeFn4 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
946
|
+
var container2 = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_1ht38h04", "enter-done": "_1ht38h05", "exit-active": "_1ht38h06", "exit-done": "_1ht38h07" } }, defaultVariants: {}, compoundVariants: [] });
|
|
947
|
+
var dim2 = "_1ht38h0d dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc dhthxqa dhthxq7 _1ht38h03";
|
|
948
|
+
var paper2 = "_1ht38h0e dhthxqc _1ht38h03";
|
|
949
|
+
var vars2 = { transitionDuration: "var(--_1ht38h00)", zIndexes: { dim: "var(--_1ht38h01)", paper: "var(--_1ht38h02)" } };
|
|
893
950
|
|
|
894
951
|
// src/components/BottomSheet.tsx
|
|
952
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
895
953
|
var BottomSheet = ({
|
|
896
954
|
borderRadius = "1rem",
|
|
897
955
|
backgroundColor,
|
|
@@ -901,9 +959,9 @@ var BottomSheet = ({
|
|
|
901
959
|
}) => {
|
|
902
960
|
var _a, _b, _c;
|
|
903
961
|
const activity = useNullableActivity();
|
|
904
|
-
const { pop } = (0,
|
|
905
|
-
const containerRef = (0,
|
|
906
|
-
const paperRef = (0,
|
|
962
|
+
const { pop } = (0, import_react10.useActions)();
|
|
963
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
964
|
+
const paperRef = (0, import_react11.useRef)(null);
|
|
907
965
|
useStyleEffect({
|
|
908
966
|
styleName: "hide",
|
|
909
967
|
refs: [containerRef]
|
|
@@ -916,7 +974,7 @@ var BottomSheet = ({
|
|
|
916
974
|
styleName: "swipe-back",
|
|
917
975
|
refs: [paperRef]
|
|
918
976
|
});
|
|
919
|
-
const popLock = (0,
|
|
977
|
+
const popLock = (0, import_react11.useRef)(false);
|
|
920
978
|
const onDimClick = (e) => {
|
|
921
979
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
922
980
|
if (e.defaultPrevented) {
|
|
@@ -934,46 +992,44 @@ var BottomSheet = ({
|
|
|
934
992
|
const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
|
|
935
993
|
const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
|
|
936
994
|
const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
|
|
937
|
-
return /* @__PURE__ */
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
className: paper2,
|
|
958
|
-
onClick: onPaperClick
|
|
959
|
-
}, children)));
|
|
995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
996
|
+
"div",
|
|
997
|
+
{
|
|
998
|
+
className: container2({
|
|
999
|
+
transitionState: useLazy(transitionState)
|
|
1000
|
+
}),
|
|
1001
|
+
ref: containerRef,
|
|
1002
|
+
style: (0, import_dynamic4.assignInlineVars)(
|
|
1003
|
+
compactMap({
|
|
1004
|
+
[globalVars.bottomSheet.borderRadius]: borderRadius,
|
|
1005
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
1006
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
1007
|
+
[vars2.zIndexes.dim]: `${zIndexBase}`,
|
|
1008
|
+
[vars2.zIndexes.paper]: `${zIndexPaper}`,
|
|
1009
|
+
[vars2.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
1010
|
+
})
|
|
1011
|
+
),
|
|
1012
|
+
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 }) })
|
|
1013
|
+
}
|
|
1014
|
+
);
|
|
960
1015
|
};
|
|
961
1016
|
BottomSheet.displayName = "BottomSheet";
|
|
962
1017
|
var BottomSheet_default = BottomSheet;
|
|
963
1018
|
|
|
964
1019
|
// src/components/Modal.tsx
|
|
965
|
-
var
|
|
1020
|
+
var import_react12 = require("@stackflow/react");
|
|
966
1021
|
var import_dynamic5 = require("@vanilla-extract/dynamic");
|
|
967
|
-
var
|
|
1022
|
+
var import_react13 = require("react");
|
|
968
1023
|
|
|
969
1024
|
// src/components/Modal.css.ts
|
|
970
|
-
var
|
|
971
|
-
var container3 = (0,
|
|
972
|
-
var dim3 = "
|
|
973
|
-
var paper3 = "
|
|
974
|
-
var vars3 = { transitionDuration: "var(--
|
|
1025
|
+
var import_createRuntimeFn5 = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
1026
|
+
var container3 = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc", variantClassNames: { transitionState: { "enter-active": "_5ozg8c4", "enter-done": "_5ozg8c5", "exit-active": "_5ozg8c6", "exit-done": "_5ozg8c7" } }, defaultVariants: {}, compoundVariants: [] });
|
|
1027
|
+
var dim3 = "_5ozg8cd dhthxq4 dhthxq0 dhthxq1 dhthxq2 dhthxq3 dhthxqc dhthxq9 dhthxq7 dhthxqb _5ozg8c3";
|
|
1028
|
+
var paper3 = "_5ozg8ce dhthxqc _5ozg8c3";
|
|
1029
|
+
var vars3 = { transitionDuration: "var(--_5ozg8c0)", zIndexes: { dim: "var(--_5ozg8c1)", paper: "var(--_5ozg8c2)" } };
|
|
975
1030
|
|
|
976
1031
|
// src/components/Modal.tsx
|
|
1032
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
977
1033
|
var Modal = ({
|
|
978
1034
|
backgroundColor,
|
|
979
1035
|
dimBackgroundColor,
|
|
@@ -983,9 +1039,9 @@ var Modal = ({
|
|
|
983
1039
|
}) => {
|
|
984
1040
|
var _a, _b, _c;
|
|
985
1041
|
const activity = useNullableActivity();
|
|
986
|
-
const { pop } = (0,
|
|
987
|
-
const containerRef = (0,
|
|
988
|
-
const paperRef = (0,
|
|
1042
|
+
const { pop } = (0, import_react12.useActions)();
|
|
1043
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
1044
|
+
const paperRef = (0, import_react13.useRef)(null);
|
|
989
1045
|
useStyleEffect({
|
|
990
1046
|
styleName: "hide",
|
|
991
1047
|
refs: [containerRef]
|
|
@@ -998,7 +1054,7 @@ var Modal = ({
|
|
|
998
1054
|
styleName: "swipe-back",
|
|
999
1055
|
refs: [paperRef]
|
|
1000
1056
|
});
|
|
1001
|
-
const popLock = (0,
|
|
1057
|
+
const popLock = (0, import_react13.useRef)(false);
|
|
1002
1058
|
const onDimClick = (e) => {
|
|
1003
1059
|
onOutsideClick == null ? void 0 : onOutsideClick(e);
|
|
1004
1060
|
if (e.defaultPrevented) {
|
|
@@ -1016,29 +1072,26 @@ var Modal = ({
|
|
|
1016
1072
|
const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
|
|
1017
1073
|
const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
|
|
1018
1074
|
const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
|
|
1019
|
-
return /* @__PURE__ */
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
className: paper3,
|
|
1040
|
-
onClick: onPaperClick
|
|
1041
|
-
}, children)));
|
|
1075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1076
|
+
"div",
|
|
1077
|
+
{
|
|
1078
|
+
className: container3({
|
|
1079
|
+
transitionState: useLazy(transitionState)
|
|
1080
|
+
}),
|
|
1081
|
+
ref: containerRef,
|
|
1082
|
+
style: (0, import_dynamic5.assignInlineVars)(
|
|
1083
|
+
compactMap({
|
|
1084
|
+
[globalVars.bottomSheet.borderRadius]: borderRadius,
|
|
1085
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
1086
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
1087
|
+
[vars3.zIndexes.dim]: `${zIndexBase}`,
|
|
1088
|
+
[vars3.zIndexes.paper]: `${zIndexPaper}`,
|
|
1089
|
+
[vars3.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
1090
|
+
})
|
|
1091
|
+
),
|
|
1092
|
+
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 }) })
|
|
1093
|
+
}
|
|
1094
|
+
);
|
|
1042
1095
|
};
|
|
1043
1096
|
Modal.displayName = "Modal";
|
|
1044
1097
|
var Modal_default = Modal;
|