@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/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 = __toESM(require("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)", 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)" } };
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
 
@@ -130,6 +124,7 @@ function requestNextFrame(cb) {
130
124
  }
131
125
 
132
126
  // src/basicUIPlugin.tsx
127
+ var import_jsx_runtime = require("react/jsx-runtime");
133
128
  var GlobalOptionsContext = (0, import_react.createContext)({
134
129
  theme: "android"
135
130
  });
@@ -141,31 +136,34 @@ var basicUIPlugin = (options) => () => ({
141
136
  key: "basic-ui",
142
137
  wrapStack({ stack }) {
143
138
  var _a, _b, _c, _d, _e, _f, _g;
144
- return /* @__PURE__ */ import_react.default.createElement(GlobalOptionsProvider, {
145
- value: options
146
- }, /* @__PURE__ */ import_react.default.createElement("div", {
147
- className: isBrowser() ? compact([theme_css_exports[options.theme], options.rootClassName]).join(" ") : options.rootClassName,
148
- style: (0, import_dynamic.assignInlineVars)(
149
- compactMap({
150
- [globalVars.backgroundColor]: options.backgroundColor,
151
- [globalVars.dimBackgroundColor]: options.dimBackgroundColor,
152
- [globalVars.appBar.borderColor]: (_a = options.appBar) == null ? void 0 : _a.borderColor,
153
- [globalVars.appBar.borderSize]: (_b = options.appBar) == null ? void 0 : _b.borderSize,
154
- [globalVars.appBar.height]: (_c = options.appBar) == null ? void 0 : _c.height,
155
- [globalVars.appBar.iconColor]: (_d = options.appBar) == null ? void 0 : _d.iconColor,
156
- [globalVars.appBar.textColor]: (_e = options.appBar) == null ? void 0 : _e.textColor,
157
- [globalVars.bottomSheet.borderRadius]: (_f = options.bottomSheet) == null ? void 0 : _f.borderRadius,
158
- [globalVars.modal.borderRadius]: (_g = options.modal) == null ? void 0 : _g.borderRadius
159
- })
160
- )
161
- }, stack.render()));
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
+ ) });
162
160
  }
163
161
  });
164
162
 
165
163
  // src/components/AppScreen.tsx
166
- var import_react10 = require("@stackflow/react");
164
+ var import_react8 = require("@stackflow/react");
167
165
  var import_dynamic3 = require("@vanilla-extract/dynamic");
168
- var import_react11 = __toESM(require("react"));
166
+ var import_react9 = require("react");
169
167
 
170
168
  // src/hooks/useLazy.tsx
171
169
  var import_react2 = require("react");
@@ -343,7 +341,7 @@ function useStyleEffectOffset({
343
341
  if (!ref.current) {
344
342
  return;
345
343
  }
346
- ref.current.style.transition = `var(--stackflow-transition-duration)`;
344
+ ref.current.style.transition = globalVars.transitionDuration;
347
345
  ref.current.style.transform = transform;
348
346
  });
349
347
  switch (activityTransitionState) {
@@ -434,15 +432,15 @@ function useStyleEffectSwipeBack({
434
432
  return new Promise((resolve) => {
435
433
  requestAnimationFrame(() => {
436
434
  $dim.style.opacity = `${swiped ? 0 : 1}`;
437
- $dim.style.transition = "var(--stackflow-transition-duration)";
435
+ $dim.style.transition = globalVars.transitionDuration;
438
436
  $paper.style.overflowY = "hidden";
439
437
  $paper.style.transform = `translateX(${swiped ? "100%" : "0"})`;
440
- $paper.style.transition = "var(--stackflow-transition-duration)";
438
+ $paper.style.transition = globalVars.transitionDuration;
441
439
  refs.forEach((ref) => {
442
440
  if (!ref.current) {
443
441
  return;
444
442
  }
445
- ref.current.style.transition = `var(--stackflow-transition-duration)`;
443
+ ref.current.style.transition = globalVars.transitionDuration;
446
444
  ref.current.style.transform = `translate3d(${swiped ? "0" : `-${OFFSET_PX_CUPERTINO / 16}rem`}, 0, 0)`;
447
445
  });
448
446
  const _cachedRefs = [...cachedRefs];
@@ -539,41 +537,61 @@ function useStyleEffectSwipeBack({
539
537
  }
540
538
 
541
539
  // src/components/AppBar.tsx
542
- var import_react8 = require("@stackflow/react");
540
+ var import_react6 = require("@stackflow/react");
543
541
  var import_dynamic2 = require("@vanilla-extract/dynamic");
544
- var import_react9 = __toESM(require("react"));
542
+ var import_react7 = require("react");
545
543
 
546
544
  // src/assets/IconBack.tsx
547
- var import_react6 = __toESM(require("react"));
548
- var IconBack = (props) => /* @__PURE__ */ import_react6.default.createElement("svg", {
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
- }, /* @__PURE__ */ import_react6.default.createElement("path", {
556
- 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",
557
- fill: "currentColor"
558
- }));
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
+ );
559
564
  var IconBack_default = IconBack;
560
565
 
561
566
  // src/assets/IconClose.tsx
562
- var import_react7 = __toESM(require("react"));
563
- var IconClose = (props) => /* @__PURE__ */ import_react7.default.createElement("svg", {
564
- className: props.className,
565
- width: "24",
566
- height: "24",
567
- viewBox: "0 0 24 24",
568
- fill: "none",
569
- xmlns: "http://www.w3.org/2000/svg"
570
- }, /* @__PURE__ */ import_react7.default.createElement("path", {
571
- 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",
572
- fill: "currentColor"
573
- }), /* @__PURE__ */ import_react7.default.createElement("path", {
574
- 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",
575
- fill: "currentColor"
576
- }));
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
+ );
577
595
  var IconClose_default = IconClose;
578
596
 
579
597
  // src/components/AppBar.css.ts
@@ -599,7 +617,8 @@ var paper = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "Ap
599
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)" } } };
600
618
 
601
619
  // src/components/AppBar.tsx
602
- var AppBar = import_react9.default.forwardRef(
620
+ var import_jsx_runtime4 = require("react/jsx-runtime");
621
+ var AppBar = (0, import_react7.forwardRef)(
603
622
  ({
604
623
  title,
605
624
  appendLeft,
@@ -620,12 +639,12 @@ var AppBar = import_react9.default.forwardRef(
620
639
  onTopClick
621
640
  }, ref) => {
622
641
  var _a, _b;
623
- const actions = (0, import_react8.useActions)();
642
+ const actions = (0, import_react6.useActions)();
624
643
  const activity = useNullableActivity();
625
644
  const globalOptions = useGlobalOptions();
626
645
  const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
627
646
  const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
628
- const centerRef = (0, import_react9.useRef)(null);
647
+ const centerRef = (0, import_react7.useRef)(null);
629
648
  const { maxWidth } = useMaxWidth({
630
649
  outerRef: ref,
631
650
  innerRef: centerRef,
@@ -649,11 +668,15 @@ var AppBar = import_react9.default.forwardRef(
649
668
  return null;
650
669
  }
651
670
  if (!backButton2 && !globalBackButton) {
652
- return /* @__PURE__ */ import_react9.default.createElement("button", {
653
- type: "button",
654
- className: backButton,
655
- onClick: onBackClick
656
- }, /* @__PURE__ */ import_react9.default.createElement(IconBack_default, null));
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
+ );
657
680
  }
658
681
  if (backButton2 && "render" in backButton2 && backButton2.render) {
659
682
  return (_a2 = backButton2.render) == null ? void 0 : _a2.call(backButton2);
@@ -661,23 +684,27 @@ var AppBar = import_react9.default.forwardRef(
661
684
  if (globalBackButton && "render" in globalBackButton && globalBackButton.render) {
662
685
  return (_b2 = globalBackButton.render) == null ? void 0 : _b2.call(globalBackButton);
663
686
  }
664
- return /* @__PURE__ */ import_react9.default.createElement("button", {
665
- type: "button",
666
- className: backButton,
667
- "aria-label": backButton2 && "ariaLabel" in backButton2 ? backButton2.ariaLabel : globalBackButton && "ariaLabel" in globalBackButton ? globalBackButton.ariaLabel : void 0,
668
- onClick: onBackClick
669
- }, (() => {
670
- if (backButton2 && "renderIcon" in backButton2 && backButton2.renderIcon) {
671
- return backButton2.renderIcon();
672
- }
673
- if (globalBackButton && "renderIcon" in globalBackButton && globalBackButton.renderIcon) {
674
- return globalBackButton.renderIcon();
675
- }
676
- if (presentModalFullScreen) {
677
- return /* @__PURE__ */ import_react9.default.createElement(IconClose_default, null);
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
+ })()
678
706
  }
679
- return /* @__PURE__ */ import_react9.default.createElement(IconBack_default, null);
680
- })());
707
+ );
681
708
  };
682
709
  const onCloseClick = (e) => {
683
710
  var _a2;
@@ -701,73 +728,93 @@ var AppBar = import_react9.default.forwardRef(
701
728
  if (globalCloseButton && "render" in globalCloseButton && globalCloseButton.render) {
702
729
  return globalCloseButton.render();
703
730
  }
704
- return /* @__PURE__ */ import_react9.default.createElement("button", {
705
- type: "button",
706
- className: closeButton,
707
- "aria-label": closeButton2 && "ariaLabel" in closeButton2 ? closeButton2.ariaLabel : globalCloseButton && "ariaLabel" in globalCloseButton ? globalCloseButton.ariaLabel : void 0,
708
- onClick: onCloseClick
709
- }, (() => {
710
- if (closeButton2 && "renderIcon" in closeButton2 && closeButton2.renderIcon) {
711
- return closeButton2.renderIcon();
712
- }
713
- if (globalCloseButton && "renderIcon" in globalCloseButton && globalCloseButton.renderIcon) {
714
- return globalCloseButton.renderIcon();
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
+ })()
715
747
  }
716
- return /* @__PURE__ */ import_react9.default.createElement(IconClose_default, null);
717
- })());
748
+ );
718
749
  };
719
750
  const hasLeft = !!(closeButtonLocation === "left" && closeButton2 || backButton2 || appendLeft);
720
- return /* @__PURE__ */ import_react9.default.createElement("div", {
721
- ref,
722
- className: appBar({
723
- border,
724
- presentModalFullScreen
725
- }),
726
- style: (0, import_dynamic2.assignInlineVars)(
727
- compactMap({
728
- [globalVars.appBar.iconColor]: iconColor,
729
- [globalVars.appBar.textColor]: textColor,
730
- [globalVars.appBar.borderColor]: borderColor,
731
- [globalVars.appBar.borderSize]: borderSize,
732
- [globalVars.appBar.height]: height,
733
- [globalVars.appBar.heightTransitionDuration]: heightTransitionDuration,
734
- [globalVars.appBar.overflow]: overflow,
735
- [globalVars.appBar.backgroundColor]: backgroundColor || globalVars.backgroundColor,
736
- [vars.appBar.center.mainWidth]: `${maxWidth}px`
737
- })
738
- )
739
- }, /* @__PURE__ */ import_react9.default.createElement("div", {
740
- className: safeArea
741
- }), /* @__PURE__ */ import_react9.default.createElement("div", {
742
- className: container
743
- }, /* @__PURE__ */ import_react9.default.createElement("div", {
744
- className: left
745
- }, closeButtonLocation === "left" && renderCloseButton(), renderBackButton(), appendLeft == null ? void 0 : appendLeft()), /* @__PURE__ */ import_react9.default.createElement("div", {
746
- ref: centerRef,
747
- className: center
748
- }, /* @__PURE__ */ import_react9.default.createElement("div", {
749
- className: centerMain({
750
- hasLeft
751
- })
752
- }, typeof title === "string" ? /* @__PURE__ */ import_react9.default.createElement("div", {
753
- className: centerText
754
- }, title) : title, /* @__PURE__ */ import_react9.default.createElement("button", {
755
- className: centerMainEdge,
756
- type: "button",
757
- "aria-hidden": "true",
758
- onClick: onTopClick
759
- }))), /* @__PURE__ */ import_react9.default.createElement("div", {
760
- className: right
761
- }, appendRight == null ? void 0 : appendRight(), closeButtonLocation === "right" && renderCloseButton())));
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
+ );
762
808
  }
763
809
  );
764
810
  AppBar.displayName = "AppBar";
765
811
  var AppBar_default = AppBar;
766
812
 
767
813
  // src/components/AppScreen.tsx
768
- var Context = (0, import_react11.createContext)(null);
814
+ var import_jsx_runtime5 = require("react/jsx-runtime");
815
+ var Context = (0, import_react9.createContext)(null);
769
816
  function useAppScreen() {
770
- return (0, import_react11.useContext)(Context);
817
+ return (0, import_react9.useContext)(Context);
771
818
  }
772
819
  var AppScreen = ({
773
820
  backgroundColor,
@@ -780,12 +827,12 @@ var AppScreen = ({
780
827
  var _a, _b;
781
828
  const globalOptions = useGlobalOptions();
782
829
  const activity = useNullableActivity();
783
- const { pop } = (0, import_react10.useActions)();
784
- const appScreenRef = (0, import_react11.useRef)(null);
785
- const dimRef = (0, import_react11.useRef)(null);
786
- const paperRef = (0, import_react11.useRef)(null);
787
- const edgeRef = (0, import_react11.useRef)(null);
788
- const appBarRef = (0, import_react11.useRef)(null);
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);
789
836
  const presentModalFullScreen = modalPresentationStyle === "fullScreen";
790
837
  const swipeBackPrevented = preventSwipeBack || presentModalFullScreen;
791
838
  useStyleEffectHide({
@@ -826,63 +873,77 @@ var AppScreen = ({
826
873
  });
827
874
  }
828
875
  };
829
- return /* @__PURE__ */ import_react11.default.createElement(Context.Provider, {
830
- value: (0, import_react11.useMemo)(
831
- () => ({
832
- scroll({ top }) {
833
- var _a2;
834
- (_a2 = paperRef == null ? void 0 : paperRef.current) == null ? void 0 : _a2.scroll({
835
- top,
836
- behavior: "smooth"
837
- });
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
+ ]
838
935
  }
839
- }),
840
- [paperRef]
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
- })));
936
+ )
937
+ }
938
+ );
878
939
  };
879
940
  AppScreen.displayName = "AppScreen";
880
941
  var AppScreen_default = AppScreen;
881
942
 
882
943
  // src/components/BottomSheet.tsx
883
- var import_react12 = require("@stackflow/react");
944
+ var import_react10 = require("@stackflow/react");
884
945
  var import_dynamic4 = require("@vanilla-extract/dynamic");
885
- var import_react13 = __toESM(require("react"));
946
+ var import_react11 = require("react");
886
947
 
887
948
  // src/components/BottomSheet.css.ts
888
949
  var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
@@ -892,6 +953,7 @@ var paper2 = "BottomSheet__1ht38h0e f__dhthxqc BottomSheet__1ht38h03";
892
953
  var vars2 = { transitionDuration: "var(--transitionDuration__1ht38h00)", zIndexes: { dim: "var(--zIndexes-dim__1ht38h01)", paper: "var(--zIndexes-paper__1ht38h02)" } };
893
954
 
894
955
  // src/components/BottomSheet.tsx
956
+ var import_jsx_runtime6 = require("react/jsx-runtime");
895
957
  var BottomSheet = ({
896
958
  borderRadius = "1rem",
897
959
  backgroundColor,
@@ -901,9 +963,9 @@ var BottomSheet = ({
901
963
  }) => {
902
964
  var _a, _b, _c;
903
965
  const activity = useNullableActivity();
904
- const { pop } = (0, import_react12.useActions)();
905
- const containerRef = (0, import_react13.useRef)(null);
906
- const paperRef = (0, import_react13.useRef)(null);
966
+ const { pop } = (0, import_react10.useActions)();
967
+ const containerRef = (0, import_react11.useRef)(null);
968
+ const paperRef = (0, import_react11.useRef)(null);
907
969
  useStyleEffect({
908
970
  styleName: "hide",
909
971
  refs: [containerRef]
@@ -916,7 +978,7 @@ var BottomSheet = ({
916
978
  styleName: "swipe-back",
917
979
  refs: [paperRef]
918
980
  });
919
- const popLock = (0, import_react13.useRef)(false);
981
+ const popLock = (0, import_react11.useRef)(false);
920
982
  const onDimClick = (e) => {
921
983
  onOutsideClick == null ? void 0 : onOutsideClick(e);
922
984
  if (e.defaultPrevented) {
@@ -934,37 +996,34 @@ var BottomSheet = ({
934
996
  const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
935
997
  const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
936
998
  const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
937
- return /* @__PURE__ */ import_react13.default.createElement("div", {
938
- className: container2({
939
- transitionState: useLazy(transitionState)
940
- }),
941
- ref: containerRef,
942
- style: (0, import_dynamic4.assignInlineVars)(
943
- compactMap({
944
- [globalVars.bottomSheet.borderRadius]: borderRadius,
945
- [globalVars.backgroundColor]: backgroundColor,
946
- [globalVars.dimBackgroundColor]: dimBackgroundColor,
947
- [vars2.zIndexes.dim]: `${zIndexBase}`,
948
- [vars2.zIndexes.paper]: `${zIndexPaper}`,
949
- [vars2.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? `var(--stackflow-transition-duration)` : "0ms"
950
- })
951
- )
952
- }, /* @__PURE__ */ import_react13.default.createElement("div", {
953
- className: dim2,
954
- ref: paperRef,
955
- onClick: onDimClick
956
- }, /* @__PURE__ */ import_react13.default.createElement("div", {
957
- className: paper2,
958
- onClick: onPaperClick
959
- }, 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
+ );
960
1019
  };
961
1020
  BottomSheet.displayName = "BottomSheet";
962
1021
  var BottomSheet_default = BottomSheet;
963
1022
 
964
1023
  // src/components/Modal.tsx
965
- var import_react14 = require("@stackflow/react");
1024
+ var import_react12 = require("@stackflow/react");
966
1025
  var import_dynamic5 = require("@vanilla-extract/dynamic");
967
- var import_react15 = __toESM(require("react"));
1026
+ var import_react13 = require("react");
968
1027
 
969
1028
  // src/components/Modal.css.ts
970
1029
  var import_createRuntimeFn4 = require("@vanilla-extract/recipes/createRuntimeFn");
@@ -974,6 +1033,7 @@ var paper3 = "Modal__5ozg8ce f__dhthxqc Modal__5ozg8c3";
974
1033
  var vars3 = { transitionDuration: "var(--transitionDuration__5ozg8c0)", zIndexes: { dim: "var(--zIndexes-dim__5ozg8c1)", paper: "var(--zIndexes-paper__5ozg8c2)" } };
975
1034
 
976
1035
  // src/components/Modal.tsx
1036
+ var import_jsx_runtime7 = require("react/jsx-runtime");
977
1037
  var Modal = ({
978
1038
  backgroundColor,
979
1039
  dimBackgroundColor,
@@ -983,9 +1043,9 @@ var Modal = ({
983
1043
  }) => {
984
1044
  var _a, _b, _c;
985
1045
  const activity = useNullableActivity();
986
- const { pop } = (0, import_react14.useActions)();
987
- const containerRef = (0, import_react15.useRef)(null);
988
- const paperRef = (0, import_react15.useRef)(null);
1046
+ const { pop } = (0, import_react12.useActions)();
1047
+ const containerRef = (0, import_react13.useRef)(null);
1048
+ const paperRef = (0, import_react13.useRef)(null);
989
1049
  useStyleEffect({
990
1050
  styleName: "hide",
991
1051
  refs: [containerRef]
@@ -998,7 +1058,7 @@ var Modal = ({
998
1058
  styleName: "swipe-back",
999
1059
  refs: [paperRef]
1000
1060
  });
1001
- const popLock = (0, import_react15.useRef)(false);
1061
+ const popLock = (0, import_react13.useRef)(false);
1002
1062
  const onDimClick = (e) => {
1003
1063
  onOutsideClick == null ? void 0 : onOutsideClick(e);
1004
1064
  if (e.defaultPrevented) {
@@ -1016,29 +1076,26 @@ var Modal = ({
1016
1076
  const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
1017
1077
  const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
1018
1078
  const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
1019
- return /* @__PURE__ */ import_react15.default.createElement("div", {
1020
- className: container3({
1021
- transitionState: useLazy(transitionState)
1022
- }),
1023
- ref: containerRef,
1024
- style: (0, import_dynamic5.assignInlineVars)(
1025
- compactMap({
1026
- [globalVars.bottomSheet.borderRadius]: borderRadius,
1027
- [globalVars.backgroundColor]: backgroundColor,
1028
- [globalVars.dimBackgroundColor]: dimBackgroundColor,
1029
- [vars3.zIndexes.dim]: `${zIndexBase}`,
1030
- [vars3.zIndexes.paper]: `${zIndexPaper}`,
1031
- [vars3.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? `var(--stackflow-transition-duration)` : "0ms"
1032
- })
1033
- )
1034
- }, /* @__PURE__ */ import_react15.default.createElement("div", {
1035
- className: dim3,
1036
- ref: paperRef,
1037
- onClick: onDimClick
1038
- }, /* @__PURE__ */ import_react15.default.createElement("div", {
1039
- className: paper3,
1040
- onClick: onPaperClick
1041
- }, 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
+ );
1042
1099
  };
1043
1100
  Modal.displayName = "Modal";
1044
1101
  var Modal_default = Modal;