@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.js CHANGED
@@ -48,7 +48,8 @@ __export(src_exports, {
48
48
  cssVars: () => globalVars,
49
49
  modalVars: () => vars3,
50
50
  useAppScreen: () => useAppScreen,
51
- useStyleEffect: () => useStyleEffect
51
+ useStyleEffect: () => useStyleEffect,
52
+ useZIndexBase: () => useZIndexBase
52
53
  });
53
54
  module.exports = __toCommonJS(src_exports);
54
55
 
@@ -394,9 +395,8 @@ function useStyleEffectOffset({
394
395
  opacity = "1";
395
396
  break;
396
397
  }
397
- case "android":
398
398
  default: {
399
- transform = activityEnterStyle === "slideInLeft" ? `translate3d(-50%, 0, 0)` : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
399
+ transform = activityEnterStyle === "slideInLeft" ? "translate3d(-50%, 0, 0)" : `translate3d(0, -${OFFSET_PX_ANDROID / 16}rem, 0)`;
400
400
  opacity = activityEnterStyle === "slideInLeft" ? "0" : "1";
401
401
  break;
402
402
  }
@@ -432,7 +432,6 @@ function useStyleEffectOffset({
432
432
  return () => {
433
433
  cleanup();
434
434
  };
435
- case "enter-active":
436
435
  default:
437
436
  return noop;
438
437
  }
@@ -635,6 +634,13 @@ function useStyleEffectSwipeBack({
635
634
  });
636
635
  }
637
636
 
637
+ // src/hooks/useZIndexBase.ts
638
+ function useZIndexBase() {
639
+ var _a;
640
+ const activity = useNullableActivity();
641
+ return ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
642
+ }
643
+
638
644
  // src/components/AppBar.tsx
639
645
  var import_react7 = require("@stackflow/react");
640
646
  var import_dynamic2 = require("@vanilla-extract/dynamic");
@@ -714,6 +720,7 @@ var AppBar = (0, import_react8.forwardRef)(
714
720
  "button",
715
721
  {
716
722
  type: "button",
723
+ "aria-label": "Go Back",
717
724
  className: backButton,
718
725
  onClick: onBackClick,
719
726
  children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBack_default, {})
@@ -837,7 +844,6 @@ var AppBar = (0, import_react8.forwardRef)(
837
844
  {
838
845
  className: centerMainEdge,
839
846
  type: "button",
840
- "aria-hidden": "true",
841
847
  onClick: onTopClick
842
848
  }
843
849
  )
@@ -872,7 +878,7 @@ var AppScreen = ({
872
878
  ANDROID_ONLY_activityEnterStyle,
873
879
  children
874
880
  }) => {
875
- var _a, _b;
881
+ var _a;
876
882
  const globalOptions = useGlobalOptions();
877
883
  const activity = useNullableActivity();
878
884
  const mounted = useMounted();
@@ -886,7 +892,7 @@ var AppScreen = ({
886
892
  const activityEnterStyle = globalOptions.theme === "android" ? ANDROID_ONLY_activityEnterStyle : void 0;
887
893
  const swipeBackPrevented = preventSwipeBack || modalPresentationStyle === "fullScreen";
888
894
  const hasAppBar = !!appBar2;
889
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5;
895
+ const zIndexBase = useZIndexBase();
890
896
  let zIndexDim;
891
897
  let zIndexPaper;
892
898
  let zIndexEdge;
@@ -899,7 +905,6 @@ var AppScreen = ({
899
905
  zIndexAppBar = zIndexBase + 7;
900
906
  break;
901
907
  }
902
- case "android":
903
908
  default: {
904
909
  zIndexDim = zIndexBase;
905
910
  zIndexPaper = zIndexBase + (activityEnterStyle === "slideInLeft" ? 1 : 3);
@@ -908,7 +913,7 @@ var AppScreen = ({
908
913
  break;
909
914
  }
910
915
  }
911
- const transitionState = (_b = activity == null ? void 0 : activity.transitionState) != null ? _b : "enter-done";
916
+ const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
912
917
  const lazyTransitionState = useLazy(transitionState);
913
918
  useStyleEffectHide({
914
919
  refs: [appScreenRef],
@@ -932,10 +937,10 @@ var AppScreen = ({
932
937
  hasEffect: true
933
938
  });
934
939
  const onAppBarTopClick = (e) => {
935
- var _a2, _b2;
940
+ var _a2, _b;
936
941
  (_a2 = appBar2 == null ? void 0 : appBar2.onTopClick) == null ? void 0 : _a2.call(appBar2, e);
937
942
  if (!e.defaultPrevented) {
938
- (_b2 = paperRef.current) == null ? void 0 : _b2.scroll({
943
+ (_b = paperRef.current) == null ? void 0 : _b.scroll({
939
944
  top: 0,
940
945
  behavior: "smooth"
941
946
  });
@@ -1031,25 +1036,26 @@ var BottomSheet = ({
1031
1036
  borderRadius = "1rem",
1032
1037
  backgroundColor,
1033
1038
  dimBackgroundColor,
1039
+ paperRef,
1034
1040
  onOutsideClick,
1035
1041
  children
1036
1042
  }) => {
1037
- var _a, _b, _c;
1043
+ var _a;
1038
1044
  const activity = useNullableActivity();
1039
1045
  const { pop } = (0, import_react11.useActions)();
1040
1046
  const containerRef = (0, import_react12.useRef)(null);
1041
- const paperRef = (0, import_react12.useRef)(null);
1047
+ const dimRef = (0, import_react12.useRef)(null);
1042
1048
  useStyleEffect({
1043
1049
  styleName: "hide",
1044
1050
  refs: [containerRef]
1045
1051
  });
1046
1052
  useStyleEffect({
1047
1053
  styleName: "offset",
1048
- refs: [paperRef]
1054
+ refs: [dimRef]
1049
1055
  });
1050
1056
  useStyleEffect({
1051
1057
  styleName: "swipe-back",
1052
- refs: [paperRef]
1058
+ refs: [dimRef]
1053
1059
  });
1054
1060
  const popLock = (0, import_react12.useRef)(false);
1055
1061
  const onDimClick = (e) => {
@@ -1066,9 +1072,9 @@ var BottomSheet = ({
1066
1072
  const onPaperClick = (e) => {
1067
1073
  e.stopPropagation();
1068
1074
  };
1069
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
1070
- const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
1071
- const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
1075
+ const zIndexBase = useZIndexBase() + 3;
1076
+ const zIndexPaper = useZIndexBase() + 4;
1077
+ const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1072
1078
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1073
1079
  "div",
1074
1080
  {
@@ -1089,7 +1095,7 @@ var BottomSheet = ({
1089
1095
  "data-stackflow-component-name": "BottomSheet",
1090
1096
  "data-stackflow-activity-id": activity == null ? void 0 : activity.id,
1091
1097
  "data-stackflow-activity-is-active": activity == null ? void 0 : activity.isActive,
1092
- 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 }) })
1098
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: dim2, ref: dimRef, onClick: onDimClick, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: paper2, ref: paperRef, onClick: onPaperClick, children }) })
1093
1099
  }
1094
1100
  );
1095
1101
  };
@@ -1117,7 +1123,7 @@ var Modal = ({
1117
1123
  onOutsideClick,
1118
1124
  children
1119
1125
  }) => {
1120
- var _a, _b, _c;
1126
+ var _a;
1121
1127
  const activity = useNullableActivity();
1122
1128
  const { pop } = (0, import_react13.useActions)();
1123
1129
  const containerRef = (0, import_react14.useRef)(null);
@@ -1149,9 +1155,9 @@ var Modal = ({
1149
1155
  const onPaperClick = (e) => {
1150
1156
  e.stopPropagation();
1151
1157
  };
1152
- const zIndexBase = ((_a = activity == null ? void 0 : activity.zIndex) != null ? _a : 0) * 5 + 3;
1153
- const zIndexPaper = ((_b = activity == null ? void 0 : activity.zIndex) != null ? _b : 0) * 5 + 4;
1154
- const transitionState = (_c = activity == null ? void 0 : activity.transitionState) != null ? _c : "enter-done";
1158
+ const zIndexBase = useZIndexBase() + 3;
1159
+ const zIndexPaper = useZIndexBase() + 4;
1160
+ const transitionState = (_a = activity == null ? void 0 : activity.transitionState) != null ? _a : "enter-done";
1155
1161
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1156
1162
  "div",
1157
1163
  {