@stll/workspace-ui 0.6.0 → 0.6.2

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.
@@ -1,9 +1,11 @@
1
1
  "use client";
2
+ import { resolveWorkspaceInspectorPresentation } from "./workspace-frame.logic.js";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  import { cn } from "@stll/ui/utils";
4
5
  import { ApplicationRail, ApplicationRailButton, ApplicationRailContent, ApplicationRailFooter, ApplicationRailHeader, ApplicationRailMenu } from "@stll/ui/application-rail";
5
6
  import { InspectorDock, TOOLBAR_ROW_HEIGHT } from "@stll/ui/inspector";
6
7
  import { Sheet, SheetPopup, SheetTitle } from "@stll/ui/sheet";
8
+ import { useIsMobile } from "@stll/ui/use-mobile";
7
9
  import { WorkspaceEndRail, WorkspaceShell } from "@stll/ui/workspace-shell";
8
10
  //#region src/workspace-frame.tsx
9
11
  /**
@@ -18,7 +20,14 @@ const WorkspaceFrame = (props) => {
18
20
  topBar: props.topBar,
19
21
  children: props.children
20
22
  });
21
- const { children, endRail, inspector, navigation, topBar } = props;
23
+ return /* @__PURE__ */ jsx(DescribedWorkspaceFrame, { ...props });
24
+ };
25
+ const DescribedWorkspaceFrame = ({ children, endRail, inspector, navigation, topBar }) => {
26
+ const isCompact = useIsMobile();
27
+ const inspectorPresentation = resolveWorkspaceInspectorPresentation({
28
+ hasMobilePresentation: inspector?.mobile !== void 0,
29
+ isCompact
30
+ });
22
31
  const desktopNavigation = /* @__PURE__ */ jsxs(ApplicationRail, {
23
32
  "aria-label": navigation.label,
24
33
  children: [
@@ -36,7 +45,7 @@ const WorkspaceFrame = (props) => {
36
45
  /* @__PURE__ */ jsx(ApplicationRailFooter, { children: navigation.footer })
37
46
  ]
38
47
  });
39
- const endDock = inspector ? /* @__PURE__ */ jsx(InspectorDock, {
48
+ const endDock = inspector && inspectorPresentation === "desktop" ? /* @__PURE__ */ jsx(InspectorDock, {
40
49
  rail: /* @__PURE__ */ jsx(WorkspaceEndRail, { ...endRail }),
41
50
  resizeHandleLabel: inspector.resizeHandleLabel,
42
51
  resizeHandleProps: inspector.resizeHandleProps,
@@ -74,17 +83,19 @@ const WorkspaceFrame = (props) => {
74
83
  });
75
84
  if (inspector?.mobile === void 0) return frame;
76
85
  return /* @__PURE__ */ jsxs(Sheet, {
77
- open: inspector.mobile.open,
78
- onOpenChange: inspector.mobile.onOpenChange,
79
- children: [frame, /* @__PURE__ */ jsxs(SheetPopup, {
80
- className: "h-dvh w-full max-w-none border-0 p-0 md:hidden",
86
+ open: inspectorPresentation === "mobile" && inspector.mobile.open,
87
+ onOpenChange: (open) => {
88
+ if (inspectorPresentation === "mobile") inspector.mobile?.onOpenChange(open);
89
+ },
90
+ children: [frame, inspectorPresentation === "mobile" ? /* @__PURE__ */ jsxs(SheetPopup, {
91
+ className: "h-dvh w-full max-w-none border-0 p-0",
81
92
  showCloseButton: false,
82
93
  side: "inline-end",
83
94
  children: [/* @__PURE__ */ jsx(SheetTitle, {
84
95
  className: "sr-only",
85
96
  children: inspector.mobile.label
86
97
  }), inspector.mobile.content]
87
- })]
98
+ }) : null]
88
99
  });
89
100
  };
90
101
  //#endregion
@@ -0,0 +1,7 @@
1
+ //#region src/workspace-frame.logic.d.ts
2
+ declare const resolveWorkspaceInspectorPresentation: ({ hasMobilePresentation, isCompact }: {
3
+ hasMobilePresentation: boolean;
4
+ isCompact: boolean;
5
+ }) => "desktop" | "mobile";
6
+ //#endregion
7
+ export { resolveWorkspaceInspectorPresentation };
@@ -0,0 +1,4 @@
1
+ //#region src/workspace-frame.logic.ts
2
+ const resolveWorkspaceInspectorPresentation = ({ hasMobilePresentation, isCompact }) => hasMobilePresentation && isCompact ? "mobile" : "desktop";
3
+ //#endregion
4
+ export { resolveWorkspaceInspectorPresentation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/workspace-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Reusable workspace presentation components and view helpers for Stella.",
5
5
  "keywords": [
6
6
  "calculations",
@@ -119,7 +119,7 @@
119
119
  "@stll/calculations": "^0.1.0",
120
120
  "@stll/conditions": "^0.2.0",
121
121
  "@stll/money": "^0.1.0",
122
- "@stll/ui": "^0.14.0",
122
+ "@stll/ui": "^0.16.0",
123
123
  "better-result": "3.0.0",
124
124
  "lucide-react": "1.30.0",
125
125
  "use-intl": "4.13.5"