@noya-app/noya-designsystem 0.1.94 → 0.1.95
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 +9 -9
- package/CHANGELOG.md +10 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +158 -93
- package/dist/index.d.ts +158 -93
- package/dist/index.js +1307 -1034
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1231 -962
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/SharedDragProvider.test.ts +72 -29
- package/src/__tests__/fuzzyScorer.test.ts +49 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Combobox.tsx +23 -3
- package/src/components/ComboboxMenu.tsx +32 -15
- package/src/components/ContextMenu.tsx +26 -7
- package/src/components/DimensionInput.tsx +12 -2
- package/src/components/DropdownMenu.tsx +23 -8
- package/src/components/InputField.tsx +1 -0
- package/src/components/InspectorContainer.tsx +16 -1
- package/src/components/List.tsx +25 -3
- package/src/components/Popover.tsx +13 -1
- package/src/components/Section.tsx +35 -11
- package/src/components/SegmentedControl.tsx +14 -4
- package/src/components/Toolbar.tsx +16 -1
- package/src/components/ToolbarItems.tsx +322 -0
- package/src/components/Tooltip.tsx +8 -1
- package/src/components/__tests__/ToolbarItems.test.tsx +205 -0
- package/src/components/internal/Menu.tsx +4 -1
- package/src/components/internal/TextInput.tsx +43 -2
- package/src/components/internal/__tests__/TextInput.test.tsx +77 -0
- package/src/components/listView/ListViewEditableRowTitle.tsx +37 -1
- package/src/components/listView/ListViewRow.tsx +3 -0
- package/src/components/listView/__tests__/ListViewEditableRowTitle.test.tsx +69 -0
- package/src/components/sorting/Sortable.tsx +4 -1
- package/src/index.tsx +0 -1
- package/src/utils/combobox.ts +22 -5
- package/src/utils/fuzzyScorer.ts +71 -0
- package/tailwind.config.ts +7 -0
- package/src/components/InspectorPrimitives.tsx +0 -188
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 useState83 = React340.useState;
|
|
43
|
+
var useEffect60 = React340.useEffect;
|
|
44
44
|
var useLayoutEffect12 = React340.useLayoutEffect;
|
|
45
45
|
var useDebugValue2 = React340.useDebugValue;
|
|
46
46
|
function useSyncExternalStore$2(subscribe2, getSnapshot2) {
|
|
47
|
-
var value = getSnapshot2(), _useState =
|
|
47
|
+
var value = getSnapshot2(), _useState = useState83({ inst: { value, getSnapshot: getSnapshot2 } }), 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
|
[subscribe2, value, getSnapshot2]
|
|
55
55
|
);
|
|
56
|
-
|
|
56
|
+
useEffect60(
|
|
57
57
|
function() {
|
|
58
58
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
59
59
|
return subscribe2(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 = useState83({
|
|
106
106
|
inst: { value, getSnapshot: getSnapshot2 }
|
|
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
|
[subscribe2, value, getSnapshot2]
|
|
116
116
|
);
|
|
117
|
-
|
|
117
|
+
useEffect60(
|
|
118
118
|
function() {
|
|
119
119
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
120
120
|
return subscribe2(function() {
|
|
@@ -140,7 +140,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
140
140
|
return getSnapshot2();
|
|
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 React340 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
143
|
+
var React340 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState83 = React340.useState, useEffect60 = React340.useEffect, useLayoutEffect12 = React340.useLayoutEffect, useDebugValue2 = React340.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 !== React340.useSyncExternalStore ? React340.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
|
}();
|
|
@@ -171,7 +171,7 @@ var require_with_selector_production = __commonJS({
|
|
|
171
171
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
172
172
|
var useSyncExternalStore5 = shim.useSyncExternalStore;
|
|
173
173
|
var useRef99 = React340.useRef;
|
|
174
|
-
var
|
|
174
|
+
var useEffect60 = React340.useEffect;
|
|
175
175
|
var useMemo102 = React340.useMemo;
|
|
176
176
|
var useDebugValue2 = React340.useDebugValue;
|
|
177
177
|
exports2.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot2, getServerSnapshot2, selector, isEqual) {
|
|
@@ -215,7 +215,7 @@ var require_with_selector_production = __commonJS({
|
|
|
215
215
|
[getSnapshot2, getServerSnapshot2, selector, isEqual]
|
|
216
216
|
);
|
|
217
217
|
var value = useSyncExternalStore5(subscribe2, instRef[0], instRef[1]);
|
|
218
|
-
|
|
218
|
+
useEffect60(
|
|
219
219
|
function() {
|
|
220
220
|
inst.hasValue = true;
|
|
221
221
|
inst.value = value;
|
|
@@ -237,7 +237,7 @@ 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 React340 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore5 = shim.useSyncExternalStore, useRef99 = React340.useRef,
|
|
240
|
+
var React340 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore5 = shim.useSyncExternalStore, useRef99 = React340.useRef, useEffect60 = React340.useEffect, useMemo102 = React340.useMemo, useDebugValue2 = React340.useDebugValue;
|
|
241
241
|
exports2.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot2, getServerSnapshot2, selector, isEqual) {
|
|
242
242
|
var instRef = useRef99(null);
|
|
243
243
|
if (null === instRef.current) {
|
|
@@ -280,7 +280,7 @@ var require_with_selector_development = __commonJS({
|
|
|
280
280
|
[getSnapshot2, getServerSnapshot2, selector, isEqual]
|
|
281
281
|
);
|
|
282
282
|
var value = useSyncExternalStore5(subscribe2, instRef[0], instRef[1]);
|
|
283
|
-
|
|
283
|
+
useEffect60(
|
|
284
284
|
function() {
|
|
285
285
|
inst.hasValue = true;
|
|
286
286
|
inst.value = value;
|
|
@@ -316,12 +316,12 @@ var require_use_sync_external_store_shim_production2 = __commonJS({
|
|
|
316
316
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
317
317
|
}
|
|
318
318
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
319
|
-
var
|
|
320
|
-
var
|
|
319
|
+
var useState83 = React340.useState;
|
|
320
|
+
var useEffect60 = React340.useEffect;
|
|
321
321
|
var useLayoutEffect12 = React340.useLayoutEffect;
|
|
322
322
|
var useDebugValue2 = React340.useDebugValue;
|
|
323
323
|
function useSyncExternalStore$2(subscribe2, getSnapshot2) {
|
|
324
|
-
var value = getSnapshot2(), _useState =
|
|
324
|
+
var value = getSnapshot2(), _useState = useState83({ inst: { value, getSnapshot: getSnapshot2 } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
325
325
|
useLayoutEffect12(
|
|
326
326
|
function() {
|
|
327
327
|
inst.value = value;
|
|
@@ -330,7 +330,7 @@ var require_use_sync_external_store_shim_production2 = __commonJS({
|
|
|
330
330
|
},
|
|
331
331
|
[subscribe2, value, getSnapshot2]
|
|
332
332
|
);
|
|
333
|
-
|
|
333
|
+
useEffect60(
|
|
334
334
|
function() {
|
|
335
335
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
336
336
|
return subscribe2(function() {
|
|
@@ -379,7 +379,7 @@ var require_use_sync_external_store_shim_development2 = __commonJS({
|
|
|
379
379
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
380
380
|
), didWarnUncachedGetSnapshot = true);
|
|
381
381
|
}
|
|
382
|
-
cachedValue =
|
|
382
|
+
cachedValue = useState83({
|
|
383
383
|
inst: { value, getSnapshot: getSnapshot2 }
|
|
384
384
|
});
|
|
385
385
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
@@ -391,7 +391,7 @@ var require_use_sync_external_store_shim_development2 = __commonJS({
|
|
|
391
391
|
},
|
|
392
392
|
[subscribe2, value, getSnapshot2]
|
|
393
393
|
);
|
|
394
|
-
|
|
394
|
+
useEffect60(
|
|
395
395
|
function() {
|
|
396
396
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
397
397
|
return subscribe2(function() {
|
|
@@ -417,7 +417,7 @@ var require_use_sync_external_store_shim_development2 = __commonJS({
|
|
|
417
417
|
return getSnapshot2();
|
|
418
418
|
}
|
|
419
419
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
420
|
-
var React340 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
420
|
+
var React340 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState83 = React340.useState, useEffect60 = React340.useEffect, useLayoutEffect12 = React340.useLayoutEffect, useDebugValue2 = React340.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
421
421
|
exports2.useSyncExternalStore = void 0 !== React340.useSyncExternalStore ? React340.useSyncExternalStore : shim;
|
|
422
422
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
423
423
|
}();
|
|
@@ -803,14 +803,14 @@ var require_grammarDiagnostics = __commonJS({
|
|
|
803
803
|
rootNonTerminating.add(name);
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
|
-
const
|
|
806
|
+
const memo43 = /* @__PURE__ */ new Map();
|
|
807
807
|
const collectCauses = (name, path) => {
|
|
808
|
-
if (
|
|
809
|
-
return
|
|
808
|
+
if (memo43.has(name)) {
|
|
809
|
+
return memo43.get(name);
|
|
810
810
|
}
|
|
811
811
|
if (rootNonTerminating.has(name)) {
|
|
812
812
|
const direct = /* @__PURE__ */ new Set([name]);
|
|
813
|
-
|
|
813
|
+
memo43.set(name, direct);
|
|
814
814
|
return direct;
|
|
815
815
|
}
|
|
816
816
|
if (path.has(name)) {
|
|
@@ -829,7 +829,7 @@ var require_grammarDiagnostics = __commonJS({
|
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
831
|
path.delete(name);
|
|
832
|
-
|
|
832
|
+
memo43.set(name, result);
|
|
833
833
|
return result;
|
|
834
834
|
};
|
|
835
835
|
const dependencyIssues = [];
|
|
@@ -3603,7 +3603,6 @@ __export(src_exports, {
|
|
|
3603
3603
|
IndentContext: () => IndentContext,
|
|
3604
3604
|
InputField: () => InputField2,
|
|
3605
3605
|
InspectorContainer: () => InspectorContainer,
|
|
3606
|
-
InspectorPrimitives: () => InspectorPrimitives_exports,
|
|
3607
3606
|
Italic: () => Italic,
|
|
3608
3607
|
KeyboardShortcut: () => KeyboardShortcut,
|
|
3609
3608
|
Label: () => Label,
|
|
@@ -3657,8 +3656,9 @@ __export(src_exports, {
|
|
|
3657
3656
|
TextAreaRow: () => TextAreaRow,
|
|
3658
3657
|
Toast: () => Toast,
|
|
3659
3658
|
ToastProvider: () => ToastProvider3,
|
|
3660
|
-
Toolbar: () =>
|
|
3659
|
+
Toolbar: () => Toolbar2,
|
|
3661
3660
|
ToolbarDrawer: () => ToolbarDrawer,
|
|
3661
|
+
ToolbarItems: () => ToolbarItems,
|
|
3662
3662
|
ToolbarMenu: () => ToolbarMenu,
|
|
3663
3663
|
ToolbarMenuButton: () => ToolbarMenuButton,
|
|
3664
3664
|
ToolbarMenuContext: () => ToolbarMenuContext,
|
|
@@ -3765,7 +3765,8 @@ __export(src_exports, {
|
|
|
3765
3765
|
validateDropIndicator: () => validateDropIndicator,
|
|
3766
3766
|
whiteboardProseTheme: () => whiteboardProseTheme,
|
|
3767
3767
|
withDragProvider: () => withDragProvider,
|
|
3768
|
-
withSeparatorElements: () => withSeparatorElements
|
|
3768
|
+
withSeparatorElements: () => withSeparatorElements,
|
|
3769
|
+
wordPrefixFilter: () => wordPrefixFilter
|
|
3769
3770
|
});
|
|
3770
3771
|
module.exports = __toCommonJS(src_exports);
|
|
3771
3772
|
|
|
@@ -17850,7 +17851,8 @@ var Tooltip = React110.memo(function Tooltip2({
|
|
|
17850
17851
|
content,
|
|
17851
17852
|
sideOffset = 2,
|
|
17852
17853
|
side = "bottom",
|
|
17853
|
-
portalContainer
|
|
17854
|
+
portalContainer,
|
|
17855
|
+
contentClassName
|
|
17854
17856
|
}) {
|
|
17855
17857
|
const portalScopeId = usePortalScopeId();
|
|
17856
17858
|
return /* @__PURE__ */ React110.createElement(index_parts_exports2.Provider, null, /* @__PURE__ */ React110.createElement(index_parts_exports2.Root, null, /* @__PURE__ */ React110.createElement(
|
|
@@ -17871,7 +17873,7 @@ var Tooltip = React110.memo(function Tooltip2({
|
|
|
17871
17873
|
/* @__PURE__ */ React110.createElement(
|
|
17872
17874
|
index_parts_exports2.Popup,
|
|
17873
17875
|
{
|
|
17874
|
-
className: `${textStyles.small} n-text-text n-rounded-sm n-p-2 n-bg-popover-background n-shadow-tooltip n-z-menu`
|
|
17876
|
+
className: contentClassName ?? `${textStyles.small} n-text-text n-rounded-sm n-p-2 n-bg-popover-background n-shadow-tooltip n-z-menu`
|
|
17875
17877
|
},
|
|
17876
17878
|
content
|
|
17877
17879
|
)
|
|
@@ -17921,7 +17923,7 @@ var Button = (0, import_react24.forwardRef)(function Button2({
|
|
|
17921
17923
|
}, forwardedRef) {
|
|
17922
17924
|
const colorScheme = colorSchemeProp ?? "default";
|
|
17923
17925
|
const baseClassName = cx(
|
|
17924
|
-
"n-no-underline n-leading-[1] n-relative n-outline-none n-select-none n-text-left n-rounded n-flex n-items-center n-justify-center [&>*]:n-pointer-events-none n-[-webkit-app-region:no-drag] focus:n-ring-2 focus:n-ring-primary focus:n-shadow-[0_0_0_1px_var(--n-popover-background)_inset] n-transition-all",
|
|
17926
|
+
"n-no-underline n-leading-[1] n-relative n-outline-none n-select-none n-text-left n-rounded n-flex n-items-center n-justify-center [&>*]:n-pointer-events-none n-[-webkit-app-region:no-drag] focus-visible:n-ring-2 focus-visible:n-ring-primary focus-visible:n-shadow-[0_0_0_1px_var(--n-popover-background)_inset] n-transition-all",
|
|
17925
17927
|
variant === "ghost" ? "n-border" : "n-border-0",
|
|
17926
17928
|
disabled2 ? "n-opacity-25" : "",
|
|
17927
17929
|
!className?.includes("flex") ? "n-flex-none" : "",
|
|
@@ -17967,6 +17969,28 @@ var Button = (0, import_react24.forwardRef)(function Button2({
|
|
|
17967
17969
|
return tooltip ? /* @__PURE__ */ import_react24.default.createElement(Tooltip, { content: tooltip }, buttonElement) : buttonElement;
|
|
17968
17970
|
});
|
|
17969
17971
|
|
|
17972
|
+
// src/components/IconButton.tsx
|
|
17973
|
+
var React112 = __toESM(require("react"));
|
|
17974
|
+
var IconButton = React112.memo(
|
|
17975
|
+
React112.forwardRef(function IconButton2({ selected, iconName, color, size: size4, contentStyle, ...props }, forwardedRef) {
|
|
17976
|
+
const Icon2 = Icons[iconName];
|
|
17977
|
+
const style2 = React112.useMemo(() => {
|
|
17978
|
+
return {
|
|
17979
|
+
padding: "0 2px",
|
|
17980
|
+
...size4 && { minHeight: size4 },
|
|
17981
|
+
...contentStyle
|
|
17982
|
+
};
|
|
17983
|
+
}, [contentStyle, size4]);
|
|
17984
|
+
return /* @__PURE__ */ React112.createElement(Button, { ref: forwardedRef, ...props, variant: "none", contentStyle: style2 }, /* @__PURE__ */ React112.createElement(
|
|
17985
|
+
Icon2,
|
|
17986
|
+
{
|
|
17987
|
+
color: color ?? (selected ? cssVars.colors.iconSelected : cssVars.colors.icon),
|
|
17988
|
+
...size4 && { width: size4, height: size4 }
|
|
17989
|
+
}
|
|
17990
|
+
));
|
|
17991
|
+
})
|
|
17992
|
+
);
|
|
17993
|
+
|
|
17970
17994
|
// src/components/internal/Menu.tsx
|
|
17971
17995
|
var import_noya_keymap2 = require("@noya-app/noya-keymap");
|
|
17972
17996
|
var import_react39 = __toESM(require("react"));
|
|
@@ -17994,14 +18018,14 @@ __export(index_parts_exports3, {
|
|
|
17994
18018
|
});
|
|
17995
18019
|
|
|
17996
18020
|
// ../../node_modules/@base-ui/react/toast/provider/ToastProvider.mjs
|
|
17997
|
-
var
|
|
18021
|
+
var React114 = __toESM(require("react"), 1);
|
|
17998
18022
|
|
|
17999
18023
|
// ../../node_modules/@base-ui/react/toast/provider/ToastProviderContext.mjs
|
|
18000
|
-
var
|
|
18001
|
-
var ToastContext = /* @__PURE__ */
|
|
18024
|
+
var React113 = __toESM(require("react"), 1);
|
|
18025
|
+
var ToastContext = /* @__PURE__ */ React113.createContext(void 0);
|
|
18002
18026
|
if (process.env.NODE_ENV !== "production") ToastContext.displayName = "ToastContext";
|
|
18003
18027
|
function useToastProviderContext() {
|
|
18004
|
-
const context =
|
|
18028
|
+
const context = React113.useContext(ToastContext);
|
|
18005
18029
|
if (!context) {
|
|
18006
18030
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: useToastManager must be used within <Toast.Provider>." : formatErrorMessage_default(73));
|
|
18007
18031
|
}
|
|
@@ -18410,7 +18434,7 @@ var ToastProvider = function ToastProvider2(props) {
|
|
|
18410
18434
|
prevFocusElement: null
|
|
18411
18435
|
})).current;
|
|
18412
18436
|
useOnMount(store.disposeEffect);
|
|
18413
|
-
|
|
18437
|
+
React114.useEffect(function subscribeToToastManager() {
|
|
18414
18438
|
if (!toastManager) {
|
|
18415
18439
|
return void 0;
|
|
18416
18440
|
}
|
|
@@ -18454,9 +18478,9 @@ function ToastProviderPropsSynchronizer(props) {
|
|
|
18454
18478
|
}
|
|
18455
18479
|
|
|
18456
18480
|
// ../../node_modules/@base-ui/react/toast/viewport/ToastViewport.mjs
|
|
18457
|
-
var
|
|
18481
|
+
var React115 = __toESM(require("react"), 1);
|
|
18458
18482
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
18459
|
-
var ToastViewport = /* @__PURE__ */
|
|
18483
|
+
var ToastViewport = /* @__PURE__ */ React115.forwardRef(function ToastViewport2(componentProps, forwardedRef) {
|
|
18460
18484
|
const {
|
|
18461
18485
|
render,
|
|
18462
18486
|
className,
|
|
@@ -18466,9 +18490,9 @@ var ToastViewport = /* @__PURE__ */ React114.forwardRef(function ToastViewport2(
|
|
|
18466
18490
|
} = componentProps;
|
|
18467
18491
|
const store = useToastProviderContext();
|
|
18468
18492
|
const windowFocusTimeout = useTimeout();
|
|
18469
|
-
const handlingFocusGuardRef =
|
|
18470
|
-
const markedReadyForMouseLeaveRef =
|
|
18471
|
-
const touchActiveRef =
|
|
18493
|
+
const handlingFocusGuardRef = React115.useRef(false);
|
|
18494
|
+
const markedReadyForMouseLeaveRef = React115.useRef(false);
|
|
18495
|
+
const touchActiveRef = React115.useRef(false);
|
|
18472
18496
|
const isEmpty = store.useState("isEmpty");
|
|
18473
18497
|
const toasts = store.useState("toasts");
|
|
18474
18498
|
const focused = store.useState("focused");
|
|
@@ -18477,7 +18501,7 @@ var ToastViewport = /* @__PURE__ */ React114.forwardRef(function ToastViewport2(
|
|
|
18477
18501
|
const frontmostHeight = toasts[0]?.height;
|
|
18478
18502
|
const hasTransitioningToasts = toasts.some((toast) => toast.transitionStatus === "ending");
|
|
18479
18503
|
const highPriorityToasts = toasts.filter((toast) => toast.priority === "high");
|
|
18480
|
-
|
|
18504
|
+
React115.useEffect(() => {
|
|
18481
18505
|
const viewport = store.state.viewport;
|
|
18482
18506
|
if (!viewport || isEmpty) {
|
|
18483
18507
|
return void 0;
|
|
@@ -18541,7 +18565,7 @@ var ToastViewport = /* @__PURE__ */ React114.forwardRef(function ToastViewport2(
|
|
|
18541
18565
|
store.set("hovering", false);
|
|
18542
18566
|
markedReadyForMouseLeaveRef.current = false;
|
|
18543
18567
|
}
|
|
18544
|
-
|
|
18568
|
+
React115.useEffect(flushMouseLeave, [hasTransitioningToasts, store]);
|
|
18545
18569
|
function handleMouseEnter() {
|
|
18546
18570
|
store.pauseTimers();
|
|
18547
18571
|
store.set("hovering", true);
|
|
@@ -18619,12 +18643,12 @@ var ToastViewport = /* @__PURE__ */ React114.forwardRef(function ToastViewport2(
|
|
|
18619
18643
|
ref: [forwardedRef, store.setViewport],
|
|
18620
18644
|
state,
|
|
18621
18645
|
props: [defaultProps, elementProps, {
|
|
18622
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
18646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(React115.Fragment, {
|
|
18623
18647
|
children: [focusGuard, children, focusGuard]
|
|
18624
18648
|
})
|
|
18625
18649
|
}]
|
|
18626
18650
|
});
|
|
18627
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
18651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(React115.Fragment, {
|
|
18628
18652
|
children: [focusGuard, element, !focused && highPriorityToasts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", {
|
|
18629
18653
|
style: visuallyHidden,
|
|
18630
18654
|
children: highPriorityToasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", {
|
|
@@ -18642,15 +18666,15 @@ var ToastViewport = /* @__PURE__ */ React114.forwardRef(function ToastViewport2(
|
|
|
18642
18666
|
if (process.env.NODE_ENV !== "production") ToastViewport.displayName = "ToastViewport";
|
|
18643
18667
|
|
|
18644
18668
|
// ../../node_modules/@base-ui/react/toast/root/ToastRoot.mjs
|
|
18645
|
-
var
|
|
18669
|
+
var React118 = __toESM(require("react"), 1);
|
|
18646
18670
|
var ReactDOM9 = __toESM(require("react-dom"), 1);
|
|
18647
18671
|
|
|
18648
18672
|
// ../../node_modules/@base-ui/react/toast/root/ToastRootContext.mjs
|
|
18649
|
-
var
|
|
18650
|
-
var ToastRootContext = /* @__PURE__ */
|
|
18673
|
+
var React116 = __toESM(require("react"), 1);
|
|
18674
|
+
var ToastRootContext = /* @__PURE__ */ React116.createContext(void 0);
|
|
18651
18675
|
if (process.env.NODE_ENV !== "production") ToastRootContext.displayName = "ToastRootContext";
|
|
18652
18676
|
function useToastRootContext() {
|
|
18653
|
-
const context =
|
|
18677
|
+
const context = React116.useContext(ToastRootContext);
|
|
18654
18678
|
if (!context) {
|
|
18655
18679
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." : formatErrorMessage_default(66));
|
|
18656
18680
|
}
|
|
@@ -18658,7 +18682,7 @@ function useToastRootContext() {
|
|
|
18658
18682
|
}
|
|
18659
18683
|
|
|
18660
18684
|
// ../../node_modules/@base-ui/react/utils/useSwipeDismiss.mjs
|
|
18661
|
-
var
|
|
18685
|
+
var React117 = __toESM(require("react"), 1);
|
|
18662
18686
|
|
|
18663
18687
|
// ../../node_modules/@base-ui/react/internals/clamp.mjs
|
|
18664
18688
|
function clamp2(val, min2 = Number.MIN_SAFE_INTEGER, max2 = Number.MAX_SAFE_INTEGER) {
|
|
@@ -18723,7 +18747,7 @@ var REVERSE_CANCEL_THRESHOLD = 10;
|
|
|
18723
18747
|
var OPPOSITE_DIRECTION_DAMPING_FACTOR = 0.5;
|
|
18724
18748
|
var MIN_DRAG_THRESHOLD = 1;
|
|
18725
18749
|
var TOAST_SWIPE_IGNORE_SELECTOR = `${BASE_UI_SWIPE_IGNORE_SELECTOR},${LEGACY_SWIPE_IGNORE_SELECTOR}`;
|
|
18726
|
-
var ToastRoot = /* @__PURE__ */
|
|
18750
|
+
var ToastRoot = /* @__PURE__ */ React118.forwardRef(function ToastRoot2(componentProps, forwardedRef) {
|
|
18727
18751
|
const {
|
|
18728
18752
|
toast,
|
|
18729
18753
|
render,
|
|
@@ -18739,46 +18763,46 @@ var ToastRoot = /* @__PURE__ */ React117.forwardRef(function ToastRoot2(componen
|
|
|
18739
18763
|
}
|
|
18740
18764
|
const swipeEnabled = swipeDirections.length > 0;
|
|
18741
18765
|
const store = useToastProviderContext();
|
|
18742
|
-
const [currentSwipeDirection, setCurrentSwipeDirection] =
|
|
18743
|
-
const [isSwiping, setIsSwiping] =
|
|
18744
|
-
const [isRealSwipe, setIsRealSwipe] =
|
|
18745
|
-
const [dragOffset, setDragOffset] =
|
|
18766
|
+
const [currentSwipeDirection, setCurrentSwipeDirection] = React118.useState(void 0);
|
|
18767
|
+
const [isSwiping, setIsSwiping] = React118.useState(false);
|
|
18768
|
+
const [isRealSwipe, setIsRealSwipe] = React118.useState(false);
|
|
18769
|
+
const [dragOffset, setDragOffset] = React118.useState({
|
|
18746
18770
|
x: 0,
|
|
18747
18771
|
y: 0
|
|
18748
18772
|
});
|
|
18749
|
-
const [initialTransform, setInitialTransform] =
|
|
18773
|
+
const [initialTransform, setInitialTransform] = React118.useState({
|
|
18750
18774
|
x: 0,
|
|
18751
18775
|
y: 0,
|
|
18752
18776
|
scale: 1
|
|
18753
18777
|
});
|
|
18754
|
-
const [titleId, setTitleId] =
|
|
18755
|
-
const [descriptionId, setDescriptionId] =
|
|
18756
|
-
const [lockedDirection, setLockedDirection] =
|
|
18757
|
-
const rootRef =
|
|
18758
|
-
const lastToastIdRef =
|
|
18759
|
-
const dragStartPosRef =
|
|
18778
|
+
const [titleId, setTitleId] = React118.useState();
|
|
18779
|
+
const [descriptionId, setDescriptionId] = React118.useState();
|
|
18780
|
+
const [lockedDirection, setLockedDirection] = React118.useState(null);
|
|
18781
|
+
const rootRef = React118.useRef(null);
|
|
18782
|
+
const lastToastIdRef = React118.useRef(void 0);
|
|
18783
|
+
const dragStartPosRef = React118.useRef({
|
|
18760
18784
|
x: 0,
|
|
18761
18785
|
y: 0
|
|
18762
18786
|
});
|
|
18763
|
-
const initialTransformRef =
|
|
18787
|
+
const initialTransformRef = React118.useRef({
|
|
18764
18788
|
x: 0,
|
|
18765
18789
|
y: 0,
|
|
18766
18790
|
scale: 1
|
|
18767
18791
|
});
|
|
18768
|
-
const intendedSwipeDirectionRef =
|
|
18769
|
-
const maxSwipeDisplacementRef =
|
|
18770
|
-
const cancelledSwipeRef =
|
|
18771
|
-
const swipeCancelBaselineRef =
|
|
18792
|
+
const intendedSwipeDirectionRef = React118.useRef(void 0);
|
|
18793
|
+
const maxSwipeDisplacementRef = React118.useRef(0);
|
|
18794
|
+
const cancelledSwipeRef = React118.useRef(false);
|
|
18795
|
+
const swipeCancelBaselineRef = React118.useRef({
|
|
18772
18796
|
x: 0,
|
|
18773
18797
|
y: 0
|
|
18774
18798
|
});
|
|
18775
|
-
const isFirstPointerMoveRef =
|
|
18776
|
-
const dragOffsetRef =
|
|
18799
|
+
const isFirstPointerMoveRef = React118.useRef(false);
|
|
18800
|
+
const dragOffsetRef = React118.useRef({
|
|
18777
18801
|
x: 0,
|
|
18778
18802
|
y: 0
|
|
18779
18803
|
});
|
|
18780
|
-
const activePointerIdRef =
|
|
18781
|
-
const dragAbortControllerRef =
|
|
18804
|
+
const activePointerIdRef = React118.useRef(null);
|
|
18805
|
+
const dragAbortControllerRef = React118.useRef(null);
|
|
18782
18806
|
const domIndex = store.useState("toastIndex", toast.id);
|
|
18783
18807
|
const visibleIndex = store.useState("toastVisibleIndex", toast.id);
|
|
18784
18808
|
const offsetY = store.useState("toastOffsetY", toast.id);
|
|
@@ -19046,7 +19070,7 @@ var ToastRoot = /* @__PURE__ */ React117.forwardRef(function ToastRoot2(componen
|
|
|
19046
19070
|
store.closeToast(toast.id);
|
|
19047
19071
|
}
|
|
19048
19072
|
}
|
|
19049
|
-
|
|
19073
|
+
React118.useEffect(() => {
|
|
19050
19074
|
const element2 = rootRef.current;
|
|
19051
19075
|
if (!swipeEnabled || !element2) {
|
|
19052
19076
|
return void 0;
|
|
@@ -19094,7 +19118,7 @@ var ToastRoot = /* @__PURE__ */ React117.forwardRef(function ToastRoot2(componen
|
|
|
19094
19118
|
["--toast-height"]: toast.height ? `${toast.height}px` : void 0
|
|
19095
19119
|
}
|
|
19096
19120
|
};
|
|
19097
|
-
const toastRoot =
|
|
19121
|
+
const toastRoot = React118.useMemo(() => ({
|
|
19098
19122
|
toast,
|
|
19099
19123
|
setTitleId,
|
|
19100
19124
|
setDescriptionId,
|
|
@@ -19124,8 +19148,8 @@ var ToastRoot = /* @__PURE__ */ React117.forwardRef(function ToastRoot2(componen
|
|
|
19124
19148
|
if (process.env.NODE_ENV !== "production") ToastRoot.displayName = "ToastRoot";
|
|
19125
19149
|
|
|
19126
19150
|
// ../../node_modules/@base-ui/react/toast/content/ToastContent.mjs
|
|
19127
|
-
var
|
|
19128
|
-
var ToastContent = /* @__PURE__ */
|
|
19151
|
+
var React119 = __toESM(require("react"), 1);
|
|
19152
|
+
var ToastContent = /* @__PURE__ */ React119.forwardRef(function ToastContent2(componentProps, forwardedRef) {
|
|
19129
19153
|
const {
|
|
19130
19154
|
render,
|
|
19131
19155
|
className,
|
|
@@ -19137,7 +19161,7 @@ var ToastContent = /* @__PURE__ */ React118.forwardRef(function ToastContent2(co
|
|
|
19137
19161
|
expanded,
|
|
19138
19162
|
recalculateHeight
|
|
19139
19163
|
} = useToastRootContext();
|
|
19140
|
-
const contentRef =
|
|
19164
|
+
const contentRef = React119.useRef(null);
|
|
19141
19165
|
useIsoLayoutEffect(() => {
|
|
19142
19166
|
recalculateHeight();
|
|
19143
19167
|
const node = contentRef.current;
|
|
@@ -19171,10 +19195,10 @@ var ToastContent = /* @__PURE__ */ React118.forwardRef(function ToastContent2(co
|
|
|
19171
19195
|
if (process.env.NODE_ENV !== "production") ToastContent.displayName = "ToastContent";
|
|
19172
19196
|
|
|
19173
19197
|
// ../../node_modules/@base-ui/react/toast/description/ToastDescription.mjs
|
|
19174
|
-
var
|
|
19198
|
+
var React121 = __toESM(require("react"), 1);
|
|
19175
19199
|
|
|
19176
19200
|
// ../../node_modules/@base-ui/react/toast/utils/isRenderableNode.mjs
|
|
19177
|
-
var
|
|
19201
|
+
var React120 = __toESM(require("react"), 1);
|
|
19178
19202
|
function isRenderableNode(node) {
|
|
19179
19203
|
if (node == null || typeof node === "boolean" || node === "") {
|
|
19180
19204
|
return false;
|
|
@@ -19185,7 +19209,7 @@ function isRenderableNode(node) {
|
|
|
19185
19209
|
return true;
|
|
19186
19210
|
}
|
|
19187
19211
|
function hasRenderableChildren(element) {
|
|
19188
|
-
return /* @__PURE__ */
|
|
19212
|
+
return /* @__PURE__ */ React120.isValidElement(element) && isRenderableNode(element.props.children);
|
|
19189
19213
|
}
|
|
19190
19214
|
|
|
19191
19215
|
// ../../node_modules/@base-ui/react/toast/utils/useToastLabelPart.mjs
|
|
@@ -19220,7 +19244,7 @@ function useToastLabelElement(element, id, setId) {
|
|
|
19220
19244
|
}
|
|
19221
19245
|
|
|
19222
19246
|
// ../../node_modules/@base-ui/react/toast/description/ToastDescription.mjs
|
|
19223
|
-
var ToastDescription = /* @__PURE__ */
|
|
19247
|
+
var ToastDescription = /* @__PURE__ */ React121.forwardRef(function ToastDescription2(componentProps, forwardedRef) {
|
|
19224
19248
|
const {
|
|
19225
19249
|
render,
|
|
19226
19250
|
className,
|
|
@@ -19252,8 +19276,8 @@ var ToastDescription = /* @__PURE__ */ React120.forwardRef(function ToastDescrip
|
|
|
19252
19276
|
if (process.env.NODE_ENV !== "production") ToastDescription.displayName = "ToastDescription";
|
|
19253
19277
|
|
|
19254
19278
|
// ../../node_modules/@base-ui/react/toast/title/ToastTitle.mjs
|
|
19255
|
-
var
|
|
19256
|
-
var ToastTitle = /* @__PURE__ */
|
|
19279
|
+
var React122 = __toESM(require("react"), 1);
|
|
19280
|
+
var ToastTitle = /* @__PURE__ */ React122.forwardRef(function ToastTitle2(componentProps, forwardedRef) {
|
|
19257
19281
|
const {
|
|
19258
19282
|
render,
|
|
19259
19283
|
className,
|
|
@@ -19285,8 +19309,8 @@ var ToastTitle = /* @__PURE__ */ React121.forwardRef(function ToastTitle2(compon
|
|
|
19285
19309
|
if (process.env.NODE_ENV !== "production") ToastTitle.displayName = "ToastTitle";
|
|
19286
19310
|
|
|
19287
19311
|
// ../../node_modules/@base-ui/react/toast/close/ToastClose.mjs
|
|
19288
|
-
var
|
|
19289
|
-
var ToastClose = /* @__PURE__ */
|
|
19312
|
+
var React123 = __toESM(require("react"), 1);
|
|
19313
|
+
var ToastClose = /* @__PURE__ */ React123.forwardRef(function ToastClose2(componentProps, forwardedRef) {
|
|
19290
19314
|
const {
|
|
19291
19315
|
render,
|
|
19292
19316
|
className,
|
|
@@ -19300,7 +19324,7 @@ var ToastClose = /* @__PURE__ */ React122.forwardRef(function ToastClose2(compon
|
|
|
19300
19324
|
toast,
|
|
19301
19325
|
expanded
|
|
19302
19326
|
} = useToastRootContext();
|
|
19303
|
-
const [hasFocus, setHasFocus] =
|
|
19327
|
+
const [hasFocus, setHasFocus] = React123.useState(false);
|
|
19304
19328
|
const {
|
|
19305
19329
|
getButtonProps,
|
|
19306
19330
|
buttonRef
|
|
@@ -19331,8 +19355,8 @@ var ToastClose = /* @__PURE__ */ React122.forwardRef(function ToastClose2(compon
|
|
|
19331
19355
|
if (process.env.NODE_ENV !== "production") ToastClose.displayName = "ToastClose";
|
|
19332
19356
|
|
|
19333
19357
|
// ../../node_modules/@base-ui/react/toast/action/ToastAction.mjs
|
|
19334
|
-
var
|
|
19335
|
-
var ToastAction = /* @__PURE__ */
|
|
19358
|
+
var React124 = __toESM(require("react"), 1);
|
|
19359
|
+
var ToastAction = /* @__PURE__ */ React124.forwardRef(function ToastAction2(componentProps, forwardedRef) {
|
|
19336
19360
|
const {
|
|
19337
19361
|
render,
|
|
19338
19362
|
className,
|
|
@@ -19367,9 +19391,9 @@ var ToastAction = /* @__PURE__ */ React123.forwardRef(function ToastAction2(comp
|
|
|
19367
19391
|
if (process.env.NODE_ENV !== "production") ToastAction.displayName = "ToastAction";
|
|
19368
19392
|
|
|
19369
19393
|
// ../../node_modules/@base-ui/react/toast/portal/ToastPortal.mjs
|
|
19370
|
-
var
|
|
19394
|
+
var React125 = __toESM(require("react"), 1);
|
|
19371
19395
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
19372
|
-
var ToastPortal = /* @__PURE__ */
|
|
19396
|
+
var ToastPortal = /* @__PURE__ */ React125.forwardRef(function ToastPortal2(props, forwardedRef) {
|
|
19373
19397
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FloatingPortalLite, {
|
|
19374
19398
|
ref: forwardedRef,
|
|
19375
19399
|
...props
|
|
@@ -19378,14 +19402,14 @@ var ToastPortal = /* @__PURE__ */ React124.forwardRef(function ToastPortal2(prop
|
|
|
19378
19402
|
if (process.env.NODE_ENV !== "production") ToastPortal.displayName = "ToastPortal";
|
|
19379
19403
|
|
|
19380
19404
|
// ../../node_modules/@base-ui/react/toast/positioner/ToastPositioner.mjs
|
|
19381
|
-
var
|
|
19405
|
+
var React127 = __toESM(require("react"), 1);
|
|
19382
19406
|
|
|
19383
19407
|
// ../../node_modules/@base-ui/react/toast/positioner/ToastPositionerContext.mjs
|
|
19384
|
-
var
|
|
19385
|
-
var ToastPositionerContext = /* @__PURE__ */
|
|
19408
|
+
var React126 = __toESM(require("react"), 1);
|
|
19409
|
+
var ToastPositionerContext = /* @__PURE__ */ React126.createContext(void 0);
|
|
19386
19410
|
if (process.env.NODE_ENV !== "production") ToastPositionerContext.displayName = "ToastPositionerContext";
|
|
19387
19411
|
function useToastPositionerContext() {
|
|
19388
|
-
const context =
|
|
19412
|
+
const context = React126.useContext(ToastPositionerContext);
|
|
19389
19413
|
if (context === void 0) {
|
|
19390
19414
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastPositionerContext is missing. ToastPositioner parts must be placed within <Toast.Positioner>." : formatErrorMessage_default(84));
|
|
19391
19415
|
}
|
|
@@ -19394,7 +19418,7 @@ function useToastPositionerContext() {
|
|
|
19394
19418
|
|
|
19395
19419
|
// ../../node_modules/@base-ui/react/toast/positioner/ToastPositioner.mjs
|
|
19396
19420
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
19397
|
-
var ToastPositioner = /* @__PURE__ */
|
|
19421
|
+
var ToastPositioner = /* @__PURE__ */ React127.forwardRef(function ToastPositioner2(componentProps, forwardedRef) {
|
|
19398
19422
|
const {
|
|
19399
19423
|
toast,
|
|
19400
19424
|
...props
|
|
@@ -19419,7 +19443,7 @@ var ToastPositioner = /* @__PURE__ */ React126.forwardRef(function ToastPosition
|
|
|
19419
19443
|
style: style2,
|
|
19420
19444
|
...elementProps
|
|
19421
19445
|
} = props;
|
|
19422
|
-
const [positionerElement, setPositionerElement] =
|
|
19446
|
+
const [positionerElement, setPositionerElement] = React127.useState(null);
|
|
19423
19447
|
const domIndex = store.useState("toastIndex", toast.id);
|
|
19424
19448
|
const visibleIndex = store.useState("toastVisibleIndex", toast.id);
|
|
19425
19449
|
const anchor = isElement(anchorProp) ? anchorProp : null;
|
|
@@ -19470,8 +19494,8 @@ var ToastPositioner = /* @__PURE__ */ React126.forwardRef(function ToastPosition
|
|
|
19470
19494
|
if (process.env.NODE_ENV !== "production") ToastPositioner.displayName = "ToastPositioner";
|
|
19471
19495
|
|
|
19472
19496
|
// ../../node_modules/@base-ui/react/toast/arrow/ToastArrow.mjs
|
|
19473
|
-
var
|
|
19474
|
-
var ToastArrow = /* @__PURE__ */
|
|
19497
|
+
var React128 = __toESM(require("react"), 1);
|
|
19498
|
+
var ToastArrow = /* @__PURE__ */ React128.forwardRef(function ToastArrow2(componentProps, forwardedRef) {
|
|
19475
19499
|
const {
|
|
19476
19500
|
className,
|
|
19477
19501
|
render,
|
|
@@ -19502,11 +19526,11 @@ var ToastArrow = /* @__PURE__ */ React127.forwardRef(function ToastArrow2(compon
|
|
|
19502
19526
|
if (process.env.NODE_ENV !== "production") ToastArrow.displayName = "ToastArrow";
|
|
19503
19527
|
|
|
19504
19528
|
// ../../node_modules/@base-ui/react/toast/useToastManager.mjs
|
|
19505
|
-
var
|
|
19529
|
+
var React129 = __toESM(require("react"), 1);
|
|
19506
19530
|
function useToastManager() {
|
|
19507
19531
|
const store = useToastProviderContext();
|
|
19508
19532
|
const toasts = store.useState("toasts");
|
|
19509
|
-
return
|
|
19533
|
+
return React129.useMemo(() => ({
|
|
19510
19534
|
toasts,
|
|
19511
19535
|
add: store.addToast,
|
|
19512
19536
|
close: store.closeToast,
|
|
@@ -19579,30 +19603,6 @@ function createToastManager() {
|
|
|
19579
19603
|
|
|
19580
19604
|
// src/components/Toast.tsx
|
|
19581
19605
|
var import_react25 = __toESM(require("react"));
|
|
19582
|
-
|
|
19583
|
-
// src/components/IconButton.tsx
|
|
19584
|
-
var React129 = __toESM(require("react"));
|
|
19585
|
-
var IconButton = React129.memo(
|
|
19586
|
-
React129.forwardRef(function IconButton2({ selected, iconName, color, size: size4, contentStyle, ...props }, forwardedRef) {
|
|
19587
|
-
const Icon2 = Icons[iconName];
|
|
19588
|
-
const style2 = React129.useMemo(() => {
|
|
19589
|
-
return {
|
|
19590
|
-
padding: "0 2px",
|
|
19591
|
-
...size4 && { minHeight: size4 },
|
|
19592
|
-
...contentStyle
|
|
19593
|
-
};
|
|
19594
|
-
}, [contentStyle, size4]);
|
|
19595
|
-
return /* @__PURE__ */ React129.createElement(Button, { ref: forwardedRef, ...props, variant: "none", contentStyle: style2 }, /* @__PURE__ */ React129.createElement(
|
|
19596
|
-
Icon2,
|
|
19597
|
-
{
|
|
19598
|
-
color: color ?? (selected ? cssVars.colors.iconSelected : cssVars.colors.icon),
|
|
19599
|
-
...size4 && { width: size4, height: size4 }
|
|
19600
|
-
}
|
|
19601
|
-
));
|
|
19602
|
-
})
|
|
19603
|
-
);
|
|
19604
|
-
|
|
19605
|
-
// src/components/Toast.tsx
|
|
19606
19606
|
var ToastContext2 = (0, import_react25.createContext)(null);
|
|
19607
19607
|
function useToast() {
|
|
19608
19608
|
const context = (0, import_react25.useContext)(ToastContext2);
|
|
@@ -20690,7 +20690,11 @@ var SubmittableTextInput = (0, import_react30.forwardRef)(function SubmittableTe
|
|
|
20690
20690
|
const handleSubmit = (0, import_react30.useCallback)(() => {
|
|
20691
20691
|
const submissionValue = isSubmitTriggeredByEscapeKey.current ? value : internalValue;
|
|
20692
20692
|
isSubmitTriggeredByEscapeKey.current = false;
|
|
20693
|
-
if (submissionValue === value && !allowSubmittingWithSameValue)
|
|
20693
|
+
if (submissionValue === value && !allowSubmittingWithSameValue) {
|
|
20694
|
+
userDidEdit.current = false;
|
|
20695
|
+
setInternalValue(latestValue.current);
|
|
20696
|
+
return;
|
|
20697
|
+
}
|
|
20694
20698
|
onSubmit(submissionValue);
|
|
20695
20699
|
userDidEdit.current = false;
|
|
20696
20700
|
setInternalValue(latestValue.current);
|
|
@@ -20709,12 +20713,16 @@ var SubmittableTextInput = (0, import_react30.forwardRef)(function SubmittableTe
|
|
|
20709
20713
|
event.stopPropagation();
|
|
20710
20714
|
} else if (event.key === "Escape") {
|
|
20711
20715
|
isSubmitTriggeredByEscapeKey.current = true;
|
|
20716
|
+
if (internalValue !== value) {
|
|
20717
|
+
event.preventDefault();
|
|
20718
|
+
event.stopPropagation();
|
|
20719
|
+
}
|
|
20712
20720
|
ref.current?.blur();
|
|
20713
20721
|
} else {
|
|
20714
20722
|
onKeyDown?.(event);
|
|
20715
20723
|
}
|
|
20716
20724
|
},
|
|
20717
|
-
[onKeyDown, handleSubmit]
|
|
20725
|
+
[onKeyDown, handleSubmit, internalValue, value]
|
|
20718
20726
|
);
|
|
20719
20727
|
const handleChange = (0, import_react30.useCallback)(
|
|
20720
20728
|
(event) => {
|
|
@@ -20733,13 +20741,27 @@ var SubmittableTextInput = (0, import_react30.forwardRef)(function SubmittableTe
|
|
|
20733
20741
|
},
|
|
20734
20742
|
[onBlur, onFocusChange, handleSubmit, submitOnBlur]
|
|
20735
20743
|
);
|
|
20744
|
+
const isFocusingFromPointer = (0, import_react30.useRef)(false);
|
|
20745
|
+
const handleMouseDown = (0, import_react30.useCallback)((event) => {
|
|
20746
|
+
if (document.activeElement !== event.currentTarget) {
|
|
20747
|
+
isFocusingFromPointer.current = true;
|
|
20748
|
+
}
|
|
20749
|
+
}, []);
|
|
20736
20750
|
const handleFocusCapture = (0, import_react30.useCallback)(
|
|
20737
20751
|
(event) => {
|
|
20738
20752
|
onFocusCapture?.(event);
|
|
20739
20753
|
onFocusChange?.(true);
|
|
20754
|
+
if (isFocusingFromPointer.current) {
|
|
20755
|
+
event.currentTarget.select();
|
|
20756
|
+
}
|
|
20740
20757
|
},
|
|
20741
20758
|
[onFocusCapture, onFocusChange]
|
|
20742
20759
|
);
|
|
20760
|
+
const handleMouseUp = (0, import_react30.useCallback)((event) => {
|
|
20761
|
+
if (!isFocusingFromPointer.current) return;
|
|
20762
|
+
isFocusingFromPointer.current = false;
|
|
20763
|
+
event.preventDefault();
|
|
20764
|
+
}, []);
|
|
20743
20765
|
const autoSubmitTimeoutRef = (0, import_react30.useRef)(
|
|
20744
20766
|
null
|
|
20745
20767
|
);
|
|
@@ -20770,7 +20792,9 @@ var SubmittableTextInput = (0, import_react30.forwardRef)(function SubmittableTe
|
|
|
20770
20792
|
onKeyDown: handleKeyDown,
|
|
20771
20793
|
onChange: handleChange,
|
|
20772
20794
|
onBlur: handleBlur,
|
|
20773
|
-
onFocusCapture: handleFocusCapture
|
|
20795
|
+
onFocusCapture: handleFocusCapture,
|
|
20796
|
+
onMouseDown: handleMouseDown,
|
|
20797
|
+
onMouseUp: handleMouseUp
|
|
20774
20798
|
}
|
|
20775
20799
|
);
|
|
20776
20800
|
});
|
|
@@ -21815,6 +21839,7 @@ function Popover({
|
|
|
21815
21839
|
closable,
|
|
21816
21840
|
open,
|
|
21817
21841
|
side,
|
|
21842
|
+
align = "center",
|
|
21818
21843
|
sideOffset = 4,
|
|
21819
21844
|
showArrow = true,
|
|
21820
21845
|
onOpenChange,
|
|
@@ -21823,7 +21848,8 @@ function Popover({
|
|
|
21823
21848
|
portalContainer,
|
|
21824
21849
|
style: style2,
|
|
21825
21850
|
initialFocus,
|
|
21826
|
-
shouldCloseOnInteractOutside
|
|
21851
|
+
shouldCloseOnInteractOutside,
|
|
21852
|
+
nativeButtonTrigger = true
|
|
21827
21853
|
}) {
|
|
21828
21854
|
const defaultId = (0, import_react33.useId)();
|
|
21829
21855
|
const portalScopeId = usePortalScopeId();
|
|
@@ -21845,6 +21871,7 @@ function Popover({
|
|
|
21845
21871
|
return /* @__PURE__ */ import_react33.default.createElement(index_parts_exports5.Root, { open: isOpen, onOpenChange: handleOpenChange }, /* @__PURE__ */ import_react33.default.createElement(
|
|
21846
21872
|
index_parts_exports5.Trigger,
|
|
21847
21873
|
{
|
|
21874
|
+
nativeButton: nativeButtonTrigger,
|
|
21848
21875
|
render: (triggerProps) => {
|
|
21849
21876
|
const element = import_react33.default.isValidElement(trigger) ? trigger : /* @__PURE__ */ import_react33.default.createElement("span", null, trigger);
|
|
21850
21877
|
const childProps = element.props;
|
|
@@ -21870,7 +21897,7 @@ function Popover({
|
|
|
21870
21897
|
...portalScopeProps(portalScopeId),
|
|
21871
21898
|
anchor: anchorElement,
|
|
21872
21899
|
side,
|
|
21873
|
-
align
|
|
21900
|
+
align,
|
|
21874
21901
|
sideOffset,
|
|
21875
21902
|
collisionPadding: 8,
|
|
21876
21903
|
arrowPadding: 2,
|
|
@@ -22297,7 +22324,8 @@ function InputFieldRoot({
|
|
|
22297
22324
|
trigger: rootElement,
|
|
22298
22325
|
initialFocus: false,
|
|
22299
22326
|
sideOffset,
|
|
22300
|
-
showArrow: false
|
|
22327
|
+
showArrow: false,
|
|
22328
|
+
nativeButtonTrigger: false
|
|
22301
22329
|
},
|
|
22302
22330
|
measuredWidthObject && /* @__PURE__ */ import_react34.default.createElement(
|
|
22303
22331
|
"div",
|
|
@@ -22783,7 +22811,10 @@ var styles = {
|
|
|
22783
22811
|
marginRight: -CHECKBOX_RIGHT_INSET
|
|
22784
22812
|
}
|
|
22785
22813
|
},
|
|
22786
|
-
|
|
22814
|
+
// n-outline-none: the popup itself can take focus (e.g. a right-click
|
|
22815
|
+
// context menu) and the browser's default focus outline reads as a stray
|
|
22816
|
+
// black border on the light surface; keyboard focus is shown on items.
|
|
22817
|
+
contentStyle: "n-rounded n-bg-popover-background n-text-text n-shadow-popover n-z-menu n-py-1 n-outline-none"
|
|
22787
22818
|
};
|
|
22788
22819
|
function getKeyboardShortcuts(item) {
|
|
22789
22820
|
if (item.type === "separator") return [];
|
|
@@ -22863,6 +22894,7 @@ var SectionHeaderMenuItem = (0, import_react39.memo)(function SectionHeaderMenuI
|
|
|
22863
22894
|
});
|
|
22864
22895
|
|
|
22865
22896
|
// src/components/DropdownMenu.tsx
|
|
22897
|
+
var MenuContentStyleContext = import_react40.default.createContext(void 0);
|
|
22866
22898
|
var itemStyle = (state) => cx(
|
|
22867
22899
|
"n-flex-none n-select-none n-cursor-pointer n-rounded",
|
|
22868
22900
|
"n-py-1.5 n-px-2",
|
|
@@ -22903,6 +22935,7 @@ function SubmenuItem({
|
|
|
22903
22935
|
portalScopeId
|
|
22904
22936
|
}) {
|
|
22905
22937
|
const [open, setOpen] = (0, import_react40.useState)(false);
|
|
22938
|
+
const inheritedContentStyle = import_react40.default.useContext(MenuContentStyleContext);
|
|
22906
22939
|
const submenuHasCheckedItem = item.items.some(
|
|
22907
22940
|
(subItem) => isSelectableMenuItem(subItem) && subItem.checked
|
|
22908
22941
|
);
|
|
@@ -22946,14 +22979,21 @@ function SubmenuItem({
|
|
|
22946
22979
|
alignOffset: -5,
|
|
22947
22980
|
className: "n-z-menu n-outline-none"
|
|
22948
22981
|
},
|
|
22949
|
-
/* @__PURE__ */ import_react40.default.createElement(
|
|
22950
|
-
|
|
22982
|
+
/* @__PURE__ */ import_react40.default.createElement(
|
|
22983
|
+
index_parts_exports.Popup,
|
|
22951
22984
|
{
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
|
|
22955
|
-
|
|
22956
|
-
|
|
22985
|
+
className: styles.contentStyle,
|
|
22986
|
+
style: inheritedContentStyle
|
|
22987
|
+
},
|
|
22988
|
+
/* @__PURE__ */ import_react40.default.createElement(
|
|
22989
|
+
MenuViewport3,
|
|
22990
|
+
{
|
|
22991
|
+
items: item.items,
|
|
22992
|
+
onSelect,
|
|
22993
|
+
hasCheckedItem: submenuHasCheckedItem
|
|
22994
|
+
}
|
|
22995
|
+
)
|
|
22996
|
+
)
|
|
22957
22997
|
))
|
|
22958
22998
|
);
|
|
22959
22999
|
}
|
|
@@ -23069,7 +23109,7 @@ var DropdownMenuRoot = forwardRefGeneric(function DropdownMenuRoot2(props, forwa
|
|
|
23069
23109
|
(item) => isSelectableMenuItem(item) && item.checked
|
|
23070
23110
|
);
|
|
23071
23111
|
const childContent = typeof children === "function" ? children({ open }) : children || /* @__PURE__ */ import_react40.default.createElement(Button, { icon, active: open, iconRight: "DropdownChevronIcon" }, title);
|
|
23072
|
-
const isNativeButton = import_react40.default.isValidElement(childContent) && (childContent.type === "button" || childContent.type === Button && childContent.props.as !== "a");
|
|
23112
|
+
const isNativeButton = import_react40.default.isValidElement(childContent) && (childContent.type === "button" || (childContent.type === Button || childContent.type === IconButton) && childContent.props.as !== "a");
|
|
23073
23113
|
return /* @__PURE__ */ import_react40.default.createElement(
|
|
23074
23114
|
index_parts_exports.Root,
|
|
23075
23115
|
{
|
|
@@ -23120,14 +23160,14 @@ var DropdownMenuRoot = forwardRefGeneric(function DropdownMenuRoot2(props, forwa
|
|
|
23120
23160
|
collisionPadding,
|
|
23121
23161
|
className: "n-z-menu n-outline-none"
|
|
23122
23162
|
},
|
|
23123
|
-
/* @__PURE__ */ import_react40.default.createElement(index_parts_exports.Popup, { className: styles.contentStyle, style: contentStyles }, items.length === 0 ? emptyState : null, /* @__PURE__ */ import_react40.default.createElement(
|
|
23163
|
+
/* @__PURE__ */ import_react40.default.createElement(index_parts_exports.Popup, { className: styles.contentStyle, style: contentStyles }, /* @__PURE__ */ import_react40.default.createElement(MenuContentStyleContext.Provider, { value: contentStyle }, items.length === 0 ? emptyState : null, /* @__PURE__ */ import_react40.default.createElement(
|
|
23124
23164
|
MenuViewport3,
|
|
23125
23165
|
{
|
|
23126
23166
|
items,
|
|
23127
23167
|
onSelect,
|
|
23128
23168
|
hasCheckedItem
|
|
23129
23169
|
}
|
|
23130
|
-
))
|
|
23170
|
+
)))
|
|
23131
23171
|
))
|
|
23132
23172
|
);
|
|
23133
23173
|
});
|
|
@@ -25141,6 +25181,7 @@ if (process.env.NODE_ENV !== "production") ContextMenuTrigger.displayName = "Con
|
|
|
25141
25181
|
var import_noya_icons6 = require("@noya-app/noya-icons");
|
|
25142
25182
|
var import_noya_keymap4 = require("@noya-app/noya-keymap");
|
|
25143
25183
|
var import_react57 = __toESM(require("react"));
|
|
25184
|
+
var ContextMenuContentStyleContext = import_react57.default.createContext(void 0);
|
|
25144
25185
|
var itemStyle2 = (state) => cx(
|
|
25145
25186
|
"n-flex-none n-select-none n-cursor-pointer n-rounded",
|
|
25146
25187
|
"n-py-1.5 n-px-2",
|
|
@@ -25181,6 +25222,9 @@ function SubmenuItem2({
|
|
|
25181
25222
|
portalScopeId
|
|
25182
25223
|
}) {
|
|
25183
25224
|
const [open, setOpen] = (0, import_react57.useState)(false);
|
|
25225
|
+
const inheritedContentStyle = import_react57.default.useContext(
|
|
25226
|
+
ContextMenuContentStyleContext
|
|
25227
|
+
);
|
|
25184
25228
|
const submenuHasCheckedItem = item.items.some(
|
|
25185
25229
|
(subItem) => isSelectableMenuItem(subItem) && subItem.checked
|
|
25186
25230
|
);
|
|
@@ -25220,14 +25264,21 @@ function SubmenuItem2({
|
|
|
25220
25264
|
alignOffset: -5,
|
|
25221
25265
|
className: "n-z-menu n-outline-none"
|
|
25222
25266
|
},
|
|
25223
|
-
/* @__PURE__ */ import_react57.default.createElement(
|
|
25224
|
-
|
|
25267
|
+
/* @__PURE__ */ import_react57.default.createElement(
|
|
25268
|
+
index_parts_exports7.Popup,
|
|
25225
25269
|
{
|
|
25226
|
-
|
|
25227
|
-
|
|
25228
|
-
|
|
25229
|
-
|
|
25230
|
-
|
|
25270
|
+
className: styles.contentStyle,
|
|
25271
|
+
style: inheritedContentStyle
|
|
25272
|
+
},
|
|
25273
|
+
/* @__PURE__ */ import_react57.default.createElement(
|
|
25274
|
+
ContextMenuViewport,
|
|
25275
|
+
{
|
|
25276
|
+
items: item.items,
|
|
25277
|
+
onSelect,
|
|
25278
|
+
hasCheckedItem: submenuHasCheckedItem
|
|
25279
|
+
}
|
|
25280
|
+
)
|
|
25281
|
+
)
|
|
25231
25282
|
))
|
|
25232
25283
|
);
|
|
25233
25284
|
}
|
|
@@ -25304,7 +25355,8 @@ function ContextMenuRoot2({
|
|
|
25304
25355
|
children,
|
|
25305
25356
|
onSelect,
|
|
25306
25357
|
shouldBindKeyboardShortcuts,
|
|
25307
|
-
onOpenChange
|
|
25358
|
+
onOpenChange,
|
|
25359
|
+
contentStyle
|
|
25308
25360
|
}) {
|
|
25309
25361
|
const keymap = (0, import_react57.useMemo)(
|
|
25310
25362
|
() => shouldBindKeyboardShortcuts === false ? {} : getKeyboardShortcutsForMenuItems(items, onSelect),
|
|
@@ -25339,14 +25391,21 @@ function ContextMenuRoot2({
|
|
|
25339
25391
|
...portalScopeProps(portalScopeId),
|
|
25340
25392
|
className: "n-z-menu n-outline-none"
|
|
25341
25393
|
},
|
|
25342
|
-
/* @__PURE__ */ import_react57.default.createElement(
|
|
25343
|
-
|
|
25394
|
+
/* @__PURE__ */ import_react57.default.createElement(
|
|
25395
|
+
index_parts_exports7.Popup,
|
|
25344
25396
|
{
|
|
25345
|
-
|
|
25346
|
-
|
|
25347
|
-
|
|
25348
|
-
}
|
|
25349
|
-
|
|
25397
|
+
className: styles.contentStyle,
|
|
25398
|
+
style: contentStyle
|
|
25399
|
+
},
|
|
25400
|
+
/* @__PURE__ */ import_react57.default.createElement(ContextMenuContentStyleContext.Provider, { value: contentStyle }, /* @__PURE__ */ import_react57.default.createElement(
|
|
25401
|
+
ContextMenuViewport,
|
|
25402
|
+
{
|
|
25403
|
+
items,
|
|
25404
|
+
onSelect: handleSelectItem,
|
|
25405
|
+
hasCheckedItem
|
|
25406
|
+
}
|
|
25407
|
+
))
|
|
25408
|
+
)
|
|
25350
25409
|
)));
|
|
25351
25410
|
}
|
|
25352
25411
|
var ContextMenu = memoGeneric(ContextMenuRoot2);
|
|
@@ -26968,6 +27027,32 @@ var ListViewEditableRowTitle = (0, import_react61.memo)(function ListViewEditabl
|
|
|
26968
27027
|
selectBeforeDot = false
|
|
26969
27028
|
}) {
|
|
26970
27029
|
const inputRef = (0, import_react61.useRef)(null);
|
|
27030
|
+
const submittedRef = (0, import_react61.useRef)(false);
|
|
27031
|
+
const handleSubmitEditing = (nextValue) => {
|
|
27032
|
+
if (submittedRef.current) return;
|
|
27033
|
+
submittedRef.current = true;
|
|
27034
|
+
onSubmitEditing(nextValue);
|
|
27035
|
+
};
|
|
27036
|
+
const handleSubmitEditingRef = (0, import_react61.useRef)(handleSubmitEditing);
|
|
27037
|
+
handleSubmitEditingRef.current = handleSubmitEditing;
|
|
27038
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
27039
|
+
const handlePointerDown = (event) => {
|
|
27040
|
+
const element = inputRef.current;
|
|
27041
|
+
if (!element) return;
|
|
27042
|
+
if (event.target instanceof Node && (element === event.target || element.contains(event.target))) {
|
|
27043
|
+
return;
|
|
27044
|
+
}
|
|
27045
|
+
handleSubmitEditingRef.current(element.value);
|
|
27046
|
+
};
|
|
27047
|
+
document.addEventListener("pointerdown", handlePointerDown, {
|
|
27048
|
+
capture: true
|
|
27049
|
+
});
|
|
27050
|
+
return () => {
|
|
27051
|
+
document.removeEventListener("pointerdown", handlePointerDown, {
|
|
27052
|
+
capture: true
|
|
27053
|
+
});
|
|
27054
|
+
};
|
|
27055
|
+
}, []);
|
|
26971
27056
|
(0, import_react61.useLayoutEffect)(() => {
|
|
26972
27057
|
const element = inputRef.current;
|
|
26973
27058
|
if (!element || !autoFocus) return;
|
|
@@ -26994,7 +27079,7 @@ var ListViewEditableRowTitle = (0, import_react61.memo)(function ListViewEditabl
|
|
|
26994
27079
|
ref: inputRef,
|
|
26995
27080
|
value,
|
|
26996
27081
|
placeholder,
|
|
26997
|
-
onSubmit:
|
|
27082
|
+
onSubmit: handleSubmitEditing,
|
|
26998
27083
|
allowSubmittingWithSameValue: true,
|
|
26999
27084
|
className: cx(
|
|
27000
27085
|
"-n-mx-input-padding-x -n-my-1 n-bg-listview-editing-background",
|
|
@@ -27992,7 +28077,10 @@ function SortableItem({
|
|
|
27992
28077
|
ref,
|
|
27993
28078
|
...attributes,
|
|
27994
28079
|
...listeners,
|
|
27995
|
-
|
|
28080
|
+
// Only set an inline opacity while dragging — an always-on inline
|
|
28081
|
+
// `opacity: 1` would override class-based opacity styling on rows
|
|
28082
|
+
// (e.g. dimmed hidden layers).
|
|
28083
|
+
...isDragging ? { style: { opacity: 0.5 } } : {}
|
|
27996
28084
|
}),
|
|
27997
28085
|
[ref, attributes, listeners, isDragging]
|
|
27998
28086
|
);
|
|
@@ -28498,6 +28586,9 @@ var RowContainer = (0, import_react67.forwardRef)(
|
|
|
28498
28586
|
$clickable ? "n-cursor-pointer" : "n-cursor-default",
|
|
28499
28587
|
$isSectionHeader && "n-bg-listview-raised-background",
|
|
28500
28588
|
"n-flex n-flex-[0_0_auto] n-select-none n-items-center n-relative",
|
|
28589
|
+
// Rows own their focus styling: the standard primary ring for
|
|
28590
|
+
// keyboard focus instead of the UA default black outline.
|
|
28591
|
+
"n-outline-none focus-visible:n-ring-1 focus-visible:n-ring-primary focus-visible:n-ring-inset",
|
|
28501
28592
|
className
|
|
28502
28593
|
),
|
|
28503
28594
|
style: {
|
|
@@ -29082,9 +29173,11 @@ var List = memoGeneric(
|
|
|
29082
29173
|
},
|
|
29083
29174
|
onKeyDown: (e) => {
|
|
29084
29175
|
if (e.key !== "Enter" && e.key !== " ") return;
|
|
29176
|
+
if (e.nativeEvent.defaultPrevented) return;
|
|
29085
29177
|
e.preventDefault();
|
|
29178
|
+
e.stopPropagation();
|
|
29086
29179
|
handleSelect(id, e);
|
|
29087
|
-
if (e.key === "Enter") {
|
|
29180
|
+
if (e.key === "Enter" && !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) {
|
|
29088
29181
|
setRenamingId(id);
|
|
29089
29182
|
}
|
|
29090
29183
|
},
|
|
@@ -29114,7 +29207,9 @@ var List = memoGeneric(
|
|
|
29114
29207
|
"div",
|
|
29115
29208
|
{
|
|
29116
29209
|
className: cx(
|
|
29117
|
-
|
|
29210
|
+
// outline-none: focusable-by-click (tabIndex -1)
|
|
29211
|
+
// wrapper must never show the UA focus outline.
|
|
29212
|
+
"n-overflow-hidden n-flex-none n-flex n-items-center n-justify-center n-outline-none",
|
|
29118
29213
|
thumbnailSize === "auto" && thumbnailSizeMap[size4],
|
|
29119
29214
|
isSelected && "n-text-selected-list-item-text",
|
|
29120
29215
|
roundedMap[size4]
|
|
@@ -29126,7 +29221,7 @@ var List = memoGeneric(
|
|
|
29126
29221
|
/* @__PURE__ */ import_react70.default.createElement("div", { className: "n-flex n-flex-col n-flex-1 n-w-0" }, /* @__PURE__ */ import_react70.default.createElement("div", { className: "n-flex n-items-center n-min-h-input-height n-flex-1 n-gap-2" }, /* @__PURE__ */ import_react70.default.createElement(
|
|
29127
29222
|
"div",
|
|
29128
29223
|
{
|
|
29129
|
-
className: "n-flex-1 n-w-0 n-flex n-items-center",
|
|
29224
|
+
className: "n-flex-1 n-w-0 n-flex n-items-center n-outline-none",
|
|
29130
29225
|
tabIndex: -1
|
|
29131
29226
|
},
|
|
29132
29227
|
isRenaming ? /* @__PURE__ */ import_react70.default.createElement(
|
|
@@ -29332,9 +29427,9 @@ var rgbaToHsva = ({ r, g, b, a }) => {
|
|
|
29332
29427
|
const delta = max2 - Math.min(r, g, b);
|
|
29333
29428
|
const hh = delta ? max2 === r ? (g - b) / delta : max2 === g ? 2 + (b - r) / delta : 4 + (r - g) / delta : 0;
|
|
29334
29429
|
return {
|
|
29335
|
-
h: (0, import_noya_utils10.round)(60 * (hh < 0 ? hh + 6 : hh)),
|
|
29336
|
-
s: (0, import_noya_utils10.round)(max2 ? delta / max2 * 100 : 0),
|
|
29337
|
-
v: (0, import_noya_utils10.round)(max2 / 255 * 100),
|
|
29430
|
+
h: (0, import_noya_utils10.round)(60 * (hh < 0 ? hh + 6 : hh), 2),
|
|
29431
|
+
s: (0, import_noya_utils10.round)(max2 ? delta / max2 * 100 : 0, 2),
|
|
29432
|
+
v: (0, import_noya_utils10.round)(max2 / 255 * 100, 2),
|
|
29338
29433
|
a
|
|
29339
29434
|
};
|
|
29340
29435
|
};
|
|
@@ -30021,6 +30116,53 @@ function fuzzyFilter({
|
|
|
30021
30116
|
if (!query) return scoredItems;
|
|
30022
30117
|
return scoredItems.filter(({ score }) => score > scoreThreshold).sort((a, b) => b.score - a.score);
|
|
30023
30118
|
}
|
|
30119
|
+
function wordPrefixFilter({
|
|
30120
|
+
items,
|
|
30121
|
+
query
|
|
30122
|
+
}) {
|
|
30123
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
30124
|
+
if (!normalizedQuery) {
|
|
30125
|
+
return items.map((_, index2) => ({ index: index2, score: 0 }));
|
|
30126
|
+
}
|
|
30127
|
+
const boundaryMatches = [];
|
|
30128
|
+
const substringMatches = [];
|
|
30129
|
+
items.forEach((text, index2) => {
|
|
30130
|
+
const lower = text.toLowerCase();
|
|
30131
|
+
const makeItem = (score, start) => ({
|
|
30132
|
+
index: index2,
|
|
30133
|
+
score,
|
|
30134
|
+
labelMatch: [{ start, end: start + normalizedQuery.length }]
|
|
30135
|
+
});
|
|
30136
|
+
if (lower === normalizedQuery) {
|
|
30137
|
+
boundaryMatches.push({
|
|
30138
|
+
index: index2,
|
|
30139
|
+
score: 4e3,
|
|
30140
|
+
labelMatch: [{ start: 0, end: text.length }]
|
|
30141
|
+
});
|
|
30142
|
+
return;
|
|
30143
|
+
}
|
|
30144
|
+
if (lower.startsWith(normalizedQuery)) {
|
|
30145
|
+
boundaryMatches.push(makeItem(3e3, 0));
|
|
30146
|
+
return;
|
|
30147
|
+
}
|
|
30148
|
+
const wordStart = lower.search(
|
|
30149
|
+
new RegExp(`[\\s-]${escapeRegExp(normalizedQuery)}`)
|
|
30150
|
+
);
|
|
30151
|
+
if (wordStart !== -1) {
|
|
30152
|
+
boundaryMatches.push(makeItem(2e3 - wordStart, wordStart + 1));
|
|
30153
|
+
return;
|
|
30154
|
+
}
|
|
30155
|
+
const substringIndex = lower.indexOf(normalizedQuery);
|
|
30156
|
+
if (substringIndex !== -1) {
|
|
30157
|
+
substringMatches.push(makeItem(1, substringIndex));
|
|
30158
|
+
}
|
|
30159
|
+
});
|
|
30160
|
+
const result = boundaryMatches.length > 0 ? boundaryMatches : substringMatches;
|
|
30161
|
+
return result.sort((a, b) => b.score - a.score);
|
|
30162
|
+
}
|
|
30163
|
+
function escapeRegExp(value) {
|
|
30164
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
30165
|
+
}
|
|
30024
30166
|
function fuzzyTokenize({
|
|
30025
30167
|
item,
|
|
30026
30168
|
itemScore
|
|
@@ -30084,7 +30226,9 @@ var ComboboxState = class {
|
|
|
30084
30226
|
subscribers = [];
|
|
30085
30227
|
version = 0;
|
|
30086
30228
|
_cachedSnapshot;
|
|
30087
|
-
|
|
30229
|
+
filterStrategy;
|
|
30230
|
+
constructor(items, initialTitle, allowArbitraryValues, filterStrategy = "fuzzy") {
|
|
30231
|
+
this.filterStrategy = filterStrategy;
|
|
30088
30232
|
this.items = items;
|
|
30089
30233
|
this.lastSubmittedValue = {
|
|
30090
30234
|
filter: initialTitle,
|
|
@@ -30147,7 +30291,9 @@ var ComboboxState = class {
|
|
|
30147
30291
|
this.subscribers.forEach((listener) => listener());
|
|
30148
30292
|
}
|
|
30149
30293
|
getFilteredItems() {
|
|
30150
|
-
return filterWithGroupedSections(this.items, this.filter
|
|
30294
|
+
return filterWithGroupedSections(this.items, this.filter, {
|
|
30295
|
+
filterStrategy: this.filterStrategy
|
|
30296
|
+
});
|
|
30151
30297
|
}
|
|
30152
30298
|
getSnapshot = () => {
|
|
30153
30299
|
if (this._cachedSnapshot && this._cachedSnapshot[0] === this.version) {
|
|
@@ -30270,7 +30416,8 @@ var ComboboxState = class {
|
|
|
30270
30416
|
this.notifyChange();
|
|
30271
30417
|
}
|
|
30272
30418
|
};
|
|
30273
|
-
function filterWithGroupedSections(items, query) {
|
|
30419
|
+
function filterWithGroupedSections(items, query, options = {}) {
|
|
30420
|
+
const filterItems = options.filterStrategy === "wordPrefix" ? wordPrefixFilter : fuzzyFilter;
|
|
30274
30421
|
const sections = (0, import_noya_utils13.chunkBy)(items, (_a, b) => isSelectableMenuItem(b));
|
|
30275
30422
|
let result = [];
|
|
30276
30423
|
let currentIndex = 0;
|
|
@@ -30300,7 +30447,7 @@ function filterWithGroupedSections(items, query) {
|
|
|
30300
30447
|
(item, index2) => createExtraItem(item, index2)
|
|
30301
30448
|
);
|
|
30302
30449
|
} else {
|
|
30303
|
-
const scoredItems =
|
|
30450
|
+
const scoredItems = filterItems({
|
|
30304
30451
|
items: selectableItems.map((item) => {
|
|
30305
30452
|
const title = item.title?.toString?.() ?? "";
|
|
30306
30453
|
const tooltipText = getNodeText(item.tooltip);
|
|
@@ -30376,7 +30523,8 @@ var ComboboxMenu = memoGeneric(
|
|
|
30376
30523
|
indented,
|
|
30377
30524
|
iconPosition = "right",
|
|
30378
30525
|
itemHeight,
|
|
30379
|
-
getRowHeightForItem
|
|
30526
|
+
getRowHeightForItem,
|
|
30527
|
+
renderItemContent
|
|
30380
30528
|
}, forwardedRef) {
|
|
30381
30529
|
return /* @__PURE__ */ import_react75.default.createElement(
|
|
30382
30530
|
ListView.Root,
|
|
@@ -30429,17 +30577,20 @@ var ComboboxMenu = memoGeneric(
|
|
|
30429
30577
|
{
|
|
30430
30578
|
size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET
|
|
30431
30579
|
}
|
|
30432
|
-
) : null, iconPosition === "left" && item.icon && /* @__PURE__ */ import_react75.default.createElement(import_react75.default.Fragment, null, /* @__PURE__ */ import_react75.default.createElement(MenuIcon, { icon: item.icon }), /* @__PURE__ */ import_react75.default.createElement(Spacer.Horizontal, { size: 8 })), /* @__PURE__ */ import_react75.default.createElement("div", { className: "n-flex n-flex-col n-min-w-0 n-flex-1" },
|
|
30433
|
-
"
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30441
|
-
|
|
30442
|
-
|
|
30580
|
+
) : null, iconPosition === "left" && item.icon && /* @__PURE__ */ import_react75.default.createElement(import_react75.default.Fragment, null, /* @__PURE__ */ import_react75.default.createElement(MenuIcon, { icon: item.icon }), /* @__PURE__ */ import_react75.default.createElement(Spacer.Horizontal, { size: 8 })), /* @__PURE__ */ import_react75.default.createElement("div", { className: "n-flex n-flex-col n-min-w-0 n-flex-1" }, (() => {
|
|
30581
|
+
const defaultContent = /* @__PURE__ */ import_react75.default.createElement("div", { className: "n-min-w-0 n-truncate" }, tokens.map((token, j) => /* @__PURE__ */ import_react75.default.createElement(
|
|
30582
|
+
"span",
|
|
30583
|
+
{
|
|
30584
|
+
key: `${item.value}-token-${j}`,
|
|
30585
|
+
className: cx(
|
|
30586
|
+
token.type === "match" ? "n-font-bold" : "n-font-normal",
|
|
30587
|
+
"n-whitespace-pre n-truncate"
|
|
30588
|
+
)
|
|
30589
|
+
},
|
|
30590
|
+
token.text
|
|
30591
|
+
)));
|
|
30592
|
+
return renderItemContent ? renderItemContent(item, defaultContent) : defaultContent;
|
|
30593
|
+
})(), tooltip && /* @__PURE__ */ import_react75.default.createElement(Small, { color: "textSubtle", className: "n-truncate" }, tooltip))),
|
|
30443
30594
|
(item.shortcut || item.icon && iconPosition === "right") && /* @__PURE__ */ import_react75.default.createElement("div", { className: "n-flex n-items-center n-min-w-0 n-ml-2" }, item.shortcut ? /* @__PURE__ */ import_react75.default.createElement(KeyboardShortcut, { shortcut: item.shortcut }) : item.icon && /* @__PURE__ */ import_react75.default.createElement(MenuIcon, { icon: item.icon }))
|
|
30444
30595
|
);
|
|
30445
30596
|
}
|
|
@@ -30470,6 +30621,8 @@ var Combobox = memoGeneric(
|
|
|
30470
30621
|
onFocus,
|
|
30471
30622
|
onDeleteWhenEmpty,
|
|
30472
30623
|
iconPosition = "right",
|
|
30624
|
+
renderItemContent,
|
|
30625
|
+
filterStrategy = "fuzzy",
|
|
30473
30626
|
...rest
|
|
30474
30627
|
}, forwardedRef) {
|
|
30475
30628
|
const props = (0, import_react76.useMemo)(() => {
|
|
@@ -30522,7 +30675,8 @@ var Combobox = memoGeneric(
|
|
|
30522
30675
|
() => new ComboboxState(
|
|
30523
30676
|
items,
|
|
30524
30677
|
initialValueString,
|
|
30525
|
-
props.mode === "string" && (props.allowArbitraryValues ?? false)
|
|
30678
|
+
props.mode === "string" && (props.allowArbitraryValues ?? false),
|
|
30679
|
+
filterStrategy
|
|
30526
30680
|
)
|
|
30527
30681
|
);
|
|
30528
30682
|
const state = useComboboxState(comboboxState);
|
|
@@ -30825,7 +30979,9 @@ var Combobox = memoGeneric(
|
|
|
30825
30979
|
menuItemsCount,
|
|
30826
30980
|
sectionHeaderCount,
|
|
30827
30981
|
tallMenuItemsCount,
|
|
30828
|
-
|
|
30982
|
+
// Whole rows only: a half-cut last row reads as a rendering bug
|
|
30983
|
+
// rather than a scrollable list.
|
|
30984
|
+
maxBaseRows: 10
|
|
30829
30985
|
});
|
|
30830
30986
|
const adjustedListSize = { width, height: computedHeight };
|
|
30831
30987
|
return /* @__PURE__ */ import_react76.default.createElement(
|
|
@@ -30846,6 +31002,7 @@ var Combobox = memoGeneric(
|
|
|
30846
31002
|
onHoverIndex: handleIndexChange,
|
|
30847
31003
|
listSize: adjustedListSize,
|
|
30848
31004
|
iconPosition,
|
|
31005
|
+
renderItemContent,
|
|
30849
31006
|
style: {
|
|
30850
31007
|
flex: `0 0 ${computedHeight}px`
|
|
30851
31008
|
},
|
|
@@ -32107,8 +32264,8 @@ var SegmentedControlItem = (0, import_react86.forwardRef)(function SegmentedCont
|
|
|
32107
32264
|
// checked
|
|
32108
32265
|
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" ? (
|
|
32109
32266
|
// default variant: only text color, background handled by sliding indicator
|
|
32110
|
-
colorScheme === "secondary" || colorScheme === "primary" ? "data-[pressed]:n-text-white" : "data-[pressed]:n-text-segmented-control-item-active-text"
|
|
32111
|
-
) : 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",
|
|
32267
|
+
colorScheme === "secondary" || colorScheme === "primary" ? "data-[pressed]:n-text-white" : colorScheme === "primaryTint" ? "data-[pressed]:n-text-primary" : "data-[pressed]:n-text-segmented-control-item-active-text"
|
|
32268
|
+
) : colorScheme === "secondary" ? "data-[pressed]:n-bg-secondary data-[pressed]:n-text-white" : colorScheme === "primary" ? "data-[pressed]:n-bg-primary data-[pressed]:n-text-white" : colorScheme === "primaryTint" ? "data-[pressed]:n-bg-primary-pastel data-[pressed]:n-text-primary" : "data-[pressed]:n-bg-segmented-control-item-active-background data-[pressed]:n-text-segmented-control-item-active-text",
|
|
32112
32269
|
"focus-visible:n-z-interactable",
|
|
32113
32270
|
// checked default (all colorSchemes) - hide separators near selected
|
|
32114
32271
|
variant === "default" && "data-[pressed]:after:n-hidden [&:has(+[data-pressed])]:after:n-hidden",
|
|
@@ -32316,7 +32473,7 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
32316
32473
|
() => ({ colorScheme, onSelect: handleSelect, itemWidth, isCompact }),
|
|
32317
32474
|
[colorScheme, handleSelect, itemWidth, isCompact]
|
|
32318
32475
|
);
|
|
32319
|
-
const indicatorBgClass = colorScheme === "secondary" ? "n-bg-secondary" : colorScheme === "primary" ? "n-bg-primary" : "n-bg-segmented-control-item-active-background";
|
|
32476
|
+
const indicatorBgClass = colorScheme === "secondary" ? "n-bg-secondary" : colorScheme === "primary" ? "n-bg-primary" : colorScheme === "primaryTint" ? "n-bg-primary-pastel" : "n-bg-segmented-control-item-active-background";
|
|
32320
32477
|
return /* @__PURE__ */ import_react86.default.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react86.default.createElement(
|
|
32321
32478
|
ToggleGroup,
|
|
32322
32479
|
{
|
|
@@ -36250,6 +36407,7 @@ var InspectorContainer = (0, import_react95.memo)(
|
|
|
36250
36407
|
header,
|
|
36251
36408
|
children,
|
|
36252
36409
|
fallback,
|
|
36410
|
+
footer,
|
|
36253
36411
|
showDividers,
|
|
36254
36412
|
id,
|
|
36255
36413
|
className,
|
|
@@ -36270,7 +36428,15 @@ var InspectorContainer = (0, import_react95.memo)(
|
|
|
36270
36428
|
}
|
|
36271
36429
|
},
|
|
36272
36430
|
header,
|
|
36273
|
-
children ? /* @__PURE__ */ import_react95.default.createElement(ScrollArea, { className: "n-flex-1 n-min-h-0" }, /* @__PURE__ */ import_react95.default.createElement(
|
|
36431
|
+
children ? /* @__PURE__ */ import_react95.default.createElement(ScrollArea, { className: "n-flex-1 n-min-h-0" }, /* @__PURE__ */ import_react95.default.createElement(
|
|
36432
|
+
"div",
|
|
36433
|
+
{
|
|
36434
|
+
className: "n-flex n-flex-col n-relative",
|
|
36435
|
+
style: footer != null ? { minHeight: "100%" } : void 0
|
|
36436
|
+
},
|
|
36437
|
+
showDividers ? withSeparatorElements(children, /* @__PURE__ */ import_react95.default.createElement(Divider, null)) : children,
|
|
36438
|
+
footer != null && /* @__PURE__ */ import_react95.default.createElement(import_react95.default.Fragment, null, /* @__PURE__ */ import_react95.default.createElement("div", { className: "n-flex-1" }), footer)
|
|
36439
|
+
)) : fallback ? /* @__PURE__ */ import_react95.default.createElement("div", { className: "n-flex n-flex-col n-relative n-h-full" }, fallback) : null
|
|
36274
36440
|
);
|
|
36275
36441
|
})
|
|
36276
36442
|
);
|
|
@@ -36922,6 +37088,24 @@ function ScrollableSidebar({ children }) {
|
|
|
36922
37088
|
|
|
36923
37089
|
// src/components/Section.tsx
|
|
36924
37090
|
var import_react104 = __toESM(require("react"));
|
|
37091
|
+
var SectionHeaderShell = ({
|
|
37092
|
+
className,
|
|
37093
|
+
...props
|
|
37094
|
+
}) => /* @__PURE__ */ import_react104.default.createElement("div", { className: cx(`n-flex n-items-center`, className), ...props });
|
|
37095
|
+
var TitleShell = ({
|
|
37096
|
+
className,
|
|
37097
|
+
$textStyle,
|
|
37098
|
+
...props
|
|
37099
|
+
}) => /* @__PURE__ */ import_react104.default.createElement(
|
|
37100
|
+
"div",
|
|
37101
|
+
{
|
|
37102
|
+
className: cx(
|
|
37103
|
+
`n-flex n-select-none ${$textStyle ? `${textStyles[$textStyle]} n-text-text` : "n-font-sans n-text-label n-text-text-muted n-font-semibold"} `,
|
|
37104
|
+
className
|
|
37105
|
+
),
|
|
37106
|
+
...props
|
|
37107
|
+
}
|
|
37108
|
+
);
|
|
36925
37109
|
var titleIconStyle = {
|
|
36926
37110
|
marginRight: "6px",
|
|
36927
37111
|
alignSelf: "flex-start",
|
|
@@ -36949,34 +37133,16 @@ function SectionHeader({
|
|
|
36949
37133
|
}),
|
|
36950
37134
|
[style2]
|
|
36951
37135
|
);
|
|
36952
|
-
const titleElement = title ? /* @__PURE__ */ import_react104.default.createElement(
|
|
36953
|
-
|
|
36954
|
-
|
|
36955
|
-
$textStyle: titleTextStyle,
|
|
36956
|
-
className: titleClassName
|
|
36957
|
-
},
|
|
36958
|
-
title
|
|
36959
|
-
) : null;
|
|
36960
|
-
return /* @__PURE__ */ import_react104.default.createElement(
|
|
36961
|
-
InspectorPrimitives_exports.SectionHeader,
|
|
37136
|
+
const titleElement = title ? /* @__PURE__ */ import_react104.default.createElement(TitleShell, { $textStyle: titleTextStyle, className: titleClassName }, title) : null;
|
|
37137
|
+
return /* @__PURE__ */ import_react104.default.createElement(SectionHeaderShell, { style: headerStyle, className }, titleIcon && /* @__PURE__ */ import_react104.default.createElement("div", { style: titleIconStyle, className: textStyles[titleTextStyle] }, "\u200B", renderIcon(titleIcon)), titleElement && /* @__PURE__ */ import_react104.default.createElement(import_react104.default.Fragment, null, onClickTitle ? /* @__PURE__ */ import_react104.default.createElement(Button, { variant: "none", onClick: onClickTitle }, titleElement) : titleElement), headerSeparator === "space" && /* @__PURE__ */ import_react104.default.createElement(Spacer.Horizontal, null), headerSeparator === "dot" && /* @__PURE__ */ import_react104.default.createElement(
|
|
37138
|
+
Text,
|
|
36962
37139
|
{
|
|
36963
|
-
|
|
36964
|
-
|
|
37140
|
+
variant: titleTextStyle,
|
|
37141
|
+
color: "textDisabled",
|
|
37142
|
+
style: { padding: "0 4px" }
|
|
36965
37143
|
},
|
|
36966
|
-
|
|
36967
|
-
|
|
36968
|
-
headerSeparator === "space" && /* @__PURE__ */ import_react104.default.createElement(Spacer.Horizontal, null),
|
|
36969
|
-
headerSeparator === "dot" && /* @__PURE__ */ import_react104.default.createElement(
|
|
36970
|
-
Text,
|
|
36971
|
-
{
|
|
36972
|
-
variant: titleTextStyle,
|
|
36973
|
-
color: "textDisabled",
|
|
36974
|
-
style: { padding: "0 4px" }
|
|
36975
|
-
},
|
|
36976
|
-
"\u2022"
|
|
36977
|
-
),
|
|
36978
|
-
right
|
|
36979
|
-
);
|
|
37144
|
+
"\u2022"
|
|
37145
|
+
), right);
|
|
36980
37146
|
}
|
|
36981
37147
|
var SectionInternal = ({
|
|
36982
37148
|
children,
|
|
@@ -37060,14 +37226,516 @@ var Section = (0, import_react104.memo)(function InspectorSection({
|
|
|
37060
37226
|
});
|
|
37061
37227
|
|
|
37062
37228
|
// src/components/SelectionToolbar.tsx
|
|
37063
|
-
var
|
|
37064
|
-
var
|
|
37229
|
+
var import_react109 = require("@floating-ui/react");
|
|
37230
|
+
var import_react110 = __toESM(require("react"));
|
|
37065
37231
|
|
|
37066
37232
|
// src/components/Toolbar.tsx
|
|
37233
|
+
var import_react108 = __toESM(require("react"));
|
|
37234
|
+
|
|
37235
|
+
// src/components/ToolbarItems.tsx
|
|
37236
|
+
var import_react107 = __toESM(require("react"));
|
|
37237
|
+
|
|
37238
|
+
// src/components/AppToolbar.tsx
|
|
37239
|
+
var import_noya_keymap6 = require("@noya-app/noya-keymap");
|
|
37240
|
+
var import_react106 = __toESM(require("react"));
|
|
37241
|
+
|
|
37242
|
+
// src/components/ToolbarDrawer.tsx
|
|
37067
37243
|
var import_react105 = __toESM(require("react"));
|
|
37068
|
-
var
|
|
37069
|
-
function
|
|
37070
|
-
return /* @__PURE__ */ import_react105.default.createElement(
|
|
37244
|
+
var ToolbarDrawer = (0, import_react105.memo)(
|
|
37245
|
+
(0, import_react105.forwardRef)(function ToolbarDrawer2({ children, trigger, sideOffset = 8 }, ref) {
|
|
37246
|
+
return /* @__PURE__ */ import_react105.default.createElement("div", { className: "n-relative", ref }, /* @__PURE__ */ import_react105.default.createElement(
|
|
37247
|
+
"div",
|
|
37248
|
+
{
|
|
37249
|
+
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",
|
|
37250
|
+
style: {
|
|
37251
|
+
marginBottom: `${sideOffset}px`,
|
|
37252
|
+
boxShadow: "0px -2px 12px 0px var(--n-toolbar-drawer-shadow)"
|
|
37253
|
+
}
|
|
37254
|
+
},
|
|
37255
|
+
children
|
|
37256
|
+
), trigger);
|
|
37257
|
+
})
|
|
37258
|
+
);
|
|
37259
|
+
|
|
37260
|
+
// src/components/AppToolbar.tsx
|
|
37261
|
+
var SIDE_OFFSET = 6;
|
|
37262
|
+
var ToolbarMenuContext = (0, import_react106.createContext)({});
|
|
37263
|
+
var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
37264
|
+
item,
|
|
37265
|
+
onSelectMenuItem,
|
|
37266
|
+
onPopoverOpenChange
|
|
37267
|
+
}) {
|
|
37268
|
+
const [open, setOpen] = import_react106.default.useState(false);
|
|
37269
|
+
const handleOpenChange = import_react106.default.useCallback(
|
|
37270
|
+
(newOpen) => {
|
|
37271
|
+
setOpen(newOpen);
|
|
37272
|
+
onPopoverOpenChange?.(newOpen);
|
|
37273
|
+
},
|
|
37274
|
+
[onPopoverOpenChange]
|
|
37275
|
+
);
|
|
37276
|
+
return /* @__PURE__ */ import_react106.default.createElement(
|
|
37277
|
+
DropdownMenu,
|
|
37278
|
+
{
|
|
37279
|
+
open,
|
|
37280
|
+
onOpenChange: handleOpenChange,
|
|
37281
|
+
items: item.items,
|
|
37282
|
+
modal: false,
|
|
37283
|
+
onSelect: (value) => {
|
|
37284
|
+
if (onSelectMenuItem && value) {
|
|
37285
|
+
onSelectMenuItem(value);
|
|
37286
|
+
}
|
|
37287
|
+
}
|
|
37288
|
+
},
|
|
37289
|
+
/* @__PURE__ */ import_react106.default.createElement(
|
|
37290
|
+
Button,
|
|
37291
|
+
{
|
|
37292
|
+
disabled: item.disabled,
|
|
37293
|
+
active: item.checked || open,
|
|
37294
|
+
icon: item.icon,
|
|
37295
|
+
iconRight: item.icon === "DotsVerticalIcon" || item.icon === "DotsHorizontalIcon" ? void 0 : "DropdownChevronIcon"
|
|
37296
|
+
},
|
|
37297
|
+
item.title
|
|
37298
|
+
)
|
|
37299
|
+
);
|
|
37300
|
+
});
|
|
37301
|
+
var ToolbarShortcut = ({
|
|
37302
|
+
shortcut,
|
|
37303
|
+
label
|
|
37304
|
+
}) => {
|
|
37305
|
+
return /* @__PURE__ */ import_react106.default.createElement("div", { className: "n-flex n-items-center" }, label, /* @__PURE__ */ import_react106.default.createElement(Spacer.Horizontal, { size: 6 }), /* @__PURE__ */ import_react106.default.createElement(KeyboardShortcut, { shortcut }));
|
|
37306
|
+
};
|
|
37307
|
+
var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
37308
|
+
item,
|
|
37309
|
+
portalContainer,
|
|
37310
|
+
onPopoverOpenChange
|
|
37311
|
+
}) {
|
|
37312
|
+
const {
|
|
37313
|
+
disabled: disabled2,
|
|
37314
|
+
icon,
|
|
37315
|
+
title,
|
|
37316
|
+
tooltip,
|
|
37317
|
+
content: itemContent,
|
|
37318
|
+
checked,
|
|
37319
|
+
popoverClassName,
|
|
37320
|
+
triggerProps: buttonProps
|
|
37321
|
+
} = item;
|
|
37322
|
+
const [open, setOpen] = import_react106.default.useState(false);
|
|
37323
|
+
const handleOpenChange = import_react106.default.useCallback(
|
|
37324
|
+
(newOpen) => {
|
|
37325
|
+
setOpen(newOpen);
|
|
37326
|
+
onPopoverOpenChange?.(newOpen);
|
|
37327
|
+
},
|
|
37328
|
+
[onPopoverOpenChange]
|
|
37329
|
+
);
|
|
37330
|
+
const { useDialogOnSmallScreen, isSmallScreen, openDialog } = (0, import_react106.useContext)(ToolbarMenuContext);
|
|
37331
|
+
const shouldUseDialog = useDialogOnSmallScreen && isSmallScreen && openDialog;
|
|
37332
|
+
const handleOpenDialog = import_react106.default.useCallback(() => {
|
|
37333
|
+
if (!openDialog) return;
|
|
37334
|
+
handleOpenChange(true);
|
|
37335
|
+
const dialogContent = typeof itemContent === "function" ? (props) => /* @__PURE__ */ import_react106.default.createElement("div", { className: "-n-m-3" }, itemContent(props)) : /* @__PURE__ */ import_react106.default.createElement("div", { className: "-n-m-3" }, itemContent);
|
|
37336
|
+
const dialog = openDialog({
|
|
37337
|
+
title,
|
|
37338
|
+
children: dialogContent
|
|
37339
|
+
});
|
|
37340
|
+
dialog.then(() => handleOpenChange(false));
|
|
37341
|
+
}, [openDialog, itemContent, title, handleOpenChange]);
|
|
37342
|
+
const trigger = /* @__PURE__ */ import_react106.default.createElement(
|
|
37343
|
+
Button,
|
|
37344
|
+
{
|
|
37345
|
+
disabled: disabled2,
|
|
37346
|
+
active: checked || open,
|
|
37347
|
+
icon,
|
|
37348
|
+
iconRight: "DropdownChevronIcon",
|
|
37349
|
+
onClick: shouldUseDialog ? handleOpenDialog : void 0,
|
|
37350
|
+
...buttonProps
|
|
37351
|
+
},
|
|
37352
|
+
title
|
|
37353
|
+
);
|
|
37354
|
+
if (shouldUseDialog) {
|
|
37355
|
+
return tooltip && !open ? /* @__PURE__ */ import_react106.default.createElement(
|
|
37356
|
+
Tooltip,
|
|
37357
|
+
{
|
|
37358
|
+
sideOffset: SIDE_OFFSET,
|
|
37359
|
+
side: "top",
|
|
37360
|
+
content: tooltip,
|
|
37361
|
+
portalContainer
|
|
37362
|
+
},
|
|
37363
|
+
trigger
|
|
37364
|
+
) : trigger;
|
|
37365
|
+
}
|
|
37366
|
+
const content = /* @__PURE__ */ import_react106.default.createElement("span", null, /* @__PURE__ */ import_react106.default.createElement(
|
|
37367
|
+
Popover,
|
|
37368
|
+
{
|
|
37369
|
+
open,
|
|
37370
|
+
onOpenChange: handleOpenChange,
|
|
37371
|
+
side: "top",
|
|
37372
|
+
showArrow: false,
|
|
37373
|
+
sideOffset: SIDE_OFFSET,
|
|
37374
|
+
portalContainer,
|
|
37375
|
+
trigger,
|
|
37376
|
+
className: popoverClassName
|
|
37377
|
+
},
|
|
37378
|
+
typeof itemContent === "function" ? itemContent({ close: () => handleOpenChange(false) }) : itemContent
|
|
37379
|
+
));
|
|
37380
|
+
return tooltip && !open ? /* @__PURE__ */ import_react106.default.createElement(
|
|
37381
|
+
Tooltip,
|
|
37382
|
+
{
|
|
37383
|
+
sideOffset: SIDE_OFFSET,
|
|
37384
|
+
side: "top",
|
|
37385
|
+
content: tooltip,
|
|
37386
|
+
portalContainer
|
|
37387
|
+
},
|
|
37388
|
+
content
|
|
37389
|
+
) : content;
|
|
37390
|
+
});
|
|
37391
|
+
var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
37392
|
+
item,
|
|
37393
|
+
onSelectMenuItem,
|
|
37394
|
+
as,
|
|
37395
|
+
activeValue,
|
|
37396
|
+
tooltipSide,
|
|
37397
|
+
displayFilter
|
|
37398
|
+
}) {
|
|
37399
|
+
const isActive = item.checked || activeValue === item.value;
|
|
37400
|
+
const content = /* @__PURE__ */ import_react106.default.createElement(
|
|
37401
|
+
Button,
|
|
37402
|
+
{
|
|
37403
|
+
as,
|
|
37404
|
+
disabled: item.disabled,
|
|
37405
|
+
active: isActive,
|
|
37406
|
+
icon: displayFilter === "textOnly" ? void 0 : item.icon,
|
|
37407
|
+
...as === "a" && { href: item.value },
|
|
37408
|
+
onClick: () => {
|
|
37409
|
+
if (onSelectMenuItem && item.value) {
|
|
37410
|
+
onSelectMenuItem(item.value);
|
|
37411
|
+
}
|
|
37412
|
+
}
|
|
37413
|
+
},
|
|
37414
|
+
displayFilter === "iconOnly" ? void 0 : item.title
|
|
37415
|
+
);
|
|
37416
|
+
const tooltip = item.tooltip ?? (displayFilter === "iconOnly" && item.title ? item.title : void 0);
|
|
37417
|
+
return item.drawer && isActive ? /* @__PURE__ */ import_react106.default.createElement(ToolbarDrawer, { trigger: content }, item.drawer) : tooltip ? /* @__PURE__ */ import_react106.default.createElement(Tooltip, { sideOffset: SIDE_OFFSET, content: tooltip, side: tooltipSide }, content) : content;
|
|
37418
|
+
});
|
|
37419
|
+
var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
37420
|
+
item,
|
|
37421
|
+
onSelectMenuItem,
|
|
37422
|
+
buttonAs,
|
|
37423
|
+
activeValue,
|
|
37424
|
+
tooltipSide,
|
|
37425
|
+
portalContainer,
|
|
37426
|
+
displayFilter,
|
|
37427
|
+
dividerOverflow: dividerOverflowProp,
|
|
37428
|
+
onPopoverOpenChange
|
|
37429
|
+
}) {
|
|
37430
|
+
const { dividerOverflow: contextDividerOverflow } = (0, import_react106.useContext)(ToolbarMenuContext);
|
|
37431
|
+
const dividerOverflow = dividerOverflowProp ?? contextDividerOverflow ?? 4;
|
|
37432
|
+
if (item.type === "sectionHeader") return null;
|
|
37433
|
+
if (item.type === "separator") {
|
|
37434
|
+
return /* @__PURE__ */ import_react106.default.createElement(DividerVertical, { overflow: dividerOverflow });
|
|
37435
|
+
}
|
|
37436
|
+
if (item.type === "popover") {
|
|
37437
|
+
return /* @__PURE__ */ import_react106.default.createElement(
|
|
37438
|
+
ToolbarMenuPopover,
|
|
37439
|
+
{
|
|
37440
|
+
item,
|
|
37441
|
+
portalContainer,
|
|
37442
|
+
onPopoverOpenChange
|
|
37443
|
+
}
|
|
37444
|
+
);
|
|
37445
|
+
}
|
|
37446
|
+
if (isSelectableMenuItem(item)) {
|
|
37447
|
+
return /* @__PURE__ */ import_react106.default.createElement(
|
|
37448
|
+
ToolbarMenuButton,
|
|
37449
|
+
{
|
|
37450
|
+
item,
|
|
37451
|
+
onSelectMenuItem,
|
|
37452
|
+
as: buttonAs,
|
|
37453
|
+
activeValue,
|
|
37454
|
+
tooltipSide,
|
|
37455
|
+
displayFilter
|
|
37456
|
+
}
|
|
37457
|
+
);
|
|
37458
|
+
}
|
|
37459
|
+
return /* @__PURE__ */ import_react106.default.createElement(
|
|
37460
|
+
ToolbarMenuDropdown,
|
|
37461
|
+
{
|
|
37462
|
+
item,
|
|
37463
|
+
onSelectMenuItem,
|
|
37464
|
+
onPopoverOpenChange
|
|
37465
|
+
}
|
|
37466
|
+
);
|
|
37467
|
+
});
|
|
37468
|
+
var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
37469
|
+
items,
|
|
37470
|
+
onSelectMenuItem,
|
|
37471
|
+
buttonAs,
|
|
37472
|
+
activeValue,
|
|
37473
|
+
tooltipSide,
|
|
37474
|
+
portalContainer,
|
|
37475
|
+
displayFilter = "iconAndText",
|
|
37476
|
+
dividerOverflow,
|
|
37477
|
+
onPopoverOpenChange
|
|
37478
|
+
}) {
|
|
37479
|
+
return /* @__PURE__ */ import_react106.default.createElement(import_react106.default.Fragment, null, items.map((item, i) => {
|
|
37480
|
+
return /* @__PURE__ */ import_react106.default.createElement(
|
|
37481
|
+
ToolbarMenuItem,
|
|
37482
|
+
{
|
|
37483
|
+
key: i,
|
|
37484
|
+
item,
|
|
37485
|
+
onSelectMenuItem,
|
|
37486
|
+
buttonAs,
|
|
37487
|
+
activeValue,
|
|
37488
|
+
tooltipSide,
|
|
37489
|
+
portalContainer,
|
|
37490
|
+
displayFilter,
|
|
37491
|
+
dividerOverflow,
|
|
37492
|
+
onPopoverOpenChange
|
|
37493
|
+
}
|
|
37494
|
+
);
|
|
37495
|
+
}));
|
|
37496
|
+
});
|
|
37497
|
+
function useBindKeyboardShortcutsForMenuItems(items, onSelectMenuItem) {
|
|
37498
|
+
return (0, import_noya_keymap6.useKeyboardShortcuts)(
|
|
37499
|
+
import_react106.default.useMemo(
|
|
37500
|
+
() => onSelectMenuItem ? getKeyboardShortcutsForMenuItems(items, onSelectMenuItem) : {},
|
|
37501
|
+
[items, onSelectMenuItem]
|
|
37502
|
+
)
|
|
37503
|
+
);
|
|
37504
|
+
}
|
|
37505
|
+
function AppToolbar({
|
|
37506
|
+
children,
|
|
37507
|
+
logo,
|
|
37508
|
+
leftMenuItems = [],
|
|
37509
|
+
rightMenuItems = [],
|
|
37510
|
+
onSelectMenuItem,
|
|
37511
|
+
shouldBindKeyboardShortcuts = true,
|
|
37512
|
+
dividerOverflow
|
|
37513
|
+
}) {
|
|
37514
|
+
const allMenuItems = import_react106.default.useMemo(
|
|
37515
|
+
() => [...leftMenuItems, ...rightMenuItems],
|
|
37516
|
+
[leftMenuItems, rightMenuItems]
|
|
37517
|
+
);
|
|
37518
|
+
useBindKeyboardShortcutsForMenuItems(
|
|
37519
|
+
allMenuItems,
|
|
37520
|
+
shouldBindKeyboardShortcuts ? onSelectMenuItem : void 0
|
|
37521
|
+
);
|
|
37522
|
+
return /* @__PURE__ */ import_react106.default.createElement(
|
|
37523
|
+
BaseToolbar,
|
|
37524
|
+
{
|
|
37525
|
+
logo,
|
|
37526
|
+
left: leftMenuItems.length > 0 && /* @__PURE__ */ import_react106.default.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ import_react106.default.createElement(
|
|
37527
|
+
ToolbarMenu,
|
|
37528
|
+
{
|
|
37529
|
+
items: leftMenuItems,
|
|
37530
|
+
onSelectMenuItem,
|
|
37531
|
+
dividerOverflow
|
|
37532
|
+
}
|
|
37533
|
+
)),
|
|
37534
|
+
right: rightMenuItems.length > 0 && /* @__PURE__ */ import_react106.default.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ import_react106.default.createElement(
|
|
37535
|
+
ToolbarMenu,
|
|
37536
|
+
{
|
|
37537
|
+
items: rightMenuItems,
|
|
37538
|
+
onSelectMenuItem,
|
|
37539
|
+
dividerOverflow
|
|
37540
|
+
}
|
|
37541
|
+
))
|
|
37542
|
+
},
|
|
37543
|
+
children
|
|
37544
|
+
);
|
|
37545
|
+
}
|
|
37546
|
+
|
|
37547
|
+
// src/components/ToolbarItems.tsx
|
|
37548
|
+
var POPUP_OFFSET = 10;
|
|
37549
|
+
function labelForTitle(title) {
|
|
37550
|
+
return typeof title === "string" ? title : void 0;
|
|
37551
|
+
}
|
|
37552
|
+
function ToolbarItemButton({
|
|
37553
|
+
item,
|
|
37554
|
+
tooltipSide,
|
|
37555
|
+
onClick
|
|
37556
|
+
}) {
|
|
37557
|
+
const label = labelForTitle(item.title);
|
|
37558
|
+
const button = /* @__PURE__ */ import_react107.default.createElement(
|
|
37559
|
+
"button",
|
|
37560
|
+
{
|
|
37561
|
+
type: "button",
|
|
37562
|
+
"aria-label": label,
|
|
37563
|
+
"aria-pressed": item.checked ?? false,
|
|
37564
|
+
disabled: item.disabled,
|
|
37565
|
+
onClick,
|
|
37566
|
+
className: cx(
|
|
37567
|
+
"n-flex n-h-input-height n-flex-none n-cursor-default n-items-center n-justify-center n-rounded n-border-0 n-outline-none n-transition-colors focus-visible:n-ring-2 focus-visible:n-ring-primary",
|
|
37568
|
+
// Icon items are square at the design system's floating-toolbar
|
|
37569
|
+
// control size (27px, see Button variant="floating" and
|
|
37570
|
+
// INPUT_HEIGHT); text titles get auto width with the same padding
|
|
37571
|
+
// and type style as the popover text trigger.
|
|
37572
|
+
item.icon ? "n-w-input-height n-p-0" : "n-px-2 n-py-0 n-font-sans n-text-[12px] n-font-medium",
|
|
37573
|
+
item.checked ? "n-bg-primary n-text-white" : "n-bg-transparent n-text-text hover:n-bg-input-background-light",
|
|
37574
|
+
item.disabled && "n-pointer-events-none n-opacity-30"
|
|
37575
|
+
)
|
|
37576
|
+
},
|
|
37577
|
+
item.icon ? renderIcon(item.icon) : item.title
|
|
37578
|
+
);
|
|
37579
|
+
if (item.disabled) return button;
|
|
37580
|
+
return /* @__PURE__ */ import_react107.default.createElement(
|
|
37581
|
+
Tooltip,
|
|
37582
|
+
{
|
|
37583
|
+
side: tooltipSide,
|
|
37584
|
+
sideOffset: POPUP_OFFSET,
|
|
37585
|
+
content: item.tooltip ?? (item.shortcut ? /* @__PURE__ */ import_react107.default.createElement(ToolbarShortcut, { shortcut: item.shortcut, label: item.title }) : item.title)
|
|
37586
|
+
},
|
|
37587
|
+
button
|
|
37588
|
+
);
|
|
37589
|
+
}
|
|
37590
|
+
function renderGroupChevron({
|
|
37591
|
+
label,
|
|
37592
|
+
open,
|
|
37593
|
+
disabled: disabled2
|
|
37594
|
+
}) {
|
|
37595
|
+
return /* @__PURE__ */ import_react107.default.createElement(
|
|
37596
|
+
"button",
|
|
37597
|
+
{
|
|
37598
|
+
type: "button",
|
|
37599
|
+
"aria-label": label,
|
|
37600
|
+
disabled: disabled2,
|
|
37601
|
+
className: cx(
|
|
37602
|
+
"n--ml-0.5 n-flex n-h-input-height n-w-3.5 n-flex-none n-cursor-default n-items-center n-justify-center n-rounded n-border-0 n-p-0 n-outline-none n-transition-colors focus-visible:n-ring-2 focus-visible:n-ring-primary",
|
|
37603
|
+
open ? "n-bg-input-background-light n-text-text" : "n-bg-transparent n-text-text-muted hover:n-bg-input-background-light hover:n-text-text",
|
|
37604
|
+
disabled2 && "n-pointer-events-none n-opacity-30"
|
|
37605
|
+
)
|
|
37606
|
+
},
|
|
37607
|
+
renderIcon("DropdownChevronIcon")
|
|
37608
|
+
);
|
|
37609
|
+
}
|
|
37610
|
+
function ToolbarItemGroup({
|
|
37611
|
+
group,
|
|
37612
|
+
onSelect,
|
|
37613
|
+
side,
|
|
37614
|
+
tooltipSide
|
|
37615
|
+
}) {
|
|
37616
|
+
const { items } = group;
|
|
37617
|
+
const checkedItem = items.find((item) => item.checked);
|
|
37618
|
+
const [lastUsed, setLastUsed] = (0, import_react107.useState)(void 0);
|
|
37619
|
+
const checkedValue = checkedItem?.value;
|
|
37620
|
+
(0, import_react107.useEffect)(() => {
|
|
37621
|
+
if (checkedValue !== void 0) setLastUsed(checkedValue);
|
|
37622
|
+
}, [checkedValue]);
|
|
37623
|
+
const representative = checkedItem ?? items.find((item) => item.value === lastUsed) ?? items[0];
|
|
37624
|
+
if (!representative) return null;
|
|
37625
|
+
const allDisabled = items.every((item) => item.disabled);
|
|
37626
|
+
const label = labelForTitle(representative.title);
|
|
37627
|
+
const chevronLabel = `${label ?? "More"} tools`;
|
|
37628
|
+
return /* @__PURE__ */ import_react107.default.createElement("div", { className: "n-flex n-items-center" }, /* @__PURE__ */ import_react107.default.createElement(
|
|
37629
|
+
ToolbarItemButton,
|
|
37630
|
+
{
|
|
37631
|
+
item: { ...representative, checked: checkedItem !== void 0 },
|
|
37632
|
+
tooltipSide,
|
|
37633
|
+
onClick: () => {
|
|
37634
|
+
setLastUsed(representative.value);
|
|
37635
|
+
onSelect(representative.value);
|
|
37636
|
+
}
|
|
37637
|
+
}
|
|
37638
|
+
), allDisabled ? (
|
|
37639
|
+
// Not wrapped in DropdownMenu (whose trigger would re-enable the
|
|
37640
|
+
// native button) — a fully disabled group has nothing to open.
|
|
37641
|
+
renderGroupChevron({
|
|
37642
|
+
label: chevronLabel,
|
|
37643
|
+
open: false,
|
|
37644
|
+
disabled: true
|
|
37645
|
+
})
|
|
37646
|
+
) : /* @__PURE__ */ import_react107.default.createElement(
|
|
37647
|
+
DropdownMenu,
|
|
37648
|
+
{
|
|
37649
|
+
items,
|
|
37650
|
+
side,
|
|
37651
|
+
sideOffset: POPUP_OFFSET + 4,
|
|
37652
|
+
align: "start",
|
|
37653
|
+
alignOffset: -29,
|
|
37654
|
+
shouldBindKeyboardShortcuts: false,
|
|
37655
|
+
onSelect: (value) => {
|
|
37656
|
+
setLastUsed(value);
|
|
37657
|
+
onSelect(value);
|
|
37658
|
+
}
|
|
37659
|
+
},
|
|
37660
|
+
({ open }) => renderGroupChevron({
|
|
37661
|
+
label: chevronLabel,
|
|
37662
|
+
open
|
|
37663
|
+
})
|
|
37664
|
+
));
|
|
37665
|
+
}
|
|
37666
|
+
function ToolbarItemPopover({
|
|
37667
|
+
item,
|
|
37668
|
+
side
|
|
37669
|
+
}) {
|
|
37670
|
+
const [open, setOpen] = (0, import_react107.useState)(false);
|
|
37671
|
+
const label = labelForTitle(item.title);
|
|
37672
|
+
const trigger = /* @__PURE__ */ import_react107.default.createElement(
|
|
37673
|
+
"button",
|
|
37674
|
+
{
|
|
37675
|
+
type: "button",
|
|
37676
|
+
"aria-label": label,
|
|
37677
|
+
className: cx(
|
|
37678
|
+
"n-flex n-h-input-height n-flex-none n-cursor-default n-items-center n-justify-center n-rounded n-border-0 n-outline-none n-transition-colors focus-visible:n-ring-2 focus-visible:n-ring-primary",
|
|
37679
|
+
item.icon ? "n-w-input-height n-p-0" : "n-px-2 n-font-sans n-text-[12px] n-font-medium",
|
|
37680
|
+
open ? "n-bg-input-background-light n-text-text" : "n-bg-transparent n-text-text hover:n-bg-input-background-light"
|
|
37681
|
+
)
|
|
37682
|
+
},
|
|
37683
|
+
item.icon ? renderIcon(item.icon) : item.title
|
|
37684
|
+
);
|
|
37685
|
+
return /* @__PURE__ */ import_react107.default.createElement(
|
|
37686
|
+
Popover,
|
|
37687
|
+
{
|
|
37688
|
+
open,
|
|
37689
|
+
onOpenChange: setOpen,
|
|
37690
|
+
side,
|
|
37691
|
+
showArrow: false,
|
|
37692
|
+
sideOffset: POPUP_OFFSET,
|
|
37693
|
+
trigger
|
|
37694
|
+
},
|
|
37695
|
+
typeof item.content === "function" ? item.content(() => setOpen(false)) : item.content
|
|
37696
|
+
);
|
|
37697
|
+
}
|
|
37698
|
+
function ToolbarItems({
|
|
37699
|
+
items,
|
|
37700
|
+
onSelect,
|
|
37701
|
+
side = "top",
|
|
37702
|
+
tooltipSide = "top"
|
|
37703
|
+
}) {
|
|
37704
|
+
return /* @__PURE__ */ import_react107.default.createElement(import_react107.default.Fragment, null, items.map((item, index2) => {
|
|
37705
|
+
if (item.type === "separator") {
|
|
37706
|
+
return /* @__PURE__ */ import_react107.default.createElement(DividerVertical, { key: `separator-${index2}` });
|
|
37707
|
+
}
|
|
37708
|
+
if (item.type === "group") {
|
|
37709
|
+
return /* @__PURE__ */ import_react107.default.createElement(
|
|
37710
|
+
ToolbarItemGroup,
|
|
37711
|
+
{
|
|
37712
|
+
key: item.id,
|
|
37713
|
+
group: item,
|
|
37714
|
+
onSelect,
|
|
37715
|
+
side,
|
|
37716
|
+
tooltipSide
|
|
37717
|
+
}
|
|
37718
|
+
);
|
|
37719
|
+
}
|
|
37720
|
+
if (item.type === "popover") {
|
|
37721
|
+
return /* @__PURE__ */ import_react107.default.createElement(ToolbarItemPopover, { key: item.id, item, side });
|
|
37722
|
+
}
|
|
37723
|
+
return /* @__PURE__ */ import_react107.default.createElement(
|
|
37724
|
+
ToolbarItemButton,
|
|
37725
|
+
{
|
|
37726
|
+
key: item.value,
|
|
37727
|
+
item,
|
|
37728
|
+
tooltipSide,
|
|
37729
|
+
onClick: () => onSelect(item.value)
|
|
37730
|
+
}
|
|
37731
|
+
);
|
|
37732
|
+
}));
|
|
37733
|
+
}
|
|
37734
|
+
|
|
37735
|
+
// src/components/Toolbar.tsx
|
|
37736
|
+
var ToolbarRoot = (0, import_react108.forwardRef)(
|
|
37737
|
+
function Toolbar({ children, className, role = "toolbar", size: size4 = "medium", style: style2, ...props }, ref) {
|
|
37738
|
+
return /* @__PURE__ */ import_react108.default.createElement(
|
|
37071
37739
|
"div",
|
|
37072
37740
|
{
|
|
37073
37741
|
ref,
|
|
@@ -37084,6 +37752,7 @@ var Toolbar = (0, import_react105.forwardRef)(
|
|
|
37084
37752
|
);
|
|
37085
37753
|
}
|
|
37086
37754
|
);
|
|
37755
|
+
var Toolbar2 = Object.assign(ToolbarRoot, { Items: ToolbarItems });
|
|
37087
37756
|
|
|
37088
37757
|
// src/components/SelectionToolbar.tsx
|
|
37089
37758
|
function getPlacement(side, align) {
|
|
@@ -37092,7 +37761,7 @@ function getPlacement(side, align) {
|
|
|
37092
37761
|
}
|
|
37093
37762
|
return `${side}-${align}`;
|
|
37094
37763
|
}
|
|
37095
|
-
var SelectionToolbarContainer = (0,
|
|
37764
|
+
var SelectionToolbarContainer = (0, import_react110.memo)(
|
|
37096
37765
|
function SelectionToolbarContainer2({
|
|
37097
37766
|
rect,
|
|
37098
37767
|
children,
|
|
@@ -37105,16 +37774,16 @@ var SelectionToolbarContainer = (0, import_react107.memo)(
|
|
|
37105
37774
|
transitionDuration = 0.2
|
|
37106
37775
|
}) {
|
|
37107
37776
|
const portalScopeId = usePortalScopeId();
|
|
37108
|
-
const [containerElement, setContainerElement] = (0,
|
|
37109
|
-
const containerRef = (0,
|
|
37777
|
+
const [containerElement, setContainerElement] = (0, import_react110.useState)(null);
|
|
37778
|
+
const containerRef = (0, import_react110.useCallback)((el) => {
|
|
37110
37779
|
setContainerElement(el);
|
|
37111
37780
|
}, []);
|
|
37112
|
-
const containerRefObject = (0,
|
|
37781
|
+
const containerRefObject = (0, import_react110.useMemo)(
|
|
37113
37782
|
() => ({ current: containerElement }),
|
|
37114
37783
|
[containerElement]
|
|
37115
37784
|
);
|
|
37116
37785
|
const size4 = useSize(containerRefObject, "width");
|
|
37117
|
-
const virtualElement = (0,
|
|
37786
|
+
const virtualElement = (0, import_react110.useMemo)(
|
|
37118
37787
|
() => ({
|
|
37119
37788
|
getBoundingClientRect: () => ({
|
|
37120
37789
|
width: rect.width,
|
|
@@ -37130,14 +37799,14 @@ var SelectionToolbarContainer = (0, import_react107.memo)(
|
|
|
37130
37799
|
[rect]
|
|
37131
37800
|
);
|
|
37132
37801
|
const placement = getPlacement(side, align);
|
|
37133
|
-
const { refs, floatingStyles } = (0,
|
|
37802
|
+
const { refs, floatingStyles } = (0, import_react109.useFloating)({
|
|
37134
37803
|
placement,
|
|
37135
|
-
middleware: avoidCollisions ? [(0,
|
|
37804
|
+
middleware: avoidCollisions ? [(0, import_react109.offset)(sideOffset), (0, import_react109.flip)(), (0, import_react109.shift)({ padding: 10 })] : [(0, import_react109.offset)(sideOffset)]
|
|
37136
37805
|
});
|
|
37137
|
-
(0,
|
|
37806
|
+
(0, import_react110.useEffect)(() => {
|
|
37138
37807
|
refs.setPositionReference(virtualElement);
|
|
37139
37808
|
}, [refs, virtualElement]);
|
|
37140
|
-
return /* @__PURE__ */
|
|
37809
|
+
return /* @__PURE__ */ import_react110.default.createElement(import_react109.FloatingPortal, null, /* @__PURE__ */ import_react110.default.createElement(
|
|
37141
37810
|
"div",
|
|
37142
37811
|
{
|
|
37143
37812
|
ref: refs.setFloating,
|
|
@@ -37150,8 +37819,8 @@ var SelectionToolbarContainer = (0, import_react107.memo)(
|
|
|
37150
37819
|
},
|
|
37151
37820
|
className: "n-z-menu"
|
|
37152
37821
|
},
|
|
37153
|
-
/* @__PURE__ */
|
|
37154
|
-
|
|
37822
|
+
/* @__PURE__ */ import_react110.default.createElement(
|
|
37823
|
+
Toolbar2,
|
|
37155
37824
|
{
|
|
37156
37825
|
ref: containerRef,
|
|
37157
37826
|
size: "small",
|
|
@@ -37196,12 +37865,12 @@ __export(index_parts_exports10, {
|
|
|
37196
37865
|
});
|
|
37197
37866
|
|
|
37198
37867
|
// ../../node_modules/@base-ui/react/select/root/SelectRoot.mjs
|
|
37199
|
-
var
|
|
37868
|
+
var React285 = __toESM(require("react"), 1);
|
|
37200
37869
|
|
|
37201
37870
|
// ../../node_modules/@base-ui/utils/useOnFirstRender.mjs
|
|
37202
|
-
var
|
|
37871
|
+
var React278 = __toESM(require("react"), 1);
|
|
37203
37872
|
function useOnFirstRender(fn) {
|
|
37204
|
-
const ref =
|
|
37873
|
+
const ref = React278.useRef(true);
|
|
37205
37874
|
if (ref.current) {
|
|
37206
37875
|
ref.current = false;
|
|
37207
37876
|
fn();
|
|
@@ -37209,11 +37878,11 @@ function useOnFirstRender(fn) {
|
|
|
37209
37878
|
}
|
|
37210
37879
|
|
|
37211
37880
|
// ../../node_modules/@base-ui/react/select/root/SelectRootContext.mjs
|
|
37212
|
-
var
|
|
37213
|
-
var SelectRootContext = /* @__PURE__ */
|
|
37881
|
+
var React279 = __toESM(require("react"), 1);
|
|
37882
|
+
var SelectRootContext = /* @__PURE__ */ React279.createContext(null);
|
|
37214
37883
|
if (process.env.NODE_ENV !== "production") SelectRootContext.displayName = "SelectRootContext";
|
|
37215
37884
|
function useSelectRootContext() {
|
|
37216
|
-
const context =
|
|
37885
|
+
const context = React279.useContext(SelectRootContext);
|
|
37217
37886
|
if (context === null) {
|
|
37218
37887
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>." : formatErrorMessage_default(60));
|
|
37219
37888
|
}
|
|
@@ -37221,7 +37890,7 @@ function useSelectRootContext() {
|
|
|
37221
37890
|
}
|
|
37222
37891
|
|
|
37223
37892
|
// ../../node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
|
|
37224
|
-
var
|
|
37893
|
+
var React280 = __toESM(require("react"), 1);
|
|
37225
37894
|
|
|
37226
37895
|
// ../../node_modules/@base-ui/react/internals/field-constants/constants.mjs
|
|
37227
37896
|
var DEFAULT_VALIDITY_STATE = {
|
|
@@ -37298,10 +37967,10 @@ var DEFAULT_FIELD_ROOT_CONTEXT = {
|
|
|
37298
37967
|
change: NOOP
|
|
37299
37968
|
}
|
|
37300
37969
|
};
|
|
37301
|
-
var FieldRootContext = /* @__PURE__ */
|
|
37970
|
+
var FieldRootContext = /* @__PURE__ */ React280.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
|
|
37302
37971
|
if (process.env.NODE_ENV !== "production") FieldRootContext.displayName = "FieldRootContext";
|
|
37303
37972
|
function useFieldRootContext(optional = true) {
|
|
37304
|
-
const context =
|
|
37973
|
+
const context = React280.useContext(FieldRootContext);
|
|
37305
37974
|
if (context.setValidityData === NOOP && !optional) {
|
|
37306
37975
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28));
|
|
37307
37976
|
}
|
|
@@ -37338,11 +38007,11 @@ function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, en
|
|
|
37338
38007
|
}
|
|
37339
38008
|
|
|
37340
38009
|
// ../../node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
|
|
37341
|
-
var
|
|
38010
|
+
var React282 = __toESM(require("react"), 1);
|
|
37342
38011
|
|
|
37343
38012
|
// ../../node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
|
|
37344
|
-
var
|
|
37345
|
-
var LabelableContext = /* @__PURE__ */
|
|
38013
|
+
var React281 = __toESM(require("react"), 1);
|
|
38014
|
+
var LabelableContext = /* @__PURE__ */ React281.createContext({
|
|
37346
38015
|
controlId: void 0,
|
|
37347
38016
|
registerControlId: NOOP,
|
|
37348
38017
|
labelId: void 0,
|
|
@@ -37353,7 +38022,7 @@ var LabelableContext = /* @__PURE__ */ React278.createContext({
|
|
|
37353
38022
|
});
|
|
37354
38023
|
if (process.env.NODE_ENV !== "production") LabelableContext.displayName = "LabelableContext";
|
|
37355
38024
|
function useLabelableContext() {
|
|
37356
|
-
return
|
|
38025
|
+
return React281.useContext(LabelableContext);
|
|
37357
38026
|
}
|
|
37358
38027
|
|
|
37359
38028
|
// ../../node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
|
|
@@ -37370,8 +38039,8 @@ function useLabelableId(params = {}) {
|
|
|
37370
38039
|
const defaultId = useBaseUiId(id);
|
|
37371
38040
|
const controlIdForEffect = implicit ? controlId : void 0;
|
|
37372
38041
|
const controlSourceRef = useRefWithInit(() => Symbol());
|
|
37373
|
-
const hasRegisteredRef =
|
|
37374
|
-
const hadExplicitIdRef =
|
|
38042
|
+
const hasRegisteredRef = React282.useRef(false);
|
|
38043
|
+
const hadExplicitIdRef = React282.useRef(id != null);
|
|
37375
38044
|
const unregisterControlId = useStableCallback2(() => {
|
|
37376
38045
|
if (!hasRegisteredRef.current || registerControlId === NOOP) {
|
|
37377
38046
|
return;
|
|
@@ -37408,7 +38077,7 @@ function useLabelableId(params = {}) {
|
|
|
37408
38077
|
registerControlId(controlSourceRef.current, nextId);
|
|
37409
38078
|
return void 0;
|
|
37410
38079
|
}, [id, controlRef, controlIdForEffect, registerControlId, implicit, defaultId, controlSourceRef, unregisterControlId]);
|
|
37411
|
-
|
|
38080
|
+
React282.useEffect(() => {
|
|
37412
38081
|
return unregisterControlId;
|
|
37413
38082
|
}, [unregisterControlId]);
|
|
37414
38083
|
return controlId ?? defaultId;
|
|
@@ -37438,7 +38107,7 @@ function removeItem(selectedValues, itemValue, comparer) {
|
|
|
37438
38107
|
}
|
|
37439
38108
|
|
|
37440
38109
|
// ../../node_modules/@base-ui/react/internals/resolveValueLabel.mjs
|
|
37441
|
-
var
|
|
38110
|
+
var React283 = __toESM(require("react"), 1);
|
|
37442
38111
|
|
|
37443
38112
|
// ../../node_modules/@base-ui/react/internals/serializeValue.mjs
|
|
37444
38113
|
function serializeValue(value) {
|
|
@@ -37542,7 +38211,7 @@ function resolveMultipleLabels(values, items, itemToStringLabel) {
|
|
|
37542
38211
|
if (index2 > 0) {
|
|
37543
38212
|
acc.push(", ");
|
|
37544
38213
|
}
|
|
37545
|
-
acc.push(/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
38214
|
+
acc.push(/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(React283.Fragment, {
|
|
37546
38215
|
children: resolveSelectedLabel(value, items, itemToStringLabel)
|
|
37547
38216
|
}, index2));
|
|
37548
38217
|
return acc;
|
|
@@ -37606,8 +38275,8 @@ var selectors7 = {
|
|
|
37606
38275
|
};
|
|
37607
38276
|
|
|
37608
38277
|
// ../../node_modules/@base-ui/react/internals/form-context/FormContext.mjs
|
|
37609
|
-
var
|
|
37610
|
-
var FormContext = /* @__PURE__ */
|
|
38278
|
+
var React284 = __toESM(require("react"), 1);
|
|
38279
|
+
var FormContext = /* @__PURE__ */ React284.createContext({
|
|
37611
38280
|
elementRef: {
|
|
37612
38281
|
current: null
|
|
37613
38282
|
},
|
|
@@ -37625,7 +38294,7 @@ var FormContext = /* @__PURE__ */ React281.createContext({
|
|
|
37625
38294
|
});
|
|
37626
38295
|
if (process.env.NODE_ENV !== "production") FormContext.displayName = "FormContext";
|
|
37627
38296
|
function useFormContext() {
|
|
37628
|
-
return
|
|
38297
|
+
return React284.useContext(FormContext);
|
|
37629
38298
|
}
|
|
37630
38299
|
|
|
37631
38300
|
// ../../node_modules/@base-ui/react/internals/areArraysEqual.mjs
|
|
@@ -37693,22 +38362,22 @@ function SelectRoot(props) {
|
|
|
37693
38362
|
name: "Select",
|
|
37694
38363
|
state: "open"
|
|
37695
38364
|
});
|
|
37696
|
-
const listRef =
|
|
37697
|
-
const labelsRef =
|
|
37698
|
-
const popupRef =
|
|
37699
|
-
const scrollHandlerRef =
|
|
37700
|
-
const scrollArrowsMountedCountRef =
|
|
37701
|
-
const valueRef =
|
|
37702
|
-
const valuesRef =
|
|
37703
|
-
const typingRef =
|
|
37704
|
-
const firstItemTextRef =
|
|
37705
|
-
const selectedItemTextRef =
|
|
37706
|
-
const selectionRef =
|
|
38365
|
+
const listRef = React285.useRef([]);
|
|
38366
|
+
const labelsRef = React285.useRef([]);
|
|
38367
|
+
const popupRef = React285.useRef(null);
|
|
38368
|
+
const scrollHandlerRef = React285.useRef(null);
|
|
38369
|
+
const scrollArrowsMountedCountRef = React285.useRef(0);
|
|
38370
|
+
const valueRef = React285.useRef(null);
|
|
38371
|
+
const valuesRef = React285.useRef([]);
|
|
38372
|
+
const typingRef = React285.useRef(false);
|
|
38373
|
+
const firstItemTextRef = React285.useRef(null);
|
|
38374
|
+
const selectedItemTextRef = React285.useRef(null);
|
|
38375
|
+
const selectionRef = React285.useRef({
|
|
37707
38376
|
allowSelectedMouseUp: false,
|
|
37708
38377
|
allowUnselectedMouseUp: false,
|
|
37709
38378
|
dragY: 0
|
|
37710
38379
|
});
|
|
37711
|
-
const alignItemWithTriggerActiveRef =
|
|
38380
|
+
const alignItemWithTriggerActiveRef = React285.useRef(false);
|
|
37712
38381
|
const {
|
|
37713
38382
|
mounted,
|
|
37714
38383
|
setMounted,
|
|
@@ -37751,13 +38420,13 @@ function SelectRoot(props) {
|
|
|
37751
38420
|
const positionerElement = useStore(store, selectors7.positionerElement);
|
|
37752
38421
|
const previousOpenMethod = usePreviousValue(openMethod);
|
|
37753
38422
|
const renderedOpenMethod = openMethod ?? previousOpenMethod;
|
|
37754
|
-
const serializedValue =
|
|
38423
|
+
const serializedValue = React285.useMemo(() => {
|
|
37755
38424
|
if (multiple) {
|
|
37756
38425
|
return "";
|
|
37757
38426
|
}
|
|
37758
38427
|
return stringifyAsValue(value, itemToStringValue);
|
|
37759
38428
|
}, [multiple, value, itemToStringValue]);
|
|
37760
|
-
const fieldStringValue =
|
|
38429
|
+
const fieldStringValue = React285.useMemo(() => {
|
|
37761
38430
|
if (multiple && Array.isArray(value)) {
|
|
37762
38431
|
return value.map((currentValue) => stringifyAsValue(currentValue, itemToStringValue));
|
|
37763
38432
|
}
|
|
@@ -37766,7 +38435,7 @@ function SelectRoot(props) {
|
|
|
37766
38435
|
const controlRef = useValueAsRef(triggerElement);
|
|
37767
38436
|
const getStringifiedValueForForm = useStableCallback2(() => fieldStringValue);
|
|
37768
38437
|
useRegisterFieldControl(controlRef, generatedId, value, getStringifiedValueForForm, !disabled2, nameProp);
|
|
37769
|
-
const initialValueRef =
|
|
38438
|
+
const initialValueRef = React285.useRef(value);
|
|
37770
38439
|
const hasSelectedValue = multiple ? Array.isArray(value) && value.length > 0 : value != null && serializedValue !== "";
|
|
37771
38440
|
useIsoLayoutEffect(() => {
|
|
37772
38441
|
setFilled(hasSelectedValue);
|
|
@@ -37835,7 +38504,7 @@ function SelectRoot(props) {
|
|
|
37835
38504
|
}
|
|
37836
38505
|
}
|
|
37837
38506
|
});
|
|
37838
|
-
|
|
38507
|
+
React285.useImperativeHandle(actionsRef, () => ({
|
|
37839
38508
|
unmount: handleUnmount
|
|
37840
38509
|
}), [handleUnmount]);
|
|
37841
38510
|
const setValue = useStableCallback2((nextValue, eventDetails) => {
|
|
@@ -37902,8 +38571,8 @@ function SelectRoot(props) {
|
|
|
37902
38571
|
typingRef.current = typing;
|
|
37903
38572
|
}
|
|
37904
38573
|
});
|
|
37905
|
-
const mergedTriggerProps =
|
|
37906
|
-
const popupProps =
|
|
38574
|
+
const mergedTriggerProps = React285.useMemo(() => mergeProps(typeahead.reference, listNavigation2.reference, dismiss.reference, click.reference, interactionTypeProps), [click.reference, typeahead.reference, listNavigation2.reference, dismiss.reference, interactionTypeProps]);
|
|
38575
|
+
const popupProps = React285.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, typeahead.floating, listNavigation2.floating, dismiss.floating), [typeahead.floating, listNavigation2.floating, dismiss.floating]);
|
|
37907
38576
|
const itemProps = listNavigation2.item ?? EMPTY_OBJECT;
|
|
37908
38577
|
useOnFirstRender(() => {
|
|
37909
38578
|
store.update({
|
|
@@ -37927,7 +38596,7 @@ function SelectRoot(props) {
|
|
|
37927
38596
|
isItemEqualToValue,
|
|
37928
38597
|
openMethod: renderedOpenMethod
|
|
37929
38598
|
});
|
|
37930
|
-
const contextValue =
|
|
38599
|
+
const contextValue = React285.useMemo(() => ({
|
|
37931
38600
|
store,
|
|
37932
38601
|
floatingContext,
|
|
37933
38602
|
required,
|
|
@@ -37957,7 +38626,7 @@ function SelectRoot(props) {
|
|
|
37957
38626
|
}), [store, floatingContext, required, disabled2, readOnly, multiple, highlightItemOnHover, setValue, setOpen, itemProps, validation, onOpenChangeComplete, handleScrollArrowVisibility]);
|
|
37958
38627
|
const ref = useMergedRefs(inputRef, validation.inputRef);
|
|
37959
38628
|
const hiddenInputName = multiple ? void 0 : name;
|
|
37960
|
-
const hiddenInputs =
|
|
38629
|
+
const hiddenInputs = React285.useMemo(() => {
|
|
37961
38630
|
if (!multiple || !Array.isArray(value) || !name) {
|
|
37962
38631
|
return null;
|
|
37963
38632
|
}
|
|
@@ -38028,7 +38697,7 @@ function SelectRoot(props) {
|
|
|
38028
38697
|
}
|
|
38029
38698
|
|
|
38030
38699
|
// ../../node_modules/@base-ui/react/select/label/SelectLabel.mjs
|
|
38031
|
-
var
|
|
38700
|
+
var React286 = __toESM(require("react"), 1);
|
|
38032
38701
|
|
|
38033
38702
|
// ../../node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs
|
|
38034
38703
|
function useLabel2(params = {}) {
|
|
@@ -38104,7 +38773,7 @@ function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
|
|
|
38104
38773
|
}
|
|
38105
38774
|
|
|
38106
38775
|
// ../../node_modules/@base-ui/react/select/label/SelectLabel.mjs
|
|
38107
|
-
var SelectLabel = /* @__PURE__ */
|
|
38776
|
+
var SelectLabel = /* @__PURE__ */ React286.forwardRef(function SelectLabel2(componentProps, forwardedRef) {
|
|
38108
38777
|
const {
|
|
38109
38778
|
render,
|
|
38110
38779
|
className,
|
|
@@ -38138,7 +38807,7 @@ var SelectLabel = /* @__PURE__ */ React283.forwardRef(function SelectLabel2(comp
|
|
|
38138
38807
|
if (process.env.NODE_ENV !== "production") SelectLabel.displayName = "SelectLabel";
|
|
38139
38808
|
|
|
38140
38809
|
// ../../node_modules/@base-ui/react/select/trigger/SelectTrigger.mjs
|
|
38141
|
-
var
|
|
38810
|
+
var React287 = __toESM(require("react"), 1);
|
|
38142
38811
|
var SELECTED_DELAY = 400;
|
|
38143
38812
|
var stateAttributesMapping2 = {
|
|
38144
38813
|
...pressableTriggerOpenStateMapping,
|
|
@@ -38148,7 +38817,7 @@ var stateAttributesMapping2 = {
|
|
|
38148
38817
|
} : null,
|
|
38149
38818
|
value: () => null
|
|
38150
38819
|
};
|
|
38151
|
-
var SelectTrigger = /* @__PURE__ */
|
|
38820
|
+
var SelectTrigger = /* @__PURE__ */ React287.forwardRef(function SelectTrigger2(componentProps, forwardedRef) {
|
|
38152
38821
|
const {
|
|
38153
38822
|
render,
|
|
38154
38823
|
className,
|
|
@@ -38196,7 +38865,7 @@ var SelectTrigger = /* @__PURE__ */ React284.forwardRef(function SelectTrigger2(
|
|
|
38196
38865
|
id
|
|
38197
38866
|
});
|
|
38198
38867
|
const positionerRef = useValueAsRef(positionerElement);
|
|
38199
|
-
const triggerRef =
|
|
38868
|
+
const triggerRef = React287.useRef(null);
|
|
38200
38869
|
const {
|
|
38201
38870
|
getButtonProps,
|
|
38202
38871
|
buttonRef
|
|
@@ -38208,7 +38877,7 @@ var SelectTrigger = /* @__PURE__ */ React284.forwardRef(function SelectTrigger2(
|
|
|
38208
38877
|
const timeoutFocus = useTimeout();
|
|
38209
38878
|
const timeoutMouseDown = useTimeout();
|
|
38210
38879
|
const selectedDelayTimeout = useTimeout();
|
|
38211
|
-
|
|
38880
|
+
React287.useEffect(() => {
|
|
38212
38881
|
if (open) {
|
|
38213
38882
|
selectedDelayTimeout.start(SELECTED_DELAY, () => {
|
|
38214
38883
|
selectionRef.current.allowUnselectedMouseUp = true;
|
|
@@ -38301,11 +38970,11 @@ var SelectTrigger = /* @__PURE__ */ React284.forwardRef(function SelectTrigger2(
|
|
|
38301
38970
|
if (process.env.NODE_ENV !== "production") SelectTrigger.displayName = "SelectTrigger";
|
|
38302
38971
|
|
|
38303
38972
|
// ../../node_modules/@base-ui/react/select/value/SelectValue.mjs
|
|
38304
|
-
var
|
|
38973
|
+
var React288 = __toESM(require("react"), 1);
|
|
38305
38974
|
var stateAttributesMapping3 = {
|
|
38306
38975
|
value: () => null
|
|
38307
38976
|
};
|
|
38308
|
-
var SelectValue = /* @__PURE__ */
|
|
38977
|
+
var SelectValue = /* @__PURE__ */ React288.forwardRef(function SelectValue2(componentProps, forwardedRef) {
|
|
38309
38978
|
const {
|
|
38310
38979
|
className,
|
|
38311
38980
|
render,
|
|
@@ -38353,8 +39022,8 @@ var SelectValue = /* @__PURE__ */ React285.forwardRef(function SelectValue2(comp
|
|
|
38353
39022
|
if (process.env.NODE_ENV !== "production") SelectValue.displayName = "SelectValue";
|
|
38354
39023
|
|
|
38355
39024
|
// ../../node_modules/@base-ui/react/select/icon/SelectIcon.mjs
|
|
38356
|
-
var
|
|
38357
|
-
var SelectIcon = /* @__PURE__ */
|
|
39025
|
+
var React289 = __toESM(require("react"), 1);
|
|
39026
|
+
var SelectIcon = /* @__PURE__ */ React289.forwardRef(function SelectIcon2(componentProps, forwardedRef) {
|
|
38358
39027
|
const {
|
|
38359
39028
|
render,
|
|
38360
39029
|
className,
|
|
@@ -38382,9 +39051,9 @@ var SelectIcon = /* @__PURE__ */ React286.forwardRef(function SelectIcon2(compon
|
|
|
38382
39051
|
if (process.env.NODE_ENV !== "production") SelectIcon.displayName = "SelectIcon";
|
|
38383
39052
|
|
|
38384
39053
|
// ../../node_modules/@base-ui/react/select/portal/SelectPortal.mjs
|
|
38385
|
-
var
|
|
39054
|
+
var React290 = __toESM(require("react"), 1);
|
|
38386
39055
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
38387
|
-
var SelectPortal = /* @__PURE__ */
|
|
39056
|
+
var SelectPortal = /* @__PURE__ */ React290.forwardRef(function SelectPortal2(portalProps, forwardedRef) {
|
|
38388
39057
|
const {
|
|
38389
39058
|
store
|
|
38390
39059
|
} = useSelectRootContext();
|
|
@@ -38402,12 +39071,12 @@ var SelectPortal = /* @__PURE__ */ React287.forwardRef(function SelectPortal2(po
|
|
|
38402
39071
|
if (process.env.NODE_ENV !== "production") SelectPortal.displayName = "SelectPortal";
|
|
38403
39072
|
|
|
38404
39073
|
// ../../node_modules/@base-ui/react/select/backdrop/SelectBackdrop.mjs
|
|
38405
|
-
var
|
|
39074
|
+
var React291 = __toESM(require("react"), 1);
|
|
38406
39075
|
var stateAttributesMapping4 = {
|
|
38407
39076
|
...popupStateMapping,
|
|
38408
39077
|
...transitionStatusMapping
|
|
38409
39078
|
};
|
|
38410
|
-
var SelectBackdrop = /* @__PURE__ */
|
|
39079
|
+
var SelectBackdrop = /* @__PURE__ */ React291.forwardRef(function SelectBackdrop2(componentProps, forwardedRef) {
|
|
38411
39080
|
const {
|
|
38412
39081
|
render,
|
|
38413
39082
|
className,
|
|
@@ -38442,14 +39111,14 @@ var SelectBackdrop = /* @__PURE__ */ React288.forwardRef(function SelectBackdrop
|
|
|
38442
39111
|
if (process.env.NODE_ENV !== "production") SelectBackdrop.displayName = "SelectBackdrop";
|
|
38443
39112
|
|
|
38444
39113
|
// ../../node_modules/@base-ui/react/select/positioner/SelectPositioner.mjs
|
|
38445
|
-
var
|
|
39114
|
+
var React293 = __toESM(require("react"), 1);
|
|
38446
39115
|
|
|
38447
39116
|
// ../../node_modules/@base-ui/react/select/positioner/SelectPositionerContext.mjs
|
|
38448
|
-
var
|
|
38449
|
-
var SelectPositionerContext = /* @__PURE__ */
|
|
39117
|
+
var React292 = __toESM(require("react"), 1);
|
|
39118
|
+
var SelectPositionerContext = /* @__PURE__ */ React292.createContext(void 0);
|
|
38450
39119
|
if (process.env.NODE_ENV !== "production") SelectPositionerContext.displayName = "SelectPositionerContext";
|
|
38451
39120
|
function useSelectPositionerContext() {
|
|
38452
|
-
const context =
|
|
39121
|
+
const context = React292.useContext(SelectPositionerContext);
|
|
38453
39122
|
if (!context) {
|
|
38454
39123
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>." : formatErrorMessage_default(59));
|
|
38455
39124
|
}
|
|
@@ -38474,7 +39143,7 @@ var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
|
38474
39143
|
var FIXED = {
|
|
38475
39144
|
position: "fixed"
|
|
38476
39145
|
};
|
|
38477
|
-
var SelectPositioner = /* @__PURE__ */
|
|
39146
|
+
var SelectPositioner = /* @__PURE__ */ React293.forwardRef(function SelectPositioner2(componentProps, forwardedRef) {
|
|
38478
39147
|
const {
|
|
38479
39148
|
anchor,
|
|
38480
39149
|
className,
|
|
@@ -38517,14 +39186,14 @@ var SelectPositioner = /* @__PURE__ */ React290.forwardRef(function SelectPositi
|
|
|
38517
39186
|
const triggerElement = useStore(store, selectors7.triggerElement);
|
|
38518
39187
|
const isItemEqualToValue = useStore(store, selectors7.isItemEqualToValue);
|
|
38519
39188
|
const transitionStatus = useStore(store, selectors7.transitionStatus);
|
|
38520
|
-
const scrollUpArrowRef =
|
|
38521
|
-
const scrollDownArrowRef =
|
|
38522
|
-
const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] =
|
|
39189
|
+
const scrollUpArrowRef = React293.useRef(null);
|
|
39190
|
+
const scrollDownArrowRef = React293.useRef(null);
|
|
39191
|
+
const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] = React293.useState(alignItemWithTrigger);
|
|
38523
39192
|
const alignItemWithTriggerActive = mounted && controlledAlignItemWithTrigger && openMethod !== "touch";
|
|
38524
39193
|
if (!mounted && controlledAlignItemWithTrigger !== alignItemWithTrigger) {
|
|
38525
39194
|
setControlledAlignItemWithTrigger(alignItemWithTrigger);
|
|
38526
39195
|
}
|
|
38527
|
-
|
|
39196
|
+
React293.useImperativeHandle(alignItemWithTriggerActiveRef, () => alignItemWithTriggerActive);
|
|
38528
39197
|
useAnchoredPopupScrollLock((alignItemWithTriggerActive || modal) && open, openMethod === "touch", positionerElement, triggerElement);
|
|
38529
39198
|
const positioning = useAnchorPositioning({
|
|
38530
39199
|
anchor,
|
|
@@ -38563,7 +39232,7 @@ var SelectPositioner = /* @__PURE__ */ React290.forwardRef(function SelectPositi
|
|
|
38563
39232
|
hidden: !mounted,
|
|
38564
39233
|
inert: !open
|
|
38565
39234
|
});
|
|
38566
|
-
const prevMapSizeRef =
|
|
39235
|
+
const prevMapSizeRef = React293.useRef(0);
|
|
38567
39236
|
const onMapChange = useStableCallback2((map) => {
|
|
38568
39237
|
if (valuesRef.current.length === 0) {
|
|
38569
39238
|
return;
|
|
@@ -38609,7 +39278,7 @@ var SelectPositioner = /* @__PURE__ */ React290.forwardRef(function SelectPositi
|
|
|
38609
39278
|
clearStyles(popupRef.current, stylesToClear);
|
|
38610
39279
|
}
|
|
38611
39280
|
});
|
|
38612
|
-
const contextValue =
|
|
39281
|
+
const contextValue = React293.useMemo(() => ({
|
|
38613
39282
|
...positioning,
|
|
38614
39283
|
side: renderedSide,
|
|
38615
39284
|
alignItemWithTriggerActive,
|
|
@@ -38633,13 +39302,13 @@ var SelectPositioner = /* @__PURE__ */ React290.forwardRef(function SelectPositi
|
|
|
38633
39302
|
if (process.env.NODE_ENV !== "production") SelectPositioner.displayName = "SelectPositioner";
|
|
38634
39303
|
|
|
38635
39304
|
// ../../node_modules/@base-ui/react/select/popup/SelectPopup.mjs
|
|
38636
|
-
var
|
|
39305
|
+
var React294 = __toESM(require("react"), 1);
|
|
38637
39306
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
38638
39307
|
var stateAttributesMapping5 = {
|
|
38639
39308
|
...popupStateMapping,
|
|
38640
39309
|
...transitionStatusMapping
|
|
38641
39310
|
};
|
|
38642
|
-
var SelectPopup = /* @__PURE__ */
|
|
39311
|
+
var SelectPopup = /* @__PURE__ */ React294.forwardRef(function SelectPopup2(componentProps, forwardedRef) {
|
|
38643
39312
|
const {
|
|
38644
39313
|
render,
|
|
38645
39314
|
className,
|
|
@@ -38684,9 +39353,9 @@ var SelectPopup = /* @__PURE__ */ React291.forwardRef(function SelectPopup2(comp
|
|
|
38684
39353
|
const triggerElement = useStore(store, selectors7.triggerElement);
|
|
38685
39354
|
const positionerElement = useStore(store, selectors7.positionerElement);
|
|
38686
39355
|
const listElement = useStore(store, selectors7.listElement);
|
|
38687
|
-
const reachedMaxHeightRef =
|
|
38688
|
-
const initialPlacedRef =
|
|
38689
|
-
const originalPositionerStylesRef =
|
|
39356
|
+
const reachedMaxHeightRef = React294.useRef(false);
|
|
39357
|
+
const initialPlacedRef = React294.useRef(false);
|
|
39358
|
+
const originalPositionerStylesRef = React294.useRef({});
|
|
38690
39359
|
const scrollArrowFrame = useAnimationFrame();
|
|
38691
39360
|
const handleScroll = useStableCallback2((scroller) => {
|
|
38692
39361
|
if (!positionerElement || !popupRef.current || !initialPlacedRef.current) {
|
|
@@ -38748,7 +39417,7 @@ var SelectPopup = /* @__PURE__ */ React291.forwardRef(function SelectPopup2(comp
|
|
|
38748
39417
|
}
|
|
38749
39418
|
handleScrollArrowVisibility(scroller);
|
|
38750
39419
|
});
|
|
38751
|
-
|
|
39420
|
+
React294.useImperativeHandle(scrollHandlerRef, () => handleScroll, [handleScroll]);
|
|
38752
39421
|
useOpenChangeComplete({
|
|
38753
39422
|
open,
|
|
38754
39423
|
ref: popupRef,
|
|
@@ -38890,7 +39559,7 @@ var SelectPopup = /* @__PURE__ */ React291.forwardRef(function SelectPopup2(comp
|
|
|
38890
39559
|
restoreTransformStyles();
|
|
38891
39560
|
}
|
|
38892
39561
|
}, [store, open, positionerElement, triggerElement, valueRef, firstItemTextRef, selectedItemTextRef, popupRef, handleScrollArrowVisibility, alignItemWithTriggerActive, setControlledAlignItemWithTrigger, scrollArrowFrame, listElement, listRef, highlightItemOnHover, direction, isPositioned]);
|
|
38893
|
-
|
|
39562
|
+
React294.useEffect(() => {
|
|
38894
39563
|
if (!alignItemWithTriggerActive || !positionerElement || !open) {
|
|
38895
39564
|
return void 0;
|
|
38896
39565
|
}
|
|
@@ -38933,7 +39602,7 @@ var SelectPopup = /* @__PURE__ */ React291.forwardRef(function SelectPopup2(comp
|
|
|
38933
39602
|
stateAttributesMapping: stateAttributesMapping5,
|
|
38934
39603
|
props: [popupProps, defaultProps, getDisabledMountTransitionStyles(transitionStatus), elementProps]
|
|
38935
39604
|
});
|
|
38936
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
39605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(React294.Fragment, {
|
|
38937
39606
|
children: [!disableStyleElements && styleDisableScrollbar.getElement(nonce), /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FloatingFocusManager, {
|
|
38938
39607
|
context: floatingRootContext,
|
|
38939
39608
|
modal: false,
|
|
@@ -38990,8 +39659,8 @@ function unsetTransformStyles(popupElement) {
|
|
|
38990
39659
|
}
|
|
38991
39660
|
|
|
38992
39661
|
// ../../node_modules/@base-ui/react/select/list/SelectList.mjs
|
|
38993
|
-
var
|
|
38994
|
-
var SelectList = /* @__PURE__ */
|
|
39662
|
+
var React295 = __toESM(require("react"), 1);
|
|
39663
|
+
var SelectList = /* @__PURE__ */ React295.forwardRef(function SelectList2(componentProps, forwardedRef) {
|
|
38995
39664
|
const {
|
|
38996
39665
|
render,
|
|
38997
39666
|
className,
|
|
@@ -39030,14 +39699,14 @@ var SelectList = /* @__PURE__ */ React292.forwardRef(function SelectList2(compon
|
|
|
39030
39699
|
if (process.env.NODE_ENV !== "production") SelectList.displayName = "SelectList";
|
|
39031
39700
|
|
|
39032
39701
|
// ../../node_modules/@base-ui/react/select/item/SelectItem.mjs
|
|
39033
|
-
var
|
|
39702
|
+
var React297 = __toESM(require("react"), 1);
|
|
39034
39703
|
|
|
39035
39704
|
// ../../node_modules/@base-ui/react/select/item/SelectItemContext.mjs
|
|
39036
|
-
var
|
|
39037
|
-
var SelectItemContext = /* @__PURE__ */
|
|
39705
|
+
var React296 = __toESM(require("react"), 1);
|
|
39706
|
+
var SelectItemContext = /* @__PURE__ */ React296.createContext(void 0);
|
|
39038
39707
|
if (process.env.NODE_ENV !== "production") SelectItemContext.displayName = "SelectItemContext";
|
|
39039
39708
|
function useSelectItemContext() {
|
|
39040
|
-
const context =
|
|
39709
|
+
const context = React296.useContext(SelectItemContext);
|
|
39041
39710
|
if (!context) {
|
|
39042
39711
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>." : formatErrorMessage_default(57));
|
|
39043
39712
|
}
|
|
@@ -39046,7 +39715,7 @@ function useSelectItemContext() {
|
|
|
39046
39715
|
|
|
39047
39716
|
// ../../node_modules/@base-ui/react/select/item/SelectItem.mjs
|
|
39048
39717
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
39049
|
-
var SelectItem = /* @__PURE__ */
|
|
39718
|
+
var SelectItem = /* @__PURE__ */ React297.memo(/* @__PURE__ */ React297.forwardRef(function SelectItem2(componentProps, forwardedRef) {
|
|
39050
39719
|
const {
|
|
39051
39720
|
render,
|
|
39052
39721
|
className,
|
|
@@ -39057,7 +39726,7 @@ var SelectItem = /* @__PURE__ */ React294.memo(/* @__PURE__ */ React294.forwardR
|
|
|
39057
39726
|
nativeButton = false,
|
|
39058
39727
|
...elementProps
|
|
39059
39728
|
} = componentProps;
|
|
39060
|
-
const textRef =
|
|
39729
|
+
const textRef = React297.useRef(null);
|
|
39061
39730
|
const listItem = useCompositeListItem({
|
|
39062
39731
|
guess: true,
|
|
39063
39732
|
label,
|
|
@@ -39083,7 +39752,7 @@ var SelectItem = /* @__PURE__ */ React294.memo(/* @__PURE__ */ React294.forwardR
|
|
|
39083
39752
|
const selectedByFocus = useStore(store, selectors7.isSelectedByFocus, listItem.index);
|
|
39084
39753
|
const isItemEqualToValue = useStore(store, selectors7.isItemEqualToValue);
|
|
39085
39754
|
const index2 = listItem.index;
|
|
39086
|
-
const itemRef =
|
|
39755
|
+
const itemRef = React297.useRef(null);
|
|
39087
39756
|
useIsoLayoutEffect(() => {
|
|
39088
39757
|
const values = valuesRef.current;
|
|
39089
39758
|
values[index2] = itemValue;
|
|
@@ -39104,8 +39773,8 @@ var SelectItem = /* @__PURE__ */ React294.memo(/* @__PURE__ */ React294.forwardR
|
|
|
39104
39773
|
}
|
|
39105
39774
|
}
|
|
39106
39775
|
}, [index2, multiple, isItemEqualToValue, store, itemValue, selectedItemTextRef]);
|
|
39107
|
-
const pointerTypeRef =
|
|
39108
|
-
const allowMouseSelectionRef =
|
|
39776
|
+
const pointerTypeRef = React297.useRef("mouse");
|
|
39777
|
+
const allowMouseSelectionRef = React297.useRef(false);
|
|
39109
39778
|
const {
|
|
39110
39779
|
getButtonProps,
|
|
39111
39780
|
buttonRef
|
|
@@ -39201,7 +39870,7 @@ var SelectItem = /* @__PURE__ */ React294.memo(/* @__PURE__ */ React294.forwardR
|
|
|
39201
39870
|
state,
|
|
39202
39871
|
props: [itemProps, defaultProps, elementProps, getButtonProps]
|
|
39203
39872
|
});
|
|
39204
|
-
const contextValue =
|
|
39873
|
+
const contextValue = React297.useMemo(() => ({
|
|
39205
39874
|
selected,
|
|
39206
39875
|
index: index2,
|
|
39207
39876
|
textRef,
|
|
@@ -39215,9 +39884,9 @@ var SelectItem = /* @__PURE__ */ React294.memo(/* @__PURE__ */ React294.forwardR
|
|
|
39215
39884
|
if (process.env.NODE_ENV !== "production") SelectItem.displayName = "SelectItem";
|
|
39216
39885
|
|
|
39217
39886
|
// ../../node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.mjs
|
|
39218
|
-
var
|
|
39887
|
+
var React298 = __toESM(require("react"), 1);
|
|
39219
39888
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
39220
|
-
var SelectItemIndicator = /* @__PURE__ */
|
|
39889
|
+
var SelectItemIndicator = /* @__PURE__ */ React298.forwardRef(function SelectItemIndicator2(componentProps, forwardedRef) {
|
|
39221
39890
|
const {
|
|
39222
39891
|
selected
|
|
39223
39892
|
} = useSelectItemContext();
|
|
@@ -39231,7 +39900,7 @@ var SelectItemIndicator = /* @__PURE__ */ React295.forwardRef(function SelectIte
|
|
|
39231
39900
|
});
|
|
39232
39901
|
});
|
|
39233
39902
|
if (process.env.NODE_ENV !== "production") SelectItemIndicator.displayName = "SelectItemIndicator";
|
|
39234
|
-
var Inner = /* @__PURE__ */
|
|
39903
|
+
var Inner = /* @__PURE__ */ React298.memo(/* @__PURE__ */ React298.forwardRef((componentProps, forwardedRef) => {
|
|
39235
39904
|
const {
|
|
39236
39905
|
render,
|
|
39237
39906
|
className,
|
|
@@ -39242,7 +39911,7 @@ var Inner = /* @__PURE__ */ React295.memo(/* @__PURE__ */ React295.forwardRef((c
|
|
|
39242
39911
|
const {
|
|
39243
39912
|
selected
|
|
39244
39913
|
} = useSelectItemContext();
|
|
39245
|
-
const indicatorRef =
|
|
39914
|
+
const indicatorRef = React298.useRef(null);
|
|
39246
39915
|
const {
|
|
39247
39916
|
transitionStatus,
|
|
39248
39917
|
setMounted
|
|
@@ -39274,8 +39943,8 @@ var Inner = /* @__PURE__ */ React295.memo(/* @__PURE__ */ React295.forwardRef((c
|
|
|
39274
39943
|
if (process.env.NODE_ENV !== "production") Inner.displayName = "Inner";
|
|
39275
39944
|
|
|
39276
39945
|
// ../../node_modules/@base-ui/react/select/item-text/SelectItemText.mjs
|
|
39277
|
-
var
|
|
39278
|
-
var SelectItemText = /* @__PURE__ */
|
|
39946
|
+
var React299 = __toESM(require("react"), 1);
|
|
39947
|
+
var SelectItemText = /* @__PURE__ */ React299.memo(/* @__PURE__ */ React299.forwardRef(function SelectItemText2(componentProps, forwardedRef) {
|
|
39279
39948
|
const {
|
|
39280
39949
|
index: index2,
|
|
39281
39950
|
textRef,
|
|
@@ -39291,7 +39960,7 @@ var SelectItemText = /* @__PURE__ */ React296.memo(/* @__PURE__ */ React296.forw
|
|
|
39291
39960
|
style: style2,
|
|
39292
39961
|
...elementProps
|
|
39293
39962
|
} = componentProps;
|
|
39294
|
-
const localRef =
|
|
39963
|
+
const localRef = React299.useCallback((node) => {
|
|
39295
39964
|
if (!node) {
|
|
39296
39965
|
return;
|
|
39297
39966
|
}
|
|
@@ -39311,8 +39980,8 @@ var SelectItemText = /* @__PURE__ */ React296.memo(/* @__PURE__ */ React296.forw
|
|
|
39311
39980
|
if (process.env.NODE_ENV !== "production") SelectItemText.displayName = "SelectItemText";
|
|
39312
39981
|
|
|
39313
39982
|
// ../../node_modules/@base-ui/react/select/arrow/SelectArrow.mjs
|
|
39314
|
-
var
|
|
39315
|
-
var SelectArrow = /* @__PURE__ */
|
|
39983
|
+
var React300 = __toESM(require("react"), 1);
|
|
39984
|
+
var SelectArrow = /* @__PURE__ */ React300.forwardRef(function SelectArrow2(componentProps, forwardedRef) {
|
|
39316
39985
|
const {
|
|
39317
39986
|
render,
|
|
39318
39987
|
className,
|
|
@@ -39354,11 +40023,11 @@ var SelectArrow = /* @__PURE__ */ React297.forwardRef(function SelectArrow2(comp
|
|
|
39354
40023
|
if (process.env.NODE_ENV !== "production") SelectArrow.displayName = "SelectArrow";
|
|
39355
40024
|
|
|
39356
40025
|
// ../../node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.mjs
|
|
39357
|
-
var
|
|
40026
|
+
var React302 = __toESM(require("react"), 1);
|
|
39358
40027
|
|
|
39359
40028
|
// ../../node_modules/@base-ui/react/select/scroll-arrow/SelectScrollArrow.mjs
|
|
39360
|
-
var
|
|
39361
|
-
var SelectScrollArrow = /* @__PURE__ */
|
|
40029
|
+
var React301 = __toESM(require("react"), 1);
|
|
40030
|
+
var SelectScrollArrow = /* @__PURE__ */ React301.forwardRef(function SelectScrollArrow2(componentProps, forwardedRef) {
|
|
39362
40031
|
const {
|
|
39363
40032
|
render,
|
|
39364
40033
|
className,
|
|
@@ -39501,7 +40170,7 @@ function getTargetScrollTop(items, isUp, scrollTop, clientHeight, scrollArrowHei
|
|
|
39501
40170
|
|
|
39502
40171
|
// ../../node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.mjs
|
|
39503
40172
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
39504
|
-
var SelectScrollDownArrow = /* @__PURE__ */
|
|
40173
|
+
var SelectScrollDownArrow = /* @__PURE__ */ React302.forwardRef(function SelectScrollDownArrow2(props, forwardedRef) {
|
|
39505
40174
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectScrollArrow, {
|
|
39506
40175
|
...props,
|
|
39507
40176
|
ref: forwardedRef,
|
|
@@ -39511,9 +40180,9 @@ var SelectScrollDownArrow = /* @__PURE__ */ React299.forwardRef(function SelectS
|
|
|
39511
40180
|
if (process.env.NODE_ENV !== "production") SelectScrollDownArrow.displayName = "SelectScrollDownArrow";
|
|
39512
40181
|
|
|
39513
40182
|
// ../../node_modules/@base-ui/react/select/scroll-up-arrow/SelectScrollUpArrow.mjs
|
|
39514
|
-
var
|
|
40183
|
+
var React303 = __toESM(require("react"), 1);
|
|
39515
40184
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
39516
|
-
var SelectScrollUpArrow = /* @__PURE__ */
|
|
40185
|
+
var SelectScrollUpArrow = /* @__PURE__ */ React303.forwardRef(function SelectScrollUpArrow2(props, forwardedRef) {
|
|
39517
40186
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectScrollArrow, {
|
|
39518
40187
|
...props,
|
|
39519
40188
|
ref: forwardedRef,
|
|
@@ -39523,14 +40192,14 @@ var SelectScrollUpArrow = /* @__PURE__ */ React300.forwardRef(function SelectScr
|
|
|
39523
40192
|
if (process.env.NODE_ENV !== "production") SelectScrollUpArrow.displayName = "SelectScrollUpArrow";
|
|
39524
40193
|
|
|
39525
40194
|
// ../../node_modules/@base-ui/react/select/group/SelectGroup.mjs
|
|
39526
|
-
var
|
|
40195
|
+
var React305 = __toESM(require("react"), 1);
|
|
39527
40196
|
|
|
39528
40197
|
// ../../node_modules/@base-ui/react/select/group/SelectGroupContext.mjs
|
|
39529
|
-
var
|
|
39530
|
-
var SelectGroupContext = /* @__PURE__ */
|
|
40198
|
+
var React304 = __toESM(require("react"), 1);
|
|
40199
|
+
var SelectGroupContext = /* @__PURE__ */ React304.createContext(void 0);
|
|
39531
40200
|
if (process.env.NODE_ENV !== "production") SelectGroupContext.displayName = "SelectGroupContext";
|
|
39532
40201
|
function useSelectGroupContext() {
|
|
39533
|
-
const context =
|
|
40202
|
+
const context = React304.useContext(SelectGroupContext);
|
|
39534
40203
|
if (context === void 0) {
|
|
39535
40204
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>." : formatErrorMessage_default(56));
|
|
39536
40205
|
}
|
|
@@ -39539,15 +40208,15 @@ function useSelectGroupContext() {
|
|
|
39539
40208
|
|
|
39540
40209
|
// ../../node_modules/@base-ui/react/select/group/SelectGroup.mjs
|
|
39541
40210
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
39542
|
-
var SelectGroup = /* @__PURE__ */
|
|
40211
|
+
var SelectGroup = /* @__PURE__ */ React305.forwardRef(function SelectGroup2(componentProps, forwardedRef) {
|
|
39543
40212
|
const {
|
|
39544
40213
|
render,
|
|
39545
40214
|
className,
|
|
39546
40215
|
style: style2,
|
|
39547
40216
|
...elementProps
|
|
39548
40217
|
} = componentProps;
|
|
39549
|
-
const [labelId, setLabelId] =
|
|
39550
|
-
const contextValue =
|
|
40218
|
+
const [labelId, setLabelId] = React305.useState();
|
|
40219
|
+
const contextValue = React305.useMemo(() => ({
|
|
39551
40220
|
labelId,
|
|
39552
40221
|
setLabelId
|
|
39553
40222
|
}), [labelId, setLabelId]);
|
|
@@ -39566,8 +40235,8 @@ var SelectGroup = /* @__PURE__ */ React302.forwardRef(function SelectGroup2(comp
|
|
|
39566
40235
|
if (process.env.NODE_ENV !== "production") SelectGroup.displayName = "SelectGroup";
|
|
39567
40236
|
|
|
39568
40237
|
// ../../node_modules/@base-ui/react/select/group-label/SelectGroupLabel.mjs
|
|
39569
|
-
var
|
|
39570
|
-
var SelectGroupLabel = /* @__PURE__ */
|
|
40238
|
+
var React306 = __toESM(require("react"), 1);
|
|
40239
|
+
var SelectGroupLabel = /* @__PURE__ */ React306.forwardRef(function SelectGroupLabel2(componentProps, forwardedRef) {
|
|
39571
40240
|
const {
|
|
39572
40241
|
render,
|
|
39573
40242
|
className,
|
|
@@ -39596,8 +40265,8 @@ var SelectGroupLabel = /* @__PURE__ */ React303.forwardRef(function SelectGroupL
|
|
|
39596
40265
|
if (process.env.NODE_ENV !== "production") SelectGroupLabel.displayName = "SelectGroupLabel";
|
|
39597
40266
|
|
|
39598
40267
|
// ../../node_modules/@base-ui/react/utils/listbox-separator/ListboxSeparator.mjs
|
|
39599
|
-
var
|
|
39600
|
-
var ListboxSeparator = /* @__PURE__ */
|
|
40268
|
+
var React307 = __toESM(require("react"), 1);
|
|
40269
|
+
var ListboxSeparator = /* @__PURE__ */ React307.forwardRef(function ListboxSeparator2(componentProps, forwardedRef) {
|
|
39601
40270
|
const {
|
|
39602
40271
|
className,
|
|
39603
40272
|
render,
|
|
@@ -39622,7 +40291,7 @@ if (process.env.NODE_ENV !== "production") ListboxSeparator.displayName = "Listb
|
|
|
39622
40291
|
var SelectSeparator = ListboxSeparator;
|
|
39623
40292
|
|
|
39624
40293
|
// src/components/SelectMenu.tsx
|
|
39625
|
-
var
|
|
40294
|
+
var import_react111 = __toESM(require("react"));
|
|
39626
40295
|
var readOnlyStyle = {
|
|
39627
40296
|
justifyContent: "flex-start",
|
|
39628
40297
|
textAlign: "left"
|
|
@@ -39645,29 +40314,29 @@ function SelectItemContent({
|
|
|
39645
40314
|
indented,
|
|
39646
40315
|
children
|
|
39647
40316
|
}) {
|
|
39648
|
-
return /* @__PURE__ */
|
|
40317
|
+
return /* @__PURE__ */ import_react111.default.createElement(import_react111.default.Fragment, null, indented && /* @__PURE__ */ import_react111.default.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), checked ? /* @__PURE__ */ import_react111.default.createElement(
|
|
39649
40318
|
"span",
|
|
39650
40319
|
{
|
|
39651
40320
|
className: "n-flex n-items-center n-relative -n-left-2.5",
|
|
39652
40321
|
style: { marginRight: -CHECKBOX_RIGHT_INSET }
|
|
39653
40322
|
},
|
|
39654
|
-
/* @__PURE__ */
|
|
39655
|
-
) : indented ? /* @__PURE__ */
|
|
40323
|
+
/* @__PURE__ */ import_react111.default.createElement(import_noya_icons14.CheckIcon, null)
|
|
40324
|
+
) : indented ? /* @__PURE__ */ import_react111.default.createElement(Spacer.Horizontal, { size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET }) : null, icon && (typeof icon === "string" ? /* @__PURE__ */ import_react111.default.createElement(
|
|
39656
40325
|
Icon,
|
|
39657
40326
|
{
|
|
39658
40327
|
name: icon,
|
|
39659
40328
|
className: "n-mr-2 n-w-4 n-h-4 n-flex-shrink-0"
|
|
39660
40329
|
}
|
|
39661
|
-
) : /* @__PURE__ */
|
|
40330
|
+
) : /* @__PURE__ */ import_react111.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_react111.default.createElement("div", { className: "n-flex n-items-center n-flex-1" }, children));
|
|
39662
40331
|
}
|
|
39663
40332
|
function SelectMenuItems({
|
|
39664
40333
|
items,
|
|
39665
40334
|
hasCheckedItem
|
|
39666
40335
|
}) {
|
|
39667
|
-
return /* @__PURE__ */
|
|
40336
|
+
return /* @__PURE__ */ import_react111.default.createElement(import_react111.default.Fragment, null, items.map((item, index2) => {
|
|
39668
40337
|
switch (item.type) {
|
|
39669
40338
|
case "separator":
|
|
39670
|
-
return /* @__PURE__ */
|
|
40339
|
+
return /* @__PURE__ */ import_react111.default.createElement(
|
|
39671
40340
|
index_parts_exports10.Separator,
|
|
39672
40341
|
{
|
|
39673
40342
|
key: index2,
|
|
@@ -39675,7 +40344,7 @@ function SelectMenuItems({
|
|
|
39675
40344
|
}
|
|
39676
40345
|
);
|
|
39677
40346
|
case "sectionHeader":
|
|
39678
|
-
return /* @__PURE__ */
|
|
40347
|
+
return /* @__PURE__ */ import_react111.default.createElement(
|
|
39679
40348
|
SectionHeaderMenuItem,
|
|
39680
40349
|
{
|
|
39681
40350
|
isFirst: index2 === 0,
|
|
@@ -39688,21 +40357,21 @@ function SelectMenuItems({
|
|
|
39688
40357
|
case "submenu":
|
|
39689
40358
|
return null;
|
|
39690
40359
|
default:
|
|
39691
|
-
return /* @__PURE__ */
|
|
40360
|
+
return /* @__PURE__ */ import_react111.default.createElement("div", { key: item.value, className: "n-px-1" }, /* @__PURE__ */ import_react111.default.createElement(
|
|
39692
40361
|
index_parts_exports10.Item,
|
|
39693
40362
|
{
|
|
39694
40363
|
value: item.value,
|
|
39695
40364
|
disabled: item.disabled,
|
|
39696
40365
|
className: itemStyle3
|
|
39697
40366
|
},
|
|
39698
|
-
/* @__PURE__ */
|
|
40367
|
+
/* @__PURE__ */ import_react111.default.createElement(
|
|
39699
40368
|
SelectItemContent,
|
|
39700
40369
|
{
|
|
39701
40370
|
icon: item.icon,
|
|
39702
40371
|
checked: item.checked,
|
|
39703
40372
|
indented: hasCheckedItem
|
|
39704
40373
|
},
|
|
39705
|
-
/* @__PURE__ */
|
|
40374
|
+
/* @__PURE__ */ import_react111.default.createElement(index_parts_exports10.ItemText, null, item.title ?? item.value)
|
|
39706
40375
|
)
|
|
39707
40376
|
));
|
|
39708
40377
|
}
|
|
@@ -39729,20 +40398,20 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39729
40398
|
(item) => isSelectableMenuItem(item) && item.value === value
|
|
39730
40399
|
);
|
|
39731
40400
|
const icon = selectedItem?.icon;
|
|
39732
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
40401
|
+
const [internalOpen, setInternalOpen] = (0, import_react111.useState)(open ?? false);
|
|
39733
40402
|
const { label, fieldId: id } = useLabel({
|
|
39734
40403
|
label: props.label,
|
|
39735
40404
|
fieldId: props.id
|
|
39736
40405
|
});
|
|
39737
40406
|
const labelType = useLabelType();
|
|
39738
|
-
const handleOpenChange = (0,
|
|
40407
|
+
const handleOpenChange = (0, import_react111.useCallback)(
|
|
39739
40408
|
(newOpen) => {
|
|
39740
40409
|
onOpenChange?.(newOpen);
|
|
39741
40410
|
setInternalOpen(newOpen);
|
|
39742
40411
|
},
|
|
39743
40412
|
[onOpenChange]
|
|
39744
40413
|
);
|
|
39745
|
-
const handleValueChange = (0,
|
|
40414
|
+
const handleValueChange = (0, import_react111.useCallback)(
|
|
39746
40415
|
(newValue) => {
|
|
39747
40416
|
if (newValue !== null) {
|
|
39748
40417
|
onSelect?.(newValue);
|
|
@@ -39753,8 +40422,8 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39753
40422
|
const hasCheckedItem = items.some(
|
|
39754
40423
|
(item) => isSelectableMenuItem(item) && item.checked
|
|
39755
40424
|
);
|
|
39756
|
-
const readOnlyButton = (0,
|
|
39757
|
-
() => /* @__PURE__ */
|
|
40425
|
+
const readOnlyButton = (0, import_react111.useMemo)(
|
|
40426
|
+
() => /* @__PURE__ */ import_react111.default.createElement(
|
|
39758
40427
|
Button,
|
|
39759
40428
|
{
|
|
39760
40429
|
id,
|
|
@@ -39764,11 +40433,11 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39764
40433
|
disabled: disabled2
|
|
39765
40434
|
},
|
|
39766
40435
|
icon && renderIcon(icon),
|
|
39767
|
-
/* @__PURE__ */
|
|
40436
|
+
/* @__PURE__ */ import_react111.default.createElement("span", { className: "n-flex n-flex-1" }, selectedItem?.title ?? value)
|
|
39768
40437
|
),
|
|
39769
40438
|
[icon, id, style2, className, disabled2, value, selectedItem]
|
|
39770
40439
|
);
|
|
39771
|
-
const contentStyle = (0,
|
|
40440
|
+
const contentStyle = (0, import_react111.useMemo)(() => {
|
|
39772
40441
|
return {
|
|
39773
40442
|
width: "var(--anchor-width)",
|
|
39774
40443
|
minWidth: "max-content",
|
|
@@ -39776,7 +40445,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39776
40445
|
...contentStyleProp
|
|
39777
40446
|
};
|
|
39778
40447
|
}, [contentStyleProp]);
|
|
39779
|
-
const content = /* @__PURE__ */
|
|
40448
|
+
const content = /* @__PURE__ */ import_react111.default.createElement(
|
|
39780
40449
|
index_parts_exports10.Root,
|
|
39781
40450
|
{
|
|
39782
40451
|
value,
|
|
@@ -39785,13 +40454,13 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39785
40454
|
onOpenChange: handleOpenChange,
|
|
39786
40455
|
disabled: disabled2
|
|
39787
40456
|
},
|
|
39788
|
-
/* @__PURE__ */
|
|
40457
|
+
/* @__PURE__ */ import_react111.default.createElement(
|
|
39789
40458
|
index_parts_exports10.Trigger,
|
|
39790
40459
|
{
|
|
39791
40460
|
id,
|
|
39792
40461
|
onFocus,
|
|
39793
40462
|
onBlur,
|
|
39794
|
-
render: /* @__PURE__ */
|
|
40463
|
+
render: /* @__PURE__ */ import_react111.default.createElement(
|
|
39795
40464
|
Button,
|
|
39796
40465
|
{
|
|
39797
40466
|
style: style2,
|
|
@@ -39804,10 +40473,10 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39804
40473
|
}
|
|
39805
40474
|
)
|
|
39806
40475
|
},
|
|
39807
|
-
icon && /* @__PURE__ */
|
|
39808
|
-
label && labelType === "inset" && /* @__PURE__ */
|
|
39809
|
-
/* @__PURE__ */
|
|
39810
|
-
/* @__PURE__ */
|
|
40476
|
+
icon && /* @__PURE__ */ import_react111.default.createElement("span", { className: "n-pr-1.5" }, renderIcon(icon)),
|
|
40477
|
+
label && labelType === "inset" && /* @__PURE__ */ import_react111.default.createElement("div", { className: insetEndStyles }, /* @__PURE__ */ import_react111.default.createElement(Label, { className: "n-pr-4 n-text-text-disabled", htmlFor: id }, label)),
|
|
40478
|
+
/* @__PURE__ */ import_react111.default.createElement("span", { className: "n-flex-1 n-flex" }, /* @__PURE__ */ import_react111.default.createElement(index_parts_exports10.Value, null, selectedItem?.title ?? value ?? placeholder)),
|
|
40479
|
+
/* @__PURE__ */ import_react111.default.createElement(index_parts_exports10.Icon, null, /* @__PURE__ */ import_react111.default.createElement(
|
|
39811
40480
|
import_noya_icons14.DropdownChevronIcon,
|
|
39812
40481
|
{
|
|
39813
40482
|
className: cx(
|
|
@@ -39817,7 +40486,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39817
40486
|
}
|
|
39818
40487
|
))
|
|
39819
40488
|
),
|
|
39820
|
-
/* @__PURE__ */
|
|
40489
|
+
/* @__PURE__ */ import_react111.default.createElement(index_parts_exports10.Portal, null, /* @__PURE__ */ import_react111.default.createElement(
|
|
39821
40490
|
index_parts_exports10.Positioner,
|
|
39822
40491
|
{
|
|
39823
40492
|
...portalScopeProps(portalScopeId),
|
|
@@ -39827,12 +40496,12 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
39827
40496
|
style: contentStyle,
|
|
39828
40497
|
className: "n-z-menu"
|
|
39829
40498
|
},
|
|
39830
|
-
/* @__PURE__ */
|
|
40499
|
+
/* @__PURE__ */ import_react111.default.createElement(index_parts_exports10.Popup, { className: styles.contentStyle }, /* @__PURE__ */ import_react111.default.createElement(index_parts_exports10.ScrollUpArrow, { className: scrollButtonStyles }, /* @__PURE__ */ import_react111.default.createElement(
|
|
39831
40500
|
import_noya_icons14.ChevronUpIcon,
|
|
39832
40501
|
{
|
|
39833
40502
|
className: cx("n-transition-transform n-duration-100")
|
|
39834
40503
|
}
|
|
39835
|
-
)), /* @__PURE__ */
|
|
40504
|
+
)), /* @__PURE__ */ import_react111.default.createElement(SelectMenuItems, { items, hasCheckedItem }), /* @__PURE__ */ import_react111.default.createElement(index_parts_exports10.ScrollDownArrow, { className: scrollButtonStyles }, /* @__PURE__ */ import_react111.default.createElement(import_noya_icons14.ChevronDownIcon, null)))
|
|
39836
40505
|
))
|
|
39837
40506
|
);
|
|
39838
40507
|
return readOnly ? readOnlyButton : content;
|
|
@@ -39851,7 +40520,7 @@ __export(index_parts_exports11, {
|
|
|
39851
40520
|
});
|
|
39852
40521
|
|
|
39853
40522
|
// ../../node_modules/@base-ui/react/slider/root/SliderRoot.mjs
|
|
39854
|
-
var
|
|
40523
|
+
var React310 = __toESM(require("react"), 1);
|
|
39855
40524
|
|
|
39856
40525
|
// ../../node_modules/@base-ui/react/slider/utils/asc.mjs
|
|
39857
40526
|
function asc(a, b) {
|
|
@@ -39896,11 +40565,11 @@ var sliderStateAttributesMapping = {
|
|
|
39896
40565
|
};
|
|
39897
40566
|
|
|
39898
40567
|
// ../../node_modules/@base-ui/react/slider/root/SliderRootContext.mjs
|
|
39899
|
-
var
|
|
39900
|
-
var SliderRootContext = /* @__PURE__ */
|
|
40568
|
+
var React309 = __toESM(require("react"), 1);
|
|
40569
|
+
var SliderRootContext = /* @__PURE__ */ React309.createContext(void 0);
|
|
39901
40570
|
if (process.env.NODE_ENV !== "production") SliderRootContext.displayName = "SliderRootContext";
|
|
39902
40571
|
function useSliderRootContext() {
|
|
39903
|
-
const context =
|
|
40572
|
+
const context = React309.useContext(SliderRootContext);
|
|
39904
40573
|
if (context === void 0) {
|
|
39905
40574
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>." : formatErrorMessage_default(62));
|
|
39906
40575
|
}
|
|
@@ -39912,7 +40581,7 @@ var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
|
39912
40581
|
function areValuesEqual(newValue, oldValue) {
|
|
39913
40582
|
return newValue === oldValue || Array.isArray(newValue) && Array.isArray(oldValue) && areArraysEqual(newValue, oldValue);
|
|
39914
40583
|
}
|
|
39915
|
-
var SliderRoot = /* @__PURE__ */
|
|
40584
|
+
var SliderRoot = /* @__PURE__ */ React310.forwardRef(function SliderRoot2(componentProps, forwardedRef) {
|
|
39916
40585
|
const {
|
|
39917
40586
|
"aria-labelledby": ariaLabelledByProp,
|
|
39918
40587
|
className,
|
|
@@ -39957,7 +40626,7 @@ var SliderRoot = /* @__PURE__ */ React307.forwardRef(function SliderRoot2(compon
|
|
|
39957
40626
|
const {
|
|
39958
40627
|
labelId: fieldLabelId
|
|
39959
40628
|
} = useLabelableContext();
|
|
39960
|
-
const [labelId, setLabelId] =
|
|
40629
|
+
const [labelId, setLabelId] = React310.useState();
|
|
39961
40630
|
const ariaLabelledby = ariaLabelledByProp ?? resolveAriaLabelledBy(fieldLabelId, labelId);
|
|
39962
40631
|
const disabled2 = fieldDisabled || disabledProp;
|
|
39963
40632
|
const name = fieldName ?? nameProp;
|
|
@@ -39966,18 +40635,18 @@ var SliderRoot = /* @__PURE__ */ React307.forwardRef(function SliderRoot2(compon
|
|
|
39966
40635
|
default: defaultValue2 ?? min2,
|
|
39967
40636
|
name: "Slider"
|
|
39968
40637
|
});
|
|
39969
|
-
const sliderRef =
|
|
39970
|
-
const controlRef =
|
|
39971
|
-
const thumbRefs =
|
|
39972
|
-
const pressedThumbCenterOffsetRef =
|
|
39973
|
-
const pressedThumbIndexRef =
|
|
39974
|
-
const pressedValuesRef =
|
|
39975
|
-
const lastChangeReasonRef =
|
|
39976
|
-
const [active, setActiveState] =
|
|
39977
|
-
const [lastUsedThumbIndex, setLastUsedThumbIndex] =
|
|
39978
|
-
const [dragging, setDragging] =
|
|
39979
|
-
const [thumbMap, setThumbMap] =
|
|
39980
|
-
const [indicatorPosition, setIndicatorPosition] =
|
|
40638
|
+
const sliderRef = React310.useRef(null);
|
|
40639
|
+
const controlRef = React310.useRef(null);
|
|
40640
|
+
const thumbRefs = React310.useRef([]);
|
|
40641
|
+
const pressedThumbCenterOffsetRef = React310.useRef(null);
|
|
40642
|
+
const pressedThumbIndexRef = React310.useRef(-1);
|
|
40643
|
+
const pressedValuesRef = React310.useRef(null);
|
|
40644
|
+
const lastChangeReasonRef = React310.useRef(reason_parts_exports.none);
|
|
40645
|
+
const [active, setActiveState] = React310.useState(-1);
|
|
40646
|
+
const [lastUsedThumbIndex, setLastUsedThumbIndex] = React310.useState(-1);
|
|
40647
|
+
const [dragging, setDragging] = React310.useState(false);
|
|
40648
|
+
const [thumbMap, setThumbMap] = React310.useState(() => /* @__PURE__ */ new Map());
|
|
40649
|
+
const [indicatorPosition, setIndicatorPosition] = React310.useState([void 0, void 0]);
|
|
39981
40650
|
const setActive = useStableCallback2((value) => {
|
|
39982
40651
|
setActiveState(value);
|
|
39983
40652
|
if (value !== -1) {
|
|
@@ -39990,7 +40659,7 @@ var SliderRoot = /* @__PURE__ */ React307.forwardRef(function SliderRoot2(compon
|
|
|
39990
40659
|
}
|
|
39991
40660
|
});
|
|
39992
40661
|
const range2 = Array.isArray(valueUnwrapped);
|
|
39993
|
-
const values =
|
|
40662
|
+
const values = React310.useMemo(() => {
|
|
39994
40663
|
if (!range2) {
|
|
39995
40664
|
return [clamp2(valueUnwrapped, min2, max2)];
|
|
39996
40665
|
}
|
|
@@ -40063,7 +40732,7 @@ var SliderRoot = /* @__PURE__ */ React307.forwardRef(function SliderRoot2(compon
|
|
|
40063
40732
|
setActive(-1);
|
|
40064
40733
|
}
|
|
40065
40734
|
}, [active, disabled2, setActive]);
|
|
40066
|
-
const state =
|
|
40735
|
+
const state = React310.useMemo(() => ({
|
|
40067
40736
|
...fieldState,
|
|
40068
40737
|
activeThumbIndex: active,
|
|
40069
40738
|
disabled: disabled2,
|
|
@@ -40075,7 +40744,7 @@ var SliderRoot = /* @__PURE__ */ React307.forwardRef(function SliderRoot2(compon
|
|
|
40075
40744
|
step,
|
|
40076
40745
|
values
|
|
40077
40746
|
}), [fieldState, active, disabled2, dragging, max2, min2, minStepsBetweenValues, orientation, step, values]);
|
|
40078
|
-
const contextValue =
|
|
40747
|
+
const contextValue = React310.useMemo(() => ({
|
|
40079
40748
|
active,
|
|
40080
40749
|
controlRef,
|
|
40081
40750
|
disabled: disabled2,
|
|
@@ -40137,8 +40806,8 @@ var SliderRoot = /* @__PURE__ */ React307.forwardRef(function SliderRoot2(compon
|
|
|
40137
40806
|
if (process.env.NODE_ENV !== "production") SliderRoot.displayName = "SliderRoot";
|
|
40138
40807
|
|
|
40139
40808
|
// ../../node_modules/@base-ui/react/slider/label/SliderLabel.mjs
|
|
40140
|
-
var
|
|
40141
|
-
var SliderLabel = /* @__PURE__ */
|
|
40809
|
+
var React311 = __toESM(require("react"), 1);
|
|
40810
|
+
var SliderLabel = /* @__PURE__ */ React311.forwardRef(function SliderLabel2(componentProps, forwardedRef) {
|
|
40142
40811
|
const {
|
|
40143
40812
|
render,
|
|
40144
40813
|
className,
|
|
@@ -40182,8 +40851,8 @@ var SliderLabel = /* @__PURE__ */ React308.forwardRef(function SliderLabel2(comp
|
|
|
40182
40851
|
if (process.env.NODE_ENV !== "production") SliderLabel.displayName = "SliderLabel";
|
|
40183
40852
|
|
|
40184
40853
|
// ../../node_modules/@base-ui/react/slider/value/SliderValue.mjs
|
|
40185
|
-
var
|
|
40186
|
-
var SliderValue = /* @__PURE__ */
|
|
40854
|
+
var React312 = __toESM(require("react"), 1);
|
|
40855
|
+
var SliderValue = /* @__PURE__ */ React312.forwardRef(function SliderValue2(componentProps, forwardedRef) {
|
|
40187
40856
|
const {
|
|
40188
40857
|
"aria-live": ariaLive = "off",
|
|
40189
40858
|
render,
|
|
@@ -40202,7 +40871,7 @@ var SliderValue = /* @__PURE__ */ React309.forwardRef(function SliderValue2(comp
|
|
|
40202
40871
|
const outputFor = Array.from(thumbMap.values(), ({
|
|
40203
40872
|
inputId
|
|
40204
40873
|
}) => inputId).join(" ").trim() || void 0;
|
|
40205
|
-
const formattedValues =
|
|
40874
|
+
const formattedValues = React312.useMemo(() => values.map((v) => formatNumber(v, locale, format)), [format, locale, values]);
|
|
40206
40875
|
const defaultDisplayValue = formattedValues.join(" \u2013 ");
|
|
40207
40876
|
const element = useRenderElement("output", componentProps, {
|
|
40208
40877
|
state,
|
|
@@ -40221,7 +40890,7 @@ var SliderValue = /* @__PURE__ */ React309.forwardRef(function SliderValue2(comp
|
|
|
40221
40890
|
if (process.env.NODE_ENV !== "production") SliderValue.displayName = "SliderValue";
|
|
40222
40891
|
|
|
40223
40892
|
// ../../node_modules/@base-ui/react/slider/control/SliderControl.mjs
|
|
40224
|
-
var
|
|
40893
|
+
var React313 = __toESM(require("react"), 1);
|
|
40225
40894
|
|
|
40226
40895
|
// ../../node_modules/@base-ui/react/slider/utils/getMidpoint.mjs
|
|
40227
40896
|
function getMidpoint(element, vertical) {
|
|
@@ -40407,7 +41076,7 @@ function getFingerCoords(event, touchIdRef) {
|
|
|
40407
41076
|
y: event.clientY
|
|
40408
41077
|
};
|
|
40409
41078
|
}
|
|
40410
|
-
var SliderControl = /* @__PURE__ */
|
|
41079
|
+
var SliderControl = /* @__PURE__ */ React313.forwardRef(function SliderControl2(componentProps, forwardedRef) {
|
|
40411
41080
|
const {
|
|
40412
41081
|
render: renderProp,
|
|
40413
41082
|
className,
|
|
@@ -40441,17 +41110,17 @@ var SliderControl = /* @__PURE__ */ React310.forwardRef(function SliderControl2(
|
|
|
40441
41110
|
const direction = useDirection();
|
|
40442
41111
|
const range2 = values.length > 1;
|
|
40443
41112
|
const vertical = orientation === "vertical";
|
|
40444
|
-
const controlRef =
|
|
40445
|
-
const stylesRef =
|
|
41113
|
+
const controlRef = React313.useRef(null);
|
|
41114
|
+
const stylesRef = React313.useRef(null);
|
|
40446
41115
|
const setStylesRef = useStableCallback2((element2) => {
|
|
40447
41116
|
if (element2 && stylesRef.current == null) {
|
|
40448
41117
|
stylesRef.current = getWindow2(element2).getComputedStyle(element2);
|
|
40449
41118
|
}
|
|
40450
41119
|
});
|
|
40451
|
-
const touchIdRef =
|
|
40452
|
-
const moveCountRef =
|
|
40453
|
-
const insetThumbOffsetRef =
|
|
40454
|
-
const currentInteractionValueRef =
|
|
41120
|
+
const touchIdRef = React313.useRef(null);
|
|
41121
|
+
const moveCountRef = React313.useRef(0);
|
|
41122
|
+
const insetThumbOffsetRef = React313.useRef(0);
|
|
41123
|
+
const currentInteractionValueRef = React313.useRef(null);
|
|
40455
41124
|
const latestValuesRef = useValueAsRef(values);
|
|
40456
41125
|
function getThumbInput(el) {
|
|
40457
41126
|
return el?.querySelector('input[type="range"]');
|
|
@@ -40664,7 +41333,7 @@ var SliderControl = /* @__PURE__ */ React310.forwardRef(function SliderControl2(
|
|
|
40664
41333
|
currentInteractionValueRef.current = null;
|
|
40665
41334
|
});
|
|
40666
41335
|
const focusFrame = useAnimationFrame();
|
|
40667
|
-
|
|
41336
|
+
React313.useEffect(() => {
|
|
40668
41337
|
const control = controlRef.current;
|
|
40669
41338
|
if (!control) {
|
|
40670
41339
|
return () => stopListening();
|
|
@@ -40678,7 +41347,7 @@ var SliderControl = /* @__PURE__ */ React310.forwardRef(function SliderControl2(
|
|
|
40678
41347
|
stopListening();
|
|
40679
41348
|
};
|
|
40680
41349
|
}, [stopListening, handleTouchStart, controlRef, focusFrame]);
|
|
40681
|
-
|
|
41350
|
+
React313.useEffect(() => {
|
|
40682
41351
|
if (disabled2) {
|
|
40683
41352
|
stopListening();
|
|
40684
41353
|
}
|
|
@@ -40741,8 +41410,8 @@ var SliderControl = /* @__PURE__ */ React310.forwardRef(function SliderControl2(
|
|
|
40741
41410
|
if (process.env.NODE_ENV !== "production") SliderControl.displayName = "SliderControl";
|
|
40742
41411
|
|
|
40743
41412
|
// ../../node_modules/@base-ui/react/slider/track/SliderTrack.mjs
|
|
40744
|
-
var
|
|
40745
|
-
var SliderTrack = /* @__PURE__ */
|
|
41413
|
+
var React314 = __toESM(require("react"), 1);
|
|
41414
|
+
var SliderTrack = /* @__PURE__ */ React314.forwardRef(function SliderTrack2(componentProps, forwardedRef) {
|
|
40746
41415
|
const {
|
|
40747
41416
|
render,
|
|
40748
41417
|
className,
|
|
@@ -40767,7 +41436,7 @@ var SliderTrack = /* @__PURE__ */ React311.forwardRef(function SliderTrack2(comp
|
|
|
40767
41436
|
if (process.env.NODE_ENV !== "production") SliderTrack.displayName = "SliderTrack";
|
|
40768
41437
|
|
|
40769
41438
|
// ../../node_modules/@base-ui/react/slider/thumb/SliderThumb.mjs
|
|
40770
|
-
var
|
|
41439
|
+
var React316 = __toESM(require("react"), 1);
|
|
40771
41440
|
|
|
40772
41441
|
// ../../node_modules/@base-ui/react/slider/thumb/prehydrationScript.min.mjs
|
|
40773
41442
|
var script = '!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();';
|
|
@@ -40788,7 +41457,7 @@ function useIsHydrating() {
|
|
|
40788
41457
|
}
|
|
40789
41458
|
|
|
40790
41459
|
// ../../node_modules/@base-ui/react/internals/PrehydrationScript.mjs
|
|
40791
|
-
var
|
|
41460
|
+
var React315 = __toESM(require("react"), 1);
|
|
40792
41461
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
40793
41462
|
function PrehydrationScript(props) {
|
|
40794
41463
|
const {
|
|
@@ -40828,7 +41497,7 @@ function getNewValue(thumbValue, increment, direction, min2, max2) {
|
|
|
40828
41497
|
const roundedValue = Number(value.toFixed(Math.max(getDecimalPrecision(thumbValue), getDecimalPrecision(increment), getDecimalPrecision(min2))));
|
|
40829
41498
|
return clamp2(roundedValue, min2, max2);
|
|
40830
41499
|
}
|
|
40831
|
-
var SliderThumb = /* @__PURE__ */
|
|
41500
|
+
var SliderThumb = /* @__PURE__ */ React316.forwardRef(function SliderThumb2(componentProps, forwardedRef) {
|
|
40832
41501
|
const {
|
|
40833
41502
|
render,
|
|
40834
41503
|
children: childrenProp,
|
|
@@ -40889,9 +41558,9 @@ var SliderThumb = /* @__PURE__ */ React313.forwardRef(function SliderThumb2(comp
|
|
|
40889
41558
|
setFocused,
|
|
40890
41559
|
validationMode
|
|
40891
41560
|
} = useFieldRootContext();
|
|
40892
|
-
const thumbRef =
|
|
40893
|
-
const inputRef =
|
|
40894
|
-
const restoringFocusVisibleRef =
|
|
41561
|
+
const thumbRef = React316.useRef(null);
|
|
41562
|
+
const inputRef = React316.useRef(null);
|
|
41563
|
+
const restoringFocusVisibleRef = React316.useRef(false);
|
|
40895
41564
|
const handleFocusProp = useStableCallback2((event) => {
|
|
40896
41565
|
if (restoringFocusVisibleRef.current) {
|
|
40897
41566
|
return;
|
|
@@ -40907,7 +41576,7 @@ var SliderThumb = /* @__PURE__ */ React313.forwardRef(function SliderThumb2(comp
|
|
|
40907
41576
|
const defaultInputId = useBaseUiId();
|
|
40908
41577
|
const labelableId = useLabelableId();
|
|
40909
41578
|
const inputId = range2 ? defaultInputId : labelableId;
|
|
40910
|
-
const thumbMetadata =
|
|
41579
|
+
const thumbMetadata = React316.useMemo(() => ({
|
|
40911
41580
|
inputId
|
|
40912
41581
|
}), [inputId]);
|
|
40913
41582
|
const {
|
|
@@ -40920,7 +41589,7 @@ var SliderThumb = /* @__PURE__ */ React313.forwardRef(function SliderThumb2(comp
|
|
|
40920
41589
|
const last = index2 === sliderValues.length - 1;
|
|
40921
41590
|
const thumbValue = sliderValues[index2];
|
|
40922
41591
|
const thumbValuePercent = valueToPercent(thumbValue, min2, max2);
|
|
40923
|
-
const [positionPercent, setPositionPercent] =
|
|
41592
|
+
const [positionPercent, setPositionPercent] = React316.useState();
|
|
40924
41593
|
const isHydrating = useIsHydrating();
|
|
40925
41594
|
const safeLastUsedThumbIndex = lastUsedThumbIndex >= 0 && lastUsedThumbIndex < sliderValues.length ? lastUsedThumbIndex : -1;
|
|
40926
41595
|
const getInsetPosition = useStableCallback2(() => {
|
|
@@ -41131,7 +41800,7 @@ var SliderThumb = /* @__PURE__ */ React313.forwardRef(function SliderThumb2(comp
|
|
|
41131
41800
|
ref: [forwardedRef, listItemRef, thumbRef],
|
|
41132
41801
|
props: [{
|
|
41133
41802
|
["data-index"]: index2,
|
|
41134
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
41803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(React316.Fragment, {
|
|
41135
41804
|
children: [childrenProp, /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("input", {
|
|
41136
41805
|
ref: mergedInputRef,
|
|
41137
41806
|
...inputProps,
|
|
@@ -41159,7 +41828,7 @@ var SliderThumb = /* @__PURE__ */ React313.forwardRef(function SliderThumb2(comp
|
|
|
41159
41828
|
if (process.env.NODE_ENV !== "production") SliderThumb.displayName = "SliderThumb";
|
|
41160
41829
|
|
|
41161
41830
|
// ../../node_modules/@base-ui/react/slider/indicator/SliderIndicator.mjs
|
|
41162
|
-
var
|
|
41831
|
+
var React317 = __toESM(require("react"), 1);
|
|
41163
41832
|
function getIndicatorStyles(vertical, range2, inset, start, end, forceHidden) {
|
|
41164
41833
|
const styles3 = {
|
|
41165
41834
|
visibility: forceHidden || inset && (start === void 0 || range2 && end === void 0) ? "hidden" : void 0,
|
|
@@ -41180,7 +41849,7 @@ function getIndicatorStyles(vertical, range2, inset, start, end, forceHidden) {
|
|
|
41180
41849
|
styles3[vertical ? "height" : "width"] = range2 ? sizeValue : startValue;
|
|
41181
41850
|
return styles3;
|
|
41182
41851
|
}
|
|
41183
|
-
var SliderIndicator = /* @__PURE__ */
|
|
41852
|
+
var SliderIndicator = /* @__PURE__ */ React317.forwardRef(function SliderIndicator2(componentProps, forwardedRef) {
|
|
41184
41853
|
const {
|
|
41185
41854
|
render,
|
|
41186
41855
|
className,
|
|
@@ -41216,12 +41885,12 @@ var SliderIndicator = /* @__PURE__ */ React314.forwardRef(function SliderIndicat
|
|
|
41216
41885
|
if (process.env.NODE_ENV !== "production") SliderIndicator.displayName = "SliderIndicator";
|
|
41217
41886
|
|
|
41218
41887
|
// src/components/Slider.tsx
|
|
41219
|
-
var
|
|
41888
|
+
var import_react112 = __toESM(require("react"));
|
|
41220
41889
|
var THUMB_WIDTH = 8;
|
|
41221
41890
|
var thumbStyle = {
|
|
41222
41891
|
width: THUMB_WIDTH
|
|
41223
41892
|
};
|
|
41224
|
-
var Slider = (0,
|
|
41893
|
+
var Slider = (0, import_react112.memo)(function Slider2({
|
|
41225
41894
|
style: style2,
|
|
41226
41895
|
className,
|
|
41227
41896
|
value,
|
|
@@ -41239,14 +41908,14 @@ var Slider = (0, import_react109.memo)(function Slider2({
|
|
|
41239
41908
|
const { fieldId: id } = useLabel({
|
|
41240
41909
|
fieldId: props.id
|
|
41241
41910
|
});
|
|
41242
|
-
const handleValueChange = (0,
|
|
41911
|
+
const handleValueChange = (0, import_react112.useCallback)(
|
|
41243
41912
|
(newValue) => {
|
|
41244
41913
|
onValueChange(newValue);
|
|
41245
41914
|
},
|
|
41246
41915
|
[onValueChange]
|
|
41247
41916
|
);
|
|
41248
41917
|
const ratio = (clampedValue - min2) / (max2 - min2);
|
|
41249
|
-
return /* @__PURE__ */
|
|
41918
|
+
return /* @__PURE__ */ import_react112.default.createElement(
|
|
41250
41919
|
index_parts_exports11.Root,
|
|
41251
41920
|
{
|
|
41252
41921
|
min: min2,
|
|
@@ -41265,7 +41934,7 @@ var Slider = (0, import_react109.memo)(function Slider2({
|
|
|
41265
41934
|
disabled: readOnly,
|
|
41266
41935
|
thumbAlignment: "edge"
|
|
41267
41936
|
},
|
|
41268
|
-
/* @__PURE__ */
|
|
41937
|
+
/* @__PURE__ */ import_react112.default.createElement(index_parts_exports11.Control, { className: "n-relative n-flex-grow n-h-[21px] n-flex n-items-center" }, /* @__PURE__ */ import_react112.default.createElement(index_parts_exports11.Track, { className: "n-relative n-flex-grow n-h-[3px] n-overflow-hidden" }, /* @__PURE__ */ import_react112.default.createElement(
|
|
41269
41938
|
"div",
|
|
41270
41939
|
{
|
|
41271
41940
|
className: "n-absolute n-h-full n-rounded-l n-bg-slider-active-background",
|
|
@@ -41276,7 +41945,7 @@ var Slider = (0, import_react109.memo)(function Slider2({
|
|
|
41276
41945
|
width: `calc(${ratio * 100}% - ${ratio * THUMB_WIDTH + 2}px)`
|
|
41277
41946
|
}
|
|
41278
41947
|
}
|
|
41279
|
-
), /* @__PURE__ */
|
|
41948
|
+
), /* @__PURE__ */ import_react112.default.createElement(
|
|
41280
41949
|
"div",
|
|
41281
41950
|
{
|
|
41282
41951
|
className: "n-absolute n-h-full n-rounded-r n-bg-input-background",
|
|
@@ -41286,7 +41955,7 @@ var Slider = (0, import_react109.memo)(function Slider2({
|
|
|
41286
41955
|
width: `calc(${(1 - ratio) * 100}% - ${(1 - ratio) * THUMB_WIDTH + 2}px)`
|
|
41287
41956
|
}
|
|
41288
41957
|
}
|
|
41289
|
-
)), /* @__PURE__ */
|
|
41958
|
+
)), /* @__PURE__ */ import_react112.default.createElement(
|
|
41290
41959
|
index_parts_exports11.Thumb,
|
|
41291
41960
|
{
|
|
41292
41961
|
style: thumbStyle,
|
|
@@ -41303,34 +41972,34 @@ var Slider = (0, import_react109.memo)(function Slider2({
|
|
|
41303
41972
|
});
|
|
41304
41973
|
|
|
41305
41974
|
// src/components/sorting/createSharedDrag.tsx
|
|
41306
|
-
var
|
|
41975
|
+
var React319 = __toESM(require("react"));
|
|
41307
41976
|
function createSharedDrag() {
|
|
41308
|
-
const dragRegistrationContext =
|
|
41309
|
-
const activeDragContext =
|
|
41977
|
+
const dragRegistrationContext = React319.createContext(null);
|
|
41978
|
+
const activeDragContext = React319.createContext(
|
|
41310
41979
|
null
|
|
41311
41980
|
);
|
|
41312
41981
|
const sharedDragProps = {
|
|
41313
41982
|
dragRegistrationContext,
|
|
41314
41983
|
activeDragContext
|
|
41315
41984
|
};
|
|
41316
|
-
const Provider = (props) => /* @__PURE__ */
|
|
41985
|
+
const Provider = (props) => /* @__PURE__ */ React319.createElement(SharedDragProvider, { sharedDragProps, ...props });
|
|
41317
41986
|
return {
|
|
41318
41987
|
Provider,
|
|
41319
|
-
Sortable: (props) => /* @__PURE__ */
|
|
41988
|
+
Sortable: (props) => /* @__PURE__ */ React319.createElement(Sortable, { sharedDragProps, ...props }),
|
|
41320
41989
|
props: sharedDragProps
|
|
41321
41990
|
};
|
|
41322
41991
|
}
|
|
41323
41992
|
|
|
41324
41993
|
// src/components/StatCard.tsx
|
|
41325
41994
|
var import_noya_icons15 = require("@noya-app/noya-icons");
|
|
41326
|
-
var
|
|
41995
|
+
var import_react113 = __toESM(require("react"));
|
|
41327
41996
|
var ICON_COLOR_STYLES = {
|
|
41328
41997
|
primary: "n-bg-primary",
|
|
41329
41998
|
secondary: "n-bg-secondary",
|
|
41330
41999
|
info: "n-bg-banner-info-text",
|
|
41331
42000
|
error: "n-bg-banner-error-text"
|
|
41332
42001
|
};
|
|
41333
|
-
var StatCard = (0,
|
|
42002
|
+
var StatCard = (0, import_react113.forwardRef)(
|
|
41334
42003
|
function StatCard2({
|
|
41335
42004
|
label,
|
|
41336
42005
|
value,
|
|
@@ -41342,14 +42011,14 @@ var StatCard = (0, import_react110.forwardRef)(
|
|
|
41342
42011
|
...props
|
|
41343
42012
|
}, forwardedRef) {
|
|
41344
42013
|
const TrendIcon = trend === "down" ? import_noya_icons15.ArrowDownIcon : import_noya_icons15.ArrowUpIcon;
|
|
41345
|
-
return /* @__PURE__ */
|
|
42014
|
+
return /* @__PURE__ */ import_react113.default.createElement(
|
|
41346
42015
|
Card,
|
|
41347
42016
|
{
|
|
41348
42017
|
ref: forwardedRef,
|
|
41349
42018
|
className: cx("n-flex n-items-center n-gap-4", className),
|
|
41350
42019
|
...props
|
|
41351
42020
|
},
|
|
41352
|
-
icon && /* @__PURE__ */
|
|
42021
|
+
icon && /* @__PURE__ */ import_react113.default.createElement(
|
|
41353
42022
|
"div",
|
|
41354
42023
|
{
|
|
41355
42024
|
"aria-hidden": "true",
|
|
@@ -41360,24 +42029,24 @@ var StatCard = (0, import_react110.forwardRef)(
|
|
|
41360
42029
|
},
|
|
41361
42030
|
renderIcon(icon)
|
|
41362
42031
|
),
|
|
41363
|
-
/* @__PURE__ */
|
|
42032
|
+
/* @__PURE__ */ import_react113.default.createElement("div", { className: "n-flex n-min-w-0 n-flex-1 n-self-stretch n-flex-col n-justify-center n-gap-1" }, /* @__PURE__ */ import_react113.default.createElement("div", { className: "n-flex n-items-center n-gap-4" }, /* @__PURE__ */ import_react113.default.createElement(Small, { className: "n-min-w-0 n-flex-1 n-opacity-70" }, label), change !== void 0 && /* @__PURE__ */ import_react113.default.createElement(
|
|
41364
42033
|
Chip,
|
|
41365
42034
|
{
|
|
41366
42035
|
className: "n-flex-none n-gap-1",
|
|
41367
42036
|
colorScheme,
|
|
41368
42037
|
size: "large"
|
|
41369
42038
|
},
|
|
41370
|
-
trend && /* @__PURE__ */
|
|
42039
|
+
trend && /* @__PURE__ */ import_react113.default.createElement(TrendIcon, { "aria-hidden": "true" }),
|
|
41371
42040
|
change
|
|
41372
|
-
)), /* @__PURE__ */
|
|
42041
|
+
)), /* @__PURE__ */ import_react113.default.createElement(Heading1, { as: "div", className: "!n-font-bold n-leading-none" }, value))
|
|
41373
42042
|
);
|
|
41374
42043
|
}
|
|
41375
42044
|
);
|
|
41376
42045
|
|
|
41377
42046
|
// src/components/Stepper.tsx
|
|
41378
42047
|
var import_noya_utils19 = require("@noya-app/noya-utils");
|
|
41379
|
-
var
|
|
41380
|
-
var Stepper = (0,
|
|
42048
|
+
var import_react114 = __toESM(require("react"));
|
|
42049
|
+
var Stepper = (0, import_react114.memo)(function Stepper2({
|
|
41381
42050
|
style: style2,
|
|
41382
42051
|
className,
|
|
41383
42052
|
value: valueProp,
|
|
@@ -41394,17 +42063,17 @@ var Stepper = (0, import_react111.memo)(function Stepper2({
|
|
|
41394
42063
|
const { fieldId: id } = useLabel({
|
|
41395
42064
|
fieldId: props.id
|
|
41396
42065
|
});
|
|
41397
|
-
const value = (0,
|
|
42066
|
+
const value = (0, import_react114.useMemo)(() => {
|
|
41398
42067
|
return (0, import_noya_utils19.clamp)(valueProp, min2, max2);
|
|
41399
42068
|
}, [valueProp, min2, max2]);
|
|
41400
|
-
const handleValueChange = (0,
|
|
42069
|
+
const handleValueChange = (0, import_react114.useCallback)(
|
|
41401
42070
|
(value2) => {
|
|
41402
42071
|
const newValue = (0, import_noya_utils19.clamp)(value2, min2, max2);
|
|
41403
42072
|
onValueChange(newValue);
|
|
41404
42073
|
},
|
|
41405
42074
|
[onValueChange, min2, max2]
|
|
41406
42075
|
);
|
|
41407
|
-
return /* @__PURE__ */
|
|
42076
|
+
return /* @__PURE__ */ import_react114.default.createElement(
|
|
41408
42077
|
"div",
|
|
41409
42078
|
{
|
|
41410
42079
|
id,
|
|
@@ -41416,7 +42085,7 @@ var Stepper = (0, import_react111.memo)(function Stepper2({
|
|
|
41416
42085
|
onFocus,
|
|
41417
42086
|
onBlur
|
|
41418
42087
|
},
|
|
41419
|
-
/* @__PURE__ */
|
|
42088
|
+
/* @__PURE__ */ import_react114.default.createElement(
|
|
41420
42089
|
InputField2.Root,
|
|
41421
42090
|
{
|
|
41422
42091
|
className: "n-flex-1",
|
|
@@ -41424,7 +42093,7 @@ var Stepper = (0, import_react111.memo)(function Stepper2({
|
|
|
41424
42093
|
startClassName: "-n-ml-[3px]",
|
|
41425
42094
|
endWidth: 17,
|
|
41426
42095
|
endClassName: "-n-mr-[3px]",
|
|
41427
|
-
start: /* @__PURE__ */
|
|
42096
|
+
start: /* @__PURE__ */ import_react114.default.createElement(
|
|
41428
42097
|
IconButton,
|
|
41429
42098
|
{
|
|
41430
42099
|
iconName: "MinusIcon",
|
|
@@ -41438,7 +42107,7 @@ var Stepper = (0, import_react111.memo)(function Stepper2({
|
|
|
41438
42107
|
}
|
|
41439
42108
|
}
|
|
41440
42109
|
),
|
|
41441
|
-
end: /* @__PURE__ */
|
|
42110
|
+
end: /* @__PURE__ */ import_react114.default.createElement(
|
|
41442
42111
|
IconButton,
|
|
41443
42112
|
{
|
|
41444
42113
|
iconName: "PlusIcon",
|
|
@@ -41453,7 +42122,7 @@ var Stepper = (0, import_react111.memo)(function Stepper2({
|
|
|
41453
42122
|
}
|
|
41454
42123
|
)
|
|
41455
42124
|
},
|
|
41456
|
-
/* @__PURE__ */
|
|
42125
|
+
/* @__PURE__ */ import_react114.default.createElement(
|
|
41457
42126
|
InputField2.NumberInput,
|
|
41458
42127
|
{
|
|
41459
42128
|
value,
|
|
@@ -41474,14 +42143,14 @@ __export(index_parts_exports12, {
|
|
|
41474
42143
|
});
|
|
41475
42144
|
|
|
41476
42145
|
// ../../node_modules/@base-ui/react/switch/root/SwitchRoot.mjs
|
|
41477
|
-
var
|
|
42146
|
+
var React324 = __toESM(require("react"), 1);
|
|
41478
42147
|
|
|
41479
42148
|
// ../../node_modules/@base-ui/react/switch/root/SwitchRootContext.mjs
|
|
41480
|
-
var
|
|
41481
|
-
var SwitchRootContext = /* @__PURE__ */
|
|
42149
|
+
var React322 = __toESM(require("react"), 1);
|
|
42150
|
+
var SwitchRootContext = /* @__PURE__ */ React322.createContext(void 0);
|
|
41482
42151
|
if (process.env.NODE_ENV !== "production") SwitchRootContext.displayName = "SwitchRootContext";
|
|
41483
42152
|
function useSwitchRootContext() {
|
|
41484
|
-
const context =
|
|
42153
|
+
const context = React322.useContext(SwitchRootContext);
|
|
41485
42154
|
if (context === void 0) {
|
|
41486
42155
|
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>." : formatErrorMessage_default(63));
|
|
41487
42156
|
}
|
|
@@ -41504,9 +42173,9 @@ var stateAttributesMapping6 = {
|
|
|
41504
42173
|
};
|
|
41505
42174
|
|
|
41506
42175
|
// ../../node_modules/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.mjs
|
|
41507
|
-
var
|
|
42176
|
+
var React323 = __toESM(require("react"), 1);
|
|
41508
42177
|
function useAriaLabelledBy(explicitAriaLabelledBy, labelId, labelSourceRef, enableFallback = true, labelSourceId) {
|
|
41509
|
-
const [fallbackAriaLabelledBy, setFallbackAriaLabelledBy] =
|
|
42178
|
+
const [fallbackAriaLabelledBy, setFallbackAriaLabelledBy] = React323.useState();
|
|
41510
42179
|
const generatedLabelId = useBaseUiId(labelSourceId ? `${labelSourceId}-label` : void 0);
|
|
41511
42180
|
const ariaLabelledBy = explicitAriaLabelledBy ?? labelId ?? fallbackAriaLabelledBy;
|
|
41512
42181
|
useIsoLayoutEffect(() => {
|
|
@@ -41548,7 +42217,7 @@ function findAssociatedLabel(labelSource) {
|
|
|
41548
42217
|
|
|
41549
42218
|
// ../../node_modules/@base-ui/react/switch/root/SwitchRoot.mjs
|
|
41550
42219
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
41551
|
-
var SwitchRoot = /* @__PURE__ */
|
|
42220
|
+
var SwitchRoot = /* @__PURE__ */ React324.forwardRef(function SwitchRoot2(componentProps, forwardedRef) {
|
|
41552
42221
|
const {
|
|
41553
42222
|
checked: checkedProp,
|
|
41554
42223
|
className,
|
|
@@ -41589,9 +42258,9 @@ var SwitchRoot = /* @__PURE__ */ React321.forwardRef(function SwitchRoot2(compon
|
|
|
41589
42258
|
} = useLabelableContext();
|
|
41590
42259
|
const disabled2 = fieldDisabled || disabledProp;
|
|
41591
42260
|
const name = fieldName ?? nameProp;
|
|
41592
|
-
const inputRef =
|
|
42261
|
+
const inputRef = React324.useRef(null);
|
|
41593
42262
|
const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);
|
|
41594
|
-
const switchRef =
|
|
42263
|
+
const switchRef = React324.useRef(null);
|
|
41595
42264
|
const id = useBaseUiId();
|
|
41596
42265
|
const controlId = useLabelableId({
|
|
41597
42266
|
id: idProp,
|
|
@@ -41701,7 +42370,7 @@ var SwitchRoot = /* @__PURE__ */ React321.forwardRef(function SwitchRoot2(compon
|
|
|
41701
42370
|
value
|
|
41702
42371
|
} : EMPTY_OBJECT
|
|
41703
42372
|
};
|
|
41704
|
-
const state =
|
|
42373
|
+
const state = React324.useMemo(() => ({
|
|
41705
42374
|
...fieldState,
|
|
41706
42375
|
checked,
|
|
41707
42376
|
disabled: disabled2,
|
|
@@ -41731,8 +42400,8 @@ var SwitchRoot = /* @__PURE__ */ React321.forwardRef(function SwitchRoot2(compon
|
|
|
41731
42400
|
if (process.env.NODE_ENV !== "production") SwitchRoot.displayName = "SwitchRoot";
|
|
41732
42401
|
|
|
41733
42402
|
// ../../node_modules/@base-ui/react/switch/thumb/SwitchThumb.mjs
|
|
41734
|
-
var
|
|
41735
|
-
var SwitchThumb = /* @__PURE__ */
|
|
42403
|
+
var React325 = __toESM(require("react"), 1);
|
|
42404
|
+
var SwitchThumb = /* @__PURE__ */ React325.forwardRef(function SwitchThumb2(componentProps, forwardedRef) {
|
|
41736
42405
|
const {
|
|
41737
42406
|
render,
|
|
41738
42407
|
className,
|
|
@@ -41750,7 +42419,7 @@ var SwitchThumb = /* @__PURE__ */ React322.forwardRef(function SwitchThumb2(comp
|
|
|
41750
42419
|
if (process.env.NODE_ENV !== "production") SwitchThumb.displayName = "SwitchThumb";
|
|
41751
42420
|
|
|
41752
42421
|
// src/components/Switch.tsx
|
|
41753
|
-
var
|
|
42422
|
+
var React326 = __toESM(require("react"));
|
|
41754
42423
|
var Switch = function Switch2({
|
|
41755
42424
|
id,
|
|
41756
42425
|
value,
|
|
@@ -41762,7 +42431,7 @@ var Switch = function Switch2({
|
|
|
41762
42431
|
style: style2,
|
|
41763
42432
|
className
|
|
41764
42433
|
}) {
|
|
41765
|
-
return /* @__PURE__ */
|
|
42434
|
+
return /* @__PURE__ */ React326.createElement(
|
|
41766
42435
|
index_parts_exports12.Root,
|
|
41767
42436
|
{
|
|
41768
42437
|
id,
|
|
@@ -41781,12 +42450,12 @@ var Switch = function Switch2({
|
|
|
41781
42450
|
onFocus,
|
|
41782
42451
|
onBlur
|
|
41783
42452
|
},
|
|
41784
|
-
/* @__PURE__ */
|
|
42453
|
+
/* @__PURE__ */ React326.createElement(index_parts_exports12.Thumb, { className: "n-block n-w-[15px] n-h-[15px] n-bg-background n-rounded-full n-transition-transform n-translate-x-[2px] n-translate-y-[2px] data-[checked]:n-translate-x-[15px]" })
|
|
41785
42454
|
);
|
|
41786
42455
|
};
|
|
41787
42456
|
|
|
41788
42457
|
// src/components/Tabs.tsx
|
|
41789
|
-
var
|
|
42458
|
+
var React327 = __toESM(require("react"));
|
|
41790
42459
|
function Tabs({
|
|
41791
42460
|
value,
|
|
41792
42461
|
onValueChange,
|
|
@@ -41801,7 +42470,7 @@ function Tabs({
|
|
|
41801
42470
|
value,
|
|
41802
42471
|
onChange: onValueChange
|
|
41803
42472
|
});
|
|
41804
|
-
return /* @__PURE__ */
|
|
42473
|
+
return /* @__PURE__ */ React327.createElement("div", { ...props, className: cx("n-flex n-flex-col", props.className) }, /* @__PURE__ */ React327.createElement("div", { className: "n-flex n-flex-row n-px-3" }, /* @__PURE__ */ React327.createElement(
|
|
41805
42474
|
SegmentedControl,
|
|
41806
42475
|
{
|
|
41807
42476
|
className: "n-flex-1",
|
|
@@ -41810,11 +42479,11 @@ function Tabs({
|
|
|
41810
42479
|
variant,
|
|
41811
42480
|
items: selectableItems
|
|
41812
42481
|
}
|
|
41813
|
-
)), /* @__PURE__ */
|
|
42482
|
+
)), /* @__PURE__ */ React327.createElement(Divider, null), renderContent({ value: activeTab }));
|
|
41814
42483
|
}
|
|
41815
42484
|
|
|
41816
42485
|
// src/components/UserPicker.tsx
|
|
41817
|
-
var
|
|
42486
|
+
var import_react115 = __toESM(require("react"));
|
|
41818
42487
|
function UserPicker({
|
|
41819
42488
|
users,
|
|
41820
42489
|
value,
|
|
@@ -41824,27 +42493,27 @@ function UserPicker({
|
|
|
41824
42493
|
placeholder = "Search users...",
|
|
41825
42494
|
...rest
|
|
41826
42495
|
}) {
|
|
41827
|
-
const sortedUsers = (0,
|
|
42496
|
+
const sortedUsers = (0, import_react115.useMemo)(() => {
|
|
41828
42497
|
return [...users].sort(
|
|
41829
42498
|
(a, b) => getUserDisplayName(a).localeCompare(getUserDisplayName(b), void 0, {
|
|
41830
42499
|
sensitivity: "base"
|
|
41831
42500
|
})
|
|
41832
42501
|
);
|
|
41833
42502
|
}, [users]);
|
|
41834
|
-
const usersById = (0,
|
|
42503
|
+
const usersById = (0, import_react115.useMemo)(() => {
|
|
41835
42504
|
return new Map(sortedUsers.map((user) => [user.id, user]));
|
|
41836
42505
|
}, [sortedUsers]);
|
|
41837
|
-
const items = (0,
|
|
42506
|
+
const items = (0, import_react115.useMemo)(() => {
|
|
41838
42507
|
return sortedUsers.map(createUserMenuItem);
|
|
41839
42508
|
}, [sortedUsers]);
|
|
41840
42509
|
const isControlled = value !== void 0;
|
|
41841
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
42510
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react115.useState)(defaultValue2);
|
|
41842
42511
|
const selectedUserId = isControlled ? value : uncontrolledValue;
|
|
41843
|
-
const selectedItem = (0,
|
|
42512
|
+
const selectedItem = (0, import_react115.useMemo)(() => {
|
|
41844
42513
|
if (!selectedUserId) return void 0;
|
|
41845
42514
|
return items.find((item) => item.value === selectedUserId);
|
|
41846
42515
|
}, [items, selectedUserId]);
|
|
41847
|
-
const updateSelectedUserId = (0,
|
|
42516
|
+
const updateSelectedUserId = (0, import_react115.useCallback)(
|
|
41848
42517
|
(userId) => {
|
|
41849
42518
|
if (!isControlled) {
|
|
41850
42519
|
setUncontrolledValue(userId);
|
|
@@ -41853,14 +42522,14 @@ function UserPicker({
|
|
|
41853
42522
|
},
|
|
41854
42523
|
[isControlled, onChangeUserId]
|
|
41855
42524
|
);
|
|
41856
|
-
const handleSelectItem = (0,
|
|
42525
|
+
const handleSelectItem = (0, import_react115.useCallback)(
|
|
41857
42526
|
(item) => {
|
|
41858
42527
|
updateSelectedUserId(item.value);
|
|
41859
42528
|
onSelectUser?.(usersById.get(item.value));
|
|
41860
42529
|
},
|
|
41861
42530
|
[updateSelectedUserId, onSelectUser, usersById]
|
|
41862
42531
|
);
|
|
41863
|
-
return /* @__PURE__ */
|
|
42532
|
+
return /* @__PURE__ */ import_react115.default.createElement(
|
|
41864
42533
|
Combobox,
|
|
41865
42534
|
{
|
|
41866
42535
|
...rest,
|
|
@@ -41884,7 +42553,7 @@ function createUserMenuItem(user) {
|
|
|
41884
42553
|
return {
|
|
41885
42554
|
value: user.id,
|
|
41886
42555
|
title,
|
|
41887
|
-
icon: /* @__PURE__ */
|
|
42556
|
+
icon: /* @__PURE__ */ import_react115.default.createElement("div", { className: "n-relative n-w-[15px] n-h-[15px]" }, /* @__PURE__ */ import_react115.default.createElement(
|
|
41888
42557
|
Avatar,
|
|
41889
42558
|
{
|
|
41890
42559
|
size: 15 + overflow * 2,
|
|
@@ -41903,15 +42572,15 @@ function createUserMenuItem(user) {
|
|
|
41903
42572
|
}
|
|
41904
42573
|
|
|
41905
42574
|
// src/components/UserPointer.tsx
|
|
41906
|
-
var
|
|
41907
|
-
var UserPointerContainer = (0,
|
|
42575
|
+
var import_react116 = __toESM(require("react"));
|
|
42576
|
+
var UserPointerContainer = (0, import_react116.memo)(function UserPointerContainer2({
|
|
41908
42577
|
point,
|
|
41909
42578
|
visible,
|
|
41910
42579
|
children,
|
|
41911
42580
|
className,
|
|
41912
42581
|
style: style2
|
|
41913
42582
|
}) {
|
|
41914
|
-
return /* @__PURE__ */
|
|
42583
|
+
return /* @__PURE__ */ import_react116.default.createElement(
|
|
41915
42584
|
"div",
|
|
41916
42585
|
{
|
|
41917
42586
|
style: {
|
|
@@ -41930,7 +42599,7 @@ var UserPointerContainer = (0, import_react113.memo)(function UserPointerContain
|
|
|
41930
42599
|
children
|
|
41931
42600
|
);
|
|
41932
42601
|
});
|
|
41933
|
-
var UserNameTag = (0,
|
|
42602
|
+
var UserNameTag = (0, import_react116.memo)(function UserNameTag2({
|
|
41934
42603
|
backgroundColor,
|
|
41935
42604
|
className,
|
|
41936
42605
|
style: style2,
|
|
@@ -41939,7 +42608,7 @@ var UserNameTag = (0, import_react113.memo)(function UserNameTag2({
|
|
|
41939
42608
|
size: size4 = "medium",
|
|
41940
42609
|
bordered = true
|
|
41941
42610
|
}) {
|
|
41942
|
-
return /* @__PURE__ */
|
|
42611
|
+
return /* @__PURE__ */ import_react116.default.createElement(
|
|
41943
42612
|
"span",
|
|
41944
42613
|
{
|
|
41945
42614
|
className: cx(
|
|
@@ -41958,14 +42627,14 @@ var UserNameTag = (0, import_react113.memo)(function UserNameTag2({
|
|
|
41958
42627
|
children
|
|
41959
42628
|
);
|
|
41960
42629
|
});
|
|
41961
|
-
var UserPointerIcon = (0,
|
|
42630
|
+
var UserPointerIcon = (0, import_react116.memo)(function PointerIcon({
|
|
41962
42631
|
size: size4,
|
|
41963
42632
|
color = "black",
|
|
41964
42633
|
className,
|
|
41965
42634
|
style: style2
|
|
41966
42635
|
}) {
|
|
41967
42636
|
const points = "0,5 10,0 10,10";
|
|
41968
|
-
return /* @__PURE__ */
|
|
42637
|
+
return /* @__PURE__ */ import_react116.default.createElement(
|
|
41969
42638
|
"svg",
|
|
41970
42639
|
{
|
|
41971
42640
|
width: size4,
|
|
@@ -41980,7 +42649,7 @@ var UserPointerIcon = (0, import_react113.memo)(function PointerIcon({
|
|
|
41980
42649
|
...style2
|
|
41981
42650
|
}
|
|
41982
42651
|
},
|
|
41983
|
-
/* @__PURE__ */
|
|
42652
|
+
/* @__PURE__ */ import_react116.default.createElement(
|
|
41984
42653
|
"polygon",
|
|
41985
42654
|
{
|
|
41986
42655
|
points,
|
|
@@ -41993,7 +42662,7 @@ var UserPointerIcon = (0, import_react113.memo)(function PointerIcon({
|
|
|
41993
42662
|
});
|
|
41994
42663
|
var POINTER_SIZE = 12;
|
|
41995
42664
|
var POINTER_OVERLAP = 6;
|
|
41996
|
-
var UserPointer = (0,
|
|
42665
|
+
var UserPointer = (0, import_react116.memo)(function UserPointer2({
|
|
41997
42666
|
userId,
|
|
41998
42667
|
name,
|
|
41999
42668
|
visible = true,
|
|
@@ -42006,22 +42675,22 @@ var UserPointer = (0, import_react113.memo)(function UserPointer2({
|
|
|
42006
42675
|
labelSize = "medium",
|
|
42007
42676
|
bordered = true
|
|
42008
42677
|
}) {
|
|
42009
|
-
const userBackgroundColor = (0,
|
|
42678
|
+
const userBackgroundColor = (0, import_react116.useMemo)(
|
|
42010
42679
|
() => backgroundColor ?? colorFromString(userId ?? name ?? ""),
|
|
42011
42680
|
[backgroundColor, userId, name]
|
|
42012
42681
|
);
|
|
42013
|
-
const pointerOverlapStyle = (0,
|
|
42682
|
+
const pointerOverlapStyle = (0, import_react116.useMemo)(
|
|
42014
42683
|
() => ({
|
|
42015
42684
|
marginRight: `-${POINTER_OVERLAP}px`,
|
|
42016
42685
|
marginBottom: `-${POINTER_OVERLAP}px`
|
|
42017
42686
|
}),
|
|
42018
42687
|
[]
|
|
42019
42688
|
);
|
|
42020
|
-
const nameTagOverlapStyle = (0,
|
|
42689
|
+
const nameTagOverlapStyle = (0, import_react116.useMemo)(
|
|
42021
42690
|
() => ({ marginLeft: `${POINTER_SIZE - POINTER_OVERLAP + 1}px` }),
|
|
42022
42691
|
[]
|
|
42023
42692
|
);
|
|
42024
|
-
return /* @__PURE__ */
|
|
42693
|
+
return /* @__PURE__ */ import_react116.default.createElement(
|
|
42025
42694
|
UserPointerContainer,
|
|
42026
42695
|
{
|
|
42027
42696
|
point,
|
|
@@ -42029,14 +42698,14 @@ var UserPointer = (0, import_react113.memo)(function UserPointer2({
|
|
|
42029
42698
|
className,
|
|
42030
42699
|
style: style2
|
|
42031
42700
|
},
|
|
42032
|
-
name && /* @__PURE__ */
|
|
42701
|
+
name && /* @__PURE__ */ import_react116.default.createElement("div", { className: "n-relative" }, showPointerIcon && /* @__PURE__ */ import_react116.default.createElement(
|
|
42033
42702
|
UserPointerIcon,
|
|
42034
42703
|
{
|
|
42035
42704
|
size: POINTER_SIZE,
|
|
42036
42705
|
color: userBackgroundColor,
|
|
42037
42706
|
style: pointerOverlapStyle
|
|
42038
42707
|
}
|
|
42039
|
-
), /* @__PURE__ */
|
|
42708
|
+
), /* @__PURE__ */ import_react116.default.createElement(
|
|
42040
42709
|
UserNameTag,
|
|
42041
42710
|
{
|
|
42042
42711
|
backgroundColor: userBackgroundColor,
|
|
@@ -42052,10 +42721,10 @@ var UserPointer = (0, import_react113.memo)(function UserPointer2({
|
|
|
42052
42721
|
|
|
42053
42722
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
42054
42723
|
var import_noya_keymap7 = require("@noya-app/noya-keymap");
|
|
42055
|
-
var
|
|
42724
|
+
var import_react126 = __toESM(require("react"));
|
|
42056
42725
|
|
|
42057
42726
|
// src/components/OverlayToolbar.tsx
|
|
42058
|
-
var
|
|
42727
|
+
var import_react117 = __toESM(require("react"));
|
|
42059
42728
|
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";
|
|
42060
42729
|
function OverlayToolbar({
|
|
42061
42730
|
left,
|
|
@@ -42066,18 +42735,18 @@ function OverlayToolbar({
|
|
|
42066
42735
|
onRectsChange
|
|
42067
42736
|
}) {
|
|
42068
42737
|
const resolvedLayout = overlayLayout === "topLeftTopRight" ? "topLeftTopRight" : "bottomCenterTopRight";
|
|
42069
|
-
const leftPanelRef = (0,
|
|
42070
|
-
const rightPanelRef = (0,
|
|
42738
|
+
const leftPanelRef = (0, import_react117.useRef)(null);
|
|
42739
|
+
const rightPanelRef = (0, import_react117.useRef)(null);
|
|
42071
42740
|
const hasLeft = Boolean(left);
|
|
42072
42741
|
const hasRight = Boolean(right);
|
|
42073
|
-
const panelStyle = (0,
|
|
42742
|
+
const panelStyle = (0, import_react117.useMemo)(
|
|
42074
42743
|
() => ({
|
|
42075
42744
|
...toolbarTransparentStyle,
|
|
42076
42745
|
...style2
|
|
42077
42746
|
}),
|
|
42078
42747
|
[style2]
|
|
42079
42748
|
);
|
|
42080
|
-
const emitRects = (0,
|
|
42749
|
+
const emitRects = (0, import_react117.useCallback)(() => {
|
|
42081
42750
|
if (!onRectsChange) return;
|
|
42082
42751
|
const panels = [
|
|
42083
42752
|
{
|
|
@@ -42108,7 +42777,7 @@ function OverlayToolbar({
|
|
|
42108
42777
|
})
|
|
42109
42778
|
);
|
|
42110
42779
|
}, [onRectsChange, resolvedLayout]);
|
|
42111
|
-
(0,
|
|
42780
|
+
(0, import_react117.useLayoutEffect)(() => {
|
|
42112
42781
|
if (!onRectsChange) return;
|
|
42113
42782
|
let animationFrame;
|
|
42114
42783
|
const scheduleEmit = () => {
|
|
@@ -42135,7 +42804,7 @@ function OverlayToolbar({
|
|
|
42135
42804
|
}, [emitRects, hasLeft, hasRight, onRectsChange]);
|
|
42136
42805
|
const renderLeftPanel = (overlayId) => {
|
|
42137
42806
|
if (!left) return null;
|
|
42138
|
-
return /* @__PURE__ */
|
|
42807
|
+
return /* @__PURE__ */ import_react117.default.createElement(
|
|
42139
42808
|
"div",
|
|
42140
42809
|
{
|
|
42141
42810
|
ref: leftPanelRef,
|
|
@@ -42146,7 +42815,7 @@ function OverlayToolbar({
|
|
|
42146
42815
|
left
|
|
42147
42816
|
);
|
|
42148
42817
|
};
|
|
42149
|
-
return /* @__PURE__ */
|
|
42818
|
+
return /* @__PURE__ */ import_react117.default.createElement(import_react117.default.Fragment, null, resolvedLayout === "bottomCenterTopRight" ? /* @__PURE__ */ import_react117.default.createElement(
|
|
42150
42819
|
"div",
|
|
42151
42820
|
{
|
|
42152
42821
|
className: cx(
|
|
@@ -42155,7 +42824,7 @@ function OverlayToolbar({
|
|
|
42155
42824
|
)
|
|
42156
42825
|
},
|
|
42157
42826
|
renderLeftPanel("noya-toolbar-bottom-center")
|
|
42158
|
-
) : /* @__PURE__ */
|
|
42827
|
+
) : /* @__PURE__ */ import_react117.default.createElement(
|
|
42159
42828
|
"div",
|
|
42160
42829
|
{
|
|
42161
42830
|
className: cx(
|
|
@@ -42164,7 +42833,7 @@ function OverlayToolbar({
|
|
|
42164
42833
|
)
|
|
42165
42834
|
},
|
|
42166
42835
|
renderLeftPanel("noya-toolbar-top-left")
|
|
42167
|
-
), right && /* @__PURE__ */
|
|
42836
|
+
), right && /* @__PURE__ */ import_react117.default.createElement(
|
|
42168
42837
|
"div",
|
|
42169
42838
|
{
|
|
42170
42839
|
className: cx(
|
|
@@ -42172,7 +42841,7 @@ function OverlayToolbar({
|
|
|
42172
42841
|
className
|
|
42173
42842
|
)
|
|
42174
42843
|
},
|
|
42175
|
-
/* @__PURE__ */
|
|
42844
|
+
/* @__PURE__ */ import_react117.default.createElement(
|
|
42176
42845
|
"div",
|
|
42177
42846
|
{
|
|
42178
42847
|
ref: rightPanelRef,
|
|
@@ -42186,316 +42855,7 @@ function OverlayToolbar({
|
|
|
42186
42855
|
}
|
|
42187
42856
|
|
|
42188
42857
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
42189
|
-
var
|
|
42190
|
-
|
|
42191
|
-
// src/components/AppToolbar.tsx
|
|
42192
|
-
var import_noya_keymap6 = require("@noya-app/noya-keymap");
|
|
42193
|
-
var import_react116 = __toESM(require("react"));
|
|
42194
|
-
|
|
42195
|
-
// src/components/ToolbarDrawer.tsx
|
|
42196
|
-
var import_react115 = __toESM(require("react"));
|
|
42197
|
-
var ToolbarDrawer = (0, import_react115.memo)(
|
|
42198
|
-
(0, import_react115.forwardRef)(function ToolbarDrawer2({ children, trigger, sideOffset = 8 }, ref) {
|
|
42199
|
-
return /* @__PURE__ */ import_react115.default.createElement("div", { className: "n-relative", ref }, /* @__PURE__ */ import_react115.default.createElement(
|
|
42200
|
-
"div",
|
|
42201
|
-
{
|
|
42202
|
-
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",
|
|
42203
|
-
style: {
|
|
42204
|
-
marginBottom: `${sideOffset}px`,
|
|
42205
|
-
boxShadow: "0px -2px 12px 0px var(--n-toolbar-drawer-shadow)"
|
|
42206
|
-
}
|
|
42207
|
-
},
|
|
42208
|
-
children
|
|
42209
|
-
), trigger);
|
|
42210
|
-
})
|
|
42211
|
-
);
|
|
42212
|
-
|
|
42213
|
-
// src/components/AppToolbar.tsx
|
|
42214
|
-
var SIDE_OFFSET = 6;
|
|
42215
|
-
var ToolbarMenuContext = (0, import_react116.createContext)({});
|
|
42216
|
-
var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
42217
|
-
item,
|
|
42218
|
-
onSelectMenuItem,
|
|
42219
|
-
onPopoverOpenChange
|
|
42220
|
-
}) {
|
|
42221
|
-
const [open, setOpen] = import_react116.default.useState(false);
|
|
42222
|
-
const handleOpenChange = import_react116.default.useCallback(
|
|
42223
|
-
(newOpen) => {
|
|
42224
|
-
setOpen(newOpen);
|
|
42225
|
-
onPopoverOpenChange?.(newOpen);
|
|
42226
|
-
},
|
|
42227
|
-
[onPopoverOpenChange]
|
|
42228
|
-
);
|
|
42229
|
-
return /* @__PURE__ */ import_react116.default.createElement(
|
|
42230
|
-
DropdownMenu,
|
|
42231
|
-
{
|
|
42232
|
-
open,
|
|
42233
|
-
onOpenChange: handleOpenChange,
|
|
42234
|
-
items: item.items,
|
|
42235
|
-
modal: false,
|
|
42236
|
-
onSelect: (value) => {
|
|
42237
|
-
if (onSelectMenuItem && value) {
|
|
42238
|
-
onSelectMenuItem(value);
|
|
42239
|
-
}
|
|
42240
|
-
}
|
|
42241
|
-
},
|
|
42242
|
-
/* @__PURE__ */ import_react116.default.createElement(
|
|
42243
|
-
Button,
|
|
42244
|
-
{
|
|
42245
|
-
disabled: item.disabled,
|
|
42246
|
-
active: item.checked || open,
|
|
42247
|
-
icon: item.icon,
|
|
42248
|
-
iconRight: item.icon === "DotsVerticalIcon" || item.icon === "DotsHorizontalIcon" ? void 0 : "DropdownChevronIcon"
|
|
42249
|
-
},
|
|
42250
|
-
item.title
|
|
42251
|
-
)
|
|
42252
|
-
);
|
|
42253
|
-
});
|
|
42254
|
-
var ToolbarShortcut = ({
|
|
42255
|
-
shortcut,
|
|
42256
|
-
label
|
|
42257
|
-
}) => {
|
|
42258
|
-
return /* @__PURE__ */ import_react116.default.createElement("div", { className: "n-flex n-items-center" }, label, /* @__PURE__ */ import_react116.default.createElement(Spacer.Horizontal, { size: 6 }), /* @__PURE__ */ import_react116.default.createElement(KeyboardShortcut, { shortcut }));
|
|
42259
|
-
};
|
|
42260
|
-
var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
42261
|
-
item,
|
|
42262
|
-
portalContainer,
|
|
42263
|
-
onPopoverOpenChange
|
|
42264
|
-
}) {
|
|
42265
|
-
const {
|
|
42266
|
-
disabled: disabled2,
|
|
42267
|
-
icon,
|
|
42268
|
-
title,
|
|
42269
|
-
tooltip,
|
|
42270
|
-
content: itemContent,
|
|
42271
|
-
checked,
|
|
42272
|
-
popoverClassName,
|
|
42273
|
-
triggerProps: buttonProps
|
|
42274
|
-
} = item;
|
|
42275
|
-
const [open, setOpen] = import_react116.default.useState(false);
|
|
42276
|
-
const handleOpenChange = import_react116.default.useCallback(
|
|
42277
|
-
(newOpen) => {
|
|
42278
|
-
setOpen(newOpen);
|
|
42279
|
-
onPopoverOpenChange?.(newOpen);
|
|
42280
|
-
},
|
|
42281
|
-
[onPopoverOpenChange]
|
|
42282
|
-
);
|
|
42283
|
-
const { useDialogOnSmallScreen, isSmallScreen, openDialog } = (0, import_react116.useContext)(ToolbarMenuContext);
|
|
42284
|
-
const shouldUseDialog = useDialogOnSmallScreen && isSmallScreen && openDialog;
|
|
42285
|
-
const handleOpenDialog = import_react116.default.useCallback(() => {
|
|
42286
|
-
if (!openDialog) return;
|
|
42287
|
-
handleOpenChange(true);
|
|
42288
|
-
const dialogContent = typeof itemContent === "function" ? (props) => /* @__PURE__ */ import_react116.default.createElement("div", { className: "-n-m-3" }, itemContent(props)) : /* @__PURE__ */ import_react116.default.createElement("div", { className: "-n-m-3" }, itemContent);
|
|
42289
|
-
const dialog = openDialog({
|
|
42290
|
-
title,
|
|
42291
|
-
children: dialogContent
|
|
42292
|
-
});
|
|
42293
|
-
dialog.then(() => handleOpenChange(false));
|
|
42294
|
-
}, [openDialog, itemContent, title, handleOpenChange]);
|
|
42295
|
-
const trigger = /* @__PURE__ */ import_react116.default.createElement(
|
|
42296
|
-
Button,
|
|
42297
|
-
{
|
|
42298
|
-
disabled: disabled2,
|
|
42299
|
-
active: checked || open,
|
|
42300
|
-
icon,
|
|
42301
|
-
iconRight: "DropdownChevronIcon",
|
|
42302
|
-
onClick: shouldUseDialog ? handleOpenDialog : void 0,
|
|
42303
|
-
...buttonProps
|
|
42304
|
-
},
|
|
42305
|
-
title
|
|
42306
|
-
);
|
|
42307
|
-
if (shouldUseDialog) {
|
|
42308
|
-
return tooltip && !open ? /* @__PURE__ */ import_react116.default.createElement(
|
|
42309
|
-
Tooltip,
|
|
42310
|
-
{
|
|
42311
|
-
sideOffset: SIDE_OFFSET,
|
|
42312
|
-
side: "top",
|
|
42313
|
-
content: tooltip,
|
|
42314
|
-
portalContainer
|
|
42315
|
-
},
|
|
42316
|
-
trigger
|
|
42317
|
-
) : trigger;
|
|
42318
|
-
}
|
|
42319
|
-
const content = /* @__PURE__ */ import_react116.default.createElement("span", null, /* @__PURE__ */ import_react116.default.createElement(
|
|
42320
|
-
Popover,
|
|
42321
|
-
{
|
|
42322
|
-
open,
|
|
42323
|
-
onOpenChange: handleOpenChange,
|
|
42324
|
-
side: "top",
|
|
42325
|
-
showArrow: false,
|
|
42326
|
-
sideOffset: SIDE_OFFSET,
|
|
42327
|
-
portalContainer,
|
|
42328
|
-
trigger,
|
|
42329
|
-
className: popoverClassName
|
|
42330
|
-
},
|
|
42331
|
-
typeof itemContent === "function" ? itemContent({ close: () => handleOpenChange(false) }) : itemContent
|
|
42332
|
-
));
|
|
42333
|
-
return tooltip && !open ? /* @__PURE__ */ import_react116.default.createElement(
|
|
42334
|
-
Tooltip,
|
|
42335
|
-
{
|
|
42336
|
-
sideOffset: SIDE_OFFSET,
|
|
42337
|
-
side: "top",
|
|
42338
|
-
content: tooltip,
|
|
42339
|
-
portalContainer
|
|
42340
|
-
},
|
|
42341
|
-
content
|
|
42342
|
-
) : content;
|
|
42343
|
-
});
|
|
42344
|
-
var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
42345
|
-
item,
|
|
42346
|
-
onSelectMenuItem,
|
|
42347
|
-
as,
|
|
42348
|
-
activeValue,
|
|
42349
|
-
tooltipSide,
|
|
42350
|
-
displayFilter
|
|
42351
|
-
}) {
|
|
42352
|
-
const isActive = item.checked || activeValue === item.value;
|
|
42353
|
-
const content = /* @__PURE__ */ import_react116.default.createElement(
|
|
42354
|
-
Button,
|
|
42355
|
-
{
|
|
42356
|
-
as,
|
|
42357
|
-
disabled: item.disabled,
|
|
42358
|
-
active: isActive,
|
|
42359
|
-
icon: displayFilter === "textOnly" ? void 0 : item.icon,
|
|
42360
|
-
...as === "a" && { href: item.value },
|
|
42361
|
-
onClick: () => {
|
|
42362
|
-
if (onSelectMenuItem && item.value) {
|
|
42363
|
-
onSelectMenuItem(item.value);
|
|
42364
|
-
}
|
|
42365
|
-
}
|
|
42366
|
-
},
|
|
42367
|
-
displayFilter === "iconOnly" ? void 0 : item.title
|
|
42368
|
-
);
|
|
42369
|
-
const tooltip = item.tooltip ?? (displayFilter === "iconOnly" && item.title ? item.title : void 0);
|
|
42370
|
-
return item.drawer && isActive ? /* @__PURE__ */ import_react116.default.createElement(ToolbarDrawer, { trigger: content }, item.drawer) : tooltip ? /* @__PURE__ */ import_react116.default.createElement(Tooltip, { sideOffset: SIDE_OFFSET, content: tooltip, side: tooltipSide }, content) : content;
|
|
42371
|
-
});
|
|
42372
|
-
var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
42373
|
-
item,
|
|
42374
|
-
onSelectMenuItem,
|
|
42375
|
-
buttonAs,
|
|
42376
|
-
activeValue,
|
|
42377
|
-
tooltipSide,
|
|
42378
|
-
portalContainer,
|
|
42379
|
-
displayFilter,
|
|
42380
|
-
dividerOverflow: dividerOverflowProp,
|
|
42381
|
-
onPopoverOpenChange
|
|
42382
|
-
}) {
|
|
42383
|
-
const { dividerOverflow: contextDividerOverflow } = (0, import_react116.useContext)(ToolbarMenuContext);
|
|
42384
|
-
const dividerOverflow = dividerOverflowProp ?? contextDividerOverflow ?? 4;
|
|
42385
|
-
if (item.type === "sectionHeader") return null;
|
|
42386
|
-
if (item.type === "separator") {
|
|
42387
|
-
return /* @__PURE__ */ import_react116.default.createElement(DividerVertical, { overflow: dividerOverflow });
|
|
42388
|
-
}
|
|
42389
|
-
if (item.type === "popover") {
|
|
42390
|
-
return /* @__PURE__ */ import_react116.default.createElement(
|
|
42391
|
-
ToolbarMenuPopover,
|
|
42392
|
-
{
|
|
42393
|
-
item,
|
|
42394
|
-
portalContainer,
|
|
42395
|
-
onPopoverOpenChange
|
|
42396
|
-
}
|
|
42397
|
-
);
|
|
42398
|
-
}
|
|
42399
|
-
if (isSelectableMenuItem(item)) {
|
|
42400
|
-
return /* @__PURE__ */ import_react116.default.createElement(
|
|
42401
|
-
ToolbarMenuButton,
|
|
42402
|
-
{
|
|
42403
|
-
item,
|
|
42404
|
-
onSelectMenuItem,
|
|
42405
|
-
as: buttonAs,
|
|
42406
|
-
activeValue,
|
|
42407
|
-
tooltipSide,
|
|
42408
|
-
displayFilter
|
|
42409
|
-
}
|
|
42410
|
-
);
|
|
42411
|
-
}
|
|
42412
|
-
return /* @__PURE__ */ import_react116.default.createElement(
|
|
42413
|
-
ToolbarMenuDropdown,
|
|
42414
|
-
{
|
|
42415
|
-
item,
|
|
42416
|
-
onSelectMenuItem,
|
|
42417
|
-
onPopoverOpenChange
|
|
42418
|
-
}
|
|
42419
|
-
);
|
|
42420
|
-
});
|
|
42421
|
-
var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
42422
|
-
items,
|
|
42423
|
-
onSelectMenuItem,
|
|
42424
|
-
buttonAs,
|
|
42425
|
-
activeValue,
|
|
42426
|
-
tooltipSide,
|
|
42427
|
-
portalContainer,
|
|
42428
|
-
displayFilter = "iconAndText",
|
|
42429
|
-
dividerOverflow,
|
|
42430
|
-
onPopoverOpenChange
|
|
42431
|
-
}) {
|
|
42432
|
-
return /* @__PURE__ */ import_react116.default.createElement(import_react116.default.Fragment, null, items.map((item, i) => {
|
|
42433
|
-
return /* @__PURE__ */ import_react116.default.createElement(
|
|
42434
|
-
ToolbarMenuItem,
|
|
42435
|
-
{
|
|
42436
|
-
key: i,
|
|
42437
|
-
item,
|
|
42438
|
-
onSelectMenuItem,
|
|
42439
|
-
buttonAs,
|
|
42440
|
-
activeValue,
|
|
42441
|
-
tooltipSide,
|
|
42442
|
-
portalContainer,
|
|
42443
|
-
displayFilter,
|
|
42444
|
-
dividerOverflow,
|
|
42445
|
-
onPopoverOpenChange
|
|
42446
|
-
}
|
|
42447
|
-
);
|
|
42448
|
-
}));
|
|
42449
|
-
});
|
|
42450
|
-
function useBindKeyboardShortcutsForMenuItems(items, onSelectMenuItem) {
|
|
42451
|
-
return (0, import_noya_keymap6.useKeyboardShortcuts)(
|
|
42452
|
-
import_react116.default.useMemo(
|
|
42453
|
-
() => onSelectMenuItem ? getKeyboardShortcutsForMenuItems(items, onSelectMenuItem) : {},
|
|
42454
|
-
[items, onSelectMenuItem]
|
|
42455
|
-
)
|
|
42456
|
-
);
|
|
42457
|
-
}
|
|
42458
|
-
function AppToolbar({
|
|
42459
|
-
children,
|
|
42460
|
-
logo,
|
|
42461
|
-
leftMenuItems = [],
|
|
42462
|
-
rightMenuItems = [],
|
|
42463
|
-
onSelectMenuItem,
|
|
42464
|
-
shouldBindKeyboardShortcuts = true,
|
|
42465
|
-
dividerOverflow
|
|
42466
|
-
}) {
|
|
42467
|
-
const allMenuItems = import_react116.default.useMemo(
|
|
42468
|
-
() => [...leftMenuItems, ...rightMenuItems],
|
|
42469
|
-
[leftMenuItems, rightMenuItems]
|
|
42470
|
-
);
|
|
42471
|
-
useBindKeyboardShortcutsForMenuItems(
|
|
42472
|
-
allMenuItems,
|
|
42473
|
-
shouldBindKeyboardShortcuts ? onSelectMenuItem : void 0
|
|
42474
|
-
);
|
|
42475
|
-
return /* @__PURE__ */ import_react116.default.createElement(
|
|
42476
|
-
BaseToolbar,
|
|
42477
|
-
{
|
|
42478
|
-
logo,
|
|
42479
|
-
left: leftMenuItems.length > 0 && /* @__PURE__ */ import_react116.default.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ import_react116.default.createElement(
|
|
42480
|
-
ToolbarMenu,
|
|
42481
|
-
{
|
|
42482
|
-
items: leftMenuItems,
|
|
42483
|
-
onSelectMenuItem,
|
|
42484
|
-
dividerOverflow
|
|
42485
|
-
}
|
|
42486
|
-
)),
|
|
42487
|
-
right: rightMenuItems.length > 0 && /* @__PURE__ */ import_react116.default.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ import_react116.default.createElement(
|
|
42488
|
-
ToolbarMenu,
|
|
42489
|
-
{
|
|
42490
|
-
items: rightMenuItems,
|
|
42491
|
-
onSelectMenuItem,
|
|
42492
|
-
dividerOverflow
|
|
42493
|
-
}
|
|
42494
|
-
))
|
|
42495
|
-
},
|
|
42496
|
-
children
|
|
42497
|
-
);
|
|
42498
|
-
}
|
|
42858
|
+
var import_react118 = __toESM(require("react"));
|
|
42499
42859
|
|
|
42500
42860
|
// src/components/workspace/constants.ts
|
|
42501
42861
|
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
@@ -42518,11 +42878,11 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42518
42878
|
onChangeLeftTab,
|
|
42519
42879
|
compactDrawerMenu
|
|
42520
42880
|
}) {
|
|
42521
|
-
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = (0,
|
|
42881
|
+
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = (0, import_react118.useState)({
|
|
42522
42882
|
leftSidebarCollapsed: true,
|
|
42523
42883
|
rightSidebarCollapsed: true
|
|
42524
42884
|
});
|
|
42525
|
-
|
|
42885
|
+
import_react118.default.useImperativeHandle(
|
|
42526
42886
|
leftSidebarRef,
|
|
42527
42887
|
() => ({
|
|
42528
42888
|
expand: () => setLayoutState((prev) => ({
|
|
@@ -42535,7 +42895,7 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42535
42895
|
}),
|
|
42536
42896
|
[leftSidebarCollapsed]
|
|
42537
42897
|
);
|
|
42538
|
-
|
|
42898
|
+
import_react118.default.useImperativeHandle(
|
|
42539
42899
|
rightSidebarRef,
|
|
42540
42900
|
() => ({
|
|
42541
42901
|
expand: () => setLayoutState((prev) => ({
|
|
@@ -42548,24 +42908,24 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42548
42908
|
}),
|
|
42549
42909
|
[rightSidebarCollapsed]
|
|
42550
42910
|
);
|
|
42551
|
-
const allTabItems = (0,
|
|
42911
|
+
const allTabItems = (0, import_react118.useMemo)(
|
|
42552
42912
|
() => [
|
|
42553
42913
|
...leftPanel ? leftTabItems ?? [] : [],
|
|
42554
42914
|
...rightPanel ? rightTabItems ?? [] : []
|
|
42555
42915
|
],
|
|
42556
42916
|
[leftTabItems, rightTabItems, leftPanel, rightPanel]
|
|
42557
42917
|
);
|
|
42558
|
-
const allSelectableTabItems = (0,
|
|
42918
|
+
const allSelectableTabItems = (0, import_react118.useMemo)(
|
|
42559
42919
|
() => allTabItems.filter(isSelectableMenuItem),
|
|
42560
42920
|
[allTabItems]
|
|
42561
42921
|
);
|
|
42562
42922
|
const hasTabs = allSelectableTabItems.length > 0;
|
|
42563
42923
|
const compactTabItem = compactDrawerMenu && allSelectableTabItems.length === 1 ? allSelectableTabItems[0] : void 0;
|
|
42564
|
-
const leftSelectableTabItems = (0,
|
|
42924
|
+
const leftSelectableTabItems = (0, import_react118.useMemo)(
|
|
42565
42925
|
() => (leftTabItems ?? []).filter(isSelectableMenuItem),
|
|
42566
42926
|
[leftTabItems]
|
|
42567
42927
|
);
|
|
42568
|
-
const rightSelectableTabItems = (0,
|
|
42928
|
+
const rightSelectableTabItems = (0, import_react118.useMemo)(
|
|
42569
42929
|
() => (rightTabItems ?? []).filter(isSelectableMenuItem),
|
|
42570
42930
|
[rightTabItems]
|
|
42571
42931
|
);
|
|
@@ -42601,20 +42961,20 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42601
42961
|
const activeDrawerPanel = !leftSidebarCollapsed ? leftPanel : !rightSidebarCollapsed ? rightPanel : null;
|
|
42602
42962
|
const isDrawerOpen = activeDrawerPanel !== null;
|
|
42603
42963
|
const activeTabValue = !leftSidebarCollapsed ? leftTabValue : !rightSidebarCollapsed ? rightTabValue : void 0;
|
|
42604
|
-
const toolbarMenuItems = (0,
|
|
42964
|
+
const toolbarMenuItems = (0, import_react118.useMemo)(
|
|
42605
42965
|
() => allSelectableTabItems.map((item) => ({
|
|
42606
42966
|
...item,
|
|
42607
42967
|
checked: activeTabValue === item.value
|
|
42608
42968
|
})),
|
|
42609
42969
|
[allSelectableTabItems, activeTabValue]
|
|
42610
42970
|
);
|
|
42611
|
-
return /* @__PURE__ */
|
|
42971
|
+
return /* @__PURE__ */ import_react118.default.createElement(
|
|
42612
42972
|
"div",
|
|
42613
42973
|
{
|
|
42614
42974
|
id: EDITOR_PANEL_GROUP_ID,
|
|
42615
42975
|
className: "n-flex n-flex-col n-flex-1 n-relative focus:n-outline-none"
|
|
42616
42976
|
},
|
|
42617
|
-
hasTabs && !compactTabItem && /* @__PURE__ */
|
|
42977
|
+
hasTabs && !compactTabItem && /* @__PURE__ */ import_react118.default.createElement(import_react118.default.Fragment, null, /* @__PURE__ */ import_react118.default.createElement(
|
|
42618
42978
|
"div",
|
|
42619
42979
|
{
|
|
42620
42980
|
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",
|
|
@@ -42623,15 +42983,15 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42623
42983
|
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
42624
42984
|
}
|
|
42625
42985
|
},
|
|
42626
|
-
/* @__PURE__ */
|
|
42986
|
+
/* @__PURE__ */ import_react118.default.createElement(
|
|
42627
42987
|
ToolbarMenu,
|
|
42628
42988
|
{
|
|
42629
42989
|
items: toolbarMenuItems,
|
|
42630
42990
|
onSelectMenuItem: handleSelectTab
|
|
42631
42991
|
}
|
|
42632
42992
|
)
|
|
42633
|
-
), /* @__PURE__ */
|
|
42634
|
-
compactTabItem && /* @__PURE__ */
|
|
42993
|
+
), /* @__PURE__ */ import_react118.default.createElement(Divider, null)),
|
|
42994
|
+
compactTabItem && /* @__PURE__ */ import_react118.default.createElement("div", { className: "n-absolute n-top-0 n-left-0 n-h-[calc(var(--n-toolbar-height)+1px)] n-w-[calc(var(--n-toolbar-height)+1px)] n-bg-sidebar-background n-border-b n-border-divider-strong n-z-10 n-flex n-items-center n-justify-center" }, /* @__PURE__ */ import_react118.default.createElement(
|
|
42635
42995
|
Button,
|
|
42636
42996
|
{
|
|
42637
42997
|
"aria-label": typeof compactTabItem.title === "string" ? compactTabItem.title : "Toggle sidebar",
|
|
@@ -42647,23 +43007,23 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
42647
43007
|
onClick: () => handleSelectTab(compactTabItem.value)
|
|
42648
43008
|
}
|
|
42649
43009
|
)),
|
|
42650
|
-
/* @__PURE__ */
|
|
43010
|
+
/* @__PURE__ */ import_react118.default.createElement("div", { className: "n-flex-1 n-flex n-flex-col n-relative n-min-h-0" }, isDrawerOpen && /* @__PURE__ */ import_react118.default.createElement("div", { className: "n-absolute n-inset-0 n-z-20 n-flex n-flex-col" }, /* @__PURE__ */ import_react118.default.createElement("div", { className: "n-relative n-flex-1 n-min-h-0 n-overflow-auto n-bg-sidebar-background n-border-b n-border-divider-strong n-shadow-lg" }, activeDrawerPanel)), /* @__PURE__ */ import_react118.default.createElement("div", { className: "n-z-0 n-flex-1 n-flex n-relative n-min-h-0" }, centerPanel))
|
|
42651
43011
|
);
|
|
42652
43012
|
});
|
|
42653
43013
|
|
|
42654
43014
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
42655
|
-
var
|
|
43015
|
+
var import_react124 = __toESM(require("react"));
|
|
42656
43016
|
|
|
42657
43017
|
// src/components/resizablePanels/Panel.tsx
|
|
42658
|
-
var
|
|
43018
|
+
var import_react120 = __toESM(require("react"));
|
|
42659
43019
|
|
|
42660
43020
|
// src/components/resizablePanels/PanelGroupContext.tsx
|
|
42661
|
-
var
|
|
42662
|
-
var PanelGroupContext = (0,
|
|
43021
|
+
var import_react119 = require("react");
|
|
43022
|
+
var PanelGroupContext = (0, import_react119.createContext)(
|
|
42663
43023
|
null
|
|
42664
43024
|
);
|
|
42665
43025
|
function usePanelGroupContext() {
|
|
42666
|
-
const context = (0,
|
|
43026
|
+
const context = (0, import_react119.useContext)(PanelGroupContext);
|
|
42667
43027
|
if (!context) {
|
|
42668
43028
|
throw new Error("Panel must be used within a PanelGroup");
|
|
42669
43029
|
}
|
|
@@ -42671,7 +43031,7 @@ function usePanelGroupContext() {
|
|
|
42671
43031
|
}
|
|
42672
43032
|
|
|
42673
43033
|
// src/components/resizablePanels/Panel.tsx
|
|
42674
|
-
var Panel = (0,
|
|
43034
|
+
var Panel = (0, import_react120.forwardRef)(
|
|
42675
43035
|
function Panel2({
|
|
42676
43036
|
id: propId,
|
|
42677
43037
|
order,
|
|
@@ -42683,7 +43043,7 @@ var Panel = (0, import_react119.forwardRef)(
|
|
|
42683
43043
|
defaultCollapsed,
|
|
42684
43044
|
children
|
|
42685
43045
|
}, ref) {
|
|
42686
|
-
const generatedId = (0,
|
|
43046
|
+
const generatedId = (0, import_react120.useId)();
|
|
42687
43047
|
const id = propId ?? generatedId;
|
|
42688
43048
|
const context = usePanelGroupContext();
|
|
42689
43049
|
const {
|
|
@@ -42694,7 +43054,7 @@ var Panel = (0, import_react119.forwardRef)(
|
|
|
42694
43054
|
collapsePanel,
|
|
42695
43055
|
isPanelExpanded
|
|
42696
43056
|
} = context;
|
|
42697
|
-
(0,
|
|
43057
|
+
(0, import_react120.useEffect)(() => {
|
|
42698
43058
|
registerPanel({
|
|
42699
43059
|
id,
|
|
42700
43060
|
order,
|
|
@@ -42720,7 +43080,7 @@ var Panel = (0, import_react119.forwardRef)(
|
|
|
42720
43080
|
]);
|
|
42721
43081
|
const size4 = getPanelSize(id);
|
|
42722
43082
|
const isFlexPanel = defaultSize === void 0;
|
|
42723
|
-
(0,
|
|
43083
|
+
(0, import_react120.useImperativeHandle)(
|
|
42724
43084
|
ref,
|
|
42725
43085
|
() => ({
|
|
42726
43086
|
expand: () => expandPanel(id),
|
|
@@ -42733,7 +43093,7 @@ var Panel = (0, import_react119.forwardRef)(
|
|
|
42733
43093
|
if (size4 === 0 && !isFlexPanel) {
|
|
42734
43094
|
return null;
|
|
42735
43095
|
}
|
|
42736
|
-
return /* @__PURE__ */
|
|
43096
|
+
return /* @__PURE__ */ import_react120.default.createElement(
|
|
42737
43097
|
"div",
|
|
42738
43098
|
{
|
|
42739
43099
|
"data-panel-id": id,
|
|
@@ -42748,7 +43108,7 @@ var Panel = (0, import_react119.forwardRef)(
|
|
|
42748
43108
|
);
|
|
42749
43109
|
|
|
42750
43110
|
// src/components/resizablePanels/PanelGroup.tsx
|
|
42751
|
-
var
|
|
43111
|
+
var import_react121 = __toESM(require("react"));
|
|
42752
43112
|
function getStorageKey(autoSaveId) {
|
|
42753
43113
|
return `noya-panels:${autoSaveId}`;
|
|
42754
43114
|
}
|
|
@@ -42766,19 +43126,19 @@ function saveSizes(autoSaveId, sizes) {
|
|
|
42766
43126
|
if (!autoSaveId) return;
|
|
42767
43127
|
clientStorage.setItem(getStorageKey(autoSaveId), JSON.stringify(sizes));
|
|
42768
43128
|
}
|
|
42769
|
-
var PanelGroup = (0,
|
|
43129
|
+
var PanelGroup = (0, import_react121.forwardRef)(
|
|
42770
43130
|
function PanelGroup2({ id, className, direction, autoSaveId, onLayout, children }, ref) {
|
|
42771
|
-
const containerRef = (0,
|
|
43131
|
+
const containerRef = (0, import_react121.useRef)(null);
|
|
42772
43132
|
const containerSize = useSize(containerRef);
|
|
42773
43133
|
const containerWidth = containerSize?.width ?? 0;
|
|
42774
|
-
const [panels, setPanels] = (0,
|
|
42775
|
-
const panelsRef = (0,
|
|
43134
|
+
const [panels, setPanels] = (0, import_react121.useState)(/* @__PURE__ */ new Map());
|
|
43135
|
+
const panelsRef = (0, import_react121.useRef)(panels);
|
|
42776
43136
|
panelsRef.current = panels;
|
|
42777
|
-
const [resizing, setResizing] = (0,
|
|
42778
|
-
const sortedPanels = (0,
|
|
43137
|
+
const [resizing, setResizing] = (0, import_react121.useState)(null);
|
|
43138
|
+
const sortedPanels = (0, import_react121.useMemo)(() => {
|
|
42779
43139
|
return Array.from(panels.values()).sort((a, b) => a.order - b.order);
|
|
42780
43140
|
}, [panels]);
|
|
42781
|
-
const flexPanelId = (0,
|
|
43141
|
+
const flexPanelId = (0, import_react121.useMemo)(() => {
|
|
42782
43142
|
for (const panel of sortedPanels) {
|
|
42783
43143
|
if (panel.defaultSize === void 0) {
|
|
42784
43144
|
return panel.id;
|
|
@@ -42786,7 +43146,7 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
42786
43146
|
}
|
|
42787
43147
|
return null;
|
|
42788
43148
|
}, [sortedPanels]);
|
|
42789
|
-
const calculateLayout = (0,
|
|
43149
|
+
const calculateLayout = (0, import_react121.useCallback)(
|
|
42790
43150
|
(panelStates, width) => {
|
|
42791
43151
|
if (width === 0) return panelStates;
|
|
42792
43152
|
const sorted = Array.from(panelStates.values()).sort(
|
|
@@ -42811,18 +43171,18 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
42811
43171
|
},
|
|
42812
43172
|
[]
|
|
42813
43173
|
);
|
|
42814
|
-
(0,
|
|
43174
|
+
(0, import_react121.useEffect)(() => {
|
|
42815
43175
|
if (containerWidth > 0 && panels.size > 0) {
|
|
42816
43176
|
setPanels((prev) => calculateLayout(prev, containerWidth));
|
|
42817
43177
|
}
|
|
42818
43178
|
}, [containerWidth, calculateLayout, panels.size]);
|
|
42819
|
-
(0,
|
|
43179
|
+
(0, import_react121.useEffect)(() => {
|
|
42820
43180
|
if (onLayout && sortedPanels.length > 0) {
|
|
42821
43181
|
const sizes = sortedPanels.map((p) => p.collapsed ? 0 : p.size);
|
|
42822
43182
|
onLayout(sizes);
|
|
42823
43183
|
}
|
|
42824
43184
|
}, [onLayout, sortedPanels]);
|
|
42825
|
-
const registerPanel = (0,
|
|
43185
|
+
const registerPanel = (0, import_react121.useCallback)(
|
|
42826
43186
|
(panel) => {
|
|
42827
43187
|
setPanels((prev) => {
|
|
42828
43188
|
const savedSizes = loadSavedSizes(autoSaveId);
|
|
@@ -42847,26 +43207,26 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
42847
43207
|
},
|
|
42848
43208
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42849
43209
|
);
|
|
42850
|
-
const unregisterPanel = (0,
|
|
43210
|
+
const unregisterPanel = (0, import_react121.useCallback)((panelId) => {
|
|
42851
43211
|
setPanels((prev) => {
|
|
42852
43212
|
const newPanels = new Map(prev);
|
|
42853
43213
|
newPanels.delete(panelId);
|
|
42854
43214
|
return newPanels;
|
|
42855
43215
|
});
|
|
42856
43216
|
}, []);
|
|
42857
|
-
const getPanelSize = (0,
|
|
43217
|
+
const getPanelSize = (0, import_react121.useCallback)(
|
|
42858
43218
|
(panelId) => {
|
|
42859
43219
|
return panels.get(panelId)?.size ?? 0;
|
|
42860
43220
|
},
|
|
42861
43221
|
[panels]
|
|
42862
43222
|
);
|
|
42863
|
-
const getPanelIndex = (0,
|
|
43223
|
+
const getPanelIndex = (0, import_react121.useCallback)(
|
|
42864
43224
|
(panelId) => {
|
|
42865
43225
|
return sortedPanels.findIndex((p) => p.id === panelId);
|
|
42866
43226
|
},
|
|
42867
43227
|
[sortedPanels]
|
|
42868
43228
|
);
|
|
42869
|
-
const setPanelSize = (0,
|
|
43229
|
+
const setPanelSize = (0, import_react121.useCallback)(
|
|
42870
43230
|
(panelId, size4) => {
|
|
42871
43231
|
setPanels((prev) => {
|
|
42872
43232
|
const panel = prev.get(panelId);
|
|
@@ -42894,7 +43254,7 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
42894
43254
|
},
|
|
42895
43255
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42896
43256
|
);
|
|
42897
|
-
const expandPanel = (0,
|
|
43257
|
+
const expandPanel = (0, import_react121.useCallback)(
|
|
42898
43258
|
(panelId) => {
|
|
42899
43259
|
setPanels((prev) => {
|
|
42900
43260
|
const panel = prev.get(panelId);
|
|
@@ -42919,7 +43279,7 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
42919
43279
|
},
|
|
42920
43280
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42921
43281
|
);
|
|
42922
|
-
const collapsePanel = (0,
|
|
43282
|
+
const collapsePanel = (0, import_react121.useCallback)(
|
|
42923
43283
|
(panelId) => {
|
|
42924
43284
|
setPanels((prev) => {
|
|
42925
43285
|
const panel = prev.get(panelId);
|
|
@@ -42943,14 +43303,14 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
42943
43303
|
},
|
|
42944
43304
|
[autoSaveId, calculateLayout, containerWidth]
|
|
42945
43305
|
);
|
|
42946
|
-
const isPanelExpanded = (0,
|
|
43306
|
+
const isPanelExpanded = (0, import_react121.useCallback)(
|
|
42947
43307
|
(panelId) => {
|
|
42948
43308
|
const panel = panels.get(panelId);
|
|
42949
43309
|
return panel ? !panel.collapsed : false;
|
|
42950
43310
|
},
|
|
42951
43311
|
[panels]
|
|
42952
43312
|
);
|
|
42953
|
-
const startResize = (0,
|
|
43313
|
+
const startResize = (0, import_react121.useCallback)(
|
|
42954
43314
|
(handleIndex, startX) => {
|
|
42955
43315
|
const startSizes = sortedPanels.map((p) => p.size);
|
|
42956
43316
|
setResizing({
|
|
@@ -42961,7 +43321,7 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
42961
43321
|
},
|
|
42962
43322
|
[sortedPanels]
|
|
42963
43323
|
);
|
|
42964
|
-
(0,
|
|
43324
|
+
(0, import_react121.useEffect)(() => {
|
|
42965
43325
|
if (!resizing) return;
|
|
42966
43326
|
const handleMouseMove = (e) => {
|
|
42967
43327
|
const delta = e.clientX - resizing.startX;
|
|
@@ -43050,7 +43410,7 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
43050
43410
|
containerWidth,
|
|
43051
43411
|
flexPanelId
|
|
43052
43412
|
]);
|
|
43053
|
-
(0,
|
|
43413
|
+
(0, import_react121.useImperativeHandle)(ref, () => ({
|
|
43054
43414
|
getLayout: () => sortedPanels.map((p) => p.size),
|
|
43055
43415
|
setLayout: (sizes) => {
|
|
43056
43416
|
setPanels((prev) => {
|
|
@@ -43068,7 +43428,7 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
43068
43428
|
});
|
|
43069
43429
|
}
|
|
43070
43430
|
}));
|
|
43071
|
-
const contextValue = (0,
|
|
43431
|
+
const contextValue = (0, import_react121.useMemo)(
|
|
43072
43432
|
() => ({
|
|
43073
43433
|
registerPanel,
|
|
43074
43434
|
unregisterPanel,
|
|
@@ -43094,7 +43454,7 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
43094
43454
|
containerWidth
|
|
43095
43455
|
]
|
|
43096
43456
|
);
|
|
43097
|
-
return /* @__PURE__ */
|
|
43457
|
+
return /* @__PURE__ */ import_react121.default.createElement(PanelGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react121.default.createElement(
|
|
43098
43458
|
"div",
|
|
43099
43459
|
{
|
|
43100
43460
|
ref: containerRef,
|
|
@@ -43112,15 +43472,15 @@ var PanelGroup = (0, import_react120.forwardRef)(
|
|
|
43112
43472
|
);
|
|
43113
43473
|
|
|
43114
43474
|
// src/components/resizablePanels/PanelResizeHandle.tsx
|
|
43115
|
-
var
|
|
43475
|
+
var import_react122 = __toESM(require("react"));
|
|
43116
43476
|
function PanelResizeHandle({
|
|
43117
43477
|
className,
|
|
43118
43478
|
disabled: disabled2,
|
|
43119
43479
|
index: index2
|
|
43120
43480
|
}) {
|
|
43121
|
-
const context = (0,
|
|
43122
|
-
const handleRef = (0,
|
|
43123
|
-
const handleMouseDown = (0,
|
|
43481
|
+
const context = (0, import_react122.useContext)(PanelGroupContext);
|
|
43482
|
+
const handleRef = (0, import_react122.useRef)(null);
|
|
43483
|
+
const handleMouseDown = (0, import_react122.useCallback)(
|
|
43124
43484
|
(e) => {
|
|
43125
43485
|
if (disabled2 || !context) return;
|
|
43126
43486
|
e.preventDefault();
|
|
@@ -43131,7 +43491,7 @@ function PanelResizeHandle({
|
|
|
43131
43491
|
if (!context) {
|
|
43132
43492
|
return null;
|
|
43133
43493
|
}
|
|
43134
|
-
return /* @__PURE__ */
|
|
43494
|
+
return /* @__PURE__ */ import_react122.default.createElement(
|
|
43135
43495
|
"div",
|
|
43136
43496
|
{
|
|
43137
43497
|
ref: handleRef,
|
|
@@ -43144,7 +43504,7 @@ function PanelResizeHandle({
|
|
|
43144
43504
|
zIndex: 10
|
|
43145
43505
|
}
|
|
43146
43506
|
},
|
|
43147
|
-
/* @__PURE__ */
|
|
43507
|
+
/* @__PURE__ */ import_react122.default.createElement(
|
|
43148
43508
|
"div",
|
|
43149
43509
|
{
|
|
43150
43510
|
style: {
|
|
@@ -43161,13 +43521,13 @@ function PanelResizeHandle({
|
|
|
43161
43521
|
}
|
|
43162
43522
|
|
|
43163
43523
|
// src/components/workspace/HorizontalTabBar.tsx
|
|
43164
|
-
var
|
|
43524
|
+
var import_react123 = __toESM(require("react"));
|
|
43165
43525
|
var HorizontalTabBar = memoGeneric(function HorizontalTabBar2({ items, activeValue, onChange }) {
|
|
43166
43526
|
const selectableItems = items.filter(isSelectableMenuItem);
|
|
43167
43527
|
if (selectableItems.length <= 1) {
|
|
43168
43528
|
return null;
|
|
43169
43529
|
}
|
|
43170
|
-
return /* @__PURE__ */
|
|
43530
|
+
return /* @__PURE__ */ import_react123.default.createElement("div", { className: "n-flex n-flex-col n-bg-sidebar-background n-flex-none" }, /* @__PURE__ */ import_react123.default.createElement("div", { className: "n-flex n-flex-row n-px-3 n-py-3" }, /* @__PURE__ */ import_react123.default.createElement(
|
|
43171
43531
|
SegmentedControl,
|
|
43172
43532
|
{
|
|
43173
43533
|
enableCompactMode: true,
|
|
@@ -43206,21 +43566,21 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43206
43566
|
onRightSidebarStateChange,
|
|
43207
43567
|
shouldAutoSave = true
|
|
43208
43568
|
}) {
|
|
43209
|
-
const panelGroupRef = (0,
|
|
43210
|
-
const containerRef = (0,
|
|
43211
|
-
const autoSaveId = (0,
|
|
43569
|
+
const panelGroupRef = (0, import_react124.useRef)(null);
|
|
43570
|
+
const containerRef = (0, import_react124.useRef)(null);
|
|
43571
|
+
const autoSaveId = (0, import_react124.useMemo)(() => {
|
|
43212
43572
|
if (!shouldAutoSave) return void 0;
|
|
43213
43573
|
return autoSavePrefix ? `${autoSavePrefix}--v5--${EDITOR_PANEL_GROUP_ID}` : Math.random().toString(36).substring(2, 15);
|
|
43214
43574
|
}, [autoSavePrefix, shouldAutoSave]);
|
|
43215
|
-
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = (0,
|
|
43575
|
+
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = (0, import_react124.useState)(
|
|
43216
43576
|
leftSidebarOptions.defaultCollapsed ?? false
|
|
43217
43577
|
);
|
|
43218
|
-
const [rightSidebarCollapsed, setRightSidebarCollapsed] = (0,
|
|
43578
|
+
const [rightSidebarCollapsed, setRightSidebarCollapsed] = (0, import_react124.useState)(
|
|
43219
43579
|
rightSidebarOptions.defaultCollapsed ?? false
|
|
43220
43580
|
);
|
|
43221
|
-
const prevLeftSidebarState = (0,
|
|
43222
|
-
const prevRightSidebarState = (0,
|
|
43223
|
-
const handleLayoutChange = (0,
|
|
43581
|
+
const prevLeftSidebarState = (0, import_react124.useRef)(null);
|
|
43582
|
+
const prevRightSidebarState = (0, import_react124.useRef)(null);
|
|
43583
|
+
const handleLayoutChange = (0, import_react124.useCallback)(
|
|
43224
43584
|
(sizes) => {
|
|
43225
43585
|
const leftIndex = leftPanel ? 0 : -1;
|
|
43226
43586
|
const rightIndex = rightPanel ? leftPanel ? 2 : 1 : -1;
|
|
@@ -43251,7 +43611,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43251
43611
|
},
|
|
43252
43612
|
[leftPanel, rightPanel, onLeftSidebarStateChange, onRightSidebarStateChange]
|
|
43253
43613
|
);
|
|
43254
|
-
const handleLeftTabChange = (0,
|
|
43614
|
+
const handleLeftTabChange = (0, import_react124.useCallback)(
|
|
43255
43615
|
(value) => {
|
|
43256
43616
|
if (value === leftTabValue) {
|
|
43257
43617
|
if (leftSidebarRef.current?.isExpanded()) {
|
|
@@ -43268,7 +43628,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43268
43628
|
},
|
|
43269
43629
|
[leftSidebarRef, leftTabValue, onChangeLeftTab]
|
|
43270
43630
|
);
|
|
43271
|
-
const handleRightTabChange = (0,
|
|
43631
|
+
const handleRightTabChange = (0, import_react124.useCallback)(
|
|
43272
43632
|
(value) => {
|
|
43273
43633
|
if (value === rightTabValue) {
|
|
43274
43634
|
if (rightSidebarRef.current?.isExpanded()) {
|
|
@@ -43286,7 +43646,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43286
43646
|
[onChangeRightTab, rightSidebarRef, rightTabValue]
|
|
43287
43647
|
);
|
|
43288
43648
|
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems;
|
|
43289
|
-
return /* @__PURE__ */
|
|
43649
|
+
return /* @__PURE__ */ import_react124.default.createElement("div", { ref: containerRef, className: "n-flex n-flex-1" }, /* @__PURE__ */ import_react124.default.createElement(
|
|
43290
43650
|
PanelGroup,
|
|
43291
43651
|
{
|
|
43292
43652
|
ref: panelGroupRef,
|
|
@@ -43296,7 +43656,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43296
43656
|
autoSaveId,
|
|
43297
43657
|
onLayout: handleLayoutChange
|
|
43298
43658
|
},
|
|
43299
|
-
leftPanel && /* @__PURE__ */
|
|
43659
|
+
leftPanel && /* @__PURE__ */ import_react124.default.createElement(import_react124.default.Fragment, null, /* @__PURE__ */ import_react124.default.createElement(
|
|
43300
43660
|
Panel,
|
|
43301
43661
|
{
|
|
43302
43662
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -43309,22 +43669,22 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43309
43669
|
collapsible: true,
|
|
43310
43670
|
defaultCollapsed: leftSidebarOptions.defaultCollapsed
|
|
43311
43671
|
},
|
|
43312
|
-
leftSidebarCollapsed ? null : /* @__PURE__ */
|
|
43672
|
+
leftSidebarCollapsed ? null : /* @__PURE__ */ import_react124.default.createElement("div", { className: "n-flex n-flex-col n-h-full" }, showLeftTabs && /* @__PURE__ */ import_react124.default.createElement(
|
|
43313
43673
|
HorizontalTabBar,
|
|
43314
43674
|
{
|
|
43315
43675
|
items: leftTabItems,
|
|
43316
43676
|
activeValue: leftTabValue,
|
|
43317
43677
|
onChange: handleLeftTabChange
|
|
43318
43678
|
}
|
|
43319
|
-
), /* @__PURE__ */
|
|
43320
|
-
), /* @__PURE__ */
|
|
43679
|
+
), /* @__PURE__ */ import_react124.default.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, leftPanel))
|
|
43680
|
+
), /* @__PURE__ */ import_react124.default.createElement(
|
|
43321
43681
|
PanelResizeHandle,
|
|
43322
43682
|
{
|
|
43323
43683
|
index: 0,
|
|
43324
43684
|
className: `n-cursor-col-resize n-w-px n-h-full ${leftSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
43325
43685
|
}
|
|
43326
43686
|
)),
|
|
43327
|
-
/* @__PURE__ */
|
|
43687
|
+
/* @__PURE__ */ import_react124.default.createElement(
|
|
43328
43688
|
Panel,
|
|
43329
43689
|
{
|
|
43330
43690
|
id: CONTENT_AREA_ID,
|
|
@@ -43333,13 +43693,13 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43333
43693
|
},
|
|
43334
43694
|
centerPanel
|
|
43335
43695
|
),
|
|
43336
|
-
rightPanel && /* @__PURE__ */
|
|
43696
|
+
rightPanel && /* @__PURE__ */ import_react124.default.createElement(import_react124.default.Fragment, null, /* @__PURE__ */ import_react124.default.createElement(
|
|
43337
43697
|
PanelResizeHandle,
|
|
43338
43698
|
{
|
|
43339
43699
|
index: 1,
|
|
43340
43700
|
className: `n-cursor-col-resize n-w-px n-h-full ${rightSidebarCollapsed ? "" : "n-bg-divider"}`
|
|
43341
43701
|
}
|
|
43342
|
-
), /* @__PURE__ */
|
|
43702
|
+
), /* @__PURE__ */ import_react124.default.createElement(
|
|
43343
43703
|
Panel,
|
|
43344
43704
|
{
|
|
43345
43705
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -43352,14 +43712,14 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
43352
43712
|
collapsible: true,
|
|
43353
43713
|
defaultCollapsed: rightSidebarOptions.defaultCollapsed
|
|
43354
43714
|
},
|
|
43355
|
-
rightSidebarCollapsed ? null : /* @__PURE__ */
|
|
43715
|
+
rightSidebarCollapsed ? null : /* @__PURE__ */ import_react124.default.createElement("div", { className: "n-flex n-flex-col n-h-full" }, rightSidebarOptions.showTabs && rightTabItems && /* @__PURE__ */ import_react124.default.createElement(
|
|
43356
43716
|
HorizontalTabBar,
|
|
43357
43717
|
{
|
|
43358
43718
|
items: rightTabItems,
|
|
43359
43719
|
activeValue: rightTabValue,
|
|
43360
43720
|
onChange: handleRightTabChange
|
|
43361
43721
|
}
|
|
43362
|
-
), /* @__PURE__ */
|
|
43722
|
+
), /* @__PURE__ */ import_react124.default.createElement("div", { className: "n-flex-1 n-relative n-min-h-0" }, rightPanel))
|
|
43363
43723
|
))
|
|
43364
43724
|
));
|
|
43365
43725
|
});
|
|
@@ -43373,11 +43733,11 @@ function renderPanelChildren(fn, props) {
|
|
|
43373
43733
|
}
|
|
43374
43734
|
|
|
43375
43735
|
// src/components/workspace/WorkspaceSideContext.tsx
|
|
43376
|
-
var
|
|
43377
|
-
var WorkspaceSideContext = (0,
|
|
43736
|
+
var import_react125 = require("react");
|
|
43737
|
+
var WorkspaceSideContext = (0, import_react125.createContext)({});
|
|
43378
43738
|
var WorkspaceSideProvider = WorkspaceSideContext.Provider;
|
|
43379
43739
|
function useWorkspaceSide() {
|
|
43380
|
-
return (0,
|
|
43740
|
+
return (0, import_react125.useContext)(WorkspaceSideContext);
|
|
43381
43741
|
}
|
|
43382
43742
|
|
|
43383
43743
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
@@ -43449,7 +43809,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43449
43809
|
onRightSidebarStateChange,
|
|
43450
43810
|
shouldAutoSave
|
|
43451
43811
|
}, forwardedRef) {
|
|
43452
|
-
const containerRef =
|
|
43812
|
+
const containerRef = import_react126.default.useRef(null);
|
|
43453
43813
|
const containerSize = useSize(containerRef);
|
|
43454
43814
|
const windowSize = useWindowSize();
|
|
43455
43815
|
const parentSize = detectSize === "window" ? windowSize : containerSize && containerSize.width > 0 ? containerSize : windowSize;
|
|
@@ -43465,8 +43825,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43465
43825
|
const rightSidebarMinPixels = toPixels(rightMinSize);
|
|
43466
43826
|
const rightSidebarMaxPixels = toPixels(rightMaxSize);
|
|
43467
43827
|
const rightSidebarInitialPixels = toPixels(rightInitialSize) ?? 280;
|
|
43468
|
-
const leftSidebarRef = (0,
|
|
43469
|
-
const rightSidebarRef = (0,
|
|
43828
|
+
const leftSidebarRef = (0, import_react126.useRef)(null);
|
|
43829
|
+
const rightSidebarRef = (0, import_react126.useRef)(null);
|
|
43470
43830
|
const [leftTabValue, setLeftTabValue] = useControlledOrUncontrolled({
|
|
43471
43831
|
value: leftTabValueProp,
|
|
43472
43832
|
onChange: onChangeLeftTab,
|
|
@@ -43477,7 +43837,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43477
43837
|
onChange: onChangeRightTab,
|
|
43478
43838
|
defaultValue: getFirstTabValue(rightTabItems, "")
|
|
43479
43839
|
});
|
|
43480
|
-
(0,
|
|
43840
|
+
(0, import_react126.useImperativeHandle)(forwardedRef, () => ({
|
|
43481
43841
|
setLeftExpanded: (expanded) => {
|
|
43482
43842
|
if (expanded) {
|
|
43483
43843
|
leftSidebarRef.current?.expand();
|
|
@@ -43534,56 +43894,56 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43534
43894
|
}
|
|
43535
43895
|
});
|
|
43536
43896
|
const isDrawerActive = sideType === "drawer" || sideType === "auto" && parentSize.width <= sideTypeBreakpoint;
|
|
43537
|
-
const closeLeftSidebar = (0,
|
|
43897
|
+
const closeLeftSidebar = (0, import_react126.useCallback)(() => {
|
|
43538
43898
|
if (isDrawerActive) {
|
|
43539
43899
|
leftSidebarRef.current?.collapse();
|
|
43540
43900
|
}
|
|
43541
43901
|
}, [isDrawerActive]);
|
|
43542
|
-
const closeRightSidebar = (0,
|
|
43902
|
+
const closeRightSidebar = (0, import_react126.useCallback)(() => {
|
|
43543
43903
|
if (isDrawerActive) {
|
|
43544
43904
|
rightSidebarRef.current?.collapse();
|
|
43545
43905
|
}
|
|
43546
43906
|
}, [isDrawerActive]);
|
|
43547
|
-
const leftChildrenProps = (0,
|
|
43907
|
+
const leftChildrenProps = (0, import_react126.useMemo)(() => {
|
|
43548
43908
|
return {
|
|
43549
43909
|
activeTabValue: leftTabValue,
|
|
43550
43910
|
closeSidebar: closeLeftSidebar
|
|
43551
43911
|
};
|
|
43552
43912
|
}, [leftTabValue, closeLeftSidebar]);
|
|
43553
|
-
const rightChildrenProps = (0,
|
|
43913
|
+
const rightChildrenProps = (0, import_react126.useMemo)(() => {
|
|
43554
43914
|
return {
|
|
43555
43915
|
activeTabValue: rightTabValue,
|
|
43556
43916
|
closeSidebar: closeRightSidebar
|
|
43557
43917
|
};
|
|
43558
43918
|
}, [rightTabValue, closeRightSidebar]);
|
|
43559
|
-
const leftSidebarProviderValue = (0,
|
|
43919
|
+
const leftSidebarProviderValue = (0, import_react126.useMemo)(() => {
|
|
43560
43920
|
return {
|
|
43561
43921
|
closeSidebar: closeLeftSidebar
|
|
43562
43922
|
};
|
|
43563
43923
|
}, [closeLeftSidebar]);
|
|
43564
|
-
const rightSidebarProviderValue = (0,
|
|
43924
|
+
const rightSidebarProviderValue = (0, import_react126.useMemo)(() => {
|
|
43565
43925
|
return {
|
|
43566
43926
|
closeSidebar: closeRightSidebar
|
|
43567
43927
|
};
|
|
43568
43928
|
}, [closeRightSidebar]);
|
|
43569
|
-
const leftPanel = left && leftVisible !== false ? /* @__PURE__ */
|
|
43929
|
+
const leftPanel = left && leftVisible !== false ? /* @__PURE__ */ import_react126.default.createElement(
|
|
43570
43930
|
PanelInner,
|
|
43571
43931
|
{
|
|
43572
43932
|
style: leftStyle,
|
|
43573
43933
|
className: cx("n-bg-sidebar-background n-flex-col", leftClassName)
|
|
43574
43934
|
},
|
|
43575
|
-
/* @__PURE__ */
|
|
43935
|
+
/* @__PURE__ */ import_react126.default.createElement(WorkspaceSideProvider, { value: leftSidebarProviderValue }, leftTabValue ? renderPanelChildren(left, leftChildrenProps) : null)
|
|
43576
43936
|
) : null;
|
|
43577
|
-
const rightPanel = right && rightVisible !== false ? /* @__PURE__ */
|
|
43937
|
+
const rightPanel = right && rightVisible !== false ? /* @__PURE__ */ import_react126.default.createElement(
|
|
43578
43938
|
PanelInner,
|
|
43579
43939
|
{
|
|
43580
43940
|
style: rightStyle,
|
|
43581
43941
|
className: cx("n-bg-sidebar-background n-flex-col", rightClassName)
|
|
43582
43942
|
},
|
|
43583
|
-
/* @__PURE__ */
|
|
43943
|
+
/* @__PURE__ */ import_react126.default.createElement(WorkspaceSideProvider, { value: rightSidebarProviderValue }, rightTabValue ? renderPanelChildren(right, rightChildrenProps) : null)
|
|
43584
43944
|
) : null;
|
|
43585
|
-
const centerPanel = /* @__PURE__ */
|
|
43586
|
-
const leftSidebarOptions = (0,
|
|
43945
|
+
const centerPanel = /* @__PURE__ */ import_react126.default.createElement(PanelInner, { className: "n-bg-canvas-background" }, children);
|
|
43946
|
+
const leftSidebarOptions = (0, import_react126.useMemo)(
|
|
43587
43947
|
() => ({
|
|
43588
43948
|
minSize: leftSidebarMinPixels,
|
|
43589
43949
|
maxSize: leftSidebarMaxPixels,
|
|
@@ -43601,7 +43961,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43601
43961
|
leftShowTabs
|
|
43602
43962
|
]
|
|
43603
43963
|
);
|
|
43604
|
-
const rightSidebarOptions = (0,
|
|
43964
|
+
const rightSidebarOptions = (0, import_react126.useMemo)(
|
|
43605
43965
|
() => ({
|
|
43606
43966
|
minSize: rightSidebarMinPixels,
|
|
43607
43967
|
maxSize: rightSidebarMaxPixels,
|
|
@@ -43622,7 +43982,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43622
43982
|
const LayoutComponent = sideType === "panel" ? PanelWorkspaceLayout : sideType === "drawer" ? DrawerWorkspaceLayout : parentSize.width > sideTypeBreakpoint ? PanelWorkspaceLayout : DrawerWorkspaceLayout;
|
|
43623
43983
|
const readyToRender = detectSize === "window" || containerSize && containerSize.width > 0;
|
|
43624
43984
|
const isOverlay = toolbarVariant === "overlay";
|
|
43625
|
-
return /* @__PURE__ */
|
|
43985
|
+
return /* @__PURE__ */ import_react126.default.createElement(
|
|
43626
43986
|
"div",
|
|
43627
43987
|
{
|
|
43628
43988
|
ref: containerRef,
|
|
@@ -43635,14 +43995,14 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43635
43995
|
"data-theme": theme
|
|
43636
43996
|
},
|
|
43637
43997
|
!isOverlay && toolbar,
|
|
43638
|
-
/* @__PURE__ */
|
|
43998
|
+
/* @__PURE__ */ import_react126.default.createElement(
|
|
43639
43999
|
"div",
|
|
43640
44000
|
{
|
|
43641
44001
|
className: "n-flex n-flex-row n-flex-1 n-min-h-0 n-relative",
|
|
43642
44002
|
"data-workspace-content": true,
|
|
43643
44003
|
style: contentTopInset > 0 ? { paddingTop: contentTopInset } : void 0
|
|
43644
44004
|
},
|
|
43645
|
-
readyToRender && /* @__PURE__ */
|
|
44005
|
+
readyToRender && /* @__PURE__ */ import_react126.default.createElement(import_react126.default.Fragment, null, /* @__PURE__ */ import_react126.default.createElement(
|
|
43646
44006
|
LayoutComponent,
|
|
43647
44007
|
{
|
|
43648
44008
|
leftPanel,
|
|
@@ -43664,7 +44024,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43664
44024
|
onRightSidebarStateChange,
|
|
43665
44025
|
shouldAutoSave
|
|
43666
44026
|
}
|
|
43667
|
-
), isOverlay && /* @__PURE__ */
|
|
44027
|
+
), isOverlay && /* @__PURE__ */ import_react126.default.createElement(
|
|
43668
44028
|
OverlayToolbar,
|
|
43669
44029
|
{
|
|
43670
44030
|
left: overlayToolbarLeft,
|
|
@@ -43676,12 +44036,12 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
43676
44036
|
)
|
|
43677
44037
|
);
|
|
43678
44038
|
});
|
|
43679
|
-
var PanelInner = (0,
|
|
44039
|
+
var PanelInner = (0, import_react126.memo)(function PanelInner2({
|
|
43680
44040
|
children,
|
|
43681
44041
|
style: style2,
|
|
43682
44042
|
className
|
|
43683
44043
|
}) {
|
|
43684
|
-
return /* @__PURE__ */
|
|
44044
|
+
return /* @__PURE__ */ import_react126.default.createElement(
|
|
43685
44045
|
"div",
|
|
43686
44046
|
{
|
|
43687
44047
|
style: style2,
|
|
@@ -43696,22 +44056,22 @@ function getFirstTabValue(items, defaultValue2) {
|
|
|
43696
44056
|
}
|
|
43697
44057
|
|
|
43698
44058
|
// src/contexts/ImageDataContext.tsx
|
|
43699
|
-
var
|
|
43700
|
-
var ImageDataContext =
|
|
44059
|
+
var React338 = __toESM(require("react"));
|
|
44060
|
+
var ImageDataContext = React338.createContext(
|
|
43701
44061
|
void 0
|
|
43702
44062
|
);
|
|
43703
|
-
var ImageDataProvider =
|
|
44063
|
+
var ImageDataProvider = React338.memo(function ImageDataProvider2({
|
|
43704
44064
|
children,
|
|
43705
44065
|
getImageData
|
|
43706
44066
|
}) {
|
|
43707
|
-
const contextValue =
|
|
44067
|
+
const contextValue = React338.useMemo(
|
|
43708
44068
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
43709
44069
|
[getImageData]
|
|
43710
44070
|
);
|
|
43711
|
-
return /* @__PURE__ */
|
|
44071
|
+
return /* @__PURE__ */ React338.createElement(ImageDataContext.Provider, { value: contextValue }, children);
|
|
43712
44072
|
});
|
|
43713
44073
|
function useImageData(ref) {
|
|
43714
|
-
const value =
|
|
44074
|
+
const value = React338.useContext(ImageDataContext);
|
|
43715
44075
|
if (!value) {
|
|
43716
44076
|
throw new Error("Missing ImageDataProvider");
|
|
43717
44077
|
}
|
|
@@ -43728,9 +44088,9 @@ function usePlatformModKey() {
|
|
|
43728
44088
|
}
|
|
43729
44089
|
|
|
43730
44090
|
// src/hooks/useTheme.ts
|
|
43731
|
-
var
|
|
44091
|
+
var import_react127 = require("react");
|
|
43732
44092
|
function useTheme() {
|
|
43733
|
-
const [theme, setTheme] = (0,
|
|
44093
|
+
const [theme, setTheme] = (0, import_react127.useState)("light");
|
|
43734
44094
|
const checkTheme = () => {
|
|
43735
44095
|
const currentTheme = document.body.getAttribute("data-theme");
|
|
43736
44096
|
switch (currentTheme) {
|
|
@@ -43742,7 +44102,7 @@ function useTheme() {
|
|
|
43742
44102
|
break;
|
|
43743
44103
|
}
|
|
43744
44104
|
};
|
|
43745
|
-
(0,
|
|
44105
|
+
(0, import_react127.useEffect)(() => {
|
|
43746
44106
|
checkTheme();
|
|
43747
44107
|
const observer = new MutationObserver((mutations) => {
|
|
43748
44108
|
mutations.forEach((mutation) => {
|
|
@@ -43885,137 +44245,49 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
43885
44245
|
|
|
43886
44246
|
// src/components/DimensionInput.tsx
|
|
43887
44247
|
var import_noya_utils21 = require("@noya-app/noya-utils");
|
|
43888
|
-
var
|
|
44248
|
+
var React339 = __toESM(require("react"));
|
|
43889
44249
|
function getNewValue2(value, mode, delta) {
|
|
43890
44250
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
43891
44251
|
}
|
|
43892
|
-
var DimensionInput =
|
|
44252
|
+
var DimensionInput = React339.memo(function DimensionInput2({
|
|
43893
44253
|
id,
|
|
43894
44254
|
value,
|
|
43895
44255
|
onSetValue,
|
|
43896
44256
|
label,
|
|
43897
44257
|
size: size4,
|
|
43898
|
-
|
|
44258
|
+
// Figma shows "Mixed" in numeric fields with differing values
|
|
44259
|
+
placeholder = "Mixed",
|
|
43899
44260
|
disabled: disabled2,
|
|
43900
|
-
trigger = "submit"
|
|
44261
|
+
trigger = "submit",
|
|
44262
|
+
suffix
|
|
43901
44263
|
}) {
|
|
43902
|
-
const handleNudgeValue =
|
|
44264
|
+
const handleNudgeValue = React339.useCallback(
|
|
43903
44265
|
(value2) => onSetValue(value2, "adjust"),
|
|
43904
44266
|
[onSetValue]
|
|
43905
44267
|
);
|
|
43906
|
-
const handleSetValue =
|
|
44268
|
+
const handleSetValue = React339.useCallback(
|
|
43907
44269
|
(value2) => onSetValue(value2, "replace"),
|
|
43908
44270
|
[onSetValue]
|
|
43909
44271
|
);
|
|
43910
|
-
return /* @__PURE__ */
|
|
43911
|
-
InputField2.
|
|
43912
|
-
{
|
|
43913
|
-
value: value === void 0 ? value : (0, import_noya_utils21.round)(value, 2),
|
|
43914
|
-
placeholder: value === void 0 ? placeholder : void 0,
|
|
43915
|
-
onNudge: handleNudgeValue,
|
|
43916
|
-
disabled: disabled2,
|
|
43917
|
-
...trigger === "change" ? { onChange: handleSetValue } : { onSubmit: handleSetValue }
|
|
43918
|
-
}
|
|
43919
|
-
)));
|
|
43920
|
-
});
|
|
43921
|
-
|
|
43922
|
-
// src/components/InspectorPrimitives.tsx
|
|
43923
|
-
var InspectorPrimitives_exports = {};
|
|
43924
|
-
__export(InspectorPrimitives_exports, {
|
|
43925
|
-
Checkbox: () => Checkbox3,
|
|
43926
|
-
Column: () => Column,
|
|
43927
|
-
HorizontalSeparator: () => HorizontalSeparator,
|
|
43928
|
-
LabeledRow: () => LabeledRow,
|
|
43929
|
-
Row: () => Row,
|
|
43930
|
-
RowLabel: () => RowLabel,
|
|
43931
|
-
Section: () => Section2,
|
|
43932
|
-
SectionHeader: () => SectionHeader2,
|
|
43933
|
-
Text: () => Text3,
|
|
43934
|
-
Title: () => Title,
|
|
43935
|
-
VerticalSeparator: () => VerticalSeparator
|
|
43936
|
-
});
|
|
43937
|
-
var import_react127 = __toESM(require("react"));
|
|
43938
|
-
var Section2 = (0, import_react127.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react127.default.createElement(
|
|
43939
|
-
"div",
|
|
43940
|
-
{
|
|
43941
|
-
ref,
|
|
43942
|
-
className: cx(`n-flex-none n-flex n-flex-col`, className),
|
|
43943
|
-
...props
|
|
43944
|
-
}
|
|
43945
|
-
));
|
|
43946
|
-
var SectionHeader2 = (0, import_react127.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react127.default.createElement("div", { ref, className: cx(`n-flex n-items-center`, className), ...props }));
|
|
43947
|
-
var Title = (0, import_react127.forwardRef)(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */ import_react127.default.createElement(
|
|
43948
|
-
"div",
|
|
43949
|
-
{
|
|
43950
|
-
ref,
|
|
43951
|
-
className: cx(
|
|
43952
|
-
`n-flex n-select-none ${$textStyle ? `${textStyles[$textStyle]} n-text-text` : "n-font-sans n-text-label n-text-text-muted n-font-semibold"} `,
|
|
43953
|
-
className
|
|
43954
|
-
),
|
|
43955
|
-
...props
|
|
43956
|
-
}
|
|
43957
|
-
));
|
|
43958
|
-
var Row = (0, import_react127.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react127.default.createElement(
|
|
43959
|
-
"div",
|
|
43960
|
-
{
|
|
43961
|
-
ref,
|
|
43962
|
-
className: cx(`n-flex-1 n-flex n-flex-row n-items-center`, className),
|
|
43963
|
-
...props
|
|
43964
|
-
}
|
|
43965
|
-
));
|
|
43966
|
-
var Column = (0, import_react127.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react127.default.createElement(
|
|
43967
|
-
"div",
|
|
43968
|
-
{
|
|
43969
|
-
ref,
|
|
43970
|
-
className: cx(`n-flex-1 n-flex n-flex-col n-gap-1`, className),
|
|
43971
|
-
...props
|
|
43972
|
-
}
|
|
43973
|
-
));
|
|
43974
|
-
var Checkbox3 = (0, import_react127.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react127.default.createElement(
|
|
43975
|
-
"input",
|
|
43976
|
-
{
|
|
43977
|
-
ref,
|
|
43978
|
-
type: "checkbox",
|
|
43979
|
-
className: cx(`n-m-0 focus:n-z-interactable`, className),
|
|
43980
|
-
...props
|
|
43981
|
-
}
|
|
43982
|
-
));
|
|
43983
|
-
var Text3 = (0, import_react127.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react127.default.createElement(
|
|
43984
|
-
"span",
|
|
43985
|
-
{
|
|
43986
|
-
ref,
|
|
43987
|
-
className: cx(`n-font-sans n-text-heading5 n-font-normal`, className),
|
|
43988
|
-
...props
|
|
43989
|
-
}
|
|
43990
|
-
));
|
|
43991
|
-
var VerticalSeparator = () => /* @__PURE__ */ import_react127.default.createElement(Spacer.Vertical, { size: "inspector-v-separator" });
|
|
43992
|
-
var HorizontalSeparator = () => /* @__PURE__ */ import_react127.default.createElement(Spacer.Horizontal, { size: "inspector-h-separator" });
|
|
43993
|
-
var RowLabel = (0, import_react127.forwardRef)(function RowLabel2({
|
|
43994
|
-
className,
|
|
43995
|
-
$textStyle,
|
|
43996
|
-
...props
|
|
43997
|
-
}, ref) {
|
|
43998
|
-
return /* @__PURE__ */ import_react127.default.createElement(
|
|
43999
|
-
"label",
|
|
44272
|
+
return /* @__PURE__ */ React339.createElement(LabeledField, { label, labelType: "inset" }, /* @__PURE__ */ React339.createElement(
|
|
44273
|
+
InputField2.Root,
|
|
44000
44274
|
{
|
|
44001
|
-
|
|
44002
|
-
|
|
44003
|
-
|
|
44004
|
-
|
|
44005
|
-
|
|
44006
|
-
|
|
44007
|
-
|
|
44008
|
-
|
|
44009
|
-
|
|
44010
|
-
|
|
44011
|
-
|
|
44012
|
-
|
|
44013
|
-
|
|
44014
|
-
|
|
44015
|
-
|
|
44016
|
-
|
|
44017
|
-
}) {
|
|
44018
|
-
return /* @__PURE__ */ import_react127.default.createElement(Row, { id, className }, /* @__PURE__ */ import_react127.default.createElement(Column, null, /* @__PURE__ */ import_react127.default.createElement(RowLabel, { $textStyle: labelTextStyle }, label, right && /* @__PURE__ */ import_react127.default.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ import_react127.default.createElement(Row, null, children)));
|
|
44275
|
+
id,
|
|
44276
|
+
width: size4,
|
|
44277
|
+
end: suffix ? /* @__PURE__ */ React339.createElement(Label, null, suffix) : void 0
|
|
44278
|
+
},
|
|
44279
|
+
/* @__PURE__ */ React339.createElement(
|
|
44280
|
+
InputField2.NumberInput,
|
|
44281
|
+
{
|
|
44282
|
+
value: value === void 0 ? value : (0, import_noya_utils21.round)(value, 2),
|
|
44283
|
+
placeholder: value === void 0 ? placeholder : void 0,
|
|
44284
|
+
onNudge: handleNudgeValue,
|
|
44285
|
+
disabled: disabled2,
|
|
44286
|
+
style: suffix ? { paddingRight: 4 } : void 0,
|
|
44287
|
+
...trigger === "change" ? { onChange: handleSetValue } : { onSubmit: handleSetValue }
|
|
44288
|
+
}
|
|
44289
|
+
)
|
|
44290
|
+
));
|
|
44019
44291
|
});
|
|
44020
44292
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44021
44293
|
0 && (module.exports = {
|
|
@@ -44095,7 +44367,6 @@ var LabeledRow = (0, import_react127.memo)(function LabeledRow2({
|
|
|
44095
44367
|
IndentContext,
|
|
44096
44368
|
InputField,
|
|
44097
44369
|
InspectorContainer,
|
|
44098
|
-
InspectorPrimitives,
|
|
44099
44370
|
Italic,
|
|
44100
44371
|
KeyboardShortcut,
|
|
44101
44372
|
Label,
|
|
@@ -44151,6 +44422,7 @@ var LabeledRow = (0, import_react127.memo)(function LabeledRow2({
|
|
|
44151
44422
|
ToastProvider,
|
|
44152
44423
|
Toolbar,
|
|
44153
44424
|
ToolbarDrawer,
|
|
44425
|
+
ToolbarItems,
|
|
44154
44426
|
ToolbarMenu,
|
|
44155
44427
|
ToolbarMenuButton,
|
|
44156
44428
|
ToolbarMenuContext,
|
|
@@ -44257,7 +44529,8 @@ var LabeledRow = (0, import_react127.memo)(function LabeledRow2({
|
|
|
44257
44529
|
validateDropIndicator,
|
|
44258
44530
|
whiteboardProseTheme,
|
|
44259
44531
|
withDragProvider,
|
|
44260
|
-
withSeparatorElements
|
|
44532
|
+
withSeparatorElements,
|
|
44533
|
+
wordPrefixFilter
|
|
44261
44534
|
});
|
|
44262
44535
|
/*! Bundled license information:
|
|
44263
44536
|
|