@noya-app/noya-designsystem 0.1.69 → 0.1.70

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.mjs CHANGED
@@ -3973,7 +3973,8 @@ var variantStyles = {
3973
3973
  floating: "n-bg-floating-button n-text-text n-shadow-[0_1px_2px_rgba(0,0,0,0.1)] hover:n-opacity-80 active:n-opacity-90",
3974
3974
  thin: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
3975
3975
  none: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
3976
- ghost: "n-bg-transparent n-text-text hover:n-bg-input-background-light"
3976
+ ghost: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
3977
+ link: "n-bg-transparent n-text-text hover:n-bg-input-background-light"
3977
3978
  };
3978
3979
  var sizeStyles = {
3979
3980
  small: "n-px-[2px] n-font-sans n-text-[10px] n-font-medium",
@@ -9781,7 +9782,7 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
9781
9782
  onClick: handleClickChevron,
9782
9783
  selected: rest.selected
9783
9784
  }
9784
- ), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ React59.createElement(React59.Fragment, null, renderIcon(icon), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 10 })), children, expandable && chevronPosition === "end" && /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 }), expanded === void 0 ? /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 19 }), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 8 })) : /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(
9785
+ ), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ React59.createElement(React59.Fragment, null, renderIcon(icon), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 10 })), children, expandable && chevronPosition === "end" && /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 }), expanded === void 0 ? /* @__PURE__ */ React59.createElement(React59.Fragment, null) : /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(
9785
9786
  IconButton,
9786
9787
  {
9787
9788
  as: chevronAs,
@@ -11580,6 +11581,9 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
11580
11581
  (event) => {
11581
11582
  if (open || !downPosition) {
11582
11583
  setDownPosition(null);
11584
+ if (open && event.target === event.currentTarget) {
11585
+ setOpen(false);
11586
+ }
11583
11587
  return;
11584
11588
  }
11585
11589
  const dx = event.clientX - downPosition.x;
@@ -17273,7 +17277,8 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
17273
17277
  rightTabItems,
17274
17278
  rightTabValue,
17275
17279
  onChangeRightTab,
17276
- onChangeLeftTab
17280
+ onChangeLeftTab,
17281
+ compactDrawerMenu
17277
17282
  }) {
17278
17283
  const portalContainer = useRef28(null);
17279
17284
  const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = useState34({
@@ -17288,6 +17293,11 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
17288
17293
  [leftTabItems, rightTabItems, leftPanel, rightPanel]
17289
17294
  );
17290
17295
  const hasTabs = allTabItems.length > 0;
17296
+ const allSelectableTabItems = useMemo45(
17297
+ () => allTabItems.filter(isSelectableMenuItem),
17298
+ [allTabItems]
17299
+ );
17300
+ const useCompactInToolbar = !!compactDrawerMenu && allSelectableTabItems.length <= 1;
17291
17301
  const leftSelectableTabItems = useMemo45(
17292
17302
  () => (leftTabItems ?? []).filter(isSelectableMenuItem),
17293
17303
  [leftTabItems]
@@ -17296,6 +17306,35 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
17296
17306
  () => (rightTabItems ?? []).filter(isSelectableMenuItem),
17297
17307
  [rightTabItems]
17298
17308
  );
17309
+ const toggleSidebar = (ref) => {
17310
+ if (ref.current?.isExpanded()) {
17311
+ ref.current?.collapse();
17312
+ } else {
17313
+ ref.current?.expand();
17314
+ }
17315
+ };
17316
+ const ensureExpanded = (ref) => {
17317
+ if (!ref.current?.isExpanded()) {
17318
+ ref.current?.expand();
17319
+ }
17320
+ };
17321
+ const handleSelectTab = (value) => {
17322
+ if (leftSelectableTabItems.some((item) => item.value === value)) {
17323
+ if (value === leftTabValue) {
17324
+ toggleSidebar(leftSidebarRef);
17325
+ } else {
17326
+ ensureExpanded(leftSidebarRef);
17327
+ onChangeLeftTab?.(value);
17328
+ }
17329
+ } else if (rightSelectableTabItems.some((item) => item.value === value)) {
17330
+ if (value === rightTabValue) {
17331
+ toggleSidebar(rightSidebarRef);
17332
+ } else {
17333
+ ensureExpanded(rightSidebarRef);
17334
+ onChangeRightTab?.(value);
17335
+ }
17336
+ }
17337
+ };
17299
17338
  const { activeValue, isSidebarCollapsed } = leftSelectableTabItems.length > 0 && !leftSidebarCollapsed ? { activeValue: leftTabValue, isSidebarCollapsed: leftSidebarCollapsed } : rightSelectableTabItems.length > 0 && !rightSidebarCollapsed ? {
17300
17339
  activeValue: rightTabValue,
17301
17340
  isSidebarCollapsed: rightSidebarCollapsed
@@ -17307,58 +17346,47 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
17307
17346
  id: EDITOR_PANEL_GROUP_ID,
17308
17347
  className: "n-flex n-flex-1 n-relative focus:n-outline-none"
17309
17348
  },
17310
- hasTabs && /* @__PURE__ */ React106.createElement(
17349
+ hasTabs && !useCompactInToolbar && /* @__PURE__ */ React106.createElement(React106.Fragment, null, /* @__PURE__ */ React106.createElement(
17311
17350
  VerticalTabMenu,
17312
17351
  {
17313
17352
  tooltipSide: "right",
17314
17353
  items: allTabItems,
17315
17354
  activeValue,
17316
17355
  isSidebarCollapsed,
17317
- onChange: (value) => {
17318
- if (leftSelectableTabItems.some((item) => item.value === value)) {
17319
- if (value === leftTabValue) {
17320
- if (leftSidebarRef.current?.isExpanded()) {
17321
- leftSidebarRef.current?.collapse();
17322
- } else {
17323
- leftSidebarRef.current?.expand();
17324
- }
17325
- } else {
17326
- if (!leftSidebarRef.current?.isExpanded()) {
17327
- leftSidebarRef.current?.expand();
17328
- }
17329
- onChangeLeftTab?.(value);
17330
- }
17331
- } else if (rightSelectableTabItems.some((item) => item.value === value)) {
17332
- if (value === rightTabValue) {
17333
- if (rightSidebarRef.current?.isExpanded()) {
17334
- rightSidebarRef.current?.collapse();
17335
- } else {
17336
- rightSidebarRef.current?.expand();
17337
- }
17338
- } else {
17339
- if (!rightSidebarRef.current?.isExpanded()) {
17340
- rightSidebarRef.current?.expand();
17341
- }
17342
- onChangeRightTab?.(value);
17343
- }
17344
- }
17356
+ onChange: (value) => handleSelectTab(value)
17357
+ }
17358
+ ), /* @__PURE__ */ React106.createElement(DividerVertical, { className: "n-h-full" })),
17359
+ useCompactInToolbar && /* @__PURE__ */ React106.createElement("div", { className: "n-absolute n-top-0 n-left-0 n-h-[calc(var(--n-toolbar-height)+1px)] n-w-[calc(var(--n-toolbar-height)+1px)] n-bg-sidebar-background n-border-r n-border-b n-border-divider-strong n-z-10 n-flex n-items-center n-justify-center" }, allSelectableTabItems[0] && /* @__PURE__ */ React106.createElement(
17360
+ Button,
17361
+ {
17362
+ variant: "none",
17363
+ className: "n-rounded",
17364
+ style: {
17365
+ width: "var(--n-input-height)",
17366
+ height: "var(--n-input-height)"
17367
+ },
17368
+ icon: allSelectableTabItems[0].icon,
17369
+ tooltip: allSelectableTabItems[0].tooltip ?? allSelectableTabItems[0].title,
17370
+ active: (() => {
17371
+ const value = allSelectableTabItems[0].value;
17372
+ const isLeftItem = leftSelectableTabItems.some((i) => i.value === value);
17373
+ const isRightItem = rightSelectableTabItems.some((i) => i.value === value);
17374
+ return isLeftItem ? !leftSidebarCollapsed : isRightItem ? !rightSidebarCollapsed : false;
17375
+ })(),
17376
+ onClick: () => {
17377
+ const value = allSelectableTabItems[0].value;
17378
+ handleSelectTab(value);
17345
17379
  }
17346
17380
  }
17347
- ),
17348
- hasTabs && /* @__PURE__ */ React106.createElement(DividerVertical, { className: "n-h-full" }),
17381
+ )),
17349
17382
  /* @__PURE__ */ React106.createElement("div", { className: "n-flex-1 n-flex n-relative" }, centerPanel),
17350
17383
  leftPanel && /* @__PURE__ */ React106.createElement(
17351
17384
  Drawer,
17352
17385
  {
17353
17386
  ref: leftSidebarRef,
17354
17387
  className: "n-flex-1",
17355
- style: {
17356
- left: 48,
17357
- maxWidth: "calc(100% - 48px)"
17358
- },
17359
- overlayStyle: {
17360
- left: 48
17361
- },
17388
+ style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
17389
+ overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
17362
17390
  open: !leftSidebarCollapsed,
17363
17391
  positioning: "absolute",
17364
17392
  side: "left",
@@ -17379,13 +17407,8 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
17379
17407
  id: RIGHT_SIDEBAR_ID,
17380
17408
  ref: rightSidebarRef,
17381
17409
  className: "n-flex-1",
17382
- style: {
17383
- left: 48,
17384
- maxWidth: "calc(100% - 48px)"
17385
- },
17386
- overlayStyle: {
17387
- left: 48
17388
- },
17410
+ style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
17411
+ overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
17389
17412
  open: !rightSidebarCollapsed,
17390
17413
  positioning: "absolute",
17391
17414
  side: "left",
@@ -17571,7 +17594,8 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
17571
17594
  leftTabValue,
17572
17595
  rightTabValue,
17573
17596
  onChangeLeftTab,
17574
- onChangeRightTab
17597
+ onChangeRightTab,
17598
+ compactDrawerMenu
17575
17599
  }) {
17576
17600
  const panelGroupRef = useRef29(null);
17577
17601
  const hasLeftPanel = !!leftPanel;
@@ -17662,6 +17686,9 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
17662
17686
  },
17663
17687
  [setData, propertyKey]
17664
17688
  );
17689
+ const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems && // When compact drawer UI is enabled, only show the rail when the
17690
+ // sidebar is collapsed (for large screens/panel layout).
17691
+ (!compactDrawerMenu || leftSidebarCollapsed);
17665
17692
  return /* @__PURE__ */ React107.createElement(
17666
17693
  PanelGroup,
17667
17694
  {
@@ -17673,7 +17700,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
17673
17700
  autoSaveId,
17674
17701
  onLayout: handleLayoutChange
17675
17702
  },
17676
- leftPanel && /* @__PURE__ */ React107.createElement(React107.Fragment, null, leftSidebarOptions.showTabs && leftTabItems && /* @__PURE__ */ React107.createElement(
17703
+ leftPanel && /* @__PURE__ */ React107.createElement(React107.Fragment, null, showLeftTabs && /* @__PURE__ */ React107.createElement(
17677
17704
  VerticalTabMenu,
17678
17705
  {
17679
17706
  tooltipSide: "right",
@@ -17682,7 +17709,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
17682
17709
  isSidebarCollapsed: leftSidebarCollapsed,
17683
17710
  onChange: handleLeftTabChange
17684
17711
  }
17685
- ), leftSidebarOptions.showTabs && leftTabItems && !leftSidebarCollapsed && /* @__PURE__ */ React107.createElement(DividerVertical, { className: "n-h-full" }), /* @__PURE__ */ React107.createElement(
17712
+ ), showLeftTabs && !leftSidebarCollapsed && /* @__PURE__ */ React107.createElement(DividerVertical, { className: "n-h-full" }), /* @__PURE__ */ React107.createElement(
17686
17713
  Panel,
17687
17714
  {
17688
17715
  id: LEFT_SIDEBAR_ID,
@@ -17806,7 +17833,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
17806
17833
  defaultCollapsed: rightDefaultCollapsed = false,
17807
17834
  showTabs: rightShowTabs = true
17808
17835
  } = {},
17809
- theme
17836
+ theme,
17837
+ compactDrawerMenu
17810
17838
  }, forwardedRef) {
17811
17839
  const containerRef = React108.useRef(null);
17812
17840
  const containerSize = useSize(containerRef);
@@ -18026,7 +18054,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
18026
18054
  centerPanelPercentage,
18027
18055
  autoSavePrefix,
18028
18056
  leftSidebarRef,
18029
- rightSidebarRef
18057
+ rightSidebarRef,
18058
+ compactDrawerMenu
18030
18059
  }
18031
18060
  ))
18032
18061
  );