@stackflow/plugin-basic-ui 1.7.0-canary.1 → 1.8.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.
Files changed (42) hide show
  1. package/dist/assets/IconBack.d.ts +0 -1
  2. package/dist/assets/IconClose.d.ts +0 -1
  3. package/dist/basicUIPlugin.css.d.ts +32 -6
  4. package/dist/basicUIPlugin.d.ts +1 -2
  5. package/dist/components/AppBar.css.d.ts +2 -2
  6. package/dist/components/AppBar.d.ts +17 -18
  7. package/dist/components/AppScreen.css.d.ts +19 -18
  8. package/dist/components/AppScreen.d.ts +2 -3
  9. package/dist/components/BottomSheet.css.d.ts +6 -6
  10. package/dist/components/BottomSheet.d.ts +2 -2
  11. package/dist/components/Modal.css.d.ts +6 -6
  12. package/dist/components/Modal.d.ts +1 -2
  13. package/dist/hooks/useMaxWidth.d.ts +0 -1
  14. package/dist/hooks/useStyleEffect.d.ts +1 -2
  15. package/dist/hooks/useStyleEffectHide.d.ts +0 -1
  16. package/dist/hooks/useStyleEffectOffset.d.ts +0 -1
  17. package/dist/hooks/useStyleEffectSwipeBack.d.ts +0 -1
  18. package/dist/index.css +13 -12
  19. package/dist/index.css.map +3 -3
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +29 -23
  22. package/dist/index.js.map +4 -4
  23. package/dist/index.mjs +29 -23
  24. package/dist/index.mjs.map +4 -4
  25. package/dist/utils/PropOf.d.ts +1 -2
  26. package/dist/utils/RecursivePartial.d.ts +1 -1
  27. package/dist/utils/last.d.ts +1 -1
  28. package/package.json +12 -25
  29. package/src/basicUIPlugin.css.ts +32 -32
  30. package/src/basicUIPlugin.tsx +2 -2
  31. package/src/components/AppBar.tsx +5 -5
  32. package/src/components/AppScreen.css.ts +7 -6
  33. package/src/components/AppScreen.tsx +2 -2
  34. package/src/components/BottomSheet.css.ts +2 -2
  35. package/src/components/BottomSheet.tsx +15 -10
  36. package/src/components/Modal.tsx +8 -5
  37. package/src/hooks/useStyleEffect.ts +1 -1
  38. package/src/hooks/useStyleEffectHide.ts +0 -2
  39. package/src/hooks/useStyleEffectOffset.ts +1 -5
  40. package/src/hooks/useStyleEffectSwipeBack.ts +1 -3
  41. package/src/index.ts +1 -1
  42. package/src/utils/last.ts +1 -1
package/dist/index.mjs CHANGED
@@ -360,9 +360,8 @@ function useStyleEffectOffset({
360
360
  opacity = "1";
361
361
  break;
362
362
  }
363
- case "android":
364
363
  default: {
365
- transform = activityEnterStyle === "slideInLeft" ? `translate3d(-50%, 0, 0)` : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
364
+ transform = activityEnterStyle === "slideInLeft" ? "translate3d(-50%, 0, 0)" : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
366
365
  opacity = activityEnterStyle === "slideInLeft" ? "0" : "1";
367
366
  break;
368
367
  }
@@ -398,7 +397,6 @@ function useStyleEffectOffset({
398
397
  return () => {
399
398
  cleanup();
400
399
  };
401
- case "enter-active":
402
400
  default:
403
401
  return noop;
404
402
  }
@@ -601,6 +599,13 @@ function useStyleEffectSwipeBack({
601
599
  });
602
600
  }
603
601
 
602
+ // src/hooks/useZIndexBase.ts
603
+ function useZIndexBase() {
604
+ var _a;
605
+ const activity = useNullableActivity();
606
+ return ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
607
+ }
608
+
604
609
  // src/components/AppBar.tsx
605
610
  import { useActions } from "@stackflow/react";
606
611
  import { assignInlineVars as assignInlineVars2 } from "@vanilla-extract/dynamic";
@@ -680,6 +685,7 @@ var AppBar = forwardRef(
680
685
  "button",
681
686
  {
682
687
  type: "button",
688
+ "aria-label": "Go Back",
683
689
  className: backButton,
684
690
  onClick: onBackClick,
685
691
  children: /* @__PURE__ */ jsx4(IconBack_default, {})
@@ -803,7 +809,6 @@ var AppBar = forwardRef(
803
809
  {
804
810
  className: centerMainEdge,
805
811
  type: "button",
806
- "aria-hidden": "true",
807
812
  onClick: onTopClick
808
813
  }
809
814
  )
@@ -838,7 +843,7 @@ var AppScreen = ({
838
843
  ANDROID_ONLY_activityEnterStyle,
839
844
  children
840
845
  }) => {
841
- var _a, _b;
846
+ var _a;
842
847
  const globalOptions = useGlobalOptions();
843
848
  const activity = useNullableActivity();
844
849
  const mounted = useMounted();
@@ -852,7 +857,7 @@ var AppScreen = ({
852
857
  const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
853
858
  const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
854
859
  const hasAppBar = !!appBar2;
855
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
860
+ const zIndexBase = useZIndexBase();
856
861
  let zIndexDim;
857
862
  let zIndexPaper;
858
863
  let zIndexEdge;
@@ -865,7 +870,6 @@ var AppScreen = ({
865
870
  zIndexAppBar = zIndexBase + 7;
866
871
  break;
867
872
  }
868
- case "android":
869
873
  default: {
870
874
  zIndexDim = zIndexBase;
871
875
  zIndexPaper = zIndexBase + (activityEnterStyle === "slideInLeft" ? 1 : 3);
@@ -874,7 +878,7 @@ var AppScreen = ({
874
878
  break;
875
879
  }
876
880
  }
877
- const transitionState = (_b = activity == null ? void 0 : activity.transitionState) != null ? _b : "enter-done";
881
+ const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
878
882
  const lazyTransitionState = useLazy(transitionState);
879
883
  useStyleEffectHide({
880
884
  refs: [appScreenRef],
@@ -898,10 +902,10 @@ var AppScreen = ({
898
902
  hasEffect: true
899
903
  });
900
904
  const onAppBarTopClick = (e) => {
901
- var _a2, _b2;
905
+ var _a2, _b;
902
906
  (_a2 = appBar2 == null ? void 0 : appBar2.onTopClick) == null ? void 0 : _a2.call(appBar2, e);
903
907
  if (!e.defaultPrevented) {
904
- (_b2 = paperRef.current) == null ? void 0 : _b2.scroll({
908
+ (_b = paperRef.current) == null ? void 0 : _b.scroll({
905
909
  top: 0,
906
910
  behavior: "smooth"
907
911
  });
@@ -997,25 +1001,26 @@ var BottomSheet = ({
997
1001
  borderRadius = "1rem",
998
1002
  backgroundColor,
999
1003
  dimBackgroundColor,
1004
+ paperRef,
1000
1005
  onOutsideClick,
1001
1006
  children
1002
1007
  }) => {
1003
- var _a, _b, _c;
1008
+ var _a;
1004
1009
  const activity = useNullableActivity();
1005
1010
  const { pop } = useActions3();
1006
1011
  const containerRef = useRef3(null);
1007
- const paperRef = useRef3(null);
1012
+ const dimRef = useRef3(null);
1008
1013
  useStyleEffect({
1009
1014
  styleName: "hide",
1010
1015
  refs: [containerRef]
1011
1016
  });
1012
1017
  useStyleEffect({
1013
1018
  styleName: "offset",
1014
- refs: [paperRef]
1019
+ refs: [dimRef]
1015
1020
  });
1016
1021
  useStyleEffect({
1017
1022
  styleName: "swipe-back",
1018
- refs: [paperRef]
1023
+ refs: [dimRef]
1019
1024
  });
1020
1025
  const popLock = useRef3(false);
1021
1026
  const onDimClick = (e) => {
@@ -1032,9 +1037,9 @@ var BottomSheet = ({
1032
1037
  const onPaperClick = (e) => {
1033
1038
  e.stopPropagation();
1034
1039
  };
1035
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
1036
- const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
1037
- const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
1040
+ const zIndexBase = useZIndexBase() + 3;
1041
+ const zIndexPaper = useZIndexBase() + 4;
1042
+ const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1038
1043
  return /* @__PURE__ */ jsx6(
1039
1044
  "div",
1040
1045
  {
@@ -1055,7 +1060,7 @@ var BottomSheet = ({
1055
1060
  "data-stackflow-component-name": "BottomSheet",
1056
1061
  "data-stackflow-activity-id": activity == null ? void 0 : activity.id,
1057
1062
  "data-stackflow-activity-is-active": activity == null ? void 0 : activity.isActive,
1058
- children: /* @__PURE__ */ jsx6("div", { className: dim2, ref: paperRef, onClick: onDimClick, children: /* @__PURE__ */ jsx6("div", { className: paper2, onClick: onPaperClick, children }) })
1063
+ children: /* @__PURE__ */ jsx6("div", { className: dim2, ref: dimRef, onClick: onDimClick, children: /* @__PURE__ */ jsx6("div", { className: paper2, ref: paperRef, onClick: onPaperClick, children }) })
1059
1064
  }
1060
1065
  );
1061
1066
  };
@@ -1083,7 +1088,7 @@ var Modal = ({
1083
1088
  onOutsideClick,
1084
1089
  children
1085
1090
  }) => {
1086
- var _a, _b, _c;
1091
+ var _a;
1087
1092
  const activity = useNullableActivity();
1088
1093
  const { pop } = useActions4();
1089
1094
  const containerRef = useRef4(null);
@@ -1115,9 +1120,9 @@ var Modal = ({
1115
1120
  const onPaperClick = (e) => {
1116
1121
  e.stopPropagation();
1117
1122
  };
1118
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
1119
- const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
1120
- const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
1123
+ const zIndexBase = useZIndexBase() + 3;
1124
+ const zIndexPaper = useZIndexBase() + 4;
1125
+ const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1121
1126
  return /* @__PURE__ */ jsx7(
1122
1127
  "div",
1123
1128
  {
@@ -1156,6 +1161,7 @@ export {
1156
1161
  globalVars as cssVars,
1157
1162
  vars3 as modalVars,
1158
1163
  useAppScreen,
1159
- useStyleEffect
1164
+ useStyleEffect,
1165
+ useZIndexBase
1160
1166
  };
1161
1167
  //# sourceMappingURL=index.mjs.map