@stackflow/plugin-basic-ui 0.21.4-alpha.4 → 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 +3 -3
- 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 +1 -1
- package/dist/hooks/useStyleEffectHide.d.ts +1 -1
- package/dist/index.css +9 -5
- package/dist/index.css.map +3 -3
- package/dist/index.js +311 -254
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +289 -226
- package/dist/index.mjs.map +3 -3
- package/dist/theme.css.d.ts +1 -0
- package/package.json +5 -5
- package/src/assets/IconBack.tsx +0 -2
- package/src/assets/IconClose.tsx +0 -2
- package/src/basicUIPlugin.tsx +5 -1
- package/src/components/AppBar.tsx +2 -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 +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/theme.css.ts +3 -1
package/dist/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ var __export = (target, all) => {
|
|
|
24
24
|
|
|
25
25
|
// src/basicUIPlugin.tsx
|
|
26
26
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
27
|
-
import
|
|
27
|
+
import { createContext, useContext } from "react";
|
|
28
28
|
|
|
29
29
|
// src/theme.css.ts
|
|
30
30
|
var theme_css_exports = {};
|
|
@@ -37,7 +37,7 @@ __export(theme_css_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
var android = "theme__1coppmz0";
|
|
39
39
|
var cupertino = "theme__1coppmz1";
|
|
40
|
-
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)" } };
|
|
40
|
+
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)" } };
|
|
41
41
|
var rootAndroid = ":root[data-stackflow-plugin-basic-ui-theme=android]";
|
|
42
42
|
var rootCupertino = ":root[data-stackflow-plugin-basic-ui-theme=cupertino]";
|
|
43
43
|
|
|
@@ -100,6 +100,7 @@ function requestNextFrame(cb) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// src/basicUIPlugin.tsx
|
|
103
|
+
import { jsx } from "react/jsx-runtime";
|
|
103
104
|
var GlobalOptionsContext = createContext({
|
|
104
105
|
theme: "android"
|
|
105
106
|
});
|
|
@@ -111,31 +112,34 @@ var basicUIPlugin = (options) => () => ({
|
|
|
111
112
|
key: "basic-ui",
|
|
112
113
|
wrapStack({ stack }) {
|
|
113
114
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
return /* @__PURE__ */ jsx(GlobalOptionsProvider, { value: options, children: /* @__PURE__ */ jsx(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
className: isBrowser() ? compact([theme_css_exports[options.theme], options.rootClassName]).join(" ") : options.rootClassName,
|
|
119
|
+
style: assignInlineVars(
|
|
120
|
+
compactMap({
|
|
121
|
+
[globalVars.backgroundColor]: options.backgroundColor,
|
|
122
|
+
[globalVars.dimBackgroundColor]: options.dimBackgroundColor,
|
|
123
|
+
[globalVars.transitionDuration]: stack.globalTransitionState === "loading" ? `${stack.transitionDuration}ms` : "0ms",
|
|
124
|
+
[globalVars.appBar.borderColor]: (_a = options.appBar) == null ? void 0 : _a.borderColor,
|
|
125
|
+
[globalVars.appBar.borderSize]: (_b = options.appBar) == null ? void 0 : _b.borderSize,
|
|
126
|
+
[globalVars.appBar.height]: (_c = options.appBar) == null ? void 0 : _c.height,
|
|
127
|
+
[globalVars.appBar.iconColor]: (_d = options.appBar) == null ? void 0 : _d.iconColor,
|
|
128
|
+
[globalVars.appBar.textColor]: (_e = options.appBar) == null ? void 0 : _e.textColor,
|
|
129
|
+
[globalVars.bottomSheet.borderRadius]: (_f = options.bottomSheet) == null ? void 0 : _f.borderRadius,
|
|
130
|
+
[globalVars.modal.borderRadius]: (_g = options.modal) == null ? void 0 : _g.borderRadius
|
|
131
|
+
})
|
|
132
|
+
),
|
|
133
|
+
children: stack.render()
|
|
134
|
+
}
|
|
135
|
+
) });
|
|
132
136
|
}
|
|
133
137
|
});
|
|
134
138
|
|
|
135
139
|
// src/components/AppScreen.tsx
|
|
136
140
|
import { useActions as useActions2 } from "@stackflow/react";
|
|
137
141
|
import { assignInlineVars as assignInlineVars3 } from "@vanilla-extract/dynamic";
|
|
138
|
-
import
|
|
142
|
+
import { createContext as createContext2, useContext as useContext2, useMemo, useRef as useRef2 } from "react";
|
|
139
143
|
|
|
140
144
|
// src/hooks/useLazy.tsx
|
|
141
145
|
import { useEffect, useState } from "react";
|
|
@@ -313,7 +317,7 @@ function useStyleEffectOffset({
|
|
|
313
317
|
if (!ref.current) {
|
|
314
318
|
return;
|
|
315
319
|
}
|
|
316
|
-
ref.current.style.transition =
|
|
320
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
317
321
|
ref.current.style.transform = transform;
|
|
318
322
|
});
|
|
319
323
|
switch (activityTransitionState) {
|
|
@@ -404,15 +408,15 @@ function useStyleEffectSwipeBack({
|
|
|
404
408
|
return new Promise((resolve) => {
|
|
405
409
|
requestAnimationFrame(() => {
|
|
406
410
|
$dim.style.opacity = `${swiped ? 0 : 1}`;
|
|
407
|
-
$dim.style.transition =
|
|
411
|
+
$dim.style.transition = globalVars.transitionDuration;
|
|
408
412
|
$paper.style.overflowY = "hidden";
|
|
409
413
|
$paper.style.transform = `translateX(${swiped ? "100%" : "0"})`;
|
|
410
|
-
$paper.style.transition =
|
|
414
|
+
$paper.style.transition = globalVars.transitionDuration;
|
|
411
415
|
refs.forEach((ref) => {
|
|
412
416
|
if (!ref.current) {
|
|
413
417
|
return;
|
|
414
418
|
}
|
|
415
|
-
ref.current.style.transition =
|
|
419
|
+
ref.current.style.transition = globalVars.transitionDuration;
|
|
416
420
|
ref.current.style.transform = `translate3d(${swiped ? "0" : `-${OFFSET_PX_CUPERTINO / 16}rem`}, 0, 0)`;
|
|
417
421
|
});
|
|
418
422
|
const _cachedRefs = [...cachedRefs];
|
|
@@ -511,39 +515,59 @@ function useStyleEffectSwipeBack({
|
|
|
511
515
|
// src/components/AppBar.tsx
|
|
512
516
|
import { useActions } from "@stackflow/react";
|
|
513
517
|
import { assignInlineVars as assignInlineVars2 } from "@vanilla-extract/dynamic";
|
|
514
|
-
import
|
|
518
|
+
import { forwardRef, useRef } from "react";
|
|
515
519
|
|
|
516
520
|
// src/assets/IconBack.tsx
|
|
517
|
-
import
|
|
518
|
-
var IconBack = (props) => /* @__PURE__ */
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
521
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
522
|
+
var IconBack = (props) => /* @__PURE__ */ jsx2(
|
|
523
|
+
"svg",
|
|
524
|
+
{
|
|
525
|
+
className: props.className,
|
|
526
|
+
width: "24",
|
|
527
|
+
height: "24",
|
|
528
|
+
viewBox: "0 0 24 24",
|
|
529
|
+
fill: "none",
|
|
530
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
531
|
+
children: /* @__PURE__ */ jsx2(
|
|
532
|
+
"path",
|
|
533
|
+
{
|
|
534
|
+
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",
|
|
535
|
+
fill: "currentColor"
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
}
|
|
539
|
+
);
|
|
529
540
|
var IconBack_default = IconBack;
|
|
530
541
|
|
|
531
542
|
// src/assets/IconClose.tsx
|
|
532
|
-
import
|
|
533
|
-
var IconClose = (props) => /* @__PURE__ */
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
543
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
544
|
+
var IconClose = (props) => /* @__PURE__ */ jsxs(
|
|
545
|
+
"svg",
|
|
546
|
+
{
|
|
547
|
+
className: props.className,
|
|
548
|
+
width: "24",
|
|
549
|
+
height: "24",
|
|
550
|
+
viewBox: "0 0 24 24",
|
|
551
|
+
fill: "none",
|
|
552
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ jsx3(
|
|
555
|
+
"path",
|
|
556
|
+
{
|
|
557
|
+
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",
|
|
558
|
+
fill: "currentColor"
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ jsx3(
|
|
562
|
+
"path",
|
|
563
|
+
{
|
|
564
|
+
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",
|
|
565
|
+
fill: "currentColor"
|
|
566
|
+
}
|
|
567
|
+
)
|
|
568
|
+
]
|
|
569
|
+
}
|
|
570
|
+
);
|
|
547
571
|
var IconClose_default = IconClose;
|
|
548
572
|
|
|
549
573
|
// src/components/AppBar.css.ts
|
|
@@ -569,7 +593,8 @@ var paper = _7a4682({ defaultClassName: "AppScreen__1dlf434j f__dhthxq4 f__dhthx
|
|
|
569
593
|
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)" } } };
|
|
570
594
|
|
|
571
595
|
// src/components/AppBar.tsx
|
|
572
|
-
|
|
596
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
597
|
+
var AppBar = forwardRef(
|
|
573
598
|
({
|
|
574
599
|
title,
|
|
575
600
|
appendLeft,
|
|
@@ -619,11 +644,15 @@ var AppBar = React4.forwardRef(
|
|
|
619
644
|
return null;
|
|
620
645
|
}
|
|
621
646
|
if (!backButton2 && !globalBackButton) {
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
647
|
+
return /* @__PURE__ */ jsx4(
|
|
648
|
+
"button",
|
|
649
|
+
{
|
|
650
|
+
type: "button",
|
|
651
|
+
className: backButton,
|
|
652
|
+
onClick: onBackClick,
|
|
653
|
+
children: /* @__PURE__ */ jsx4(IconBack_default, {})
|
|
654
|
+
}
|
|
655
|
+
);
|
|
627
656
|
}
|
|
628
657
|
if (backButton2 && "render" in backButton2 && backButton2.render) {
|
|
629
658
|
return (_a2 = backButton2.render) == null ? void 0 : _a2.call(backButton2);
|
|
@@ -631,23 +660,27 @@ var AppBar = React4.forwardRef(
|
|
|
631
660
|
if (globalBackButton && "render" in globalBackButton && globalBackButton.render) {
|
|
632
661
|
return (_b2 = globalBackButton.render) == null ? void 0 : _b2.call(globalBackButton);
|
|
633
662
|
}
|
|
634
|
-
return /* @__PURE__ */
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
663
|
+
return /* @__PURE__ */ jsx4(
|
|
664
|
+
"button",
|
|
665
|
+
{
|
|
666
|
+
type: "button",
|
|
667
|
+
className: backButton,
|
|
668
|
+
"aria-label": backButton2 && "ariaLabel" in backButton2 ? backButton2.ariaLabel : globalBackButton && "ariaLabel" in globalBackButton ? globalBackButton.ariaLabel : void 0,
|
|
669
|
+
onClick: onBackClick,
|
|
670
|
+
children: (() => {
|
|
671
|
+
if (backButton2 && "renderIcon" in backButton2 && backButton2.renderIcon) {
|
|
672
|
+
return backButton2.renderIcon();
|
|
673
|
+
}
|
|
674
|
+
if (globalBackButton && "renderIcon" in globalBackButton && globalBackButton.renderIcon) {
|
|
675
|
+
return globalBackButton.renderIcon();
|
|
676
|
+
}
|
|
677
|
+
if (presentModalFullScreen) {
|
|
678
|
+
return /* @__PURE__ */ jsx4(IconClose_default, {});
|
|
679
|
+
}
|
|
680
|
+
return /* @__PURE__ */ jsx4(IconBack_default, {});
|
|
681
|
+
})()
|
|
648
682
|
}
|
|
649
|
-
|
|
650
|
-
})());
|
|
683
|
+
);
|
|
651
684
|
};
|
|
652
685
|
const onCloseClick = (e) => {
|
|
653
686
|
var _a2;
|
|
@@ -671,70 +704,90 @@ var AppBar = React4.forwardRef(
|
|
|
671
704
|
if (globalCloseButton && "render" in globalCloseButton && globalCloseButton.render) {
|
|
672
705
|
return globalCloseButton.render();
|
|
673
706
|
}
|
|
674
|
-
return /* @__PURE__ */
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
707
|
+
return /* @__PURE__ */ jsx4(
|
|
708
|
+
"button",
|
|
709
|
+
{
|
|
710
|
+
type: "button",
|
|
711
|
+
className: closeButton,
|
|
712
|
+
"aria-label": closeButton2 && "ariaLabel" in closeButton2 ? closeButton2.ariaLabel : globalCloseButton && "ariaLabel" in globalCloseButton ? globalCloseButton.ariaLabel : void 0,
|
|
713
|
+
onClick: onCloseClick,
|
|
714
|
+
children: (() => {
|
|
715
|
+
if (closeButton2 && "renderIcon" in closeButton2 && closeButton2.renderIcon) {
|
|
716
|
+
return closeButton2.renderIcon();
|
|
717
|
+
}
|
|
718
|
+
if (globalCloseButton && "renderIcon" in globalCloseButton && globalCloseButton.renderIcon) {
|
|
719
|
+
return globalCloseButton.renderIcon();
|
|
720
|
+
}
|
|
721
|
+
return /* @__PURE__ */ jsx4(IconClose_default, {});
|
|
722
|
+
})()
|
|
685
723
|
}
|
|
686
|
-
|
|
687
|
-
})());
|
|
724
|
+
);
|
|
688
725
|
};
|
|
689
726
|
const hasLeft = !!(closeButtonLocation === "left" && closeButton2 || backButton2 || appendLeft);
|
|
690
|
-
return /* @__PURE__ */
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
727
|
+
return /* @__PURE__ */ jsxs2(
|
|
728
|
+
"div",
|
|
729
|
+
{
|
|
730
|
+
ref,
|
|
731
|
+
className: appBar({
|
|
732
|
+
border,
|
|
733
|
+
presentModalFullScreen
|
|
734
|
+
}),
|
|
735
|
+
style: assignInlineVars2(
|
|
736
|
+
compactMap({
|
|
737
|
+
[globalVars.appBar.iconColor]: iconColor,
|
|
738
|
+
[globalVars.appBar.textColor]: textColor,
|
|
739
|
+
[globalVars.appBar.borderColor]: borderColor,
|
|
740
|
+
[globalVars.appBar.borderSize]: borderSize,
|
|
741
|
+
[globalVars.appBar.height]: height,
|
|
742
|
+
[globalVars.appBar.heightTransitionDuration]: heightTransitionDuration,
|
|
743
|
+
[globalVars.appBar.overflow]: overflow,
|
|
744
|
+
[globalVars.appBar.backgroundColor]: backgroundColor || globalVars.backgroundColor,
|
|
745
|
+
[vars.appBar.center.mainWidth]: `${maxWidth}px`
|
|
746
|
+
})
|
|
747
|
+
),
|
|
748
|
+
children: [
|
|
749
|
+
/* @__PURE__ */ jsx4("div", { className: safeArea }),
|
|
750
|
+
/* @__PURE__ */ jsxs2("div", { className: container, children: [
|
|
751
|
+
/* @__PURE__ */ jsxs2("div", { className: left, children: [
|
|
752
|
+
closeButtonLocation === "left" && renderCloseButton(),
|
|
753
|
+
renderBackButton(),
|
|
754
|
+
appendLeft == null ? void 0 : appendLeft()
|
|
755
|
+
] }),
|
|
756
|
+
/* @__PURE__ */ jsx4("div", { ref: centerRef, className: center, children: /* @__PURE__ */ jsxs2(
|
|
757
|
+
"div",
|
|
758
|
+
{
|
|
759
|
+
className: centerMain({
|
|
760
|
+
hasLeft
|
|
761
|
+
}),
|
|
762
|
+
children: [
|
|
763
|
+
typeof title === "string" ? /* @__PURE__ */ jsx4("div", { className: centerText, children: title }) : title,
|
|
764
|
+
/* @__PURE__ */ jsx4(
|
|
765
|
+
"button",
|
|
766
|
+
{
|
|
767
|
+
className: centerMainEdge,
|
|
768
|
+
type: "button",
|
|
769
|
+
"aria-hidden": "true",
|
|
770
|
+
onClick: onTopClick
|
|
771
|
+
}
|
|
772
|
+
)
|
|
773
|
+
]
|
|
774
|
+
}
|
|
775
|
+
) }),
|
|
776
|
+
/* @__PURE__ */ jsxs2("div", { className: right, children: [
|
|
777
|
+
appendRight == null ? void 0 : appendRight(),
|
|
778
|
+
closeButtonLocation === "right" && renderCloseButton()
|
|
779
|
+
] })
|
|
780
|
+
] })
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
);
|
|
732
784
|
}
|
|
733
785
|
);
|
|
734
786
|
AppBar.displayName = "AppBar";
|
|
735
787
|
var AppBar_default = AppBar;
|
|
736
788
|
|
|
737
789
|
// src/components/AppScreen.tsx
|
|
790
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
738
791
|
var Context = createContext2(null);
|
|
739
792
|
function useAppScreen() {
|
|
740
793
|
return useContext2(Context);
|
|
@@ -796,55 +849,69 @@ var AppScreen = ({
|
|
|
796
849
|
});
|
|
797
850
|
}
|
|
798
851
|
};
|
|
799
|
-
return /* @__PURE__ */
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
(
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
852
|
+
return /* @__PURE__ */ jsx5(
|
|
853
|
+
Context.Provider,
|
|
854
|
+
{
|
|
855
|
+
value: useMemo(
|
|
856
|
+
() => ({
|
|
857
|
+
scroll({ top }) {
|
|
858
|
+
var _a2;
|
|
859
|
+
(_a2 = paperRef == null ? void 0 : paperRef.current) == null ? void 0 : _a2.scroll({
|
|
860
|
+
top,
|
|
861
|
+
behavior: "smooth"
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}),
|
|
865
|
+
[paperRef]
|
|
866
|
+
),
|
|
867
|
+
children: /* @__PURE__ */ jsxs3(
|
|
868
|
+
"div",
|
|
869
|
+
{
|
|
870
|
+
ref: appScreenRef,
|
|
871
|
+
className: appScreen({
|
|
872
|
+
transitionState: transitionState === "enter-done" || transitionState === "exit-done" ? transitionState : lazyTransitionState
|
|
873
|
+
}),
|
|
874
|
+
style: assignInlineVars3(
|
|
875
|
+
compactMap({
|
|
876
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
877
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
878
|
+
[globalVars.appBar.height]: appBar2 == null ? void 0 : appBar2.height,
|
|
879
|
+
[globalVars.appBar.heightTransitionDuration]: appBar2 == null ? void 0 : appBar2.heightTransitionDuration,
|
|
880
|
+
[vars.zIndexes.dim]: `${zIndexDim}`,
|
|
881
|
+
[vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
882
|
+
[vars.zIndexes.edge]: `${zIndexEdge}`,
|
|
883
|
+
[vars.zIndexes.appBar]: `${zIndexAppBar}`,
|
|
884
|
+
[vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
885
|
+
})
|
|
886
|
+
),
|
|
887
|
+
children: [
|
|
888
|
+
/* @__PURE__ */ jsx5("div", { className: dim, ref: dimRef }),
|
|
889
|
+
appBar2 && /* @__PURE__ */ jsx5(
|
|
890
|
+
AppBar_default,
|
|
891
|
+
__spreadProps(__spreadValues({}, appBar2), {
|
|
892
|
+
ref: appBarRef,
|
|
893
|
+
modalPresentationStyle,
|
|
894
|
+
onTopClick: onAppBarTopClick
|
|
895
|
+
})
|
|
896
|
+
),
|
|
897
|
+
/* @__PURE__ */ jsx5(
|
|
898
|
+
"div",
|
|
899
|
+
{
|
|
900
|
+
className: paper({
|
|
901
|
+
hasAppBar,
|
|
902
|
+
presentModalFullScreen
|
|
903
|
+
}),
|
|
904
|
+
ref: paperRef,
|
|
905
|
+
children
|
|
906
|
+
},
|
|
907
|
+
activity == null ? void 0 : activity.id
|
|
908
|
+
),
|
|
909
|
+
!(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ jsx5("div", { className: edge({ hasAppBar }), ref: edgeRef })
|
|
910
|
+
]
|
|
808
911
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}, /* @__PURE__ */ React5.createElement("div", {
|
|
813
|
-
ref: appScreenRef,
|
|
814
|
-
className: appScreen({
|
|
815
|
-
transitionState: transitionState === "enter-done" || transitionState === "exit-done" ? transitionState : lazyTransitionState
|
|
816
|
-
}),
|
|
817
|
-
style: assignInlineVars3(
|
|
818
|
-
compactMap({
|
|
819
|
-
[globalVars.backgroundColor]: backgroundColor,
|
|
820
|
-
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
821
|
-
[globalVars.appBar.height]: appBar2 == null ? void 0 : appBar2.height,
|
|
822
|
-
[globalVars.appBar.heightTransitionDuration]: appBar2 == null ? void 0 : appBar2.heightTransitionDuration,
|
|
823
|
-
[vars.zIndexes.dim]: `${zIndexDim}`,
|
|
824
|
-
[vars.zIndexes.paper]: `${zIndexPaper}`,
|
|
825
|
-
[vars.zIndexes.edge]: `${zIndexEdge}`,
|
|
826
|
-
[vars.zIndexes.appBar]: `${zIndexAppBar}`,
|
|
827
|
-
[vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? `var(--stackflow-transition-duration)` : "0ms"
|
|
828
|
-
})
|
|
829
|
-
)
|
|
830
|
-
}, /* @__PURE__ */ React5.createElement("div", {
|
|
831
|
-
className: dim,
|
|
832
|
-
ref: dimRef
|
|
833
|
-
}), appBar2 && /* @__PURE__ */ React5.createElement(AppBar_default, __spreadProps(__spreadValues({}, appBar2), {
|
|
834
|
-
ref: appBarRef,
|
|
835
|
-
modalPresentationStyle,
|
|
836
|
-
onTopClick: onAppBarTopClick
|
|
837
|
-
})), /* @__PURE__ */ React5.createElement("div", {
|
|
838
|
-
key: activity == null ? void 0 : activity.id,
|
|
839
|
-
className: paper({
|
|
840
|
-
hasAppBar,
|
|
841
|
-
presentModalFullScreen
|
|
842
|
-
}),
|
|
843
|
-
ref: paperRef
|
|
844
|
-
}, children), !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !swipeBackPrevented && /* @__PURE__ */ React5.createElement("div", {
|
|
845
|
-
className: edge({ hasAppBar }),
|
|
846
|
-
ref: edgeRef
|
|
847
|
-
})));
|
|
912
|
+
)
|
|
913
|
+
}
|
|
914
|
+
);
|
|
848
915
|
};
|
|
849
916
|
AppScreen.displayName = "AppScreen";
|
|
850
917
|
var AppScreen_default = AppScreen;
|
|
@@ -852,7 +919,7 @@ var AppScreen_default = AppScreen;
|
|
|
852
919
|
// src/components/BottomSheet.tsx
|
|
853
920
|
import { useActions as useActions3 } from "@stackflow/react";
|
|
854
921
|
import { assignInlineVars as assignInlineVars4 } from "@vanilla-extract/dynamic";
|
|
855
|
-
import
|
|
922
|
+
import { useRef as useRef3 } from "react";
|
|
856
923
|
|
|
857
924
|
// src/components/BottomSheet.css.ts
|
|
858
925
|
import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
@@ -862,6 +929,7 @@ var paper2 = "BottomSheet__1ht38h0e f__dhthxqc BottomSheet__1ht38h03";
|
|
|
862
929
|
var vars2 = { transitionDuration: "var(--transitionDuration__1ht38h00)", zIndexes: { dim: "var(--zIndexes-dim__1ht38h01)", paper: "var(--zIndexes-paper__1ht38h02)" } };
|
|
863
930
|
|
|
864
931
|
// src/components/BottomSheet.tsx
|
|
932
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
865
933
|
var BottomSheet = ({
|
|
866
934
|
borderRadius = "1rem",
|
|
867
935
|
backgroundColor,
|
|
@@ -904,29 +972,26 @@ var BottomSheet = ({
|
|
|
904
972
|
const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
|
|
905
973
|
const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
|
|
906
974
|
const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
|
|
907
|
-
return /* @__PURE__ */
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
className: paper2,
|
|
928
|
-
onClick: onPaperClick
|
|
929
|
-
}, children)));
|
|
975
|
+
return /* @__PURE__ */ jsx6(
|
|
976
|
+
"div",
|
|
977
|
+
{
|
|
978
|
+
className: container2({
|
|
979
|
+
transitionState: useLazy(transitionState)
|
|
980
|
+
}),
|
|
981
|
+
ref: containerRef,
|
|
982
|
+
style: assignInlineVars4(
|
|
983
|
+
compactMap({
|
|
984
|
+
[globalVars.bottomSheet.borderRadius]: borderRadius,
|
|
985
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
986
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
987
|
+
[vars2.zIndexes.dim]: `${zIndexBase}`,
|
|
988
|
+
[vars2.zIndexes.paper]: `${zIndexPaper}`,
|
|
989
|
+
[vars2.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
990
|
+
})
|
|
991
|
+
),
|
|
992
|
+
children: /* @__PURE__ */ jsx6("div", { className: dim2, ref: paperRef, onClick: onDimClick, children: /* @__PURE__ */ jsx6("div", { className: paper2, onClick: onPaperClick, children }) })
|
|
993
|
+
}
|
|
994
|
+
);
|
|
930
995
|
};
|
|
931
996
|
BottomSheet.displayName = "BottomSheet";
|
|
932
997
|
var BottomSheet_default = BottomSheet;
|
|
@@ -934,7 +999,7 @@ var BottomSheet_default = BottomSheet;
|
|
|
934
999
|
// src/components/Modal.tsx
|
|
935
1000
|
import { useActions as useActions4 } from "@stackflow/react";
|
|
936
1001
|
import { assignInlineVars as assignInlineVars5 } from "@vanilla-extract/dynamic";
|
|
937
|
-
import
|
|
1002
|
+
import { useRef as useRef4 } from "react";
|
|
938
1003
|
|
|
939
1004
|
// src/components/Modal.css.ts
|
|
940
1005
|
import { createRuntimeFn as _7a4684 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
@@ -944,6 +1009,7 @@ var paper3 = "Modal__5ozg8ce f__dhthxqc Modal__5ozg8c3";
|
|
|
944
1009
|
var vars3 = { transitionDuration: "var(--transitionDuration__5ozg8c0)", zIndexes: { dim: "var(--zIndexes-dim__5ozg8c1)", paper: "var(--zIndexes-paper__5ozg8c2)" } };
|
|
945
1010
|
|
|
946
1011
|
// src/components/Modal.tsx
|
|
1012
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
947
1013
|
var Modal = ({
|
|
948
1014
|
backgroundColor,
|
|
949
1015
|
dimBackgroundColor,
|
|
@@ -986,29 +1052,26 @@ var Modal = ({
|
|
|
986
1052
|
const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
|
|
987
1053
|
const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
|
|
988
1054
|
const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
|
|
989
|
-
return /* @__PURE__ */
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
className: paper3,
|
|
1010
|
-
onClick: onPaperClick
|
|
1011
|
-
}, children)));
|
|
1055
|
+
return /* @__PURE__ */ jsx7(
|
|
1056
|
+
"div",
|
|
1057
|
+
{
|
|
1058
|
+
className: container3({
|
|
1059
|
+
transitionState: useLazy(transitionState)
|
|
1060
|
+
}),
|
|
1061
|
+
ref: containerRef,
|
|
1062
|
+
style: assignInlineVars5(
|
|
1063
|
+
compactMap({
|
|
1064
|
+
[globalVars.bottomSheet.borderRadius]: borderRadius,
|
|
1065
|
+
[globalVars.backgroundColor]: backgroundColor,
|
|
1066
|
+
[globalVars.dimBackgroundColor]: dimBackgroundColor,
|
|
1067
|
+
[vars3.zIndexes.dim]: `${zIndexBase}`,
|
|
1068
|
+
[vars3.zIndexes.paper]: `${zIndexPaper}`,
|
|
1069
|
+
[vars3.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.transitionDuration : "0ms"
|
|
1070
|
+
})
|
|
1071
|
+
),
|
|
1072
|
+
children: /* @__PURE__ */ jsx7("div", { className: dim3, ref: paperRef, onClick: onDimClick, children: /* @__PURE__ */ jsx7("div", { className: paper3, onClick: onPaperClick, children }) })
|
|
1073
|
+
}
|
|
1074
|
+
);
|
|
1012
1075
|
};
|
|
1013
1076
|
Modal.displayName = "Modal";
|
|
1014
1077
|
var Modal_default = Modal;
|