@noya-app/noya-designsystem 0.1.81 → 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.
- package/.turbo/turbo-build.log +37 -38
- package/.turbo/turbo-lint.log +1 -15
- package/CHANGELOG.md +15 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +43 -13
- package/dist/index.d.ts +43 -13
- package/dist/index.js +682 -469
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +608 -389
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
- package/src/components/Drawer.tsx +8 -5
- package/src/components/EmojiPicker.tsx +13 -1
- package/src/components/Popover.tsx +8 -6
- package/src/components/SegmentedControl.tsx +237 -42
- package/src/components/SelectionToolbar.tsx +88 -71
- package/src/components/resizablePanels/Panel.tsx +22 -2
- package/src/components/resizablePanels/PanelGroup.tsx +15 -8
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +131 -152
- package/src/components/workspace/HorizontalTabBar.tsx +43 -0
- package/src/components/workspace/PanelWorkspaceLayout.tsx +112 -54
- package/src/components/workspace/WorkspaceLayout.tsx +19 -5
- package/src/components/workspace/types.ts +17 -5
- package/src/index.css +12 -2
- package/src/utils/mergeProps.ts +38 -0
- package/dist/chunk-D57E6H3M.mjs +0 -36
- package/dist/chunk-D57E6H3M.mjs.map +0 -1
- package/dist/chunk-FJ6ZGZIA.mjs +0 -43
- package/dist/chunk-FJ6ZGZIA.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -39,12 +39,12 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
39
39
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
40
40
|
}
|
|
41
41
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
42
|
-
var
|
|
43
|
-
var
|
|
42
|
+
var useState80 = React321.useState;
|
|
43
|
+
var useEffect61 = React321.useEffect;
|
|
44
44
|
var useLayoutEffect12 = React321.useLayoutEffect;
|
|
45
45
|
var useDebugValue2 = React321.useDebugValue;
|
|
46
46
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
47
|
-
var value = getSnapshot(), _useState =
|
|
47
|
+
var value = getSnapshot(), _useState = useState80({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
48
48
|
useLayoutEffect12(
|
|
49
49
|
function() {
|
|
50
50
|
inst.value = value;
|
|
@@ -53,7 +53,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
53
53
|
},
|
|
54
54
|
[subscribe, value, getSnapshot]
|
|
55
55
|
);
|
|
56
|
-
|
|
56
|
+
useEffect61(
|
|
57
57
|
function() {
|
|
58
58
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
59
59
|
return subscribe(function() {
|
|
@@ -102,7 +102,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
102
102
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
103
103
|
), didWarnUncachedGetSnapshot = true);
|
|
104
104
|
}
|
|
105
|
-
cachedValue =
|
|
105
|
+
cachedValue = useState80({
|
|
106
106
|
inst: { value, getSnapshot }
|
|
107
107
|
});
|
|
108
108
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
@@ -114,7 +114,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
114
114
|
},
|
|
115
115
|
[subscribe, value, getSnapshot]
|
|
116
116
|
);
|
|
117
|
-
|
|
117
|
+
useEffect61(
|
|
118
118
|
function() {
|
|
119
119
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
120
120
|
return subscribe(function() {
|
|
@@ -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 React321 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
143
|
+
var React321 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState80 = React321.useState, useEffect61 = React321.useEffect, useLayoutEffect12 = React321.useLayoutEffect, useDebugValue2 = React321.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 !== React321.useSyncExternalStore ? React321.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,17 +170,17 @@ 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
|
|
174
|
-
var
|
|
175
|
-
var
|
|
173
|
+
var useRef94 = React321.useRef;
|
|
174
|
+
var useEffect61 = React321.useEffect;
|
|
175
|
+
var useMemo156 = React321.useMemo;
|
|
176
176
|
var useDebugValue2 = React321.useDebugValue;
|
|
177
177
|
exports2.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
178
|
-
var instRef =
|
|
178
|
+
var instRef = useRef94(null);
|
|
179
179
|
if (null === instRef.current) {
|
|
180
180
|
var inst = { hasValue: false, value: null };
|
|
181
181
|
instRef.current = inst;
|
|
182
182
|
} else inst = instRef.current;
|
|
183
|
-
instRef =
|
|
183
|
+
instRef = useMemo156(
|
|
184
184
|
function() {
|
|
185
185
|
function memoizedSelector(nextSnapshot) {
|
|
186
186
|
if (!hasMemo) {
|
|
@@ -215,7 +215,7 @@ var require_with_selector_production = __commonJS({
|
|
|
215
215
|
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
216
216
|
);
|
|
217
217
|
var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
|
|
218
|
-
|
|
218
|
+
useEffect61(
|
|
219
219
|
function() {
|
|
220
220
|
inst.hasValue = true;
|
|
221
221
|
inst.value = value;
|
|
@@ -237,14 +237,14 @@ 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 React321 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore,
|
|
240
|
+
var React321 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef94 = React321.useRef, useEffect61 = React321.useEffect, useMemo156 = React321.useMemo, useDebugValue2 = React321.useDebugValue;
|
|
241
241
|
exports2.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
242
|
-
var instRef =
|
|
242
|
+
var instRef = useRef94(null);
|
|
243
243
|
if (null === instRef.current) {
|
|
244
244
|
var inst = { hasValue: false, value: null };
|
|
245
245
|
instRef.current = inst;
|
|
246
246
|
} else inst = instRef.current;
|
|
247
|
-
instRef =
|
|
247
|
+
instRef = useMemo156(
|
|
248
248
|
function() {
|
|
249
249
|
function memoizedSelector(nextSnapshot) {
|
|
250
250
|
if (!hasMemo) {
|
|
@@ -280,7 +280,7 @@ var require_with_selector_development = __commonJS({
|
|
|
280
280
|
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
281
281
|
);
|
|
282
282
|
var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
|
|
283
|
-
|
|
283
|
+
useEffect61(
|
|
284
284
|
function() {
|
|
285
285
|
inst.hasValue = true;
|
|
286
286
|
inst.value = value;
|
|
@@ -4075,6 +4075,15 @@ var ClientStorage = class {
|
|
|
4075
4075
|
};
|
|
4076
4076
|
var clientStorage = new ClientStorage();
|
|
4077
4077
|
|
|
4078
|
+
// ../noya-react-utils/src/utils/composeRefs.ts
|
|
4079
|
+
function composeRefs(...refs) {
|
|
4080
|
+
return (value) => {
|
|
4081
|
+
for (const ref of refs) {
|
|
4082
|
+
assignRef(ref, value);
|
|
4083
|
+
}
|
|
4084
|
+
};
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4078
4087
|
// src/components/ActionMenu.tsx
|
|
4079
4088
|
var import_react41 = __toESM(require("react"));
|
|
4080
4089
|
|
|
@@ -6546,11 +6555,11 @@ function getGridNavigatedIndex(listRef, {
|
|
|
6546
6555
|
if (loopFocus && (prevIndex - cols < minIndex || nextIndex < 0)) {
|
|
6547
6556
|
const col = prevIndex % cols;
|
|
6548
6557
|
const maxCol = maxIndex % cols;
|
|
6549
|
-
const
|
|
6558
|
+
const offset5 = maxIndex - (maxCol - col);
|
|
6550
6559
|
if (maxCol === col) {
|
|
6551
6560
|
nextIndex = maxIndex;
|
|
6552
6561
|
} else {
|
|
6553
|
-
nextIndex = maxCol > col ?
|
|
6562
|
+
nextIndex = maxCol > col ? offset5 : offset5 - cols;
|
|
6554
6563
|
}
|
|
6555
6564
|
}
|
|
6556
6565
|
}
|
|
@@ -9043,7 +9052,7 @@ var limitShift = function(options) {
|
|
|
9043
9052
|
middlewareData
|
|
9044
9053
|
} = state;
|
|
9045
9054
|
const {
|
|
9046
|
-
offset:
|
|
9055
|
+
offset: offset5 = 0,
|
|
9047
9056
|
mainAxis: checkMainAxis = true,
|
|
9048
9057
|
crossAxis: checkCrossAxis = true
|
|
9049
9058
|
} = evaluate(options, state);
|
|
@@ -9055,7 +9064,7 @@ var limitShift = function(options) {
|
|
|
9055
9064
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
9056
9065
|
let mainAxisCoord = coords[mainAxis];
|
|
9057
9066
|
let crossAxisCoord = coords[crossAxis];
|
|
9058
|
-
const rawOffset = evaluate(
|
|
9067
|
+
const rawOffset = evaluate(offset5, state);
|
|
9059
9068
|
const computedOffset = typeof rawOffset === "number" ? {
|
|
9060
9069
|
mainAxis: rawOffset,
|
|
9061
9070
|
crossAxis: 0
|
|
@@ -13631,14 +13640,14 @@ var baseArrow = (options) => ({
|
|
|
13631
13640
|
const min2 = minPadding;
|
|
13632
13641
|
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
13633
13642
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
13634
|
-
const
|
|
13635
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !==
|
|
13643
|
+
const offset5 = clamp(min2, center, max2);
|
|
13644
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset5 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
13636
13645
|
const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
|
|
13637
13646
|
return {
|
|
13638
13647
|
[axis]: coords[axis] + alignmentOffset,
|
|
13639
13648
|
data: {
|
|
13640
|
-
[axis]:
|
|
13641
|
-
centerOffset: center -
|
|
13649
|
+
[axis]: offset5,
|
|
13650
|
+
centerOffset: center - offset5 - alignmentOffset,
|
|
13642
13651
|
...shouldAddOffset && {
|
|
13643
13652
|
alignmentOffset
|
|
13644
13653
|
}
|
|
@@ -17084,8 +17093,8 @@ var TooltipViewport = /* @__PURE__ */ React102.forwardRef(function TooltipViewpo
|
|
|
17084
17093
|
if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
|
|
17085
17094
|
setPreviousContentNode(capturedNodeRef.current);
|
|
17086
17095
|
setShowStartingStyleAttribute(true);
|
|
17087
|
-
const
|
|
17088
|
-
setNewTriggerOffset(
|
|
17096
|
+
const offset5 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
|
|
17097
|
+
setNewTriggerOffset(offset5);
|
|
17089
17098
|
cleanupFrame.request(() => {
|
|
17090
17099
|
cleanupFrame.request(() => {
|
|
17091
17100
|
setShowStartingStyleAttribute(false);
|
|
@@ -17162,11 +17171,11 @@ var TooltipViewport = /* @__PURE__ */ React102.forwardRef(function TooltipViewpo
|
|
|
17162
17171
|
});
|
|
17163
17172
|
});
|
|
17164
17173
|
if (process.env.NODE_ENV !== "production") TooltipViewport.displayName = "TooltipViewport";
|
|
17165
|
-
function getActivationDirection(
|
|
17166
|
-
if (!
|
|
17174
|
+
function getActivationDirection(offset5) {
|
|
17175
|
+
if (!offset5) {
|
|
17167
17176
|
return void 0;
|
|
17168
17177
|
}
|
|
17169
|
-
return `${getValueWithTolerance(
|
|
17178
|
+
return `${getValueWithTolerance(offset5.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset5.vertical, 5, "down", "up")}`;
|
|
17170
17179
|
}
|
|
17171
17180
|
function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
|
|
17172
17181
|
if (value > tolerance) {
|
|
@@ -17252,6 +17261,29 @@ function mergePropsWithEventComposition(triggerProps, childProps) {
|
|
|
17252
17261
|
};
|
|
17253
17262
|
}
|
|
17254
17263
|
}
|
|
17264
|
+
if (triggerProps.ref || childProps.ref) {
|
|
17265
|
+
const triggerRef = triggerProps.ref;
|
|
17266
|
+
const childRef = childProps.ref;
|
|
17267
|
+
if (triggerRef && childRef) {
|
|
17268
|
+
mergedProps.ref = (value) => {
|
|
17269
|
+
assignRef(triggerRef, value);
|
|
17270
|
+
assignRef(childRef, value);
|
|
17271
|
+
};
|
|
17272
|
+
} else if (childRef) {
|
|
17273
|
+
mergedProps.ref = childRef;
|
|
17274
|
+
}
|
|
17275
|
+
}
|
|
17276
|
+
if (typeof triggerProps.style === "object" && triggerProps.style !== null && typeof childProps.style === "object" && childProps.style !== null) {
|
|
17277
|
+
mergedProps.style = { ...triggerProps.style, ...childProps.style };
|
|
17278
|
+
} else if (childProps.style !== void 0) {
|
|
17279
|
+
mergedProps.style = childProps.style;
|
|
17280
|
+
}
|
|
17281
|
+
if (triggerProps.className || childProps.className) {
|
|
17282
|
+
const classes = [triggerProps.className, childProps.className].filter(Boolean).join(" ");
|
|
17283
|
+
if (classes) {
|
|
17284
|
+
mergedProps.className = classes;
|
|
17285
|
+
}
|
|
17286
|
+
}
|
|
17255
17287
|
return mergedProps;
|
|
17256
17288
|
}
|
|
17257
17289
|
function cloneElementWithMergedProps(element, triggerProps) {
|
|
@@ -21294,8 +21326,8 @@ var PopoverViewport = /* @__PURE__ */ React156.forwardRef(function PopoverViewpo
|
|
|
21294
21326
|
if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
|
|
21295
21327
|
setPreviousContentNode(capturedNodeRef.current);
|
|
21296
21328
|
setShowStartingStyleAttribute(true);
|
|
21297
|
-
const
|
|
21298
|
-
setNewTriggerOffset(
|
|
21329
|
+
const offset5 = calculateRelativePosition2(previousActiveTrigger, activeTrigger);
|
|
21330
|
+
setNewTriggerOffset(offset5);
|
|
21299
21331
|
cleanupFrame.request(() => {
|
|
21300
21332
|
cleanupFrame.request(() => {
|
|
21301
21333
|
setShowStartingStyleAttribute(false);
|
|
@@ -21360,11 +21392,11 @@ var PopoverViewport = /* @__PURE__ */ React156.forwardRef(function PopoverViewpo
|
|
|
21360
21392
|
});
|
|
21361
21393
|
});
|
|
21362
21394
|
if (process.env.NODE_ENV !== "production") PopoverViewport.displayName = "PopoverViewport";
|
|
21363
|
-
function getActivationDirection2(
|
|
21364
|
-
if (!
|
|
21395
|
+
function getActivationDirection2(offset5) {
|
|
21396
|
+
if (!offset5) {
|
|
21365
21397
|
return void 0;
|
|
21366
21398
|
}
|
|
21367
|
-
return `${getValueWithTolerance2(
|
|
21399
|
+
return `${getValueWithTolerance2(offset5.horizontal, 5, "right", "left")} ${getValueWithTolerance2(offset5.vertical, 5, "down", "up")}`;
|
|
21368
21400
|
}
|
|
21369
21401
|
function getValueWithTolerance2(value, tolerance, positiveLabel, negativeLabel) {
|
|
21370
21402
|
if (value > tolerance) {
|
|
@@ -21572,9 +21604,12 @@ function Popover({
|
|
|
21572
21604
|
triggerProps,
|
|
21573
21605
|
childProps
|
|
21574
21606
|
);
|
|
21575
|
-
mergedProps.ref = (
|
|
21576
|
-
|
|
21577
|
-
|
|
21607
|
+
mergedProps.ref = composeRefs(
|
|
21608
|
+
mergedProps.ref,
|
|
21609
|
+
(node) => {
|
|
21610
|
+
if (node) setAnchorElement(node);
|
|
21611
|
+
}
|
|
21612
|
+
);
|
|
21578
21613
|
return import_react33.default.cloneElement(
|
|
21579
21614
|
element,
|
|
21580
21615
|
mergedProps
|
|
@@ -26701,18 +26736,18 @@ function buildMeasurements({
|
|
|
26701
26736
|
gap
|
|
26702
26737
|
}) {
|
|
26703
26738
|
const measurements = [];
|
|
26704
|
-
let
|
|
26739
|
+
let offset5 = paddingTop;
|
|
26705
26740
|
for (let index2 = 0; index2 < itemCount; index2 += 1) {
|
|
26706
26741
|
const size4 = Math.max(0, getItemHeight(index2));
|
|
26707
|
-
const start =
|
|
26742
|
+
const start = offset5;
|
|
26708
26743
|
const end = start + size4;
|
|
26709
26744
|
measurements.push({ index: index2, size: size4, start, end });
|
|
26710
|
-
|
|
26745
|
+
offset5 = end + gap;
|
|
26711
26746
|
}
|
|
26712
26747
|
const totalHeight = measurements.length ? measurements[measurements.length - 1].end + paddingBottom : paddingTop + paddingBottom;
|
|
26713
26748
|
return { measurements, totalHeight };
|
|
26714
26749
|
}
|
|
26715
|
-
function findFirstVisibleIndex(measurements,
|
|
26750
|
+
function findFirstVisibleIndex(measurements, offset5) {
|
|
26716
26751
|
if (!measurements.length) return 0;
|
|
26717
26752
|
let low = 0;
|
|
26718
26753
|
let high = measurements.length - 1;
|
|
@@ -26720,7 +26755,7 @@ function findFirstVisibleIndex(measurements, offset4) {
|
|
|
26720
26755
|
while (low <= high) {
|
|
26721
26756
|
const middle = Math.floor((low + high) / 2);
|
|
26722
26757
|
const measurement = measurements[middle];
|
|
26723
|
-
if (measurement.end >
|
|
26758
|
+
if (measurement.end > offset5) {
|
|
26724
26759
|
match = middle;
|
|
26725
26760
|
high = middle - 1;
|
|
26726
26761
|
} else {
|
|
@@ -26937,8 +26972,8 @@ var VirtualizedInner = import_react61.default.forwardRef(function Virtualized({
|
|
|
26937
26972
|
},
|
|
26938
26973
|
visibleRange.end >= visibleRange.start && Array.from(
|
|
26939
26974
|
{ length: visibleRange.end - visibleRange.start + 1 },
|
|
26940
|
-
(_,
|
|
26941
|
-
const index2 = visibleRange.start +
|
|
26975
|
+
(_, offset5) => {
|
|
26976
|
+
const index2 = visibleRange.start + offset5;
|
|
26942
26977
|
const measurement = measurements[index2];
|
|
26943
26978
|
const key = itemKey ? itemKey(index2) : index2;
|
|
26944
26979
|
return /* @__PURE__ */ import_react61.default.createElement(
|
|
@@ -30928,9 +30963,12 @@ var Drawer = React229.memo(
|
|
|
30928
30963
|
triggerProps,
|
|
30929
30964
|
childProps
|
|
30930
30965
|
);
|
|
30931
|
-
mergedProps.ref = (
|
|
30932
|
-
|
|
30933
|
-
|
|
30966
|
+
mergedProps.ref = composeRefs(
|
|
30967
|
+
mergedProps.ref,
|
|
30968
|
+
(node) => {
|
|
30969
|
+
if (node) setAnchorElement(node);
|
|
30970
|
+
}
|
|
30971
|
+
);
|
|
30934
30972
|
return React229.cloneElement(
|
|
30935
30973
|
element,
|
|
30936
30974
|
mergedProps
|
|
@@ -31014,6 +31052,12 @@ function applySkinTone(emoji, skinTone) {
|
|
|
31014
31052
|
|
|
31015
31053
|
// src/components/SegmentedControl.tsx
|
|
31016
31054
|
var import_react81 = __toESM(require("react"));
|
|
31055
|
+
var CONTAINER_PADDING_X = "n-px-0.5";
|
|
31056
|
+
var CONTAINER_PADDING_X_PX = 4;
|
|
31057
|
+
var ITEM_PADDING = "n-px-input-padding-x";
|
|
31058
|
+
var ITEM_PADDING_PX = 16;
|
|
31059
|
+
var EXPANSION_THRESHOLD_PX = 20;
|
|
31060
|
+
var RESIZE_SETTLE_MS = 150;
|
|
31017
31061
|
var SegmentedControlContext = (0, import_react81.createContext)({
|
|
31018
31062
|
colorScheme: "primary"
|
|
31019
31063
|
});
|
|
@@ -31027,7 +31071,14 @@ var SegmentedControlItem = (0, import_react81.forwardRef)(function SegmentedCont
|
|
|
31027
31071
|
variant = "default",
|
|
31028
31072
|
...props
|
|
31029
31073
|
}, forwardedRef) {
|
|
31030
|
-
const {
|
|
31074
|
+
const {
|
|
31075
|
+
colorScheme,
|
|
31076
|
+
onSelect,
|
|
31077
|
+
itemWidth = "auto",
|
|
31078
|
+
isCompact
|
|
31079
|
+
} = (0, import_react81.useContext)(SegmentedControlContext);
|
|
31080
|
+
const showTitle = !(isCompact && icon);
|
|
31081
|
+
const effectiveTooltip = !showTitle && !tooltip ? title : tooltip;
|
|
31031
31082
|
const handlePointerDown = (0, import_react81.useCallback)(
|
|
31032
31083
|
(event2) => {
|
|
31033
31084
|
if (disabled2) return;
|
|
@@ -31058,7 +31109,7 @@ var SegmentedControlItem = (0, import_react81.forwardRef)(function SegmentedCont
|
|
|
31058
31109
|
// checked
|
|
31059
31110
|
variant === "tabs" ? "data-[pressed]:n-text-primary" : variant === "buttons" ? "active:n-text-button-text-active active:n-bg-button-background-active data-[pressed]:n-text-button-text-active data-[pressed]:n-bg-button-background-active" : variant === "default" ? (
|
|
31060
31111
|
// default variant: only text color, background handled by sliding indicator
|
|
31061
|
-
colorScheme === "secondary"
|
|
31112
|
+
colorScheme === "secondary" || colorScheme === "primary" ? "data-[pressed]:n-text-white" : "data-[pressed]:n-text-segmented-control-item-active-text"
|
|
31062
31113
|
) : colorScheme === "secondary" ? "data-[pressed]:n-bg-secondary data-[pressed]:n-text-white" : colorScheme === "primary" ? "data-[pressed]:n-bg-primary data-[pressed]:n-text-white" : "data-[pressed]:n-bg-segmented-control-item-active-background data-[pressed]:n-text-segmented-control-item-active-text",
|
|
31063
31114
|
"focus-visible:n-z-interactable",
|
|
31064
31115
|
// checked default (all colorSchemes) - hide separators near selected
|
|
@@ -31066,10 +31117,12 @@ var SegmentedControlItem = (0, import_react81.forwardRef)(function SegmentedCont
|
|
|
31066
31117
|
// hover
|
|
31067
31118
|
variant === "buttons" && "hover:n-bg-button-background-hover",
|
|
31068
31119
|
// spacing and borders
|
|
31069
|
-
|
|
31120
|
+
ITEM_PADDING,
|
|
31070
31121
|
variant === "default" ? "n-rounded after:n-content-[''] after:n-absolute after:n-right-0 after:n-top-0.5 after:n-bottom-0.5 after:n-w-px after:n-bg-divider last:after:n-hidden" : variant === "buttons" ? "n-rounded-sm n-max-w-fit" : "n-border-y-2 n-border-y-transparent data-[pressed]:n-border-b-primary",
|
|
31071
|
-
// icon only buttons
|
|
31122
|
+
// icon only buttons (explicit or due to compact mode)
|
|
31072
31123
|
variant === "buttons" && title === "" && icon && "n-min-w-input-height",
|
|
31124
|
+
// icon only in compact mode
|
|
31125
|
+
isCompact && icon && "n-min-w-input-height",
|
|
31073
31126
|
className
|
|
31074
31127
|
),
|
|
31075
31128
|
...props
|
|
@@ -31083,33 +31136,24 @@ var SegmentedControlItem = (0, import_react81.forwardRef)(function SegmentedCont
|
|
|
31083
31136
|
)
|
|
31084
31137
|
},
|
|
31085
31138
|
icon && renderIcon(icon),
|
|
31086
|
-
title
|
|
31139
|
+
showTitle && title
|
|
31087
31140
|
)
|
|
31088
31141
|
);
|
|
31089
|
-
return
|
|
31142
|
+
return effectiveTooltip ? /* @__PURE__ */ import_react81.default.createElement(Tooltip, { content: effectiveTooltip }, itemElement) : itemElement;
|
|
31090
31143
|
});
|
|
31091
|
-
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
|
|
31096
|
-
|
|
31097
|
-
|
|
31098
|
-
variant = "default",
|
|
31099
|
-
className,
|
|
31100
|
-
style: style2,
|
|
31101
|
-
itemWidth = "auto"
|
|
31144
|
+
function useIndicatorPosition({
|
|
31145
|
+
containerRef,
|
|
31146
|
+
itemRefs,
|
|
31147
|
+
selectedIndex,
|
|
31148
|
+
variant,
|
|
31149
|
+
itemCount,
|
|
31150
|
+
isCompact
|
|
31102
31151
|
}) {
|
|
31103
|
-
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
31104
31152
|
const hasInitialized = (0, import_react81.useRef)(false);
|
|
31105
|
-
const
|
|
31106
|
-
const
|
|
31153
|
+
const isResizingRef = (0, import_react81.useRef)(false);
|
|
31154
|
+
const resizeTimeoutRef = (0, import_react81.useRef)(void 0);
|
|
31107
31155
|
const [indicatorStyle, setIndicatorStyle] = (0, import_react81.useState)(null);
|
|
31108
|
-
const
|
|
31109
|
-
if (!value) return -1;
|
|
31110
|
-
return items.findIndex((item) => item.value === value);
|
|
31111
|
-
}, [value, items]);
|
|
31112
|
-
(0, import_react81.useLayoutEffect)(() => {
|
|
31156
|
+
const measureIndicator = (0, import_react81.useCallback)(() => {
|
|
31113
31157
|
if (variant !== "default" || selectedIndex < 0) {
|
|
31114
31158
|
setIndicatorStyle(null);
|
|
31115
31159
|
return;
|
|
@@ -31127,7 +31171,134 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31127
31171
|
width: itemRect.width
|
|
31128
31172
|
});
|
|
31129
31173
|
hasInitialized.current = true;
|
|
31130
|
-
}, [selectedIndex, variant,
|
|
31174
|
+
}, [containerRef, itemRefs, selectedIndex, variant, itemCount, isCompact]);
|
|
31175
|
+
(0, import_react81.useLayoutEffect)(measureIndicator, [measureIndicator]);
|
|
31176
|
+
(0, import_react81.useLayoutEffect)(() => {
|
|
31177
|
+
const container = containerRef.current;
|
|
31178
|
+
if (!container || variant !== "default") return;
|
|
31179
|
+
const observer = new ResizeObserver(() => {
|
|
31180
|
+
isResizingRef.current = true;
|
|
31181
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
31182
|
+
resizeTimeoutRef.current = setTimeout(() => {
|
|
31183
|
+
isResizingRef.current = false;
|
|
31184
|
+
}, RESIZE_SETTLE_MS);
|
|
31185
|
+
measureIndicator();
|
|
31186
|
+
});
|
|
31187
|
+
observer.observe(container);
|
|
31188
|
+
return () => {
|
|
31189
|
+
observer.disconnect();
|
|
31190
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
31191
|
+
};
|
|
31192
|
+
}, [containerRef, variant, measureIndicator]);
|
|
31193
|
+
return { indicatorStyle, hasInitialized, isResizingRef };
|
|
31194
|
+
}
|
|
31195
|
+
function useCompactMode({
|
|
31196
|
+
containerRef,
|
|
31197
|
+
itemRefs,
|
|
31198
|
+
variant,
|
|
31199
|
+
items,
|
|
31200
|
+
enabled
|
|
31201
|
+
}) {
|
|
31202
|
+
const containerSize = useSize(containerRef, "width");
|
|
31203
|
+
const expandedWidthRef = (0, import_react81.useRef)(null);
|
|
31204
|
+
const isCompactRef = (0, import_react81.useRef)(false);
|
|
31205
|
+
const [isCompact, setIsCompact] = (0, import_react81.useState)(false);
|
|
31206
|
+
const allItemsHaveIcons = (0, import_react81.useMemo)(
|
|
31207
|
+
() => items.every((item) => item.icon),
|
|
31208
|
+
[items]
|
|
31209
|
+
);
|
|
31210
|
+
const itemsKey = (0, import_react81.useMemo)(
|
|
31211
|
+
() => items.map((item) => `${item.value}-${item.icon}-${item.title}`).join("|"),
|
|
31212
|
+
[items]
|
|
31213
|
+
);
|
|
31214
|
+
(0, import_react81.useLayoutEffect)(() => {
|
|
31215
|
+
expandedWidthRef.current = null;
|
|
31216
|
+
isCompactRef.current = false;
|
|
31217
|
+
setIsCompact(false);
|
|
31218
|
+
}, [itemsKey]);
|
|
31219
|
+
(0, import_react81.useLayoutEffect)(() => {
|
|
31220
|
+
if (!enabled) return;
|
|
31221
|
+
const container = containerRef.current;
|
|
31222
|
+
if (!container || variant !== "default" || !allItemsHaveIcons) {
|
|
31223
|
+
return;
|
|
31224
|
+
}
|
|
31225
|
+
const validItems = itemRefs.current.filter(Boolean);
|
|
31226
|
+
if (validItems.length !== items.length) return;
|
|
31227
|
+
const availableWidth = (containerSize?.width ?? container.clientWidth) - CONTAINER_PADDING_X_PX;
|
|
31228
|
+
if (!isCompactRef.current) {
|
|
31229
|
+
const isOverflowing = validItems.some((item) => {
|
|
31230
|
+
const span = item.querySelector("span");
|
|
31231
|
+
if (!span) return false;
|
|
31232
|
+
const contentWidth = span.scrollWidth;
|
|
31233
|
+
const availableInButton = item.clientWidth - ITEM_PADDING_PX;
|
|
31234
|
+
return contentWidth >= availableInButton - 1;
|
|
31235
|
+
});
|
|
31236
|
+
if (isOverflowing) {
|
|
31237
|
+
const totalItemsWidth = validItems.reduce((sum, item) => {
|
|
31238
|
+
const span = item.querySelector("span");
|
|
31239
|
+
const contentWidth = span ? span.scrollWidth : 0;
|
|
31240
|
+
return sum + contentWidth + ITEM_PADDING_PX;
|
|
31241
|
+
}, 0);
|
|
31242
|
+
expandedWidthRef.current = totalItemsWidth;
|
|
31243
|
+
isCompactRef.current = true;
|
|
31244
|
+
setIsCompact(true);
|
|
31245
|
+
}
|
|
31246
|
+
} else {
|
|
31247
|
+
const expandedWidth = expandedWidthRef.current;
|
|
31248
|
+
if (!expandedWidth) return;
|
|
31249
|
+
if (availableWidth >= expandedWidth + EXPANSION_THRESHOLD_PX) {
|
|
31250
|
+
isCompactRef.current = false;
|
|
31251
|
+
expandedWidthRef.current = null;
|
|
31252
|
+
setIsCompact(false);
|
|
31253
|
+
}
|
|
31254
|
+
}
|
|
31255
|
+
}, [
|
|
31256
|
+
enabled,
|
|
31257
|
+
containerRef,
|
|
31258
|
+
itemRefs,
|
|
31259
|
+
variant,
|
|
31260
|
+
allItemsHaveIcons,
|
|
31261
|
+
containerSize?.width,
|
|
31262
|
+
itemsKey,
|
|
31263
|
+
items.length
|
|
31264
|
+
]);
|
|
31265
|
+
return isCompact;
|
|
31266
|
+
}
|
|
31267
|
+
var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
31268
|
+
id: idProp,
|
|
31269
|
+
value,
|
|
31270
|
+
onValueChange,
|
|
31271
|
+
colorScheme,
|
|
31272
|
+
allowEmpty,
|
|
31273
|
+
items,
|
|
31274
|
+
variant = "default",
|
|
31275
|
+
className,
|
|
31276
|
+
style: style2,
|
|
31277
|
+
itemWidth = "auto",
|
|
31278
|
+
enableCompactMode = false
|
|
31279
|
+
}) {
|
|
31280
|
+
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
31281
|
+
const containerRef = (0, import_react81.useRef)(null);
|
|
31282
|
+
const itemRefs = (0, import_react81.useRef)([]);
|
|
31283
|
+
const selectedIndex = (0, import_react81.useMemo)(() => {
|
|
31284
|
+
if (!value) return -1;
|
|
31285
|
+
return items.findIndex((item) => item.value === value);
|
|
31286
|
+
}, [value, items]);
|
|
31287
|
+
const isCompact = useCompactMode({
|
|
31288
|
+
containerRef,
|
|
31289
|
+
itemRefs,
|
|
31290
|
+
variant,
|
|
31291
|
+
items,
|
|
31292
|
+
enabled: enableCompactMode
|
|
31293
|
+
});
|
|
31294
|
+
const { indicatorStyle, hasInitialized, isResizingRef } = useIndicatorPosition({
|
|
31295
|
+
containerRef,
|
|
31296
|
+
itemRefs,
|
|
31297
|
+
selectedIndex,
|
|
31298
|
+
variant,
|
|
31299
|
+
itemCount: items.length,
|
|
31300
|
+
isCompact
|
|
31301
|
+
});
|
|
31131
31302
|
const handleSelect = (0, import_react81.useCallback)(
|
|
31132
31303
|
(newValue) => {
|
|
31133
31304
|
if (!allowEmpty && !newValue) return;
|
|
@@ -31140,8 +31311,8 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31140
31311
|
[handleSelect]
|
|
31141
31312
|
);
|
|
31142
31313
|
const contextValue = (0, import_react81.useMemo)(
|
|
31143
|
-
() => ({ colorScheme, onSelect: handleSelect, itemWidth }),
|
|
31144
|
-
[colorScheme, handleSelect, itemWidth]
|
|
31314
|
+
() => ({ colorScheme, onSelect: handleSelect, itemWidth, isCompact }),
|
|
31315
|
+
[colorScheme, handleSelect, itemWidth, isCompact]
|
|
31145
31316
|
);
|
|
31146
31317
|
const indicatorBgClass = colorScheme === "secondary" ? "n-bg-secondary" : colorScheme === "primary" ? "n-bg-primary" : "n-bg-segmented-control-item-active-background";
|
|
31147
31318
|
return /* @__PURE__ */ import_react81.default.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react81.default.createElement(
|
|
@@ -31154,7 +31325,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31154
31325
|
className: cx(
|
|
31155
31326
|
"n-appearance-none n-relative n-outline-none",
|
|
31156
31327
|
variant === "default" && (itemWidth === "fit" ? "n-flex n-w-fit" : "n-grid"),
|
|
31157
|
-
variant === "default" &&
|
|
31328
|
+
variant === "default" && `n-min-h-input-height n-bg-input-background n-rounded n-py-0.5 ${CONTAINER_PADDING_X}`,
|
|
31158
31329
|
variant !== "default" && "n-flex",
|
|
31159
31330
|
variant === "tabs" && "n-gap-1.5 n-min-h-[33px]",
|
|
31160
31331
|
variant === "buttons" && "n-gap-1.5 n-min-h-input-height",
|
|
@@ -31173,7 +31344,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
31173
31344
|
className: cx(
|
|
31174
31345
|
"n-absolute n-top-0.5 n-bottom-0.5 n-rounded n-shadow-segment n-pointer-events-none",
|
|
31175
31346
|
indicatorBgClass,
|
|
31176
|
-
hasInitialized.current && "n-transition-[left,width] n-duration-200 n-ease-out"
|
|
31347
|
+
hasInitialized.current && !isResizingRef.current && "n-transition-[left,width] n-duration-200 n-ease-out"
|
|
31177
31348
|
),
|
|
31178
31349
|
style: {
|
|
31179
31350
|
left: indicatorStyle.left,
|
|
@@ -31234,6 +31405,7 @@ var SECTION_HEADER_HEIGHT = 24;
|
|
|
31234
31405
|
var HEADER_HEIGHT = 80;
|
|
31235
31406
|
var FOOTER_HEIGHT = 40;
|
|
31236
31407
|
var HORIZONTAL_PADDING = 8;
|
|
31408
|
+
var SEGMENTED_CONTROL_ITEM_WIDTH = 31;
|
|
31237
31409
|
var categoryIcons = {
|
|
31238
31410
|
search: /* @__PURE__ */ import_react82.default.createElement(import_noya_icons10.MagnifyingGlassIcon, null),
|
|
31239
31411
|
frequent: /* @__PURE__ */ import_react82.default.createElement(import_noya_icons10.ClockIcon, null),
|
|
@@ -31575,6 +31747,14 @@ var EmojiPicker = (0, import_react82.memo)(function EmojiPicker2({
|
|
|
31575
31747
|
],
|
|
31576
31748
|
[frequentlyUsed.length]
|
|
31577
31749
|
);
|
|
31750
|
+
const segmentedControlGap = (0, import_react82.useMemo)(() => {
|
|
31751
|
+
const numItems = categoryItems.length;
|
|
31752
|
+
const availableWidth = size4.width - HORIZONTAL_PADDING * 2;
|
|
31753
|
+
const totalItemsWidth = numItems * SEGMENTED_CONTROL_ITEM_WIDTH;
|
|
31754
|
+
const remainingSpace = availableWidth - totalItemsWidth;
|
|
31755
|
+
const numGaps = numItems - 1;
|
|
31756
|
+
return numGaps > 0 ? Math.max(0, remainingSpace / numGaps) : 0;
|
|
31757
|
+
}, [categoryItems.length, size4.width]);
|
|
31578
31758
|
const displayEmoji = hoveredEmoji ?? selectedEmoji;
|
|
31579
31759
|
const footerText = displayEmoji ? `:${displayEmoji.names[0]}:${displayEmoji.names.length > 1 ? ` :${displayEmoji.names[1]}:` : ""}` : "";
|
|
31580
31760
|
const skinToneMenuItems = (0, import_react82.useMemo)(
|
|
@@ -31599,7 +31779,8 @@ var EmojiPicker = (0, import_react82.memo)(function EmojiPicker2({
|
|
|
31599
31779
|
value: activeCategory ?? "search",
|
|
31600
31780
|
onValueChange: handleCategoryChange,
|
|
31601
31781
|
allowEmpty: true,
|
|
31602
|
-
className: "n-flex-nowrap n-px-2"
|
|
31782
|
+
className: "n-flex-nowrap n-px-2",
|
|
31783
|
+
style: { gap: segmentedControlGap }
|
|
31603
31784
|
}
|
|
31604
31785
|
),
|
|
31605
31786
|
/* @__PURE__ */ import_react82.default.createElement(Divider, null),
|
|
@@ -36431,27 +36612,18 @@ var Section = (0, import_react102.memo)(function InspectorSection({
|
|
|
36431
36612
|
});
|
|
36432
36613
|
|
|
36433
36614
|
// src/components/SelectionToolbar.tsx
|
|
36434
|
-
var
|
|
36435
|
-
var
|
|
36436
|
-
|
|
36437
|
-
|
|
36438
|
-
|
|
36439
|
-
|
|
36440
|
-
|
|
36441
|
-
|
|
36442
|
-
|
|
36443
|
-
top: rect.y,
|
|
36444
|
-
right: rect.x + rect.width,
|
|
36445
|
-
bottom: rect.y + rect.height,
|
|
36446
|
-
left: rect.x,
|
|
36447
|
-
toJSON: () => null
|
|
36448
|
-
})
|
|
36449
|
-
});
|
|
36450
|
-
var SelectionToolbarContainer = (0, import_react103.memo)(
|
|
36615
|
+
var import_react103 = require("@floating-ui/react");
|
|
36616
|
+
var import_react104 = __toESM(require("react"));
|
|
36617
|
+
function getPlacement(side, align) {
|
|
36618
|
+
if (align === "center") {
|
|
36619
|
+
return side;
|
|
36620
|
+
}
|
|
36621
|
+
return `${side}-${align}`;
|
|
36622
|
+
}
|
|
36623
|
+
var SelectionToolbarContainer = (0, import_react104.memo)(
|
|
36451
36624
|
function SelectionToolbarContainer2({
|
|
36452
36625
|
rect,
|
|
36453
36626
|
children,
|
|
36454
|
-
portalContainer,
|
|
36455
36627
|
side = "top",
|
|
36456
36628
|
sideOffset = 10,
|
|
36457
36629
|
align = "center",
|
|
@@ -36461,33 +36633,54 @@ var SelectionToolbarContainer = (0, import_react103.memo)(
|
|
|
36461
36633
|
transitionDuration = 0.2
|
|
36462
36634
|
}) {
|
|
36463
36635
|
const portalScopeId = usePortalScopeId();
|
|
36464
|
-
const
|
|
36465
|
-
const
|
|
36466
|
-
|
|
36636
|
+
const [containerElement, setContainerElement] = (0, import_react104.useState)(null);
|
|
36637
|
+
const containerRef = (0, import_react104.useCallback)((el) => {
|
|
36638
|
+
setContainerElement(el);
|
|
36639
|
+
}, []);
|
|
36640
|
+
const containerRefObject = (0, import_react104.useMemo)(
|
|
36641
|
+
() => ({ current: containerElement }),
|
|
36642
|
+
[containerElement]
|
|
36643
|
+
);
|
|
36644
|
+
const size4 = useSize(containerRefObject, "width");
|
|
36645
|
+
const virtualElement = (0, import_react104.useMemo)(
|
|
36467
36646
|
() => ({
|
|
36468
|
-
|
|
36647
|
+
getBoundingClientRect: () => ({
|
|
36648
|
+
width: rect.width,
|
|
36649
|
+
height: rect.height,
|
|
36650
|
+
x: rect.x,
|
|
36651
|
+
y: rect.y,
|
|
36652
|
+
top: rect.y,
|
|
36653
|
+
right: rect.x + rect.width,
|
|
36654
|
+
bottom: rect.y + rect.height,
|
|
36655
|
+
left: rect.x
|
|
36656
|
+
})
|
|
36469
36657
|
}),
|
|
36470
36658
|
[rect]
|
|
36471
36659
|
);
|
|
36472
|
-
const
|
|
36473
|
-
|
|
36660
|
+
const placement = getPlacement(side, align);
|
|
36661
|
+
const { refs, floatingStyles } = (0, import_react103.useFloating)({
|
|
36662
|
+
placement,
|
|
36663
|
+
middleware: avoidCollisions ? [(0, import_react103.offset)(sideOffset), (0, import_react103.flip)(), (0, import_react103.shift)({ padding: 10 })] : [(0, import_react103.offset)(sideOffset)]
|
|
36664
|
+
});
|
|
36665
|
+
(0, import_react104.useEffect)(() => {
|
|
36666
|
+
refs.setPositionReference(virtualElement);
|
|
36667
|
+
}, [refs, virtualElement]);
|
|
36668
|
+
return /* @__PURE__ */ import_react104.default.createElement(import_react103.FloatingPortal, null, /* @__PURE__ */ import_react104.default.createElement(
|
|
36669
|
+
"div",
|
|
36474
36670
|
{
|
|
36671
|
+
ref: refs.setFloating,
|
|
36475
36672
|
...portalScopeProps(portalScopeId),
|
|
36476
|
-
side,
|
|
36477
|
-
sideOffset,
|
|
36478
|
-
align,
|
|
36479
|
-
avoidCollisions,
|
|
36480
|
-
collisionPadding: 10,
|
|
36481
36673
|
contentEditable: false,
|
|
36482
36674
|
style: {
|
|
36483
|
-
|
|
36675
|
+
...floatingStyles,
|
|
36484
36676
|
opacity: size4 ? 1 : 0,
|
|
36485
36677
|
transition: `opacity ${transitionDuration}s ease-in-out`,
|
|
36486
36678
|
[cssVarNames.colors.inputBackground]: "transparent",
|
|
36487
36679
|
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
36488
|
-
}
|
|
36680
|
+
},
|
|
36681
|
+
className: "n-z-menu"
|
|
36489
36682
|
},
|
|
36490
|
-
/* @__PURE__ */
|
|
36683
|
+
/* @__PURE__ */ import_react104.default.createElement(
|
|
36491
36684
|
"div",
|
|
36492
36685
|
{
|
|
36493
36686
|
ref: containerRef,
|
|
@@ -36503,8 +36696,7 @@ var SelectionToolbarContainer = (0, import_react103.memo)(
|
|
|
36503
36696
|
},
|
|
36504
36697
|
children
|
|
36505
36698
|
)
|
|
36506
|
-
);
|
|
36507
|
-
return /* @__PURE__ */ import_react103.default.createElement(PopperPrimitive.Root, null, /* @__PURE__ */ import_react103.default.createElement(PopperPrimitive.Anchor, { virtualRef }), portalContainer ? (0, import_react_dom8.createPortal)(popperContent, portalContainer) : popperContent);
|
|
36699
|
+
));
|
|
36508
36700
|
}
|
|
36509
36701
|
);
|
|
36510
36702
|
|
|
@@ -38875,7 +39067,7 @@ var SelectGroupLabel = /* @__PURE__ */ React289.forwardRef(function SelectGroupL
|
|
|
38875
39067
|
if (process.env.NODE_ENV !== "production") SelectGroupLabel.displayName = "SelectGroupLabel";
|
|
38876
39068
|
|
|
38877
39069
|
// src/components/SelectMenu.tsx
|
|
38878
|
-
var
|
|
39070
|
+
var import_react105 = __toESM(require("react"));
|
|
38879
39071
|
var readOnlyStyle = {
|
|
38880
39072
|
justifyContent: "flex-start",
|
|
38881
39073
|
textAlign: "left"
|
|
@@ -38898,29 +39090,29 @@ function SelectItemContent({
|
|
|
38898
39090
|
indented,
|
|
38899
39091
|
children
|
|
38900
39092
|
}) {
|
|
38901
|
-
return /* @__PURE__ */
|
|
39093
|
+
return /* @__PURE__ */ import_react105.default.createElement(import_react105.default.Fragment, null, indented && /* @__PURE__ */ import_react105.default.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), checked ? /* @__PURE__ */ import_react105.default.createElement(
|
|
38902
39094
|
"span",
|
|
38903
39095
|
{
|
|
38904
39096
|
className: "n-flex n-items-center n-relative -n-left-2.5",
|
|
38905
39097
|
style: { marginRight: -CHECKBOX_RIGHT_INSET }
|
|
38906
39098
|
},
|
|
38907
|
-
/* @__PURE__ */
|
|
38908
|
-
) : indented ? /* @__PURE__ */
|
|
39099
|
+
/* @__PURE__ */ import_react105.default.createElement(import_noya_icons14.CheckIcon, null)
|
|
39100
|
+
) : indented ? /* @__PURE__ */ import_react105.default.createElement(Spacer.Horizontal, { size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET }) : null, icon && (typeof icon === "string" ? /* @__PURE__ */ import_react105.default.createElement(
|
|
38909
39101
|
Icon,
|
|
38910
39102
|
{
|
|
38911
39103
|
name: icon,
|
|
38912
39104
|
className: "n-mr-2 n-w-4 n-h-4 n-flex-shrink-0"
|
|
38913
39105
|
}
|
|
38914
|
-
) : /* @__PURE__ */
|
|
39106
|
+
) : /* @__PURE__ */ import_react105.default.createElement("span", { className: "n-mr-2 n-w-4 n-h-4 n-flex-shrink-0 n-flex n-items-center n-justify-center" }, icon)), /* @__PURE__ */ import_react105.default.createElement("div", { className: "n-flex n-items-center n-flex-1" }, children));
|
|
38915
39107
|
}
|
|
38916
39108
|
function SelectMenuItems({
|
|
38917
39109
|
items,
|
|
38918
39110
|
hasCheckedItem
|
|
38919
39111
|
}) {
|
|
38920
|
-
return /* @__PURE__ */
|
|
39112
|
+
return /* @__PURE__ */ import_react105.default.createElement(import_react105.default.Fragment, null, items.map((item, index2) => {
|
|
38921
39113
|
switch (item.type) {
|
|
38922
39114
|
case "separator":
|
|
38923
|
-
return /* @__PURE__ */
|
|
39115
|
+
return /* @__PURE__ */ import_react105.default.createElement(
|
|
38924
39116
|
index_parts_exports10.Separator,
|
|
38925
39117
|
{
|
|
38926
39118
|
key: index2,
|
|
@@ -38928,7 +39120,7 @@ function SelectMenuItems({
|
|
|
38928
39120
|
}
|
|
38929
39121
|
);
|
|
38930
39122
|
case "sectionHeader":
|
|
38931
|
-
return /* @__PURE__ */
|
|
39123
|
+
return /* @__PURE__ */ import_react105.default.createElement(
|
|
38932
39124
|
SectionHeaderMenuItem,
|
|
38933
39125
|
{
|
|
38934
39126
|
isFirst: index2 === 0,
|
|
@@ -38941,21 +39133,21 @@ function SelectMenuItems({
|
|
|
38941
39133
|
case "submenu":
|
|
38942
39134
|
return null;
|
|
38943
39135
|
default:
|
|
38944
|
-
return /* @__PURE__ */
|
|
39136
|
+
return /* @__PURE__ */ import_react105.default.createElement("div", { key: item.value, className: "n-px-1" }, /* @__PURE__ */ import_react105.default.createElement(
|
|
38945
39137
|
index_parts_exports10.Item,
|
|
38946
39138
|
{
|
|
38947
39139
|
value: item.value,
|
|
38948
39140
|
disabled: item.disabled,
|
|
38949
39141
|
className: itemStyle3
|
|
38950
39142
|
},
|
|
38951
|
-
/* @__PURE__ */
|
|
39143
|
+
/* @__PURE__ */ import_react105.default.createElement(
|
|
38952
39144
|
SelectItemContent,
|
|
38953
39145
|
{
|
|
38954
39146
|
icon: item.icon,
|
|
38955
39147
|
checked: item.checked,
|
|
38956
39148
|
indented: hasCheckedItem
|
|
38957
39149
|
},
|
|
38958
|
-
/* @__PURE__ */
|
|
39150
|
+
/* @__PURE__ */ import_react105.default.createElement(index_parts_exports10.ItemText, null, item.title ?? item.value)
|
|
38959
39151
|
)
|
|
38960
39152
|
));
|
|
38961
39153
|
}
|
|
@@ -38982,20 +39174,20 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
38982
39174
|
(item) => isSelectableMenuItem(item) && item.value === value
|
|
38983
39175
|
);
|
|
38984
39176
|
const icon = selectedItem?.icon;
|
|
38985
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
39177
|
+
const [internalOpen, setInternalOpen] = (0, import_react105.useState)(open2 ?? false);
|
|
38986
39178
|
const { label, fieldId: id } = useLabel({
|
|
38987
39179
|
label: props.label,
|
|
38988
39180
|
fieldId: props.id
|
|
38989
39181
|
});
|
|
38990
39182
|
const labelType = useLabelType();
|
|
38991
|
-
const handleOpenChange = (0,
|
|
39183
|
+
const handleOpenChange = (0, import_react105.useCallback)(
|
|
38992
39184
|
(newOpen) => {
|
|
38993
39185
|
onOpenChange?.(newOpen);
|
|
38994
39186
|
setInternalOpen(newOpen);
|
|
38995
39187
|
},
|
|
38996
39188
|
[onOpenChange]
|
|
38997
39189
|
);
|
|
38998
|
-
const handleValueChange = (0,
|
|
39190
|
+
const handleValueChange = (0, import_react105.useCallback)(
|
|
38999
39191
|
(newValue) => {
|
|
39000
39192
|
if (newValue !== null) {
|
|
39001
39193
|
onSelect?.(newValue);
|
|
@@ -39006,8 +39198,8 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39006
39198
|
const hasCheckedItem = items.some(
|
|
39007
39199
|
(item) => isSelectableMenuItem(item) && item.checked
|
|
39008
39200
|
);
|
|
39009
|
-
const readOnlyButton = (0,
|
|
39010
|
-
() => /* @__PURE__ */
|
|
39201
|
+
const readOnlyButton = (0, import_react105.useMemo)(
|
|
39202
|
+
() => /* @__PURE__ */ import_react105.default.createElement(
|
|
39011
39203
|
Button,
|
|
39012
39204
|
{
|
|
39013
39205
|
id,
|
|
@@ -39017,11 +39209,11 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39017
39209
|
disabled: disabled2
|
|
39018
39210
|
},
|
|
39019
39211
|
icon && renderIcon(icon),
|
|
39020
|
-
/* @__PURE__ */
|
|
39212
|
+
/* @__PURE__ */ import_react105.default.createElement("span", { className: "n-flex n-flex-1" }, selectedItem?.title ?? value)
|
|
39021
39213
|
),
|
|
39022
39214
|
[icon, id, style2, className, disabled2, value, selectedItem]
|
|
39023
39215
|
);
|
|
39024
|
-
const contentStyle = (0,
|
|
39216
|
+
const contentStyle = (0, import_react105.useMemo)(() => {
|
|
39025
39217
|
return {
|
|
39026
39218
|
width: "var(--anchor-width)",
|
|
39027
39219
|
minWidth: "max-content",
|
|
@@ -39029,7 +39221,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39029
39221
|
...contentStyleProp
|
|
39030
39222
|
};
|
|
39031
39223
|
}, [contentStyleProp]);
|
|
39032
|
-
const content = /* @__PURE__ */
|
|
39224
|
+
const content = /* @__PURE__ */ import_react105.default.createElement(
|
|
39033
39225
|
index_parts_exports10.Root,
|
|
39034
39226
|
{
|
|
39035
39227
|
value,
|
|
@@ -39038,13 +39230,13 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39038
39230
|
onOpenChange: handleOpenChange,
|
|
39039
39231
|
disabled: disabled2
|
|
39040
39232
|
},
|
|
39041
|
-
/* @__PURE__ */
|
|
39233
|
+
/* @__PURE__ */ import_react105.default.createElement(
|
|
39042
39234
|
index_parts_exports10.Trigger,
|
|
39043
39235
|
{
|
|
39044
39236
|
id,
|
|
39045
39237
|
onFocus,
|
|
39046
39238
|
onBlur,
|
|
39047
|
-
render: /* @__PURE__ */
|
|
39239
|
+
render: /* @__PURE__ */ import_react105.default.createElement(
|
|
39048
39240
|
Button,
|
|
39049
39241
|
{
|
|
39050
39242
|
style: style2,
|
|
@@ -39057,10 +39249,10 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39057
39249
|
}
|
|
39058
39250
|
)
|
|
39059
39251
|
},
|
|
39060
|
-
icon && /* @__PURE__ */
|
|
39061
|
-
label && labelType === "inset" && /* @__PURE__ */
|
|
39062
|
-
/* @__PURE__ */
|
|
39063
|
-
/* @__PURE__ */
|
|
39252
|
+
icon && /* @__PURE__ */ import_react105.default.createElement("span", { className: "n-pr-1.5" }, renderIcon(icon)),
|
|
39253
|
+
label && labelType === "inset" && /* @__PURE__ */ import_react105.default.createElement("div", { className: insetEndStyles }, /* @__PURE__ */ import_react105.default.createElement(Label, { className: "n-pr-4 n-text-text-disabled", htmlFor: id }, label)),
|
|
39254
|
+
/* @__PURE__ */ import_react105.default.createElement("span", { className: "n-flex-1 n-flex" }, /* @__PURE__ */ import_react105.default.createElement(index_parts_exports10.Value, null, selectedItem?.title ?? value ?? placeholder)),
|
|
39255
|
+
/* @__PURE__ */ import_react105.default.createElement(index_parts_exports10.Icon, null, /* @__PURE__ */ import_react105.default.createElement(
|
|
39064
39256
|
import_noya_icons14.DropdownChevronIcon,
|
|
39065
39257
|
{
|
|
39066
39258
|
className: cx(
|
|
@@ -39070,7 +39262,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39070
39262
|
}
|
|
39071
39263
|
))
|
|
39072
39264
|
),
|
|
39073
|
-
/* @__PURE__ */
|
|
39265
|
+
/* @__PURE__ */ import_react105.default.createElement(index_parts_exports10.Portal, null, /* @__PURE__ */ import_react105.default.createElement(
|
|
39074
39266
|
index_parts_exports10.Positioner,
|
|
39075
39267
|
{
|
|
39076
39268
|
...portalScopeProps(portalScopeId),
|
|
@@ -39080,12 +39272,12 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39080
39272
|
style: contentStyle,
|
|
39081
39273
|
className: "n-z-menu"
|
|
39082
39274
|
},
|
|
39083
|
-
/* @__PURE__ */
|
|
39275
|
+
/* @__PURE__ */ import_react105.default.createElement(index_parts_exports10.Popup, { className: styles.contentStyle }, /* @__PURE__ */ import_react105.default.createElement(index_parts_exports10.ScrollUpArrow, { className: scrollButtonStyles }, /* @__PURE__ */ import_react105.default.createElement(
|
|
39084
39276
|
import_noya_icons14.ChevronUpIcon,
|
|
39085
39277
|
{
|
|
39086
39278
|
className: cx("n-transition-transform n-duration-100")
|
|
39087
39279
|
}
|
|
39088
|
-
)), /* @__PURE__ */
|
|
39280
|
+
)), /* @__PURE__ */ import_react105.default.createElement(SelectMenuItems, { items, hasCheckedItem }), /* @__PURE__ */ import_react105.default.createElement(index_parts_exports10.ScrollDownArrow, { className: scrollButtonStyles }, /* @__PURE__ */ import_react105.default.createElement(import_noya_icons14.ChevronDownIcon, null)))
|
|
39089
39281
|
))
|
|
39090
39282
|
);
|
|
39091
39283
|
return readOnly ? readOnlyButton : content;
|
|
@@ -40386,8 +40578,8 @@ var SliderThumb = /* @__PURE__ */ React296.forwardRef(function SliderThumb2(comp
|
|
|
40386
40578
|
if (thumbRef.current != null) {
|
|
40387
40579
|
const axis = orientation === "horizontal" ? "x" : "y";
|
|
40388
40580
|
const midpoint = getMidpoint(thumbRef.current);
|
|
40389
|
-
const
|
|
40390
|
-
pressedThumbCenterOffsetRef.current =
|
|
40581
|
+
const offset5 = (orientation === "horizontal" ? event2.clientX : event2.clientY) - midpoint[axis];
|
|
40582
|
+
pressedThumbCenterOffsetRef.current = offset5;
|
|
40391
40583
|
}
|
|
40392
40584
|
if (inputRef.current != null && pressedInputRef.current !== inputRef.current) {
|
|
40393
40585
|
pressedInputRef.current = inputRef.current;
|
|
@@ -40480,12 +40672,12 @@ var SliderIndicator = /* @__PURE__ */ React297.forwardRef(function SliderIndicat
|
|
|
40480
40672
|
if (process.env.NODE_ENV !== "production") SliderIndicator.displayName = "SliderIndicator";
|
|
40481
40673
|
|
|
40482
40674
|
// src/components/Slider.tsx
|
|
40483
|
-
var
|
|
40675
|
+
var import_react106 = __toESM(require("react"));
|
|
40484
40676
|
var THUMB_WIDTH = 8;
|
|
40485
40677
|
var thumbStyle = {
|
|
40486
40678
|
width: THUMB_WIDTH
|
|
40487
40679
|
};
|
|
40488
|
-
var Slider = (0,
|
|
40680
|
+
var Slider = (0, import_react106.memo)(function Slider2({
|
|
40489
40681
|
style: style2,
|
|
40490
40682
|
className,
|
|
40491
40683
|
value,
|
|
@@ -40503,14 +40695,14 @@ var Slider = (0, import_react105.memo)(function Slider2({
|
|
|
40503
40695
|
const { fieldId: id } = useLabel({
|
|
40504
40696
|
fieldId: props.id
|
|
40505
40697
|
});
|
|
40506
|
-
const handleValueChange = (0,
|
|
40698
|
+
const handleValueChange = (0, import_react106.useCallback)(
|
|
40507
40699
|
(newValue) => {
|
|
40508
40700
|
onValueChange(newValue);
|
|
40509
40701
|
},
|
|
40510
40702
|
[onValueChange]
|
|
40511
40703
|
);
|
|
40512
40704
|
const ratio = (clampedValue - min2) / (max2 - min2);
|
|
40513
|
-
return /* @__PURE__ */
|
|
40705
|
+
return /* @__PURE__ */ import_react106.default.createElement(
|
|
40514
40706
|
index_parts_exports11.Root,
|
|
40515
40707
|
{
|
|
40516
40708
|
min: min2,
|
|
@@ -40529,7 +40721,7 @@ var Slider = (0, import_react105.memo)(function Slider2({
|
|
|
40529
40721
|
disabled: readOnly,
|
|
40530
40722
|
thumbAlignment: "edge"
|
|
40531
40723
|
},
|
|
40532
|
-
/* @__PURE__ */
|
|
40724
|
+
/* @__PURE__ */ import_react106.default.createElement(index_parts_exports11.Control, { className: "n-relative n-flex-grow n-h-[21px] n-flex n-items-center" }, /* @__PURE__ */ import_react106.default.createElement(index_parts_exports11.Track, { className: "n-relative n-flex-grow n-h-[3px] n-overflow-hidden" }, /* @__PURE__ */ import_react106.default.createElement(
|
|
40533
40725
|
"div",
|
|
40534
40726
|
{
|
|
40535
40727
|
className: "n-absolute n-h-full n-rounded-l n-bg-slider-active-background",
|
|
@@ -40540,7 +40732,7 @@ var Slider = (0, import_react105.memo)(function Slider2({
|
|
|
40540
40732
|
width: `calc(${ratio * 100}% - ${ratio * THUMB_WIDTH + 2}px)`
|
|
40541
40733
|
}
|
|
40542
40734
|
}
|
|
40543
|
-
), /* @__PURE__ */
|
|
40735
|
+
), /* @__PURE__ */ import_react106.default.createElement(
|
|
40544
40736
|
"div",
|
|
40545
40737
|
{
|
|
40546
40738
|
className: "n-absolute n-h-full n-rounded-r n-bg-input-background",
|
|
@@ -40550,7 +40742,7 @@ var Slider = (0, import_react105.memo)(function Slider2({
|
|
|
40550
40742
|
width: `calc(${(1 - ratio) * 100}% - ${(1 - ratio) * THUMB_WIDTH + 2}px)`
|
|
40551
40743
|
}
|
|
40552
40744
|
}
|
|
40553
|
-
)), /* @__PURE__ */
|
|
40745
|
+
)), /* @__PURE__ */ import_react106.default.createElement(
|
|
40554
40746
|
index_parts_exports11.Thumb,
|
|
40555
40747
|
{
|
|
40556
40748
|
style: thumbStyle,
|
|
@@ -40587,8 +40779,8 @@ function createSharedDrag() {
|
|
|
40587
40779
|
|
|
40588
40780
|
// src/components/Stepper.tsx
|
|
40589
40781
|
var import_noya_utils19 = require("@noya-app/noya-utils");
|
|
40590
|
-
var
|
|
40591
|
-
var Stepper = (0,
|
|
40782
|
+
var import_react107 = __toESM(require("react"));
|
|
40783
|
+
var Stepper = (0, import_react107.memo)(function Stepper2({
|
|
40592
40784
|
style: style2,
|
|
40593
40785
|
className,
|
|
40594
40786
|
value: valueProp,
|
|
@@ -40605,17 +40797,17 @@ var Stepper = (0, import_react106.memo)(function Stepper2({
|
|
|
40605
40797
|
const { fieldId: id } = useLabel({
|
|
40606
40798
|
fieldId: props.id
|
|
40607
40799
|
});
|
|
40608
|
-
const value = (0,
|
|
40800
|
+
const value = (0, import_react107.useMemo)(() => {
|
|
40609
40801
|
return (0, import_noya_utils19.clamp)(valueProp, min2, max2);
|
|
40610
40802
|
}, [valueProp, min2, max2]);
|
|
40611
|
-
const handleValueChange = (0,
|
|
40803
|
+
const handleValueChange = (0, import_react107.useCallback)(
|
|
40612
40804
|
(value2) => {
|
|
40613
40805
|
const newValue = (0, import_noya_utils19.clamp)(value2, min2, max2);
|
|
40614
40806
|
onValueChange(newValue);
|
|
40615
40807
|
},
|
|
40616
40808
|
[onValueChange, min2, max2]
|
|
40617
40809
|
);
|
|
40618
|
-
return /* @__PURE__ */
|
|
40810
|
+
return /* @__PURE__ */ import_react107.default.createElement(
|
|
40619
40811
|
"div",
|
|
40620
40812
|
{
|
|
40621
40813
|
id,
|
|
@@ -40627,7 +40819,7 @@ var Stepper = (0, import_react106.memo)(function Stepper2({
|
|
|
40627
40819
|
onFocus,
|
|
40628
40820
|
onBlur
|
|
40629
40821
|
},
|
|
40630
|
-
/* @__PURE__ */
|
|
40822
|
+
/* @__PURE__ */ import_react107.default.createElement(
|
|
40631
40823
|
InputField2.Root,
|
|
40632
40824
|
{
|
|
40633
40825
|
className: "n-flex-1",
|
|
@@ -40635,7 +40827,7 @@ var Stepper = (0, import_react106.memo)(function Stepper2({
|
|
|
40635
40827
|
startClassName: "-n-ml-[3px]",
|
|
40636
40828
|
endWidth: 17,
|
|
40637
40829
|
endClassName: "-n-mr-[3px]",
|
|
40638
|
-
start: /* @__PURE__ */
|
|
40830
|
+
start: /* @__PURE__ */ import_react107.default.createElement(
|
|
40639
40831
|
IconButton,
|
|
40640
40832
|
{
|
|
40641
40833
|
iconName: "MinusIcon",
|
|
@@ -40649,7 +40841,7 @@ var Stepper = (0, import_react106.memo)(function Stepper2({
|
|
|
40649
40841
|
}
|
|
40650
40842
|
}
|
|
40651
40843
|
),
|
|
40652
|
-
end: /* @__PURE__ */
|
|
40844
|
+
end: /* @__PURE__ */ import_react107.default.createElement(
|
|
40653
40845
|
IconButton,
|
|
40654
40846
|
{
|
|
40655
40847
|
iconName: "PlusIcon",
|
|
@@ -40664,7 +40856,7 @@ var Stepper = (0, import_react106.memo)(function Stepper2({
|
|
|
40664
40856
|
}
|
|
40665
40857
|
)
|
|
40666
40858
|
},
|
|
40667
|
-
/* @__PURE__ */
|
|
40859
|
+
/* @__PURE__ */ import_react107.default.createElement(
|
|
40668
40860
|
InputField2.NumberInput,
|
|
40669
40861
|
{
|
|
40670
40862
|
value,
|
|
@@ -40989,7 +41181,7 @@ function Tabs({
|
|
|
40989
41181
|
}
|
|
40990
41182
|
|
|
40991
41183
|
// src/components/UserPicker.tsx
|
|
40992
|
-
var
|
|
41184
|
+
var import_react108 = __toESM(require("react"));
|
|
40993
41185
|
function UserPicker({
|
|
40994
41186
|
users,
|
|
40995
41187
|
value,
|
|
@@ -40999,27 +41191,27 @@ function UserPicker({
|
|
|
40999
41191
|
placeholder = "Search users...",
|
|
41000
41192
|
...rest
|
|
41001
41193
|
}) {
|
|
41002
|
-
const sortedUsers = (0,
|
|
41194
|
+
const sortedUsers = (0, import_react108.useMemo)(() => {
|
|
41003
41195
|
return [...users].sort(
|
|
41004
41196
|
(a, b) => getUserDisplayName(a).localeCompare(getUserDisplayName(b), void 0, {
|
|
41005
41197
|
sensitivity: "base"
|
|
41006
41198
|
})
|
|
41007
41199
|
);
|
|
41008
41200
|
}, [users]);
|
|
41009
|
-
const usersById = (0,
|
|
41201
|
+
const usersById = (0, import_react108.useMemo)(() => {
|
|
41010
41202
|
return new Map(sortedUsers.map((user) => [user.id, user]));
|
|
41011
41203
|
}, [sortedUsers]);
|
|
41012
|
-
const items = (0,
|
|
41204
|
+
const items = (0, import_react108.useMemo)(() => {
|
|
41013
41205
|
return sortedUsers.map(createUserMenuItem);
|
|
41014
41206
|
}, [sortedUsers]);
|
|
41015
41207
|
const isControlled = value !== void 0;
|
|
41016
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
41208
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react108.useState)(defaultValue2);
|
|
41017
41209
|
const selectedUserId = isControlled ? value : uncontrolledValue;
|
|
41018
|
-
const selectedItem = (0,
|
|
41210
|
+
const selectedItem = (0, import_react108.useMemo)(() => {
|
|
41019
41211
|
if (!selectedUserId) return void 0;
|
|
41020
41212
|
return items.find((item) => item.value === selectedUserId);
|
|
41021
41213
|
}, [items, selectedUserId]);
|
|
41022
|
-
const updateSelectedUserId = (0,
|
|
41214
|
+
const updateSelectedUserId = (0, import_react108.useCallback)(
|
|
41023
41215
|
(userId) => {
|
|
41024
41216
|
if (!isControlled) {
|
|
41025
41217
|
setUncontrolledValue(userId);
|
|
@@ -41028,14 +41220,14 @@ function UserPicker({
|
|
|
41028
41220
|
},
|
|
41029
41221
|
[isControlled, onChangeUserId]
|
|
41030
41222
|
);
|
|
41031
|
-
const handleSelectItem = (0,
|
|
41223
|
+
const handleSelectItem = (0, import_react108.useCallback)(
|
|
41032
41224
|
(item) => {
|
|
41033
41225
|
updateSelectedUserId(item.value);
|
|
41034
41226
|
onSelectUser?.(usersById.get(item.value));
|
|
41035
41227
|
},
|
|
41036
41228
|
[updateSelectedUserId, onSelectUser, usersById]
|
|
41037
41229
|
);
|
|
41038
|
-
return /* @__PURE__ */
|
|
41230
|
+
return /* @__PURE__ */ import_react108.default.createElement(
|
|
41039
41231
|
Combobox,
|
|
41040
41232
|
{
|
|
41041
41233
|
...rest,
|
|
@@ -41059,7 +41251,7 @@ function createUserMenuItem(user) {
|
|
|
41059
41251
|
return {
|
|
41060
41252
|
value: user.id,
|
|
41061
41253
|
title,
|
|
41062
|
-
icon: /* @__PURE__ */
|
|
41254
|
+
icon: /* @__PURE__ */ import_react108.default.createElement("div", { className: "n-relative n-w-[15px] n-h-[15px]" }, /* @__PURE__ */ import_react108.default.createElement(
|
|
41063
41255
|
Avatar,
|
|
41064
41256
|
{
|
|
41065
41257
|
size: 15 + overflow * 2,
|
|
@@ -41078,15 +41270,15 @@ function createUserMenuItem(user) {
|
|
|
41078
41270
|
}
|
|
41079
41271
|
|
|
41080
41272
|
// src/components/UserPointer.tsx
|
|
41081
|
-
var
|
|
41082
|
-
var UserPointerContainer = (0,
|
|
41273
|
+
var import_react109 = __toESM(require("react"));
|
|
41274
|
+
var UserPointerContainer = (0, import_react109.memo)(function UserPointerContainer2({
|
|
41083
41275
|
point,
|
|
41084
41276
|
visible,
|
|
41085
41277
|
children,
|
|
41086
41278
|
className,
|
|
41087
41279
|
style: style2
|
|
41088
41280
|
}) {
|
|
41089
|
-
return /* @__PURE__ */
|
|
41281
|
+
return /* @__PURE__ */ import_react109.default.createElement(
|
|
41090
41282
|
"div",
|
|
41091
41283
|
{
|
|
41092
41284
|
style: {
|
|
@@ -41105,7 +41297,7 @@ var UserPointerContainer = (0, import_react108.memo)(function UserPointerContain
|
|
|
41105
41297
|
children
|
|
41106
41298
|
);
|
|
41107
41299
|
});
|
|
41108
|
-
var UserNameTag = (0,
|
|
41300
|
+
var UserNameTag = (0, import_react109.memo)(function UserNameTag2({
|
|
41109
41301
|
backgroundColor,
|
|
41110
41302
|
className,
|
|
41111
41303
|
style: style2,
|
|
@@ -41114,7 +41306,7 @@ var UserNameTag = (0, import_react108.memo)(function UserNameTag2({
|
|
|
41114
41306
|
size: size4 = "medium",
|
|
41115
41307
|
bordered = true
|
|
41116
41308
|
}) {
|
|
41117
|
-
return /* @__PURE__ */
|
|
41309
|
+
return /* @__PURE__ */ import_react109.default.createElement(
|
|
41118
41310
|
"span",
|
|
41119
41311
|
{
|
|
41120
41312
|
className: cx(
|
|
@@ -41133,14 +41325,14 @@ var UserNameTag = (0, import_react108.memo)(function UserNameTag2({
|
|
|
41133
41325
|
children
|
|
41134
41326
|
);
|
|
41135
41327
|
});
|
|
41136
|
-
var UserPointerIcon = (0,
|
|
41328
|
+
var UserPointerIcon = (0, import_react109.memo)(function PointerIcon({
|
|
41137
41329
|
size: size4,
|
|
41138
41330
|
color = "black",
|
|
41139
41331
|
className,
|
|
41140
41332
|
style: style2
|
|
41141
41333
|
}) {
|
|
41142
41334
|
const points = "0,5 10,0 10,10";
|
|
41143
|
-
return /* @__PURE__ */
|
|
41335
|
+
return /* @__PURE__ */ import_react109.default.createElement(
|
|
41144
41336
|
"svg",
|
|
41145
41337
|
{
|
|
41146
41338
|
width: size4,
|
|
@@ -41155,7 +41347,7 @@ var UserPointerIcon = (0, import_react108.memo)(function PointerIcon({
|
|
|
41155
41347
|
...style2
|
|
41156
41348
|
}
|
|
41157
41349
|
},
|
|
41158
|
-
/* @__PURE__ */
|
|
41350
|
+
/* @__PURE__ */ import_react109.default.createElement(
|
|
41159
41351
|
"polygon",
|
|
41160
41352
|
{
|
|
41161
41353
|
points,
|
|
@@ -41168,7 +41360,7 @@ var UserPointerIcon = (0, import_react108.memo)(function PointerIcon({
|
|
|
41168
41360
|
});
|
|
41169
41361
|
var POINTER_SIZE = 12;
|
|
41170
41362
|
var POINTER_OVERLAP = 6;
|
|
41171
|
-
var UserPointer = (0,
|
|
41363
|
+
var UserPointer = (0, import_react109.memo)(function UserPointer2({
|
|
41172
41364
|
userId,
|
|
41173
41365
|
name,
|
|
41174
41366
|
visible = true,
|
|
@@ -41181,22 +41373,22 @@ var UserPointer = (0, import_react108.memo)(function UserPointer2({
|
|
|
41181
41373
|
labelSize = "medium",
|
|
41182
41374
|
bordered = true
|
|
41183
41375
|
}) {
|
|
41184
|
-
const userBackgroundColor = (0,
|
|
41376
|
+
const userBackgroundColor = (0, import_react109.useMemo)(
|
|
41185
41377
|
() => backgroundColor ?? colorFromString(userId ?? name ?? ""),
|
|
41186
41378
|
[backgroundColor, userId, name]
|
|
41187
41379
|
);
|
|
41188
|
-
const pointerOverlapStyle = (0,
|
|
41380
|
+
const pointerOverlapStyle = (0, import_react109.useMemo)(
|
|
41189
41381
|
() => ({
|
|
41190
41382
|
marginRight: `-${POINTER_OVERLAP}px`,
|
|
41191
41383
|
marginBottom: `-${POINTER_OVERLAP}px`
|
|
41192
41384
|
}),
|
|
41193
41385
|
[]
|
|
41194
41386
|
);
|
|
41195
|
-
const nameTagOverlapStyle = (0,
|
|
41387
|
+
const nameTagOverlapStyle = (0, import_react109.useMemo)(
|
|
41196
41388
|
() => ({ marginLeft: `${POINTER_SIZE - POINTER_OVERLAP + 1}px` }),
|
|
41197
41389
|
[]
|
|
41198
41390
|
);
|
|
41199
|
-
return /* @__PURE__ */
|
|
41391
|
+
return /* @__PURE__ */ import_react109.default.createElement(
|
|
41200
41392
|
UserPointerContainer,
|
|
41201
41393
|
{
|
|
41202
41394
|
point,
|
|
@@ -41204,14 +41396,14 @@ var UserPointer = (0, import_react108.memo)(function UserPointer2({
|
|
|
41204
41396
|
className,
|
|
41205
41397
|
style: style2
|
|
41206
41398
|
},
|
|
41207
|
-
name && /* @__PURE__ */
|
|
41399
|
+
name && /* @__PURE__ */ import_react109.default.createElement("div", { className: "n-relative" }, showPointerIcon && /* @__PURE__ */ import_react109.default.createElement(
|
|
41208
41400
|
UserPointerIcon,
|
|
41209
41401
|
{
|
|
41210
41402
|
size: POINTER_SIZE,
|
|
41211
41403
|
color: userBackgroundColor,
|
|
41212
41404
|
style: pointerOverlapStyle
|
|
41213
41405
|
}
|
|
41214
|
-
), /* @__PURE__ */
|
|
41406
|
+
), /* @__PURE__ */ import_react109.default.createElement(
|
|
41215
41407
|
UserNameTag,
|
|
41216
41408
|
{
|
|
41217
41409
|
backgroundColor: userBackgroundColor,
|
|
@@ -41227,10 +41419,10 @@ var UserPointer = (0, import_react108.memo)(function UserPointer2({
|
|
|
41227
41419
|
|
|
41228
41420
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
41229
41421
|
var import_noya_keymap7 = require("@noya-app/noya-keymap");
|
|
41230
|
-
var
|
|
41422
|
+
var import_react121 = __toESM(require("react"));
|
|
41231
41423
|
|
|
41232
41424
|
// src/components/OverlayToolbar.tsx
|
|
41233
|
-
var
|
|
41425
|
+
var import_react110 = __toESM(require("react"));
|
|
41234
41426
|
var panelClassName = "n-pointer-events-auto n-inline-flex n-items-center n-gap-toolbar-separator n-rounded-3xl n-border n-border-divider n-bg-sidebar-background n-px-3 n-py-2.5 n-shadow-2xl";
|
|
41235
41427
|
function OverlayToolbar({
|
|
41236
41428
|
left,
|
|
@@ -41240,7 +41432,7 @@ function OverlayToolbar({
|
|
|
41240
41432
|
style: style2
|
|
41241
41433
|
}) {
|
|
41242
41434
|
const resolvedLayout = overlayLayout === "topLeftTopRight" ? "topLeftTopRight" : "bottomCenterTopRight";
|
|
41243
|
-
const panelStyle = (0,
|
|
41435
|
+
const panelStyle = (0, import_react110.useMemo)(
|
|
41244
41436
|
() => ({
|
|
41245
41437
|
...toolbarTransparentStyle,
|
|
41246
41438
|
...style2
|
|
@@ -41249,7 +41441,7 @@ function OverlayToolbar({
|
|
|
41249
41441
|
);
|
|
41250
41442
|
const renderLeftPanel = (overlayId) => {
|
|
41251
41443
|
if (!left) return null;
|
|
41252
|
-
return /* @__PURE__ */
|
|
41444
|
+
return /* @__PURE__ */ import_react110.default.createElement(
|
|
41253
41445
|
"div",
|
|
41254
41446
|
{
|
|
41255
41447
|
className: panelClassName,
|
|
@@ -41259,7 +41451,7 @@ function OverlayToolbar({
|
|
|
41259
41451
|
left
|
|
41260
41452
|
);
|
|
41261
41453
|
};
|
|
41262
|
-
return /* @__PURE__ */
|
|
41454
|
+
return /* @__PURE__ */ import_react110.default.createElement(import_react110.default.Fragment, null, resolvedLayout === "bottomCenterTopRight" ? /* @__PURE__ */ import_react110.default.createElement(
|
|
41263
41455
|
"div",
|
|
41264
41456
|
{
|
|
41265
41457
|
className: cx(
|
|
@@ -41268,7 +41460,7 @@ function OverlayToolbar({
|
|
|
41268
41460
|
)
|
|
41269
41461
|
},
|
|
41270
41462
|
renderLeftPanel("noya-toolbar-bottom-center")
|
|
41271
|
-
) : /* @__PURE__ */
|
|
41463
|
+
) : /* @__PURE__ */ import_react110.default.createElement(
|
|
41272
41464
|
"div",
|
|
41273
41465
|
{
|
|
41274
41466
|
className: cx(
|
|
@@ -41277,7 +41469,7 @@ function OverlayToolbar({
|
|
|
41277
41469
|
)
|
|
41278
41470
|
},
|
|
41279
41471
|
renderLeftPanel("noya-toolbar-top-left")
|
|
41280
|
-
), right && /* @__PURE__ */
|
|
41472
|
+
), right && /* @__PURE__ */ import_react110.default.createElement(
|
|
41281
41473
|
"div",
|
|
41282
41474
|
{
|
|
41283
41475
|
className: cx(
|
|
@@ -41285,7 +41477,7 @@ function OverlayToolbar({
|
|
|
41285
41477
|
className
|
|
41286
41478
|
)
|
|
41287
41479
|
},
|
|
41288
|
-
/* @__PURE__ */
|
|
41480
|
+
/* @__PURE__ */ import_react110.default.createElement(
|
|
41289
41481
|
"div",
|
|
41290
41482
|
{
|
|
41291
41483
|
className: panelClassName,
|
|
@@ -41300,24 +41492,15 @@ function OverlayToolbar({
|
|
|
41300
41492
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
41301
41493
|
var import_react113 = __toESM(require("react"));
|
|
41302
41494
|
|
|
41303
|
-
// src/components/workspace/constants.ts
|
|
41304
|
-
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
41305
|
-
var LEFT_SIDEBAR_ID = "editor-1-left-sidebar";
|
|
41306
|
-
var RIGHT_SIDEBAR_ID = "editor-3-right-sidebar";
|
|
41307
|
-
var CONTENT_AREA_ID = "editor-2-content-area";
|
|
41308
|
-
|
|
41309
|
-
// src/components/workspace/VerticalTabMenu.tsx
|
|
41310
|
-
var import_react112 = __toESM(require("react"));
|
|
41311
|
-
|
|
41312
41495
|
// src/components/Toolbar.tsx
|
|
41313
41496
|
var import_noya_keymap6 = require("@noya-app/noya-keymap");
|
|
41314
|
-
var
|
|
41497
|
+
var import_react112 = __toESM(require("react"));
|
|
41315
41498
|
|
|
41316
41499
|
// src/components/ToolbarDrawer.tsx
|
|
41317
|
-
var
|
|
41318
|
-
var ToolbarDrawer = (0,
|
|
41319
|
-
(0,
|
|
41320
|
-
return /* @__PURE__ */
|
|
41500
|
+
var import_react111 = __toESM(require("react"));
|
|
41501
|
+
var ToolbarDrawer = (0, import_react111.memo)(
|
|
41502
|
+
(0, import_react111.forwardRef)(function ToolbarDrawer2({ children, trigger, sideOffset = 8 }, ref) {
|
|
41503
|
+
return /* @__PURE__ */ import_react111.default.createElement("div", { className: "n-relative", ref }, /* @__PURE__ */ import_react111.default.createElement(
|
|
41321
41504
|
"div",
|
|
41322
41505
|
{
|
|
41323
41506
|
className: "n-absolute n-bottom-full n-left-1/2 -n-translate-x-1/2 n-rounded-t-lg n-border n-border-toolbar-drawer-border n-border-b-transparent n-bg-toolbar-drawer-background -n-z-10",
|
|
@@ -41333,21 +41516,21 @@ var ToolbarDrawer = (0, import_react110.memo)(
|
|
|
41333
41516
|
|
|
41334
41517
|
// src/components/Toolbar.tsx
|
|
41335
41518
|
var SIDE_OFFSET = 6;
|
|
41336
|
-
var ToolbarMenuContext = (0,
|
|
41519
|
+
var ToolbarMenuContext = (0, import_react112.createContext)({});
|
|
41337
41520
|
var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
41338
41521
|
item,
|
|
41339
41522
|
onSelectMenuItem,
|
|
41340
41523
|
onPopoverOpenChange
|
|
41341
41524
|
}) {
|
|
41342
|
-
const [open2, setOpen] =
|
|
41343
|
-
const handleOpenChange =
|
|
41525
|
+
const [open2, setOpen] = import_react112.default.useState(false);
|
|
41526
|
+
const handleOpenChange = import_react112.default.useCallback(
|
|
41344
41527
|
(newOpen) => {
|
|
41345
41528
|
setOpen(newOpen);
|
|
41346
41529
|
onPopoverOpenChange?.(newOpen);
|
|
41347
41530
|
},
|
|
41348
41531
|
[onPopoverOpenChange]
|
|
41349
41532
|
);
|
|
41350
|
-
return /* @__PURE__ */
|
|
41533
|
+
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41351
41534
|
DropdownMenu,
|
|
41352
41535
|
{
|
|
41353
41536
|
open: open2,
|
|
@@ -41360,7 +41543,7 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
41360
41543
|
}
|
|
41361
41544
|
}
|
|
41362
41545
|
},
|
|
41363
|
-
/* @__PURE__ */
|
|
41546
|
+
/* @__PURE__ */ import_react112.default.createElement(
|
|
41364
41547
|
Button,
|
|
41365
41548
|
{
|
|
41366
41549
|
disabled: item.disabled,
|
|
@@ -41376,7 +41559,7 @@ var ToolbarShortcut = ({
|
|
|
41376
41559
|
shortcut,
|
|
41377
41560
|
label
|
|
41378
41561
|
}) => {
|
|
41379
|
-
return /* @__PURE__ */
|
|
41562
|
+
return /* @__PURE__ */ import_react112.default.createElement("div", { className: "n-flex n-items-center" }, label, /* @__PURE__ */ import_react112.default.createElement(Spacer.Horizontal, { size: 6 }), /* @__PURE__ */ import_react112.default.createElement(KeyboardShortcut, { shortcut }));
|
|
41380
41563
|
};
|
|
41381
41564
|
var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
41382
41565
|
item,
|
|
@@ -41393,20 +41576,20 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
41393
41576
|
popoverClassName,
|
|
41394
41577
|
triggerProps: buttonProps
|
|
41395
41578
|
} = item;
|
|
41396
|
-
const [open2, setOpen] =
|
|
41397
|
-
const handleOpenChange =
|
|
41579
|
+
const [open2, setOpen] = import_react112.default.useState(false);
|
|
41580
|
+
const handleOpenChange = import_react112.default.useCallback(
|
|
41398
41581
|
(newOpen) => {
|
|
41399
41582
|
setOpen(newOpen);
|
|
41400
41583
|
onPopoverOpenChange?.(newOpen);
|
|
41401
41584
|
},
|
|
41402
41585
|
[onPopoverOpenChange]
|
|
41403
41586
|
);
|
|
41404
|
-
const { useDialogOnSmallScreen, isSmallScreen, openDialog } = (0,
|
|
41587
|
+
const { useDialogOnSmallScreen, isSmallScreen, openDialog } = (0, import_react112.useContext)(ToolbarMenuContext);
|
|
41405
41588
|
const shouldUseDialog = useDialogOnSmallScreen && isSmallScreen && openDialog;
|
|
41406
|
-
const handleOpenDialog =
|
|
41589
|
+
const handleOpenDialog = import_react112.default.useCallback(() => {
|
|
41407
41590
|
if (!openDialog) return;
|
|
41408
41591
|
handleOpenChange(true);
|
|
41409
|
-
const dialogContent = typeof itemContent === "function" ? (props) => /* @__PURE__ */
|
|
41592
|
+
const dialogContent = typeof itemContent === "function" ? (props) => /* @__PURE__ */ import_react112.default.createElement("div", { className: "-n-m-3" }, itemContent(props)) : /* @__PURE__ */ import_react112.default.createElement("div", { className: "-n-m-3" }, itemContent);
|
|
41410
41593
|
const dialog = openDialog({
|
|
41411
41594
|
title,
|
|
41412
41595
|
className: "n-w-[90vw] n-max-w-[360px]",
|
|
@@ -41414,7 +41597,7 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
41414
41597
|
});
|
|
41415
41598
|
dialog.then(() => handleOpenChange(false));
|
|
41416
41599
|
}, [openDialog, itemContent, title, handleOpenChange]);
|
|
41417
|
-
const trigger = /* @__PURE__ */
|
|
41600
|
+
const trigger = /* @__PURE__ */ import_react112.default.createElement(
|
|
41418
41601
|
Button,
|
|
41419
41602
|
{
|
|
41420
41603
|
disabled: disabled2,
|
|
@@ -41427,7 +41610,7 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
41427
41610
|
title
|
|
41428
41611
|
);
|
|
41429
41612
|
if (shouldUseDialog) {
|
|
41430
|
-
return tooltip && !open2 ? /* @__PURE__ */
|
|
41613
|
+
return tooltip && !open2 ? /* @__PURE__ */ import_react112.default.createElement(
|
|
41431
41614
|
Tooltip,
|
|
41432
41615
|
{
|
|
41433
41616
|
sideOffset: SIDE_OFFSET,
|
|
@@ -41438,7 +41621,7 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
41438
41621
|
trigger
|
|
41439
41622
|
) : trigger;
|
|
41440
41623
|
}
|
|
41441
|
-
const content = /* @__PURE__ */
|
|
41624
|
+
const content = /* @__PURE__ */ import_react112.default.createElement("span", null, /* @__PURE__ */ import_react112.default.createElement(
|
|
41442
41625
|
Popover,
|
|
41443
41626
|
{
|
|
41444
41627
|
open: open2,
|
|
@@ -41452,7 +41635,7 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
41452
41635
|
},
|
|
41453
41636
|
typeof itemContent === "function" ? itemContent({ close: () => handleOpenChange(false) }) : itemContent
|
|
41454
41637
|
));
|
|
41455
|
-
return tooltip && !open2 ? /* @__PURE__ */
|
|
41638
|
+
return tooltip && !open2 ? /* @__PURE__ */ import_react112.default.createElement(
|
|
41456
41639
|
Tooltip,
|
|
41457
41640
|
{
|
|
41458
41641
|
sideOffset: SIDE_OFFSET,
|
|
@@ -41472,7 +41655,7 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
|
41472
41655
|
displayFilter
|
|
41473
41656
|
}) {
|
|
41474
41657
|
const isActive = item.checked || activeValue === item.value;
|
|
41475
|
-
const content = /* @__PURE__ */
|
|
41658
|
+
const content = /* @__PURE__ */ import_react112.default.createElement(
|
|
41476
41659
|
Button,
|
|
41477
41660
|
{
|
|
41478
41661
|
as,
|
|
@@ -41489,7 +41672,7 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
|
41489
41672
|
displayFilter === "iconOnly" ? void 0 : item.title
|
|
41490
41673
|
);
|
|
41491
41674
|
const tooltip = item.tooltip ?? (displayFilter === "iconOnly" && item.title ? item.title : void 0);
|
|
41492
|
-
return item.drawer && isActive ? /* @__PURE__ */
|
|
41675
|
+
return item.drawer && isActive ? /* @__PURE__ */ import_react112.default.createElement(ToolbarDrawer, { trigger: content }, item.drawer) : tooltip ? /* @__PURE__ */ import_react112.default.createElement(Tooltip, { sideOffset: SIDE_OFFSET, content: tooltip, side: tooltipSide }, content) : content;
|
|
41493
41676
|
});
|
|
41494
41677
|
var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
41495
41678
|
item,
|
|
@@ -41502,14 +41685,14 @@ var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
|
41502
41685
|
dividerOverflow: dividerOverflowProp,
|
|
41503
41686
|
onPopoverOpenChange
|
|
41504
41687
|
}) {
|
|
41505
|
-
const { dividerOverflow: contextDividerOverflow } = (0,
|
|
41688
|
+
const { dividerOverflow: contextDividerOverflow } = (0, import_react112.useContext)(ToolbarMenuContext);
|
|
41506
41689
|
const dividerOverflow = dividerOverflowProp ?? contextDividerOverflow ?? 4;
|
|
41507
41690
|
if (item.type === "sectionHeader") return null;
|
|
41508
41691
|
if (item.type === "separator") {
|
|
41509
|
-
return /* @__PURE__ */
|
|
41692
|
+
return /* @__PURE__ */ import_react112.default.createElement(DividerVertical, { overflow: dividerOverflow });
|
|
41510
41693
|
}
|
|
41511
41694
|
if (item.type === "popover") {
|
|
41512
|
-
return /* @__PURE__ */
|
|
41695
|
+
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41513
41696
|
ToolbarMenuPopover,
|
|
41514
41697
|
{
|
|
41515
41698
|
item,
|
|
@@ -41519,7 +41702,7 @@ var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
|
41519
41702
|
);
|
|
41520
41703
|
}
|
|
41521
41704
|
if (isSelectableMenuItem(item)) {
|
|
41522
|
-
return /* @__PURE__ */
|
|
41705
|
+
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41523
41706
|
ToolbarMenuButton,
|
|
41524
41707
|
{
|
|
41525
41708
|
item,
|
|
@@ -41531,7 +41714,7 @@ var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
|
41531
41714
|
}
|
|
41532
41715
|
);
|
|
41533
41716
|
}
|
|
41534
|
-
return /* @__PURE__ */
|
|
41717
|
+
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41535
41718
|
ToolbarMenuDropdown,
|
|
41536
41719
|
{
|
|
41537
41720
|
item,
|
|
@@ -41551,8 +41734,8 @@ var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
|
41551
41734
|
dividerOverflow,
|
|
41552
41735
|
onPopoverOpenChange
|
|
41553
41736
|
}) {
|
|
41554
|
-
return /* @__PURE__ */
|
|
41555
|
-
return /* @__PURE__ */
|
|
41737
|
+
return /* @__PURE__ */ import_react112.default.createElement(import_react112.default.Fragment, null, items.map((item, i) => {
|
|
41738
|
+
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41556
41739
|
ToolbarMenuItem,
|
|
41557
41740
|
{
|
|
41558
41741
|
key: i,
|
|
@@ -41571,7 +41754,7 @@ var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
|
41571
41754
|
});
|
|
41572
41755
|
function useBindKeyboardShortcutsForMenuItems(items, onSelectMenuItem) {
|
|
41573
41756
|
return (0, import_noya_keymap6.useKeyboardShortcuts)(
|
|
41574
|
-
|
|
41757
|
+
import_react112.default.useMemo(
|
|
41575
41758
|
() => onSelectMenuItem ? getKeyboardShortcutsForMenuItems(items, onSelectMenuItem) : {},
|
|
41576
41759
|
[items, onSelectMenuItem]
|
|
41577
41760
|
)
|
|
@@ -41586,7 +41769,7 @@ function Toolbar({
|
|
|
41586
41769
|
shouldBindKeyboardShortcuts = true,
|
|
41587
41770
|
dividerOverflow
|
|
41588
41771
|
}) {
|
|
41589
|
-
const allMenuItems =
|
|
41772
|
+
const allMenuItems = import_react112.default.useMemo(
|
|
41590
41773
|
() => [...leftMenuItems, ...rightMenuItems],
|
|
41591
41774
|
[leftMenuItems, rightMenuItems]
|
|
41592
41775
|
);
|
|
@@ -41594,11 +41777,11 @@ function Toolbar({
|
|
|
41594
41777
|
allMenuItems,
|
|
41595
41778
|
shouldBindKeyboardShortcuts ? onSelectMenuItem : void 0
|
|
41596
41779
|
);
|
|
41597
|
-
return /* @__PURE__ */
|
|
41780
|
+
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41598
41781
|
BaseToolbar,
|
|
41599
41782
|
{
|
|
41600
41783
|
logo,
|
|
41601
|
-
left: leftMenuItems.length > 0 && /* @__PURE__ */
|
|
41784
|
+
left: leftMenuItems.length > 0 && /* @__PURE__ */ import_react112.default.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ import_react112.default.createElement(
|
|
41602
41785
|
ToolbarMenu,
|
|
41603
41786
|
{
|
|
41604
41787
|
items: leftMenuItems,
|
|
@@ -41606,7 +41789,7 @@ function Toolbar({
|
|
|
41606
41789
|
dividerOverflow
|
|
41607
41790
|
}
|
|
41608
41791
|
)),
|
|
41609
|
-
right: rightMenuItems.length > 0 && /* @__PURE__ */
|
|
41792
|
+
right: rightMenuItems.length > 0 && /* @__PURE__ */ import_react112.default.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ import_react112.default.createElement(
|
|
41610
41793
|
ToolbarMenu,
|
|
41611
41794
|
{
|
|
41612
41795
|
items: rightMenuItems,
|
|
@@ -41619,38 +41802,11 @@ function Toolbar({
|
|
|
41619
41802
|
);
|
|
41620
41803
|
}
|
|
41621
41804
|
|
|
41622
|
-
// src/components/workspace/
|
|
41623
|
-
var
|
|
41624
|
-
|
|
41625
|
-
|
|
41626
|
-
|
|
41627
|
-
onChange,
|
|
41628
|
-
tooltipSide
|
|
41629
|
-
}) {
|
|
41630
|
-
const style2 = (0, import_react112.useMemo)(() => {
|
|
41631
|
-
return {
|
|
41632
|
-
[cssVarNames.colors.inputBackground]: "transparent",
|
|
41633
|
-
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
41634
|
-
};
|
|
41635
|
-
}, []);
|
|
41636
|
-
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41637
|
-
"div",
|
|
41638
|
-
{
|
|
41639
|
-
className: "n-w-[calc(var(--n-toolbar-height)+1px)] n-h-full n-bg-sidebar-background n-flex n-flex-col n-items-center n-py-3 n-gap-3",
|
|
41640
|
-
style: style2
|
|
41641
|
-
},
|
|
41642
|
-
/* @__PURE__ */ import_react112.default.createElement(
|
|
41643
|
-
ToolbarMenu,
|
|
41644
|
-
{
|
|
41645
|
-
items,
|
|
41646
|
-
activeValue: isSidebarCollapsed ? void 0 : activeValue,
|
|
41647
|
-
onSelectMenuItem: onChange,
|
|
41648
|
-
tooltipSide,
|
|
41649
|
-
displayFilter: "iconOnly"
|
|
41650
|
-
}
|
|
41651
|
-
)
|
|
41652
|
-
);
|
|
41653
|
-
});
|
|
41805
|
+
// src/components/workspace/constants.ts
|
|
41806
|
+
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
41807
|
+
var LEFT_SIDEBAR_ID = "editor-1-left-sidebar";
|
|
41808
|
+
var RIGHT_SIDEBAR_ID = "editor-3-right-sidebar";
|
|
41809
|
+
var CONTENT_AREA_ID = "editor-2-content-area";
|
|
41654
41810
|
|
|
41655
41811
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
41656
41812
|
var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
@@ -41664,14 +41820,38 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
41664
41820
|
rightTabItems,
|
|
41665
41821
|
rightTabValue,
|
|
41666
41822
|
onChangeRightTab,
|
|
41667
|
-
onChangeLeftTab
|
|
41668
|
-
compactDrawerMenu
|
|
41823
|
+
onChangeLeftTab
|
|
41669
41824
|
}) {
|
|
41670
|
-
const portalContainer = (0, import_react113.useRef)(null);
|
|
41671
41825
|
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = (0, import_react113.useState)({
|
|
41672
41826
|
leftSidebarCollapsed: true,
|
|
41673
41827
|
rightSidebarCollapsed: true
|
|
41674
41828
|
});
|
|
41829
|
+
import_react113.default.useImperativeHandle(
|
|
41830
|
+
leftSidebarRef,
|
|
41831
|
+
() => ({
|
|
41832
|
+
expand: () => setLayoutState((prev) => ({
|
|
41833
|
+
...prev,
|
|
41834
|
+
leftSidebarCollapsed: false,
|
|
41835
|
+
rightSidebarCollapsed: true
|
|
41836
|
+
})),
|
|
41837
|
+
collapse: () => setLayoutState((prev) => ({ ...prev, leftSidebarCollapsed: true })),
|
|
41838
|
+
isExpanded: () => !leftSidebarCollapsed
|
|
41839
|
+
}),
|
|
41840
|
+
[leftSidebarCollapsed]
|
|
41841
|
+
);
|
|
41842
|
+
import_react113.default.useImperativeHandle(
|
|
41843
|
+
rightSidebarRef,
|
|
41844
|
+
() => ({
|
|
41845
|
+
expand: () => setLayoutState((prev) => ({
|
|
41846
|
+
...prev,
|
|
41847
|
+
rightSidebarCollapsed: false,
|
|
41848
|
+
leftSidebarCollapsed: true
|
|
41849
|
+
})),
|
|
41850
|
+
collapse: () => setLayoutState((prev) => ({ ...prev, rightSidebarCollapsed: true })),
|
|
41851
|
+
isExpanded: () => !rightSidebarCollapsed
|
|
41852
|
+
}),
|
|
41853
|
+
[rightSidebarCollapsed]
|
|
41854
|
+
);
|
|
41675
41855
|
const allTabItems = (0, import_react113.useMemo)(
|
|
41676
41856
|
() => [
|
|
41677
41857
|
...leftPanel ? leftTabItems ?? [] : [],
|
|
@@ -41679,12 +41859,11 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
41679
41859
|
],
|
|
41680
41860
|
[leftTabItems, rightTabItems, leftPanel, rightPanel]
|
|
41681
41861
|
);
|
|
41682
|
-
const hasTabs = allTabItems.length > 0;
|
|
41683
41862
|
const allSelectableTabItems = (0, import_react113.useMemo)(
|
|
41684
41863
|
() => allTabItems.filter(isSelectableMenuItem),
|
|
41685
41864
|
[allTabItems]
|
|
41686
41865
|
);
|
|
41687
|
-
const
|
|
41866
|
+
const hasTabs = allSelectableTabItems.length > 0;
|
|
41688
41867
|
const leftSelectableTabItems = (0, import_react113.useMemo)(
|
|
41689
41868
|
() => (leftTabItems ?? []).filter(isSelectableMenuItem),
|
|
41690
41869
|
[leftTabItems]
|
|
@@ -41693,134 +41872,83 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
41693
41872
|
() => (rightTabItems ?? []).filter(isSelectableMenuItem),
|
|
41694
41873
|
[rightTabItems]
|
|
41695
41874
|
);
|
|
41696
|
-
const toggleSidebar = (ref) => {
|
|
41697
|
-
if (ref.current?.isExpanded()) {
|
|
41698
|
-
ref.current?.collapse();
|
|
41699
|
-
} else {
|
|
41700
|
-
ref.current?.expand();
|
|
41701
|
-
}
|
|
41702
|
-
};
|
|
41703
|
-
const ensureExpanded = (ref) => {
|
|
41704
|
-
if (!ref.current?.isExpanded()) {
|
|
41705
|
-
ref.current?.expand();
|
|
41706
|
-
}
|
|
41707
|
-
};
|
|
41708
41875
|
const handleSelectTab = (value) => {
|
|
41709
|
-
|
|
41710
|
-
|
|
41711
|
-
|
|
41876
|
+
const isLeftItem = leftSelectableTabItems.some(
|
|
41877
|
+
(item) => item.value === value
|
|
41878
|
+
);
|
|
41879
|
+
const isRightItem = rightSelectableTabItems.some(
|
|
41880
|
+
(item) => item.value === value
|
|
41881
|
+
);
|
|
41882
|
+
if (isLeftItem) {
|
|
41883
|
+
if (value === leftTabValue && !leftSidebarCollapsed) {
|
|
41884
|
+
setLayoutState((prev) => ({ ...prev, leftSidebarCollapsed: true }));
|
|
41712
41885
|
} else {
|
|
41713
|
-
|
|
41886
|
+
setLayoutState({
|
|
41887
|
+
leftSidebarCollapsed: false,
|
|
41888
|
+
rightSidebarCollapsed: true
|
|
41889
|
+
});
|
|
41714
41890
|
onChangeLeftTab?.(value);
|
|
41715
41891
|
}
|
|
41716
|
-
} else if (
|
|
41717
|
-
if (value === rightTabValue) {
|
|
41718
|
-
|
|
41892
|
+
} else if (isRightItem) {
|
|
41893
|
+
if (value === rightTabValue && !rightSidebarCollapsed) {
|
|
41894
|
+
setLayoutState((prev) => ({ ...prev, rightSidebarCollapsed: true }));
|
|
41719
41895
|
} else {
|
|
41720
|
-
|
|
41896
|
+
setLayoutState({
|
|
41897
|
+
leftSidebarCollapsed: true,
|
|
41898
|
+
rightSidebarCollapsed: false
|
|
41899
|
+
});
|
|
41721
41900
|
onChangeRightTab?.(value);
|
|
41722
41901
|
}
|
|
41723
41902
|
}
|
|
41724
41903
|
};
|
|
41725
|
-
const
|
|
41726
|
-
|
|
41727
|
-
|
|
41728
|
-
|
|
41904
|
+
const activeDrawerPanel = !leftSidebarCollapsed ? leftPanel : !rightSidebarCollapsed ? rightPanel : null;
|
|
41905
|
+
const isDrawerOpen = activeDrawerPanel !== null;
|
|
41906
|
+
const activeTabValue = !leftSidebarCollapsed ? leftTabValue : !rightSidebarCollapsed ? rightTabValue : void 0;
|
|
41907
|
+
const toolbarMenuItems = (0, import_react113.useMemo)(
|
|
41908
|
+
() => allSelectableTabItems.map((item) => ({
|
|
41909
|
+
...item,
|
|
41910
|
+
checked: activeTabValue === item.value
|
|
41911
|
+
})),
|
|
41912
|
+
[allSelectableTabItems, activeTabValue]
|
|
41913
|
+
);
|
|
41729
41914
|
return /* @__PURE__ */ import_react113.default.createElement(
|
|
41730
41915
|
"div",
|
|
41731
41916
|
{
|
|
41732
|
-
ref: portalContainer,
|
|
41733
41917
|
id: EDITOR_PANEL_GROUP_ID,
|
|
41734
|
-
className: "n-flex n-flex-1 n-relative focus:n-outline-none"
|
|
41918
|
+
className: "n-flex n-flex-col n-flex-1 n-relative focus:n-outline-none"
|
|
41735
41919
|
},
|
|
41736
|
-
hasTabs &&
|
|
41737
|
-
|
|
41738
|
-
{
|
|
41739
|
-
tooltipSide: "right",
|
|
41740
|
-
items: allTabItems,
|
|
41741
|
-
activeValue,
|
|
41742
|
-
isSidebarCollapsed,
|
|
41743
|
-
onChange: (value) => handleSelectTab(value)
|
|
41744
|
-
}
|
|
41745
|
-
), /* @__PURE__ */ import_react113.default.createElement(DividerVertical, { className: "n-h-full" })),
|
|
41746
|
-
useCompactInToolbar && /* @__PURE__ */ import_react113.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-r n-border-b n-border-divider-strong n-z-10 n-flex n-items-center n-justify-center" }, allSelectableTabItems[0] && /* @__PURE__ */ import_react113.default.createElement(
|
|
41747
|
-
Button,
|
|
41920
|
+
hasTabs && /* @__PURE__ */ import_react113.default.createElement(import_react113.default.Fragment, null, /* @__PURE__ */ import_react113.default.createElement(
|
|
41921
|
+
"div",
|
|
41748
41922
|
{
|
|
41749
|
-
|
|
41750
|
-
className: "n-rounded",
|
|
41923
|
+
className: "n-flex n-flex-row n-items-center n-gap-1 n-px-2 n-py-1.5 n-bg-sidebar-background n-flex-none",
|
|
41751
41924
|
style: {
|
|
41752
|
-
|
|
41753
|
-
|
|
41754
|
-
},
|
|
41755
|
-
icon: allSelectableTabItems[0].icon,
|
|
41756
|
-
tooltip: allSelectableTabItems[0].tooltip ?? allSelectableTabItems[0].title,
|
|
41757
|
-
active: (() => {
|
|
41758
|
-
const value = allSelectableTabItems[0].value;
|
|
41759
|
-
const isLeftItem = leftSelectableTabItems.some(
|
|
41760
|
-
(i) => i.value === value
|
|
41761
|
-
);
|
|
41762
|
-
const isRightItem = rightSelectableTabItems.some(
|
|
41763
|
-
(i) => i.value === value
|
|
41764
|
-
);
|
|
41765
|
-
return isLeftItem ? !leftSidebarCollapsed : isRightItem ? !rightSidebarCollapsed : false;
|
|
41766
|
-
})(),
|
|
41767
|
-
onClick: () => {
|
|
41768
|
-
const value = allSelectableTabItems[0].value;
|
|
41769
|
-
handleSelectTab(value);
|
|
41770
|
-
}
|
|
41771
|
-
}
|
|
41772
|
-
)),
|
|
41773
|
-
/* @__PURE__ */ import_react113.default.createElement("div", { className: "n-flex-1 n-flex n-relative" }, centerPanel),
|
|
41774
|
-
leftPanel && /* @__PURE__ */ import_react113.default.createElement(
|
|
41775
|
-
Drawer,
|
|
41776
|
-
{
|
|
41777
|
-
modal: false,
|
|
41778
|
-
ref: leftSidebarRef,
|
|
41779
|
-
className: "n-flex-1",
|
|
41780
|
-
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
41781
|
-
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
41782
|
-
open: !leftSidebarCollapsed,
|
|
41783
|
-
positioning: "absolute",
|
|
41784
|
-
side: "left",
|
|
41785
|
-
trigger: null,
|
|
41786
|
-
portalContainer: portalContainer.current,
|
|
41787
|
-
onOpenChange: (open2) => {
|
|
41788
|
-
setLayoutState({
|
|
41789
|
-
leftSidebarCollapsed: !open2,
|
|
41790
|
-
rightSidebarCollapsed
|
|
41791
|
-
});
|
|
41925
|
+
[cssVarNames.colors.inputBackground]: "transparent",
|
|
41926
|
+
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
41792
41927
|
}
|
|
41793
41928
|
},
|
|
41794
|
-
|
|
41795
|
-
|
|
41796
|
-
|
|
41797
|
-
|
|
41798
|
-
|
|
41799
|
-
id: RIGHT_SIDEBAR_ID,
|
|
41800
|
-
modal: false,
|
|
41801
|
-
ref: rightSidebarRef,
|
|
41802
|
-
className: "n-flex-1",
|
|
41803
|
-
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
41804
|
-
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
41805
|
-
open: !rightSidebarCollapsed,
|
|
41806
|
-
positioning: "absolute",
|
|
41807
|
-
side: "left",
|
|
41808
|
-
trigger: null,
|
|
41809
|
-
portalContainer: portalContainer.current,
|
|
41810
|
-
onOpenChange: (open2) => {
|
|
41811
|
-
setLayoutState({
|
|
41812
|
-
leftSidebarCollapsed,
|
|
41813
|
-
rightSidebarCollapsed: !open2
|
|
41814
|
-
});
|
|
41929
|
+
/* @__PURE__ */ import_react113.default.createElement(
|
|
41930
|
+
ToolbarMenu,
|
|
41931
|
+
{
|
|
41932
|
+
items: toolbarMenuItems,
|
|
41933
|
+
onSelectMenuItem: handleSelectTab
|
|
41815
41934
|
}
|
|
41816
|
-
|
|
41817
|
-
|
|
41818
|
-
)
|
|
41935
|
+
)
|
|
41936
|
+
), /* @__PURE__ */ import_react113.default.createElement(Divider, null)),
|
|
41937
|
+
/* @__PURE__ */ import_react113.default.createElement("div", { className: "n-flex-1 n-flex n-flex-col n-relative n-min-h-0" }, isDrawerOpen && /* @__PURE__ */ import_react113.default.createElement("div", { className: "n-absolute n-inset-0 n-z-20 n-flex n-flex-col" }, /* @__PURE__ */ import_react113.default.createElement("div", { className: "n-flex-none n-max-h-[50vh] n-overflow-auto n-bg-sidebar-background n-border-b n-border-divider-strong n-shadow-lg" }, activeDrawerPanel), /* @__PURE__ */ import_react113.default.createElement(
|
|
41938
|
+
"div",
|
|
41939
|
+
{
|
|
41940
|
+
className: "n-flex-1 n-bg-black/30",
|
|
41941
|
+
onClick: () => setLayoutState({
|
|
41942
|
+
leftSidebarCollapsed: true,
|
|
41943
|
+
rightSidebarCollapsed: true
|
|
41944
|
+
})
|
|
41945
|
+
}
|
|
41946
|
+
)), /* @__PURE__ */ import_react113.default.createElement("div", { className: "n-flex-1 n-flex n-relative n-min-h-0" }, centerPanel))
|
|
41819
41947
|
);
|
|
41820
41948
|
});
|
|
41821
41949
|
|
|
41822
41950
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
41823
|
-
var
|
|
41951
|
+
var import_react119 = __toESM(require("react"));
|
|
41824
41952
|
|
|
41825
41953
|
// src/components/resizablePanels/Panel.tsx
|
|
41826
41954
|
var import_react115 = __toESM(require("react"));
|
|
@@ -41840,7 +41968,17 @@ function usePanelGroupContext() {
|
|
|
41840
41968
|
|
|
41841
41969
|
// src/components/resizablePanels/Panel.tsx
|
|
41842
41970
|
var Panel = (0, import_react115.forwardRef)(
|
|
41843
|
-
function Panel2({
|
|
41971
|
+
function Panel2({
|
|
41972
|
+
id: propId,
|
|
41973
|
+
order,
|
|
41974
|
+
className,
|
|
41975
|
+
defaultSize,
|
|
41976
|
+
minSize,
|
|
41977
|
+
maxSize,
|
|
41978
|
+
collapsible,
|
|
41979
|
+
defaultCollapsed,
|
|
41980
|
+
children
|
|
41981
|
+
}, ref) {
|
|
41844
41982
|
const generatedId = (0, import_react115.useId)();
|
|
41845
41983
|
const id = propId ?? generatedId;
|
|
41846
41984
|
const context = usePanelGroupContext();
|
|
@@ -41865,7 +42003,17 @@ var Panel = (0, import_react115.forwardRef)(
|
|
|
41865
42003
|
return () => {
|
|
41866
42004
|
unregisterPanel(id);
|
|
41867
42005
|
};
|
|
41868
|
-
}, [
|
|
42006
|
+
}, [
|
|
42007
|
+
id,
|
|
42008
|
+
order,
|
|
42009
|
+
defaultSize,
|
|
42010
|
+
minSize,
|
|
42011
|
+
maxSize,
|
|
42012
|
+
collapsible,
|
|
42013
|
+
defaultCollapsed,
|
|
42014
|
+
registerPanel,
|
|
42015
|
+
unregisterPanel
|
|
42016
|
+
]);
|
|
41869
42017
|
const size4 = getPanelSize(id);
|
|
41870
42018
|
const isFlexPanel = defaultSize === void 0;
|
|
41871
42019
|
(0, import_react115.useImperativeHandle)(
|
|
@@ -41976,8 +42124,13 @@ var PanelGroup = (0, import_react116.forwardRef)(
|
|
|
41976
42124
|
const savedSizes = loadSavedSizes(autoSaveId);
|
|
41977
42125
|
const savedSize = savedSizes?.[panel.id];
|
|
41978
42126
|
const hasSavedSize = savedSize !== void 0;
|
|
41979
|
-
|
|
41980
|
-
|
|
42127
|
+
let collapsed;
|
|
42128
|
+
if (hasSavedSize) {
|
|
42129
|
+
collapsed = savedSize === 0 && !!panel.collapsible;
|
|
42130
|
+
} else {
|
|
42131
|
+
collapsed = !!panel.defaultCollapsed && !!panel.collapsible;
|
|
42132
|
+
}
|
|
42133
|
+
const initialSize = collapsed ? 0 : hasSavedSize ? savedSize : panel.defaultSize ?? 0;
|
|
41981
42134
|
const newPanels = new Map(prev);
|
|
41982
42135
|
newPanels.set(panel.id, {
|
|
41983
42136
|
...panel,
|
|
@@ -42303,6 +42456,32 @@ function PanelResizeHandle({
|
|
|
42303
42456
|
);
|
|
42304
42457
|
}
|
|
42305
42458
|
|
|
42459
|
+
// src/components/workspace/HorizontalTabBar.tsx
|
|
42460
|
+
var import_react118 = __toESM(require("react"));
|
|
42461
|
+
var HorizontalTabBar = memoGeneric(function HorizontalTabBar2({ items, activeValue, onChange }) {
|
|
42462
|
+
const selectableItems = items.filter(isSelectableMenuItem);
|
|
42463
|
+
if (selectableItems.length <= 1) {
|
|
42464
|
+
return null;
|
|
42465
|
+
}
|
|
42466
|
+
return /* @__PURE__ */ import_react118.default.createElement("div", { className: "n-flex n-flex-col n-bg-sidebar-background n-flex-none" }, /* @__PURE__ */ import_react118.default.createElement("div", { className: "n-flex n-flex-row n-px-3 n-py-3" }, /* @__PURE__ */ import_react118.default.createElement(
|
|
42467
|
+
SegmentedControl,
|
|
42468
|
+
{
|
|
42469
|
+
enableCompactMode: true,
|
|
42470
|
+
className: "n-flex-1",
|
|
42471
|
+
value: activeValue,
|
|
42472
|
+
onValueChange: onChange,
|
|
42473
|
+
variant: "default",
|
|
42474
|
+
items: selectableItems.map((item) => ({
|
|
42475
|
+
value: item.value,
|
|
42476
|
+
title: item.title,
|
|
42477
|
+
icon: item.icon,
|
|
42478
|
+
tooltip: item.tooltip,
|
|
42479
|
+
disabled: item.disabled
|
|
42480
|
+
}))
|
|
42481
|
+
}
|
|
42482
|
+
)));
|
|
42483
|
+
});
|
|
42484
|
+
|
|
42306
42485
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
42307
42486
|
var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
42308
42487
|
leftPanel,
|
|
@@ -42319,32 +42498,56 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42319
42498
|
rightTabValue,
|
|
42320
42499
|
onChangeLeftTab,
|
|
42321
42500
|
onChangeRightTab,
|
|
42322
|
-
|
|
42501
|
+
onLeftSidebarStateChange,
|
|
42502
|
+
onRightSidebarStateChange,
|
|
42503
|
+
shouldAutoSave = true
|
|
42323
42504
|
}) {
|
|
42324
|
-
const panelGroupRef = (0,
|
|
42325
|
-
const
|
|
42326
|
-
|
|
42327
|
-
|
|
42328
|
-
|
|
42505
|
+
const panelGroupRef = (0, import_react119.useRef)(null);
|
|
42506
|
+
const containerRef = (0, import_react119.useRef)(null);
|
|
42507
|
+
const autoSaveId = (0, import_react119.useMemo)(() => {
|
|
42508
|
+
if (!shouldAutoSave) return void 0;
|
|
42509
|
+
return autoSavePrefix ? `${autoSavePrefix}--v5--${EDITOR_PANEL_GROUP_ID}` : Math.random().toString(36).substring(2, 15);
|
|
42510
|
+
}, [autoSavePrefix, shouldAutoSave]);
|
|
42511
|
+
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = (0, import_react119.useState)(
|
|
42329
42512
|
leftSidebarOptions.defaultCollapsed ?? false
|
|
42330
42513
|
);
|
|
42331
|
-
const [rightSidebarCollapsed, setRightSidebarCollapsed] = (0,
|
|
42514
|
+
const [rightSidebarCollapsed, setRightSidebarCollapsed] = (0, import_react119.useState)(
|
|
42332
42515
|
rightSidebarOptions.defaultCollapsed ?? false
|
|
42333
42516
|
);
|
|
42334
|
-
const
|
|
42517
|
+
const prevLeftSidebarState = (0, import_react119.useRef)(null);
|
|
42518
|
+
const prevRightSidebarState = (0, import_react119.useRef)(null);
|
|
42519
|
+
const handleLayoutChange = (0, import_react119.useCallback)(
|
|
42335
42520
|
(sizes) => {
|
|
42336
42521
|
const leftIndex = leftPanel ? 0 : -1;
|
|
42337
42522
|
const rightIndex = rightPanel ? leftPanel ? 2 : 1 : -1;
|
|
42523
|
+
const containerWidth = containerRef.current?.clientWidth ?? 0;
|
|
42524
|
+
const sizesSum = sizes.reduce((a, b) => a + b, 0);
|
|
42525
|
+
if (containerWidth > 0 && sizesSum < containerWidth * 0.5 && sizesSum > 100) {
|
|
42526
|
+
return;
|
|
42527
|
+
}
|
|
42528
|
+
const isPixels = containerWidth > 0 && Math.abs(sizesSum - containerWidth) < Math.abs(sizesSum - 100);
|
|
42338
42529
|
if (leftIndex >= 0) {
|
|
42339
|
-
|
|
42530
|
+
const collapsed = sizes[leftIndex] === 0;
|
|
42531
|
+
setLeftSidebarCollapsed(collapsed);
|
|
42532
|
+
const widthPixels = isPixels ? Math.round(sizes[leftIndex]) : containerWidth > 0 ? Math.round(sizes[leftIndex] / 100 * containerWidth) : 0;
|
|
42533
|
+
if (prevLeftSidebarState.current?.width !== widthPixels || prevLeftSidebarState.current?.collapsed !== collapsed) {
|
|
42534
|
+
prevLeftSidebarState.current = { width: widthPixels, collapsed };
|
|
42535
|
+
onLeftSidebarStateChange?.({ width: widthPixels, collapsed });
|
|
42536
|
+
}
|
|
42340
42537
|
}
|
|
42341
42538
|
if (rightIndex >= 0) {
|
|
42342
|
-
|
|
42539
|
+
const collapsed = sizes[rightIndex] === 0;
|
|
42540
|
+
setRightSidebarCollapsed(collapsed);
|
|
42541
|
+
const widthPixels = isPixels ? Math.round(sizes[rightIndex]) : containerWidth > 0 ? Math.round(sizes[rightIndex] / 100 * containerWidth) : 0;
|
|
42542
|
+
if (prevRightSidebarState.current?.width !== widthPixels || prevRightSidebarState.current?.collapsed !== collapsed) {
|
|
42543
|
+
prevRightSidebarState.current = { width: widthPixels, collapsed };
|
|
42544
|
+
onRightSidebarStateChange?.({ width: widthPixels, collapsed });
|
|
42545
|
+
}
|
|
42343
42546
|
}
|
|
42344
42547
|
},
|
|
42345
|
-
[leftPanel, rightPanel]
|
|
42548
|
+
[leftPanel, rightPanel, onLeftSidebarStateChange, onRightSidebarStateChange]
|
|
42346
42549
|
);
|
|
42347
|
-
const handleLeftTabChange = (0,
|
|
42550
|
+
const handleLeftTabChange = (0, import_react119.useCallback)(
|
|
42348
42551
|
(value) => {
|
|
42349
42552
|
if (value === leftTabValue) {
|
|
42350
42553
|
if (leftSidebarRef.current?.isExpanded()) {
|
|
@@ -42361,7 +42564,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42361
42564
|
},
|
|
42362
42565
|
[leftSidebarRef, leftTabValue, onChangeLeftTab]
|
|
42363
42566
|
);
|
|
42364
|
-
const handleRightTabChange = (0,
|
|
42567
|
+
const handleRightTabChange = (0, import_react119.useCallback)(
|
|
42365
42568
|
(value) => {
|
|
42366
42569
|
if (value === rightTabValue) {
|
|
42367
42570
|
if (rightSidebarRef.current?.isExpanded()) {
|
|
@@ -42378,10 +42581,8 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42378
42581
|
},
|
|
42379
42582
|
[onChangeRightTab, rightSidebarRef, rightTabValue]
|
|
42380
42583
|
);
|
|
42381
|
-
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems
|
|
42382
|
-
|
|
42383
|
-
(!compactDrawerMenu || leftSidebarCollapsed);
|
|
42384
|
-
return /* @__PURE__ */ import_react118.default.createElement(
|
|
42584
|
+
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems;
|
|
42585
|
+
return /* @__PURE__ */ import_react119.default.createElement("div", { ref: containerRef, className: "n-flex n-flex-1" }, /* @__PURE__ */ import_react119.default.createElement(
|
|
42385
42586
|
PanelGroup,
|
|
42386
42587
|
{
|
|
42387
42588
|
ref: panelGroupRef,
|
|
@@ -42391,20 +42592,11 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42391
42592
|
autoSaveId,
|
|
42392
42593
|
onLayout: handleLayoutChange
|
|
42393
42594
|
},
|
|
42394
|
-
leftPanel && /* @__PURE__ */
|
|
42395
|
-
VerticalTabMenu,
|
|
42396
|
-
{
|
|
42397
|
-
tooltipSide: "right",
|
|
42398
|
-
items: leftTabItems,
|
|
42399
|
-
activeValue: leftTabValue,
|
|
42400
|
-
isSidebarCollapsed: leftSidebarCollapsed,
|
|
42401
|
-
onChange: handleLeftTabChange
|
|
42402
|
-
}
|
|
42403
|
-
), showLeftTabs && !leftSidebarCollapsed && /* @__PURE__ */ import_react118.default.createElement(DividerVertical, { className: "n-h-full" }), /* @__PURE__ */ import_react118.default.createElement(
|
|
42595
|
+
leftPanel && /* @__PURE__ */ import_react119.default.createElement(import_react119.default.Fragment, null, /* @__PURE__ */ import_react119.default.createElement(
|
|
42404
42596
|
Panel,
|
|
42405
42597
|
{
|
|
42406
42598
|
id: LEFT_SIDEBAR_ID,
|
|
42407
|
-
className: "n-relative",
|
|
42599
|
+
className: "n-relative n-workspace-sidebar",
|
|
42408
42600
|
order: 1,
|
|
42409
42601
|
ref: leftSidebarRef,
|
|
42410
42602
|
defaultSize: leftSidebarOptions.initialSize,
|
|
@@ -42413,9 +42605,22 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42413
42605
|
collapsible: true,
|
|
42414
42606
|
defaultCollapsed: leftSidebarOptions.defaultCollapsed
|
|
42415
42607
|
},
|
|
42416
|
-
leftSidebarCollapsed ? null :
|
|
42417
|
-
|
|
42418
|
-
|
|
42608
|
+
leftSidebarCollapsed ? null : /* @__PURE__ */ import_react119.default.createElement("div", { className: "n-flex n-flex-col n-h-full" }, showLeftTabs && /* @__PURE__ */ import_react119.default.createElement(
|
|
42609
|
+
HorizontalTabBar,
|
|
42610
|
+
{
|
|
42611
|
+
items: leftTabItems,
|
|
42612
|
+
activeValue: leftTabValue,
|
|
42613
|
+
onChange: handleLeftTabChange
|
|
42614
|
+
}
|
|
42615
|
+
), /* @__PURE__ */ import_react119.default.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, leftPanel))
|
|
42616
|
+
), /* @__PURE__ */ import_react119.default.createElement(
|
|
42617
|
+
PanelResizeHandle,
|
|
42618
|
+
{
|
|
42619
|
+
index: 0,
|
|
42620
|
+
className: `n-cursor-col-resize n-w-px n-h-full ${leftSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
42621
|
+
}
|
|
42622
|
+
)),
|
|
42623
|
+
/* @__PURE__ */ import_react119.default.createElement(
|
|
42419
42624
|
Panel,
|
|
42420
42625
|
{
|
|
42421
42626
|
id: CONTENT_AREA_ID,
|
|
@@ -42424,11 +42629,17 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42424
42629
|
},
|
|
42425
42630
|
centerPanel
|
|
42426
42631
|
),
|
|
42427
|
-
rightPanel && /* @__PURE__ */
|
|
42632
|
+
rightPanel && /* @__PURE__ */ import_react119.default.createElement(import_react119.default.Fragment, null, /* @__PURE__ */ import_react119.default.createElement(
|
|
42633
|
+
PanelResizeHandle,
|
|
42634
|
+
{
|
|
42635
|
+
index: 1,
|
|
42636
|
+
className: `n-cursor-col-resize n-w-px n-h-full ${rightSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
42637
|
+
}
|
|
42638
|
+
), /* @__PURE__ */ import_react119.default.createElement(
|
|
42428
42639
|
Panel,
|
|
42429
42640
|
{
|
|
42430
42641
|
id: RIGHT_SIDEBAR_ID,
|
|
42431
|
-
className: "n-relative",
|
|
42642
|
+
className: "n-relative n-workspace-sidebar",
|
|
42432
42643
|
order: 3,
|
|
42433
42644
|
ref: rightSidebarRef,
|
|
42434
42645
|
minSize: rightSidebarOptions.minSize,
|
|
@@ -42437,18 +42648,16 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
42437
42648
|
collapsible: true,
|
|
42438
42649
|
defaultCollapsed: rightSidebarOptions.defaultCollapsed
|
|
42439
42650
|
},
|
|
42440
|
-
rightSidebarCollapsed ? null :
|
|
42441
|
-
|
|
42442
|
-
|
|
42443
|
-
|
|
42444
|
-
|
|
42445
|
-
|
|
42446
|
-
|
|
42447
|
-
|
|
42448
|
-
onChange: handleRightTabChange
|
|
42449
|
-
}
|
|
42651
|
+
rightSidebarCollapsed ? null : /* @__PURE__ */ import_react119.default.createElement("div", { className: "n-flex n-flex-col n-h-full" }, rightSidebarOptions.showTabs && rightTabItems && /* @__PURE__ */ import_react119.default.createElement(
|
|
42652
|
+
HorizontalTabBar,
|
|
42653
|
+
{
|
|
42654
|
+
items: rightTabItems,
|
|
42655
|
+
activeValue: rightTabValue,
|
|
42656
|
+
onChange: handleRightTabChange
|
|
42657
|
+
}
|
|
42658
|
+
), /* @__PURE__ */ import_react119.default.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, rightPanel))
|
|
42450
42659
|
))
|
|
42451
|
-
);
|
|
42660
|
+
));
|
|
42452
42661
|
});
|
|
42453
42662
|
|
|
42454
42663
|
// src/components/workspace/renderPanelChildren.tsx
|
|
@@ -42460,11 +42669,11 @@ function renderPanelChildren(fn, props) {
|
|
|
42460
42669
|
}
|
|
42461
42670
|
|
|
42462
42671
|
// src/components/workspace/WorkspaceSideContext.tsx
|
|
42463
|
-
var
|
|
42464
|
-
var WorkspaceSideContext = (0,
|
|
42672
|
+
var import_react120 = require("react");
|
|
42673
|
+
var WorkspaceSideContext = (0, import_react120.createContext)({});
|
|
42465
42674
|
var WorkspaceSideProvider = WorkspaceSideContext.Provider;
|
|
42466
42675
|
function useWorkspaceSide() {
|
|
42467
|
-
return (0,
|
|
42676
|
+
return (0, import_react120.useContext)(WorkspaceSideContext);
|
|
42468
42677
|
}
|
|
42469
42678
|
|
|
42470
42679
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
@@ -42529,9 +42738,11 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42529
42738
|
showTabs: rightShowTabs = true
|
|
42530
42739
|
} = {},
|
|
42531
42740
|
theme,
|
|
42532
|
-
|
|
42741
|
+
onLeftSidebarStateChange,
|
|
42742
|
+
onRightSidebarStateChange,
|
|
42743
|
+
shouldAutoSave
|
|
42533
42744
|
}, forwardedRef) {
|
|
42534
|
-
const containerRef =
|
|
42745
|
+
const containerRef = import_react121.default.useRef(null);
|
|
42535
42746
|
const containerSize = useSize(containerRef);
|
|
42536
42747
|
const windowSize = useWindowSize();
|
|
42537
42748
|
const parentSize = detectSize === "window" ? windowSize : containerSize && containerSize.width > 0 ? containerSize : windowSize;
|
|
@@ -42547,8 +42758,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42547
42758
|
const rightSidebarMinPixels = toPixels(rightMinSize);
|
|
42548
42759
|
const rightSidebarMaxPixels = toPixels(rightMaxSize);
|
|
42549
42760
|
const rightSidebarInitialPixels = toPixels(rightInitialSize) ?? 280;
|
|
42550
|
-
const leftSidebarRef = (0,
|
|
42551
|
-
const rightSidebarRef = (0,
|
|
42761
|
+
const leftSidebarRef = (0, import_react121.useRef)(null);
|
|
42762
|
+
const rightSidebarRef = (0, import_react121.useRef)(null);
|
|
42552
42763
|
const [leftTabValue, setLeftTabValue] = useControlledOrUncontrolled({
|
|
42553
42764
|
value: leftTabValueProp,
|
|
42554
42765
|
onChange: onChangeLeftTab,
|
|
@@ -42559,7 +42770,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42559
42770
|
onChange: onChangeRightTab,
|
|
42560
42771
|
defaultValue: getFirstTabValue(rightTabItems, "")
|
|
42561
42772
|
});
|
|
42562
|
-
(0,
|
|
42773
|
+
(0, import_react121.useImperativeHandle)(forwardedRef, () => ({
|
|
42563
42774
|
setLeftExpanded: (expanded) => {
|
|
42564
42775
|
if (expanded) {
|
|
42565
42776
|
leftSidebarRef.current?.expand();
|
|
@@ -42616,56 +42827,56 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42616
42827
|
}
|
|
42617
42828
|
});
|
|
42618
42829
|
const isDrawerActive = sideType === "drawer" || sideType === "auto" && parentSize.width <= sideTypeBreakpoint;
|
|
42619
|
-
const closeLeftSidebar = (0,
|
|
42830
|
+
const closeLeftSidebar = (0, import_react121.useCallback)(() => {
|
|
42620
42831
|
if (isDrawerActive) {
|
|
42621
42832
|
leftSidebarRef.current?.collapse();
|
|
42622
42833
|
}
|
|
42623
42834
|
}, [isDrawerActive]);
|
|
42624
|
-
const closeRightSidebar = (0,
|
|
42835
|
+
const closeRightSidebar = (0, import_react121.useCallback)(() => {
|
|
42625
42836
|
if (isDrawerActive) {
|
|
42626
42837
|
rightSidebarRef.current?.collapse();
|
|
42627
42838
|
}
|
|
42628
42839
|
}, [isDrawerActive]);
|
|
42629
|
-
const leftChildrenProps = (0,
|
|
42840
|
+
const leftChildrenProps = (0, import_react121.useMemo)(() => {
|
|
42630
42841
|
return {
|
|
42631
42842
|
activeTabValue: leftTabValue,
|
|
42632
42843
|
closeSidebar: closeLeftSidebar
|
|
42633
42844
|
};
|
|
42634
42845
|
}, [leftTabValue, closeLeftSidebar]);
|
|
42635
|
-
const rightChildrenProps = (0,
|
|
42846
|
+
const rightChildrenProps = (0, import_react121.useMemo)(() => {
|
|
42636
42847
|
return {
|
|
42637
42848
|
activeTabValue: rightTabValue,
|
|
42638
42849
|
closeSidebar: closeRightSidebar
|
|
42639
42850
|
};
|
|
42640
42851
|
}, [rightTabValue, closeRightSidebar]);
|
|
42641
|
-
const leftSidebarProviderValue = (0,
|
|
42852
|
+
const leftSidebarProviderValue = (0, import_react121.useMemo)(() => {
|
|
42642
42853
|
return {
|
|
42643
42854
|
closeSidebar: closeLeftSidebar
|
|
42644
42855
|
};
|
|
42645
42856
|
}, [closeLeftSidebar]);
|
|
42646
|
-
const rightSidebarProviderValue = (0,
|
|
42857
|
+
const rightSidebarProviderValue = (0, import_react121.useMemo)(() => {
|
|
42647
42858
|
return {
|
|
42648
42859
|
closeSidebar: closeRightSidebar
|
|
42649
42860
|
};
|
|
42650
42861
|
}, [closeRightSidebar]);
|
|
42651
|
-
const leftPanel = left && leftVisible !== false ? /* @__PURE__ */
|
|
42862
|
+
const leftPanel = left && leftVisible !== false ? /* @__PURE__ */ import_react121.default.createElement(
|
|
42652
42863
|
PanelInner,
|
|
42653
42864
|
{
|
|
42654
42865
|
style: leftStyle,
|
|
42655
42866
|
className: cx("n-bg-sidebar-background n-flex-col", leftClassName)
|
|
42656
42867
|
},
|
|
42657
|
-
/* @__PURE__ */
|
|
42868
|
+
/* @__PURE__ */ import_react121.default.createElement(WorkspaceSideProvider, { value: leftSidebarProviderValue }, leftTabValue ? renderPanelChildren(left, leftChildrenProps) : null)
|
|
42658
42869
|
) : null;
|
|
42659
|
-
const rightPanel = right && rightVisible !== false ? /* @__PURE__ */
|
|
42870
|
+
const rightPanel = right && rightVisible !== false ? /* @__PURE__ */ import_react121.default.createElement(
|
|
42660
42871
|
PanelInner,
|
|
42661
42872
|
{
|
|
42662
42873
|
style: rightStyle,
|
|
42663
42874
|
className: cx("n-bg-sidebar-background n-flex-col", rightClassName)
|
|
42664
42875
|
},
|
|
42665
|
-
/* @__PURE__ */
|
|
42876
|
+
/* @__PURE__ */ import_react121.default.createElement(WorkspaceSideProvider, { value: rightSidebarProviderValue }, rightTabValue ? renderPanelChildren(right, rightChildrenProps) : null)
|
|
42666
42877
|
) : null;
|
|
42667
|
-
const centerPanel = /* @__PURE__ */
|
|
42668
|
-
const leftSidebarOptions = (0,
|
|
42878
|
+
const centerPanel = /* @__PURE__ */ import_react121.default.createElement(PanelInner, { className: "n-bg-canvas-background" }, children);
|
|
42879
|
+
const leftSidebarOptions = (0, import_react121.useMemo)(
|
|
42669
42880
|
() => ({
|
|
42670
42881
|
minSize: leftSidebarMinPixels,
|
|
42671
42882
|
maxSize: leftSidebarMaxPixels,
|
|
@@ -42683,7 +42894,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42683
42894
|
leftShowTabs
|
|
42684
42895
|
]
|
|
42685
42896
|
);
|
|
42686
|
-
const rightSidebarOptions = (0,
|
|
42897
|
+
const rightSidebarOptions = (0, import_react121.useMemo)(
|
|
42687
42898
|
() => ({
|
|
42688
42899
|
minSize: rightSidebarMinPixels,
|
|
42689
42900
|
maxSize: rightSidebarMaxPixels,
|
|
@@ -42704,7 +42915,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42704
42915
|
const LayoutComponent = sideType === "panel" ? PanelWorkspaceLayout : sideType === "drawer" ? DrawerWorkspaceLayout : parentSize.width > sideTypeBreakpoint ? PanelWorkspaceLayout : DrawerWorkspaceLayout;
|
|
42705
42916
|
const readyToRender = detectSize === "window" || containerSize && containerSize.width > 0;
|
|
42706
42917
|
const isOverlay = toolbarVariant === "overlay";
|
|
42707
|
-
return /* @__PURE__ */
|
|
42918
|
+
return /* @__PURE__ */ import_react121.default.createElement(
|
|
42708
42919
|
"div",
|
|
42709
42920
|
{
|
|
42710
42921
|
ref: containerRef,
|
|
@@ -42717,7 +42928,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42717
42928
|
"data-theme": theme
|
|
42718
42929
|
},
|
|
42719
42930
|
!isOverlay && toolbar,
|
|
42720
|
-
/* @__PURE__ */
|
|
42931
|
+
/* @__PURE__ */ import_react121.default.createElement("div", { className: "n-flex n-flex-row n-flex-1 n-relative" }, readyToRender && /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null, /* @__PURE__ */ import_react121.default.createElement(
|
|
42721
42932
|
LayoutComponent,
|
|
42722
42933
|
{
|
|
42723
42934
|
leftPanel,
|
|
@@ -42734,9 +42945,11 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42734
42945
|
autoSavePrefix,
|
|
42735
42946
|
leftSidebarRef,
|
|
42736
42947
|
rightSidebarRef,
|
|
42737
|
-
|
|
42948
|
+
onLeftSidebarStateChange,
|
|
42949
|
+
onRightSidebarStateChange,
|
|
42950
|
+
shouldAutoSave
|
|
42738
42951
|
}
|
|
42739
|
-
), isOverlay && /* @__PURE__ */
|
|
42952
|
+
), isOverlay && /* @__PURE__ */ import_react121.default.createElement(
|
|
42740
42953
|
OverlayToolbar,
|
|
42741
42954
|
{
|
|
42742
42955
|
left: overlayToolbarLeft,
|
|
@@ -42746,12 +42959,12 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
42746
42959
|
)))
|
|
42747
42960
|
);
|
|
42748
42961
|
});
|
|
42749
|
-
var PanelInner = (0,
|
|
42962
|
+
var PanelInner = (0, import_react121.memo)(function PanelInner2({
|
|
42750
42963
|
children,
|
|
42751
42964
|
style: style2,
|
|
42752
42965
|
className
|
|
42753
42966
|
}) {
|
|
42754
|
-
return /* @__PURE__ */
|
|
42967
|
+
return /* @__PURE__ */ import_react121.default.createElement(
|
|
42755
42968
|
"div",
|
|
42756
42969
|
{
|
|
42757
42970
|
style: style2,
|
|
@@ -42798,9 +43011,9 @@ function usePlatformModKey() {
|
|
|
42798
43011
|
}
|
|
42799
43012
|
|
|
42800
43013
|
// src/hooks/useTheme.ts
|
|
42801
|
-
var
|
|
43014
|
+
var import_react122 = require("react");
|
|
42802
43015
|
function useTheme() {
|
|
42803
|
-
const [theme, setTheme] = (0,
|
|
43016
|
+
const [theme, setTheme] = (0, import_react122.useState)("light");
|
|
42804
43017
|
const checkTheme = () => {
|
|
42805
43018
|
const currentTheme = document.body.getAttribute("data-theme");
|
|
42806
43019
|
switch (currentTheme) {
|
|
@@ -42812,7 +43025,7 @@ function useTheme() {
|
|
|
42812
43025
|
break;
|
|
42813
43026
|
}
|
|
42814
43027
|
};
|
|
42815
|
-
(0,
|
|
43028
|
+
(0, import_react122.useEffect)(() => {
|
|
42816
43029
|
checkTheme();
|
|
42817
43030
|
const observer = new MutationObserver((mutations) => {
|
|
42818
43031
|
mutations.forEach((mutation) => {
|
|
@@ -43004,8 +43217,8 @@ __export(InspectorPrimitives_exports, {
|
|
|
43004
43217
|
Title: () => Title,
|
|
43005
43218
|
VerticalSeparator: () => VerticalSeparator
|
|
43006
43219
|
});
|
|
43007
|
-
var
|
|
43008
|
-
var Section2 = (0,
|
|
43220
|
+
var import_react123 = __toESM(require("react"));
|
|
43221
|
+
var Section2 = (0, import_react123.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react123.default.createElement(
|
|
43009
43222
|
"div",
|
|
43010
43223
|
{
|
|
43011
43224
|
ref,
|
|
@@ -43013,8 +43226,8 @@ var Section2 = (0, import_react122.forwardRef)(({ className, ...props }, ref) =>
|
|
|
43013
43226
|
...props
|
|
43014
43227
|
}
|
|
43015
43228
|
));
|
|
43016
|
-
var SectionHeader2 = (0,
|
|
43017
|
-
var Title = (0,
|
|
43229
|
+
var SectionHeader2 = (0, import_react123.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react123.default.createElement("div", { ref, className: cx(`n-flex n-items-center`, className), ...props }));
|
|
43230
|
+
var Title = (0, import_react123.forwardRef)(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */ import_react123.default.createElement(
|
|
43018
43231
|
"div",
|
|
43019
43232
|
{
|
|
43020
43233
|
ref,
|
|
@@ -43025,7 +43238,7 @@ var Title = (0, import_react122.forwardRef)(({ className, $textStyle, ...props }
|
|
|
43025
43238
|
...props
|
|
43026
43239
|
}
|
|
43027
43240
|
));
|
|
43028
|
-
var Row = (0,
|
|
43241
|
+
var Row = (0, import_react123.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react123.default.createElement(
|
|
43029
43242
|
"div",
|
|
43030
43243
|
{
|
|
43031
43244
|
ref,
|
|
@@ -43033,7 +43246,7 @@ var Row = (0, import_react122.forwardRef)(({ className, ...props }, ref) => /* @
|
|
|
43033
43246
|
...props
|
|
43034
43247
|
}
|
|
43035
43248
|
));
|
|
43036
|
-
var Column = (0,
|
|
43249
|
+
var Column = (0, import_react123.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react123.default.createElement(
|
|
43037
43250
|
"div",
|
|
43038
43251
|
{
|
|
43039
43252
|
ref,
|
|
@@ -43041,7 +43254,7 @@ var Column = (0, import_react122.forwardRef)(({ className, ...props }, ref) => /
|
|
|
43041
43254
|
...props
|
|
43042
43255
|
}
|
|
43043
43256
|
));
|
|
43044
|
-
var Checkbox3 = (0,
|
|
43257
|
+
var Checkbox3 = (0, import_react123.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react123.default.createElement(
|
|
43045
43258
|
"input",
|
|
43046
43259
|
{
|
|
43047
43260
|
ref,
|
|
@@ -43050,7 +43263,7 @@ var Checkbox3 = (0, import_react122.forwardRef)(({ className, ...props }, ref) =
|
|
|
43050
43263
|
...props
|
|
43051
43264
|
}
|
|
43052
43265
|
));
|
|
43053
|
-
var Text3 = (0,
|
|
43266
|
+
var Text3 = (0, import_react123.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react123.default.createElement(
|
|
43054
43267
|
"span",
|
|
43055
43268
|
{
|
|
43056
43269
|
ref,
|
|
@@ -43058,14 +43271,14 @@ var Text3 = (0, import_react122.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
43058
43271
|
...props
|
|
43059
43272
|
}
|
|
43060
43273
|
));
|
|
43061
|
-
var VerticalSeparator = () => /* @__PURE__ */
|
|
43062
|
-
var HorizontalSeparator = () => /* @__PURE__ */
|
|
43063
|
-
var RowLabel = (0,
|
|
43274
|
+
var VerticalSeparator = () => /* @__PURE__ */ import_react123.default.createElement(Spacer.Vertical, { size: "inspector-v-separator" });
|
|
43275
|
+
var HorizontalSeparator = () => /* @__PURE__ */ import_react123.default.createElement(Spacer.Horizontal, { size: "inspector-h-separator" });
|
|
43276
|
+
var RowLabel = (0, import_react123.forwardRef)(function RowLabel2({
|
|
43064
43277
|
className,
|
|
43065
43278
|
$textStyle,
|
|
43066
43279
|
...props
|
|
43067
43280
|
}, ref) {
|
|
43068
|
-
return /* @__PURE__ */
|
|
43281
|
+
return /* @__PURE__ */ import_react123.default.createElement(
|
|
43069
43282
|
"label",
|
|
43070
43283
|
{
|
|
43071
43284
|
ref,
|
|
@@ -43077,7 +43290,7 @@ var RowLabel = (0, import_react122.forwardRef)(function RowLabel2({
|
|
|
43077
43290
|
}
|
|
43078
43291
|
);
|
|
43079
43292
|
});
|
|
43080
|
-
var LabeledRow = (0,
|
|
43293
|
+
var LabeledRow = (0, import_react123.memo)(function LabeledRow2({
|
|
43081
43294
|
id,
|
|
43082
43295
|
children,
|
|
43083
43296
|
label,
|
|
@@ -43085,7 +43298,7 @@ var LabeledRow = (0, import_react122.memo)(function LabeledRow2({
|
|
|
43085
43298
|
right,
|
|
43086
43299
|
className
|
|
43087
43300
|
}) {
|
|
43088
|
-
return /* @__PURE__ */
|
|
43301
|
+
return /* @__PURE__ */ import_react123.default.createElement(Row, { id, className }, /* @__PURE__ */ import_react123.default.createElement(Column, null, /* @__PURE__ */ import_react123.default.createElement(RowLabel, { $textStyle: labelTextStyle }, label, right && /* @__PURE__ */ import_react123.default.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ import_react123.default.createElement(Row, null, children)));
|
|
43089
43302
|
});
|
|
43090
43303
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43091
43304
|
0 && (module.exports = {
|