@noya-app/noya-designsystem 0.1.89 → 0.1.91
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +16 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +119 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/BaseToolbar.tsx +3 -1
- package/src/components/Dialog.tsx +4 -1
- package/src/components/OverlayToolbar.tsx +87 -1
- package/src/components/__tests__/BaseToolbar.test.tsx +22 -0
- package/src/components/__tests__/DialogNavigator.test.tsx +13 -0
- package/src/components/__tests__/OverlayToolbar.test.tsx +63 -0
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +1 -1
- package/src/components/workspace/WorkspaceLayout.tsx +19 -2
- package/src/components/workspace/__tests__/DrawerWorkspaceLayout.test.tsx +6 -1
- package/src/components/workspace/__tests__/WorkspaceLayout.test.tsx +41 -0
package/dist/index.js
CHANGED
|
@@ -41,11 +41,11 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
41
41
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
42
42
|
var useState80 = React325.useState;
|
|
43
43
|
var useEffect61 = React325.useEffect;
|
|
44
|
-
var
|
|
44
|
+
var useLayoutEffect13 = React325.useLayoutEffect;
|
|
45
45
|
var useDebugValue2 = React325.useDebugValue;
|
|
46
46
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
47
47
|
var value = getSnapshot(), _useState = useState80({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
48
|
-
|
|
48
|
+
useLayoutEffect13(
|
|
49
49
|
function() {
|
|
50
50
|
inst.value = value;
|
|
51
51
|
inst.getSnapshot = getSnapshot;
|
|
@@ -106,7 +106,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
106
106
|
inst: { value, getSnapshot }
|
|
107
107
|
});
|
|
108
108
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
109
|
-
|
|
109
|
+
useLayoutEffect13(
|
|
110
110
|
function() {
|
|
111
111
|
inst.value = value;
|
|
112
112
|
inst.getSnapshot = getSnapshot;
|
|
@@ -140,7 +140,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
140
140
|
return getSnapshot();
|
|
141
141
|
}
|
|
142
142
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
143
|
-
var React325 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState80 = React325.useState, useEffect61 = React325.useEffect,
|
|
143
|
+
var React325 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState80 = React325.useState, useEffect61 = React325.useEffect, useLayoutEffect13 = React325.useLayoutEffect, useDebugValue2 = React325.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
144
144
|
exports2.useSyncExternalStore = void 0 !== React325.useSyncExternalStore ? React325.useSyncExternalStore : shim;
|
|
145
145
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
146
146
|
}();
|
|
@@ -170,12 +170,12 @@ var require_with_selector_production = __commonJS({
|
|
|
170
170
|
}
|
|
171
171
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
172
172
|
var useSyncExternalStore3 = shim.useSyncExternalStore;
|
|
173
|
-
var
|
|
173
|
+
var useRef95 = React325.useRef;
|
|
174
174
|
var useEffect61 = React325.useEffect;
|
|
175
175
|
var useMemo156 = React325.useMemo;
|
|
176
176
|
var useDebugValue2 = React325.useDebugValue;
|
|
177
177
|
exports2.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
178
|
-
var instRef =
|
|
178
|
+
var instRef = useRef95(null);
|
|
179
179
|
if (null === instRef.current) {
|
|
180
180
|
var inst = { hasValue: false, value: null };
|
|
181
181
|
instRef.current = inst;
|
|
@@ -237,9 +237,9 @@ var require_with_selector_development = __commonJS({
|
|
|
237
237
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
238
238
|
}
|
|
239
239
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
240
|
-
var React325 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore,
|
|
240
|
+
var React325 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef95 = React325.useRef, useEffect61 = React325.useEffect, useMemo156 = React325.useMemo, useDebugValue2 = React325.useDebugValue;
|
|
241
241
|
exports2.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
242
|
-
var instRef =
|
|
242
|
+
var instRef = useRef95(null);
|
|
243
243
|
if (null === instRef.current) {
|
|
244
244
|
var inst = { hasValue: false, value: null };
|
|
245
245
|
instRef.current = inst;
|
|
@@ -19937,7 +19937,10 @@ var StyledBackdrop = (0, import_react27.forwardRef)(({ className, ...props }, re
|
|
|
19937
19937
|
index_parts_exports4.Backdrop,
|
|
19938
19938
|
{
|
|
19939
19939
|
ref,
|
|
19940
|
-
className: cx(
|
|
19940
|
+
className: cx(
|
|
19941
|
+
`n-fixed n-inset-0 n-z-[999] n-bg-[rgba(0,0,0,0.5)]`,
|
|
19942
|
+
className
|
|
19943
|
+
),
|
|
19941
19944
|
...props
|
|
19942
19945
|
}
|
|
19943
19946
|
));
|
|
@@ -30867,6 +30870,7 @@ function BaseToolbar({
|
|
|
30867
30870
|
left,
|
|
30868
30871
|
right,
|
|
30869
30872
|
logo,
|
|
30873
|
+
showLogoDivider = true,
|
|
30870
30874
|
showDivider = true,
|
|
30871
30875
|
className,
|
|
30872
30876
|
innerClassName,
|
|
@@ -30887,7 +30891,7 @@ function BaseToolbar({
|
|
|
30887
30891
|
innerClassName,
|
|
30888
30892
|
enableAbsoluteBreakpoint
|
|
30889
30893
|
},
|
|
30890
|
-
logo && /* @__PURE__ */ import_react80.default.createElement(import_react80.default.Fragment, null, logo, /* @__PURE__ */ import_react80.default.createElement(DividerVertical, null)),
|
|
30894
|
+
logo && /* @__PURE__ */ import_react80.default.createElement(import_react80.default.Fragment, null, logo, showLogoDivider && /* @__PURE__ */ import_react80.default.createElement(DividerVertical, null)),
|
|
30891
30895
|
/* @__PURE__ */ import_react80.default.createElement(Spacer.Horizontal, { size: 10 }),
|
|
30892
30896
|
leftElement && !enableContainerQuery && /* @__PURE__ */ import_react80.default.createElement(import_react80.default.Fragment, null, leftElement, childrenElement && /* @__PURE__ */ import_react80.default.createElement(Spacer.Horizontal, { size: 10 })),
|
|
30893
30897
|
childrenElement,
|
|
@@ -41664,9 +41668,14 @@ function OverlayToolbar({
|
|
|
41664
41668
|
right,
|
|
41665
41669
|
overlayLayout = "bottomCenterTopRight",
|
|
41666
41670
|
className,
|
|
41667
|
-
style: style2
|
|
41671
|
+
style: style2,
|
|
41672
|
+
onRectsChange
|
|
41668
41673
|
}) {
|
|
41669
41674
|
const resolvedLayout = overlayLayout === "topLeftTopRight" ? "topLeftTopRight" : "bottomCenterTopRight";
|
|
41675
|
+
const leftPanelRef = (0, import_react114.useRef)(null);
|
|
41676
|
+
const rightPanelRef = (0, import_react114.useRef)(null);
|
|
41677
|
+
const hasLeft = Boolean(left);
|
|
41678
|
+
const hasRight = Boolean(right);
|
|
41670
41679
|
const panelStyle = (0, import_react114.useMemo)(
|
|
41671
41680
|
() => ({
|
|
41672
41681
|
...toolbarTransparentStyle,
|
|
@@ -41674,11 +41683,68 @@ function OverlayToolbar({
|
|
|
41674
41683
|
}),
|
|
41675
41684
|
[style2]
|
|
41676
41685
|
);
|
|
41686
|
+
const emitRects = (0, import_react114.useCallback)(() => {
|
|
41687
|
+
if (!onRectsChange) return;
|
|
41688
|
+
const panels = [
|
|
41689
|
+
{
|
|
41690
|
+
id: resolvedLayout === "topLeftTopRight" ? "noya-toolbar-top-left" : "noya-toolbar-bottom-center",
|
|
41691
|
+
element: leftPanelRef.current
|
|
41692
|
+
},
|
|
41693
|
+
{
|
|
41694
|
+
id: "noya-toolbar-top-right",
|
|
41695
|
+
element: rightPanelRef.current
|
|
41696
|
+
}
|
|
41697
|
+
];
|
|
41698
|
+
onRectsChange(
|
|
41699
|
+
panels.flatMap(({ id, element }) => {
|
|
41700
|
+
if (!element) return [];
|
|
41701
|
+
const rect = element.getBoundingClientRect();
|
|
41702
|
+
const containerRect = element.closest("[data-workspace-content]")?.getBoundingClientRect();
|
|
41703
|
+
return [
|
|
41704
|
+
{
|
|
41705
|
+
id,
|
|
41706
|
+
rect: {
|
|
41707
|
+
x: rect.x - (containerRect?.x ?? 0),
|
|
41708
|
+
y: rect.y - (containerRect?.y ?? 0),
|
|
41709
|
+
width: rect.width,
|
|
41710
|
+
height: rect.height
|
|
41711
|
+
}
|
|
41712
|
+
}
|
|
41713
|
+
];
|
|
41714
|
+
})
|
|
41715
|
+
);
|
|
41716
|
+
}, [onRectsChange, resolvedLayout]);
|
|
41717
|
+
(0, import_react114.useLayoutEffect)(() => {
|
|
41718
|
+
if (!onRectsChange) return;
|
|
41719
|
+
let animationFrame;
|
|
41720
|
+
const scheduleEmit = () => {
|
|
41721
|
+
if (animationFrame !== void 0) {
|
|
41722
|
+
cancelAnimationFrame(animationFrame);
|
|
41723
|
+
}
|
|
41724
|
+
animationFrame = requestAnimationFrame(emitRects);
|
|
41725
|
+
};
|
|
41726
|
+
emitRects();
|
|
41727
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(scheduleEmit);
|
|
41728
|
+
const panels = [leftPanelRef.current, rightPanelRef.current];
|
|
41729
|
+
panels.forEach((panel) => panel && resizeObserver?.observe(panel));
|
|
41730
|
+
window.addEventListener("resize", scheduleEmit);
|
|
41731
|
+
window.addEventListener("scroll", scheduleEmit, true);
|
|
41732
|
+
return () => {
|
|
41733
|
+
if (animationFrame !== void 0) {
|
|
41734
|
+
cancelAnimationFrame(animationFrame);
|
|
41735
|
+
}
|
|
41736
|
+
resizeObserver?.disconnect();
|
|
41737
|
+
window.removeEventListener("resize", scheduleEmit);
|
|
41738
|
+
window.removeEventListener("scroll", scheduleEmit, true);
|
|
41739
|
+
onRectsChange([]);
|
|
41740
|
+
};
|
|
41741
|
+
}, [emitRects, hasLeft, hasRight, onRectsChange]);
|
|
41677
41742
|
const renderLeftPanel = (overlayId) => {
|
|
41678
41743
|
if (!left) return null;
|
|
41679
41744
|
return /* @__PURE__ */ import_react114.default.createElement(
|
|
41680
41745
|
"div",
|
|
41681
41746
|
{
|
|
41747
|
+
ref: leftPanelRef,
|
|
41682
41748
|
className: panelClassName,
|
|
41683
41749
|
"data-embedded-overlay-id": overlayId,
|
|
41684
41750
|
style: panelStyle
|
|
@@ -41715,6 +41781,7 @@ function OverlayToolbar({
|
|
|
41715
41781
|
/* @__PURE__ */ import_react114.default.createElement(
|
|
41716
41782
|
"div",
|
|
41717
41783
|
{
|
|
41784
|
+
ref: rightPanelRef,
|
|
41718
41785
|
className: panelClassName,
|
|
41719
41786
|
"data-embedded-overlay-id": "noya-toolbar-top-right",
|
|
41720
41787
|
style: panelStyle
|
|
@@ -42170,7 +42237,7 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42170
42237
|
}
|
|
42171
42238
|
)
|
|
42172
42239
|
), /* @__PURE__ */ import_react117.default.createElement(Divider, null)),
|
|
42173
|
-
compactTabItem && /* @__PURE__ */ import_react117.default.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-
|
|
42240
|
+
compactTabItem && /* @__PURE__ */ import_react117.default.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-b n-border-divider-strong n-z-10 n-flex n-items-center n-justify-center" }, /* @__PURE__ */ import_react117.default.createElement(
|
|
42174
42241
|
Button,
|
|
42175
42242
|
{
|
|
42176
42243
|
"aria-label": typeof compactTabItem.title === "string" ? compactTabItem.title : "Toggle sidebar",
|
|
@@ -42954,6 +43021,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42954
43021
|
overlayToolbarLeft,
|
|
42955
43022
|
overlayToolbarRight,
|
|
42956
43023
|
overlayLayout,
|
|
43024
|
+
contentTopInset = 0,
|
|
43025
|
+
onOverlayToolbarRectsChange,
|
|
42957
43026
|
children,
|
|
42958
43027
|
sideType = "auto",
|
|
42959
43028
|
sideTypeBreakpoint = 800,
|
|
@@ -43172,36 +43241,45 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43172
43241
|
"data-theme": theme
|
|
43173
43242
|
},
|
|
43174
43243
|
!isOverlay && toolbar,
|
|
43175
|
-
/* @__PURE__ */ import_react125.default.createElement(
|
|
43176
|
-
|
|
43177
|
-
{
|
|
43178
|
-
leftPanel,
|
|
43179
|
-
rightPanel,
|
|
43180
|
-
centerPanel,
|
|
43181
|
-
leftTabItems,
|
|
43182
|
-
leftTabValue,
|
|
43183
|
-
onChangeLeftTab: setLeftTabValue,
|
|
43184
|
-
rightTabItems,
|
|
43185
|
-
rightTabValue,
|
|
43186
|
-
onChangeRightTab: setRightTabValue,
|
|
43187
|
-
leftSidebarOptions,
|
|
43188
|
-
rightSidebarOptions,
|
|
43189
|
-
autoSavePrefix,
|
|
43190
|
-
leftSidebarRef,
|
|
43191
|
-
rightSidebarRef,
|
|
43192
|
-
compactDrawerMenu,
|
|
43193
|
-
onLeftSidebarStateChange,
|
|
43194
|
-
onRightSidebarStateChange,
|
|
43195
|
-
shouldAutoSave
|
|
43196
|
-
}
|
|
43197
|
-
), isOverlay && /* @__PURE__ */ import_react125.default.createElement(
|
|
43198
|
-
OverlayToolbar,
|
|
43244
|
+
/* @__PURE__ */ import_react125.default.createElement(
|
|
43245
|
+
"div",
|
|
43199
43246
|
{
|
|
43200
|
-
|
|
43201
|
-
|
|
43202
|
-
|
|
43203
|
-
}
|
|
43204
|
-
|
|
43247
|
+
className: "n-flex n-flex-row n-flex-1 n-min-h-0 n-relative",
|
|
43248
|
+
"data-workspace-content": true,
|
|
43249
|
+
style: contentTopInset > 0 ? { paddingTop: contentTopInset } : void 0
|
|
43250
|
+
},
|
|
43251
|
+
readyToRender && /* @__PURE__ */ import_react125.default.createElement(import_react125.default.Fragment, null, /* @__PURE__ */ import_react125.default.createElement(
|
|
43252
|
+
LayoutComponent,
|
|
43253
|
+
{
|
|
43254
|
+
leftPanel,
|
|
43255
|
+
rightPanel,
|
|
43256
|
+
centerPanel,
|
|
43257
|
+
leftTabItems,
|
|
43258
|
+
leftTabValue,
|
|
43259
|
+
onChangeLeftTab: setLeftTabValue,
|
|
43260
|
+
rightTabItems,
|
|
43261
|
+
rightTabValue,
|
|
43262
|
+
onChangeRightTab: setRightTabValue,
|
|
43263
|
+
leftSidebarOptions,
|
|
43264
|
+
rightSidebarOptions,
|
|
43265
|
+
autoSavePrefix,
|
|
43266
|
+
leftSidebarRef,
|
|
43267
|
+
rightSidebarRef,
|
|
43268
|
+
compactDrawerMenu,
|
|
43269
|
+
onLeftSidebarStateChange,
|
|
43270
|
+
onRightSidebarStateChange,
|
|
43271
|
+
shouldAutoSave
|
|
43272
|
+
}
|
|
43273
|
+
), isOverlay && /* @__PURE__ */ import_react125.default.createElement(
|
|
43274
|
+
OverlayToolbar,
|
|
43275
|
+
{
|
|
43276
|
+
left: overlayToolbarLeft,
|
|
43277
|
+
right: overlayToolbarRight,
|
|
43278
|
+
overlayLayout,
|
|
43279
|
+
onRectsChange: onOverlayToolbarRectsChange
|
|
43280
|
+
}
|
|
43281
|
+
))
|
|
43282
|
+
)
|
|
43205
43283
|
);
|
|
43206
43284
|
});
|
|
43207
43285
|
var PanelInner = (0, import_react125.memo)(function PanelInner2({
|