@noya-app/noya-designsystem 0.1.82 → 0.1.83

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.
@@ -25,6 +25,7 @@ import {
25
25
  RenderPanel,
26
26
  SidebarOptions,
27
27
  SidebarRef,
28
+ SidebarState,
28
29
  } from "./types";
29
30
  import { WorkspaceSideProvider } from "./WorkspaceSideContext";
30
31
 
@@ -79,10 +80,19 @@ export interface WorkspaceLayoutProps<
79
80
  sideTypeBreakpoint?: number;
80
81
  detectSize?: DetectSizeType;
81
82
  /**
82
- * Use a compact top-row menu in Drawer (mobile) layout instead of a
83
- * full-height left menu. Useful when there is only a single icon.
83
+ * Callback when left sidebar state changes (width or collapsed).
84
84
  */
85
- compactDrawerMenu?: boolean;
85
+ onLeftSidebarStateChange?: (state: SidebarState) => void;
86
+ /**
87
+ * Callback when right sidebar state changes (width or collapsed).
88
+ */
89
+ onRightSidebarStateChange?: (state: SidebarState) => void;
90
+ /**
91
+ * Whether to persist panel sizes to localStorage.
92
+ * Set to false when using external storage (e.g., cookies) for sidebar state.
93
+ * @default true
94
+ */
95
+ shouldAutoSave?: boolean;
86
96
  }
87
97
 
88
98
  export type WorkspaceLayoutRef = {
@@ -177,7 +187,9 @@ export const WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout<
177
187
  showTabs: rightShowTabs = true,
178
188
  } = {},
179
189
  theme,
180
- compactDrawerMenu,
190
+ onLeftSidebarStateChange,
191
+ onRightSidebarStateChange,
192
+ shouldAutoSave,
181
193
  }: WorkspaceLayoutProps<LeftTab, RightTab>,
182
194
  forwardedRef: React.ForwardedRef<WorkspaceLayoutRef>
183
195
  ) {
@@ -450,7 +462,9 @@ export const WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout<
450
462
  autoSavePrefix={autoSavePrefix}
451
463
  leftSidebarRef={leftSidebarRef}
452
464
  rightSidebarRef={rightSidebarRef}
453
- compactDrawerMenu={compactDrawerMenu}
465
+ onLeftSidebarStateChange={onLeftSidebarStateChange}
466
+ onRightSidebarStateChange={onRightSidebarStateChange}
467
+ shouldAutoSave={shouldAutoSave}
454
468
  />
455
469
  {isOverlay && (
456
470
  <OverlayToolbar
@@ -24,6 +24,11 @@ export type PanelLayoutState = {
24
24
  rightSidebarCollapsed: boolean;
25
25
  };
26
26
 
27
+ export type SidebarState = {
28
+ width: number;
29
+ collapsed: boolean;
30
+ };
31
+
27
32
  export type RenderPanel<TabValue extends string> =
28
33
  | ReactNode
29
34
  | ((props: {
@@ -54,12 +59,19 @@ export type LayoutProps<
54
59
  leftSidebarRef: React.RefObject<SidebarRef | null>;
55
60
  rightSidebarRef: React.RefObject<SidebarRef | null>;
56
61
  /**
57
- * When using the Drawer (mobile) layout, render the vertical tab menu
58
- * in a compact top row whose height equals the toolbar height.
59
- * Intended for scenarios with a single icon to avoid reserving
60
- * full-height left-side space.
62
+ * Callback when left sidebar state changes (width or collapsed).
63
+ */
64
+ onLeftSidebarStateChange?: (state: SidebarState) => void;
65
+ /**
66
+ * Callback when right sidebar state changes (width or collapsed).
67
+ */
68
+ onRightSidebarStateChange?: (state: SidebarState) => void;
69
+ /**
70
+ * Whether to persist panel sizes to localStorage.
71
+ * Set to false when using external storage (e.g., cookies) for sidebar state.
72
+ * @default true
61
73
  */
62
- compactDrawerMenu?: boolean;
74
+ shouldAutoSave?: boolean;
63
75
  };
64
76
 
65
77
  export type WorkspaceLayoutGroup = {
package/src/index.css CHANGED
@@ -73,7 +73,7 @@
73
73
  --n-toolbar-drawer-shadow: rgba(153, 153, 153, 0.25);
74
74
  --n-canvas-background: var(--n-indigo-25);
75
75
  --n-canvas-grid: rgba(0, 0, 0, 0.05);
76
- --n-sidebar-background: rgb(255, 255, 255);
76
+ --n-sidebar-background: #fdfcff;
77
77
  --n-popover-background: rgb(252, 252, 252);
78
78
  --n-popover-divider: transparent;
79
79
  --n-listview-raised-background: rgba(0, 0, 0, 0.03);
@@ -103,7 +103,7 @@
103
103
  --n-text-link-focused: var(--n-primary-400);
104
104
  --n-inset-top: 46px;
105
105
  --n-sidebar-width: 260px;
106
- --n-toolbar-height: 46px;
106
+ --n-toolbar-height: 52px;
107
107
  --n-toolbar-separator: 8px;
108
108
  --n-inspector-h-separator: 8px;
109
109
  --n-inspector-v-separator: 10px;
@@ -267,6 +267,16 @@
267
267
  --n-cm-info: #3390ff;
268
268
  }
269
269
 
270
+ .n-workspace-sidebar {
271
+ --n-input-background: rgb(242, 240, 247);
272
+ --n-button-background: rgb(242, 240, 247);
273
+ }
274
+
275
+ [data-theme="dark"] .n-workspace-sidebar {
276
+ --n-input-background: rgb(55, 53, 65);
277
+ --n-button-background: rgb(55, 53, 65);
278
+ }
279
+
270
280
  .markdown-editor-line-placeholder::after {
271
281
  content: var(--n-markdown-editor-line-placeholder-content);
272
282
  color: var(--n-text-disabled);
@@ -1,36 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
-
31
- export {
32
- __commonJS,
33
- __export,
34
- __toESM
35
- };
36
- //# sourceMappingURL=chunk-D57E6H3M.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,43 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
- var __commonJS = (cb, mod) => function __require2() {
14
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
- };
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
-
37
- export {
38
- __require,
39
- __commonJS,
40
- __export,
41
- __toESM
42
- };
43
- //# sourceMappingURL=chunk-FJ6ZGZIA.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,37 +0,0 @@
1
- import * as __noya_react__ from "react";const require=(m)=>{if(m==="react")return __noya_react__;throw new Error("Dynamic require not supported: "+m)};
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
-
32
- export {
33
- __commonJS,
34
- __export,
35
- __toESM
36
- };
37
- //# sourceMappingURL=chunk-QDV7OQMJ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}