@stackflow/plugin-basic-ui 1.10.1-canary.3 → 1.11.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
@@ -65,7 +65,9 @@ var IconBack = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
65
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
66
  "path",
67
67
  {
68
- d: "M16.66 3.23C16.96 3.53 16.96 4.02 16.66 4.32L8.97999 12L16.66 19.68C16.96 19.98 16.96 20.47 16.66 20.77C16.36 21.07 15.87 21.07 15.57 20.77L7.33999 12.55C7.03999 12.25 7.03999 11.76 7.33999 11.46L15.56 3.23C15.86 2.93 16.35 2.93 16.65 3.23H16.66Z",
68
+ fillRule: "evenodd",
69
+ clipRule: "evenodd",
70
+ d: "M16.7241 2.76052C17.105 3.16043 17.0896 3.79341 16.6897 4.17431L8.45 12.0222L16.6896 19.8689C17.0896 20.2498 17.105 20.8827 16.7242 21.2827C16.3433 21.6826 15.7103 21.6981 15.3104 21.3172L6.31037 12.7464C6.11218 12.5576 6.00001 12.2959 6 12.0222C5.99999 11.7486 6.11215 11.4868 6.31032 11.2981L15.3103 2.72608C15.7102 2.34518 16.3432 2.3606 16.7241 2.76052Z",
69
71
  fill: "currentColor"
70
72
  }
71
73
  )
@@ -75,7 +77,7 @@ var IconBack_default = IconBack;
75
77
 
76
78
  // src/assets/IconClose.tsx
77
79
  var import_jsx_runtime2 = require("react/jsx-runtime");
78
- var IconClose = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
80
+ var IconClose = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
79
81
  "svg",
80
82
  {
81
83
  className: props.className,
@@ -84,22 +86,13 @@ var IconClose = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
84
86
  viewBox: "0 0 24 24",
85
87
  fill: "none",
86
88
  xmlns: "http://www.w3.org/2000/svg",
87
- children: [
88
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
89
- "path",
90
- {
91
- 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",
92
- fill: "currentColor"
93
- }
94
- ),
95
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
96
- "path",
97
- {
98
- 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",
99
- fill: "currentColor"
100
- }
101
- )
102
- ]
89
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
90
+ "path",
91
+ {
92
+ d: "M20.7071 4.70711C21.0976 4.31658 21.0976 3.68342 20.7071 3.29289C20.3166 2.90237 19.6834 2.90237 19.2929 3.29289L12 10.5858L4.70711 3.29289C4.31658 2.90237 3.68342 2.90237 3.29289 3.29289C2.90237 3.68342 2.90237 4.31658 3.29289 4.70711L10.5858 12L3.29289 19.2929C2.90237 19.6834 2.90237 20.3166 3.29289 20.7071C3.68342 21.0976 4.31658 21.0976 4.70711 20.7071L12 13.4142L19.2929 20.7071C19.6834 21.0976 20.3166 21.0976 20.7071 20.7071C21.0976 20.3166 21.0976 19.6834 20.7071 19.2929L13.4142 12L20.7071 4.70711Z",
93
+ fill: "currentColor"
94
+ }
95
+ )
103
96
  }
104
97
  );
105
98
  var IconClose_default = IconClose;
@@ -110,7 +103,7 @@ var import_react = require("react");
110
103
 
111
104
  // src/basicUIPlugin.css.ts
112
105
  var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
113
- 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)", computedTransitionDuration: "var(--stackflow-plugin-basic-ui-computed-transition-duration)", appBar: { borderColor: "var(--stackflow-plugin-basic-ui-app-bar-border-color)", borderColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-border-color-transition-duration)", 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)", iconColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-icon-color-transition-duration)", textColor: "var(--stackflow-plugin-basic-ui-app-bar-text-color)", textColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-text-color-transition-duration)", backgroundColor: "var(--stackflow-plugin-basic-ui-app-bar-background-color)", backgroundColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-background-color-transition-duration)", overflow: "var(--stackflow-plugin-basic-ui-app-bar-overflow)", minSafeAreaInsetTop: "var(--stackflow-plugin-basic-ui-app-bar-min-safe-area-inset-top)" }, bottomSheet: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" }, modal: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" } };
106
+ 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)", computedTransitionDuration: "var(--stackflow-plugin-basic-ui-computed-transition-duration)", appBar: { borderColor: "var(--stackflow-plugin-basic-ui-app-bar-border-color)", borderColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-border-color-transition-duration)", 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)", iconColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-icon-color-transition-duration)", textColor: "var(--stackflow-plugin-basic-ui-app-bar-text-color)", textColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-text-color-transition-duration)", backgroundColor: "var(--stackflow-plugin-basic-ui-app-bar-background-color)", backgroundColorTransitionDuration: "var(--stackflow-plugin-basic-ui-app-bar-background-color-transition-duration)", overflow: "var(--stackflow-plugin-basic-ui-app-bar-overflow)", minSafeAreaInsetTop: "var(--stackflow-plugin-basic-ui-app-bar-min-safe-area-inset-top)" }, bottomSheet: { borderRadius: "var(--stackflow-plugin-basic-ui-bottom-sheet-border-radius)" }, modal: { borderRadius: "var(--stackflow-plugin-basic-ui-modal-border-radius)", maxWidth: "var(--stackflow-plugin-basic-ui-modal-max-width)" } };
114
107
  var stackWrapper = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_1q6dj2j2", variantClassNames: { theme: { android: "_1q6dj2j0", cupertino: "_1q6dj2j1" }, loading: { true: "_1q6dj2j5" } }, defaultVariants: {}, compoundVariants: [] });
115
108
 
116
109
  // src/utils/compact.ts
@@ -186,28 +179,28 @@ var basicUIPlugin = (options) => () => ({
186
179
 
187
180
  // src/components/AppScreen.tsx
188
181
  var import_react4 = require("@stackflow/react");
182
+ var import_react_ui_core2 = require("@stackflow/react-ui-core");
189
183
  var import_dynamic3 = require("@vanilla-extract/dynamic");
190
184
  var import_react5 = require("react");
191
- var import_react_ui_core2 = require("@stackflow/react-ui-core");
192
185
 
193
186
  // src/components/AppBar.tsx
194
187
  var import_react2 = require("@stackflow/react");
188
+ var import_react_ui_core = require("@stackflow/react-ui-core");
195
189
  var import_dynamic2 = require("@vanilla-extract/dynamic");
196
190
  var import_react3 = require("react");
197
- var import_react_ui_core = require("@stackflow/react-ui-core");
198
191
 
199
192
  // src/components/AppBar.css.ts
200
193
  var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
201
194
  var appBar = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1yk3a452 dhthxq4 dhthxq0 dhthxqh _1dlf4348 _1yk3a451", variantClassNames: { border: { true: "_1yk3a453" }, modalPresentationStyle: { fullScreen: "_1yk3a454" }, activityEnterStyle: { slideInLeft: "_1yk3a455" } }, defaultVariants: {}, compoundVariants: [] });
202
195
  var backButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
203
196
  var center = "dhthxq9 dhthxq7 dhthxq8 _1yk3a450";
204
- var centerMain = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1yk3a45c", variantClassNames: { hasLeft: { true: "_1yk3a45d" } }, defaultVariants: {}, compoundVariants: [] });
205
- var centerMainEdge = "_1yk3a45e dhthxqi dhthxq4 dhthxq2 dhthxqf";
206
- var centerText = "_1yk3a45f dhthxqc dhthxqd dhthxq0";
197
+ var centerMain = "_1yk3a45c";
198
+ var centerMainEdge = "_1yk3a45d dhthxqi dhthxq4 dhthxq2 dhthxqf";
199
+ var centerText = "_1yk3a45e dhthxqc dhthxqd dhthxq0";
207
200
  var closeButton = "_1yk3a459 dhthxq9 dhthxq7 dhthxqb dhthxqf dhthxqi";
208
201
  var container = "_1yk3a457 dhthxqa dhthxq7 _1yk3a451";
209
202
  var left = "_1yk3a458 dhthxq9 dhthxq7 dhthxq1 _1yk3a450";
210
- var right = "_1yk3a45g dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
203
+ var right = "_1yk3a45f dhthxq9 dhthxq7 dhthxq1 dhthxq5 _1yk3a450";
211
204
  var safeArea = "_1yk3a456";
212
205
 
213
206
  // src/components/AppScreen.css.ts
@@ -252,6 +245,8 @@ var AppBar = (0, import_react3.forwardRef)(
252
245
  var _a, _b;
253
246
  const actions = (0, import_react2.useActions)();
254
247
  const activity = (0, import_react_ui_core.useNullableActivity)();
248
+ const activityDataAttributes = (0, import_react_ui_core.useActivityDataAttributes)();
249
+ const mounted = (0, import_react_ui_core.useMounted)();
255
250
  const globalOptions = useGlobalOptions();
256
251
  const globalCloseButton = (_a = globalOptions.appBar) == null ? void 0 : _a.closeButton;
257
252
  const globalBackButton = (_b = globalOptions.appBar) == null ? void 0 : _b.backButton;
@@ -358,10 +353,9 @@ var AppBar = (0, import_react3.forwardRef)(
358
353
  }
359
354
  );
360
355
  };
361
- const hasLeft = !!(closeButtonLocation === "left" && closeButton2 || backButton2 || renderLeft);
362
356
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
363
357
  "div",
364
- {
358
+ __spreadProps(__spreadValues({
365
359
  ref,
366
360
  className: appBar({
367
361
  border,
@@ -385,6 +379,8 @@ var AppBar = (0, import_react3.forwardRef)(
385
379
  [vars.appBar.center.mainWidth]: `${maxWidth}px`
386
380
  })
387
381
  ),
382
+ "data-part": "appBar"
383
+ }, activityDataAttributes), {
388
384
  children: [
389
385
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: safeArea }),
390
386
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: container, children: [
@@ -393,32 +389,24 @@ var AppBar = (0, import_react3.forwardRef)(
393
389
  renderBackButton(),
394
390
  renderLeft == null ? void 0 : renderLeft()
395
391
  ] }),
396
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: centerRef, className: center, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
397
- "div",
398
- {
399
- className: centerMain({
400
- hasLeft
401
- }),
402
- children: [
403
- typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: centerText, children: title }) : title,
404
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
405
- "button",
406
- {
407
- className: centerMainEdge,
408
- type: "button",
409
- onClick: onTopClick
410
- }
411
- )
412
- ]
413
- }
414
- ) }),
392
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: centerRef, className: center, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: centerMain, children: [
393
+ typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: centerText, children: title }) : title,
394
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
395
+ "button",
396
+ {
397
+ className: centerMainEdge,
398
+ type: "button",
399
+ onClick: onTopClick
400
+ }
401
+ )
402
+ ] }) }),
415
403
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: right, children: [
416
404
  renderRight == null ? void 0 : renderRight(),
417
405
  closeButtonLocation === "right" && renderCloseButton()
418
406
  ] })
419
407
  ] })
420
408
  ]
421
- }
409
+ })
422
410
  );
423
411
  }
424
412
  );
@@ -445,6 +433,7 @@ var AppScreen = ({
445
433
  var _a;
446
434
  const globalOptions = useGlobalOptions();
447
435
  const activity = (0, import_react_ui_core2.useNullableActivity)();
436
+ const activityDataAttributes = (0, import_react_ui_core2.useActivityDataAttributes)();
448
437
  const mounted = (0, import_react_ui_core2.useMounted)();
449
438
  const { pop } = (0, import_react4.useActions)();
450
439
  const appScreenRef = (0, import_react5.useRef)(null);
@@ -501,6 +490,7 @@ var AppScreen = ({
501
490
  dimRef,
502
491
  edgeRef,
503
492
  paperRef,
493
+ appBarRef,
504
494
  offset: OFFSET_PX_CUPERTINO,
505
495
  transitionDuration: globalVars.transitionDuration,
506
496
  preventSwipeBack: isSwipeBackPrevented || globalOptions.theme !== "cupertino",
@@ -524,8 +514,10 @@ var AppScreen = ({
524
514
  }
525
515
  return null;
526
516
  },
527
- onSwiped() {
528
- pop();
517
+ onSwipeEnd({ swiped }) {
518
+ if (swiped) {
519
+ pop();
520
+ }
529
521
  }
530
522
  });
531
523
  const onAppBarTopClick = (e) => {
@@ -561,7 +553,7 @@ var AppScreen = ({
561
553
  ),
562
554
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
563
555
  "div",
564
- {
556
+ __spreadProps(__spreadValues({
565
557
  ref: appScreenRef,
566
558
  className: appScreen({
567
559
  transitionState: transitionState === "enter-done" || transitionState === "exit-done" ? transitionState : lazyTransitionState
@@ -579,11 +571,17 @@ var AppScreen = ({
579
571
  [vars.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.computedTransitionDuration : "0ms"
580
572
  })
581
573
  ),
582
- "data-stackflow-component-name": "AppScreen",
583
- "data-stackflow-activity-id": mounted ? activity == null ? void 0 : activity.id : void 0,
584
- "data-stackflow-activity-is-active": mounted ? activity == null ? void 0 : activity.isActive : void 0,
574
+ "data-stackflow-component-name": "AppScreen"
575
+ }, activityDataAttributes), {
585
576
  children: [
586
- activityEnterStyle !== "slideInLeft" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: dim, ref: dimRef }),
577
+ activityEnterStyle !== "slideInLeft" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
578
+ "div",
579
+ __spreadValues({
580
+ ref: dimRef,
581
+ className: dim,
582
+ "data-part": "dim"
583
+ }, activityDataAttributes)
584
+ ),
587
585
  appBar2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
588
586
  AppBar_default,
589
587
  __spreadProps(__spreadValues({}, appBar2), {
@@ -595,20 +593,29 @@ var AppScreen = ({
595
593
  ),
596
594
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
597
595
  "div",
598
- {
596
+ __spreadProps(__spreadValues({
597
+ ref: paperRef,
599
598
  className: paper({
600
599
  hasAppBar,
601
600
  modalPresentationStyle,
602
601
  activityEnterStyle
603
602
  }),
604
- ref: paperRef,
603
+ "data-part": "paper"
604
+ }, activityDataAttributes), {
605
605
  children
606
- },
606
+ }),
607
607
  activity == null ? void 0 : activity.id
608
608
  ),
609
- !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !isSwipeBackPrevented && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: edge({ hasAppBar }), ref: edgeRef })
609
+ !(activity == null ? void 0 : activity.isRoot) && globalOptions.theme === "cupertino" && !isSwipeBackPrevented && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
610
+ "div",
611
+ __spreadValues({
612
+ ref: edgeRef,
613
+ className: edge({ hasAppBar }),
614
+ "data-part": "edge"
615
+ }, activityDataAttributes)
616
+ )
610
617
  ]
611
- }
618
+ })
612
619
  )
613
620
  }
614
621
  );
@@ -719,6 +726,7 @@ var Modal = ({
719
726
  backgroundColor,
720
727
  dimBackgroundColor,
721
728
  borderRadius = "1rem",
729
+ maxWidth,
722
730
  onOutsideClick,
723
731
  children
724
732
  }) => {
@@ -766,9 +774,10 @@ var Modal = ({
766
774
  ref: containerRef,
767
775
  style: (0, import_dynamic5.assignInlineVars)(
768
776
  compactMap({
769
- [globalVars.bottomSheet.borderRadius]: borderRadius,
770
777
  [globalVars.backgroundColor]: backgroundColor,
771
778
  [globalVars.dimBackgroundColor]: dimBackgroundColor,
779
+ [globalVars.modal.borderRadius]: borderRadius,
780
+ [globalVars.modal.maxWidth]: maxWidth,
772
781
  [vars3.zIndexes.dim]: `${zIndexBase}`,
773
782
  [vars3.zIndexes.paper]: `${zIndexPaper}`,
774
783
  [vars3.transitionDuration]: transitionState === "enter-active" || transitionState === "exit-active" ? globalVars.computedTransitionDuration : "0ms"