@noya-app/noya-designsystem 0.1.42 → 0.1.44
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 +12 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +62 -36
- package/dist/index.d.ts +62 -36
- package/dist/index.js +226 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +234 -143
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Combobox.tsx +158 -52
- package/src/components/SelectMenu.tsx +4 -0
- package/src/components/TextArea.tsx +61 -24
- package/src/components/Toolbar.tsx +4 -9
- package/src/components/WorkspaceLayout.tsx +145 -152
package/dist/index.js
CHANGED
|
@@ -1391,7 +1391,6 @@ var src_exports = {};
|
|
|
1391
1391
|
__export(src_exports, {
|
|
1392
1392
|
ActivityIndicator: () => ActivityIndicator,
|
|
1393
1393
|
AnimatePresence: () => AnimatePresence,
|
|
1394
|
-
AutoResizingTextArea: () => AutoResizingTextArea,
|
|
1395
1394
|
Avatar: () => Avatar,
|
|
1396
1395
|
AvatarStack: () => AvatarStack,
|
|
1397
1396
|
BaseToolbar: () => BaseToolbar,
|
|
@@ -1455,6 +1454,8 @@ __export(src_exports, {
|
|
|
1455
1454
|
Spacer: () => Spacer,
|
|
1456
1455
|
Switch: () => Switch,
|
|
1457
1456
|
Text: () => Text,
|
|
1457
|
+
TextArea: () => TextArea,
|
|
1458
|
+
TextAreaRow: () => TextAreaRow,
|
|
1458
1459
|
Toast: () => Toast,
|
|
1459
1460
|
ToastProvider: () => ToastProvider,
|
|
1460
1461
|
Toolbar: () => Toolbar,
|
|
@@ -12300,7 +12301,8 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
12300
12301
|
open,
|
|
12301
12302
|
onFocus,
|
|
12302
12303
|
onBlur,
|
|
12303
|
-
onOpenChange
|
|
12304
|
+
onOpenChange,
|
|
12305
|
+
contentStyle
|
|
12304
12306
|
}) {
|
|
12305
12307
|
const selectedItem = menuItems.find(
|
|
12306
12308
|
(item) => typeof item !== "string" && item.value === value
|
|
@@ -12388,7 +12390,9 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
12388
12390
|
collisionPadding: 8,
|
|
12389
12391
|
align: "end",
|
|
12390
12392
|
style: {
|
|
12391
|
-
width: "var(--radix-select-trigger-width)"
|
|
12393
|
+
width: "var(--radix-select-trigger-width)",
|
|
12394
|
+
maxHeight: "500px",
|
|
12395
|
+
...contentStyle
|
|
12392
12396
|
}
|
|
12393
12397
|
},
|
|
12394
12398
|
/* @__PURE__ */ import_react35.default.createElement(Select.ScrollUpButton, { className: scrollButtonStyles }, /* @__PURE__ */ import_react35.default.createElement(
|
|
@@ -13167,29 +13171,66 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13167
13171
|
(0, import_react38.forwardRef)(function Combobox2({
|
|
13168
13172
|
id,
|
|
13169
13173
|
loading,
|
|
13170
|
-
initialValue = "",
|
|
13171
13174
|
placeholder,
|
|
13172
13175
|
items,
|
|
13173
13176
|
size: size3,
|
|
13174
|
-
onChange,
|
|
13175
|
-
onSelectItem,
|
|
13176
|
-
onHoverItem,
|
|
13177
|
-
onFocus,
|
|
13178
|
-
onBlur,
|
|
13179
|
-
onDeleteWhenEmpty,
|
|
13180
13177
|
style: style5,
|
|
13181
13178
|
className,
|
|
13182
13179
|
label,
|
|
13183
13180
|
children: children2,
|
|
13184
13181
|
hideMenuWhenEmptyValue = false,
|
|
13185
|
-
allowArbitraryValues = false,
|
|
13186
13182
|
readOnly = false,
|
|
13187
13183
|
tabBehavior = "select",
|
|
13188
|
-
openMenuBehavior = "showFilteredItems"
|
|
13184
|
+
openMenuBehavior = "showFilteredItems",
|
|
13185
|
+
onFocus,
|
|
13186
|
+
onDeleteWhenEmpty,
|
|
13187
|
+
...rest
|
|
13189
13188
|
}, forwardedRef) {
|
|
13189
|
+
const props = (0, import_react38.useMemo)(() => {
|
|
13190
|
+
if (rest.mode === "string") {
|
|
13191
|
+
return {
|
|
13192
|
+
mode: rest.mode,
|
|
13193
|
+
value: rest.value,
|
|
13194
|
+
onChange: rest.onChange,
|
|
13195
|
+
onSelectItem: rest.onSelectItem,
|
|
13196
|
+
onHoverItem: rest.onHoverItem,
|
|
13197
|
+
onBlur: rest.onBlur,
|
|
13198
|
+
allowArbitraryValues: rest.allowArbitraryValues
|
|
13199
|
+
};
|
|
13200
|
+
} else {
|
|
13201
|
+
return {
|
|
13202
|
+
mode: rest.mode,
|
|
13203
|
+
value: rest.value,
|
|
13204
|
+
onChange: rest.onChange,
|
|
13205
|
+
onSelectItem: rest.onSelectItem,
|
|
13206
|
+
onHoverItem: rest.onHoverItem,
|
|
13207
|
+
onBlur: rest.onBlur
|
|
13208
|
+
};
|
|
13209
|
+
}
|
|
13210
|
+
}, [
|
|
13211
|
+
rest.mode,
|
|
13212
|
+
rest.value,
|
|
13213
|
+
rest.onChange,
|
|
13214
|
+
rest.onSelectItem,
|
|
13215
|
+
rest.onHoverItem,
|
|
13216
|
+
rest.onBlur,
|
|
13217
|
+
rest.allowArbitraryValues
|
|
13218
|
+
]);
|
|
13190
13219
|
const ref = (0, import_react38.useRef)(null);
|
|
13220
|
+
function getInitialValueString() {
|
|
13221
|
+
if (props.mode === "string") {
|
|
13222
|
+
return props.value ?? "";
|
|
13223
|
+
} else {
|
|
13224
|
+
return props.value?.name ?? "";
|
|
13225
|
+
}
|
|
13226
|
+
}
|
|
13227
|
+
const initialValueString = getInitialValueString();
|
|
13191
13228
|
const [comboboxState] = (0, import_react38.useState)(
|
|
13192
|
-
() => new ComboboxState(
|
|
13229
|
+
() => new ComboboxState(
|
|
13230
|
+
items,
|
|
13231
|
+
initialValueString,
|
|
13232
|
+
props.mode === "string" && (props.allowArbitraryValues ?? false)
|
|
13233
|
+
)
|
|
13193
13234
|
);
|
|
13194
13235
|
const state = useComboboxState(comboboxState);
|
|
13195
13236
|
const [isFocused, setIsFocused] = (0, import_react38.useState)(false);
|
|
@@ -13198,12 +13239,11 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13198
13239
|
(0, import_react38.useEffect)(() => {
|
|
13199
13240
|
comboboxState.setItems(items);
|
|
13200
13241
|
}, [items, comboboxState]);
|
|
13242
|
+
(0, import_react38.useEffect)(() => {
|
|
13243
|
+
comboboxState.setFilter(initialValueString);
|
|
13244
|
+
}, [comboboxState, initialValueString]);
|
|
13201
13245
|
const { filter, selectedIndex, filteredItems } = state;
|
|
13202
|
-
const shouldShowMenu =
|
|
13203
|
-
if (!isFocused) return false;
|
|
13204
|
-
if (hideMenuWhenEmptyValue && filter === "") return false;
|
|
13205
|
-
return true;
|
|
13206
|
-
}, [hideMenuWhenEmptyValue, filter, isFocused]);
|
|
13246
|
+
const shouldShowMenu = isFocused && !(hideMenuWhenEmptyValue && filter === "");
|
|
13207
13247
|
(0, import_react38.useEffect)(() => {
|
|
13208
13248
|
if (listRef.current) {
|
|
13209
13249
|
listRef.current.scrollToIndex(selectedIndex);
|
|
@@ -13211,15 +13251,28 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13211
13251
|
}, [selectedIndex]);
|
|
13212
13252
|
const handleBlur = (0, import_react38.useCallback)(() => {
|
|
13213
13253
|
ref.current?.blur();
|
|
13214
|
-
comboboxState.reset(
|
|
13215
|
-
|
|
13254
|
+
comboboxState.reset(initialValueString);
|
|
13255
|
+
if (props.mode === "string") {
|
|
13256
|
+
props.onBlur?.(
|
|
13257
|
+
state.filter === state.lastSubmittedValue.filter,
|
|
13258
|
+
filter
|
|
13259
|
+
);
|
|
13260
|
+
} else {
|
|
13261
|
+
const selectedItem = comboboxState.getSelectedItem();
|
|
13262
|
+
if (selectedItem && selectedItem.type !== "sectionHeader") {
|
|
13263
|
+
props.onBlur?.(
|
|
13264
|
+
state.filter === state.lastSubmittedValue.filter,
|
|
13265
|
+
selectedItem
|
|
13266
|
+
);
|
|
13267
|
+
}
|
|
13268
|
+
}
|
|
13216
13269
|
setIsFocused(false);
|
|
13217
|
-
}, [filter,
|
|
13270
|
+
}, [filter, initialValueString, props, state, comboboxState]);
|
|
13218
13271
|
const handleFocus = (0, import_react38.useCallback)(
|
|
13219
13272
|
(event) => {
|
|
13220
13273
|
setIsFocused(true);
|
|
13221
13274
|
comboboxState.reset(
|
|
13222
|
-
openMenuBehavior === "showAllItems" ? "" :
|
|
13275
|
+
openMenuBehavior === "showAllItems" ? "" : initialValueString
|
|
13223
13276
|
);
|
|
13224
13277
|
if (ref.current) {
|
|
13225
13278
|
const length = ref.current.value.length;
|
|
@@ -13227,30 +13280,54 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13227
13280
|
}
|
|
13228
13281
|
onFocus?.(event);
|
|
13229
13282
|
},
|
|
13230
|
-
[
|
|
13283
|
+
[initialValueString, onFocus, openMenuBehavior, comboboxState]
|
|
13231
13284
|
);
|
|
13232
13285
|
const handleUpdateSelection = (0, import_react38.useCallback)(
|
|
13233
13286
|
(item) => {
|
|
13234
13287
|
if (item.type === "sectionHeader") return;
|
|
13235
13288
|
const selectedItem = comboboxState.selectCurrentItem(item);
|
|
13236
13289
|
if (!selectedItem || selectedItem.type === "sectionHeader") return;
|
|
13237
|
-
|
|
13238
|
-
|
|
13290
|
+
if (props.mode === "string") {
|
|
13291
|
+
props.onSelectItem?.(selectedItem.name);
|
|
13292
|
+
props.onHoverItem?.(void 0);
|
|
13293
|
+
} else {
|
|
13294
|
+
props.onSelectItem?.(selectedItem);
|
|
13295
|
+
props.onHoverItem?.(void 0);
|
|
13296
|
+
}
|
|
13239
13297
|
setShouldBlur(true);
|
|
13240
13298
|
},
|
|
13241
|
-
[
|
|
13299
|
+
[props, comboboxState]
|
|
13242
13300
|
);
|
|
13243
13301
|
const handleIndexChange = (0, import_react38.useCallback)(
|
|
13244
13302
|
(index) => {
|
|
13245
13303
|
comboboxState.setSelectedIndex(index);
|
|
13246
13304
|
const item = comboboxState.getSelectedItem();
|
|
13247
13305
|
if (item && item.type !== "sectionHeader") {
|
|
13248
|
-
|
|
13306
|
+
if (props.mode === "string") {
|
|
13307
|
+
props.onHoverItem?.(item.name);
|
|
13308
|
+
} else {
|
|
13309
|
+
props.onHoverItem?.(item);
|
|
13310
|
+
}
|
|
13311
|
+
} else {
|
|
13312
|
+
props.onHoverItem?.(void 0);
|
|
13313
|
+
}
|
|
13314
|
+
},
|
|
13315
|
+
[props, comboboxState]
|
|
13316
|
+
);
|
|
13317
|
+
const handleChange = (0, import_react38.useCallback)(
|
|
13318
|
+
(value) => {
|
|
13319
|
+
if (readOnly) return;
|
|
13320
|
+
comboboxState.setFilter(value);
|
|
13321
|
+
if (props.mode === "string") {
|
|
13322
|
+
props.onChange?.(value);
|
|
13249
13323
|
} else {
|
|
13250
|
-
|
|
13324
|
+
const selectedItem = comboboxState.getSelectedItem();
|
|
13325
|
+
if (selectedItem && selectedItem.type !== "sectionHeader") {
|
|
13326
|
+
props.onChange?.(selectedItem);
|
|
13327
|
+
}
|
|
13251
13328
|
}
|
|
13252
13329
|
},
|
|
13253
|
-
[
|
|
13330
|
+
[readOnly, props, comboboxState]
|
|
13254
13331
|
);
|
|
13255
13332
|
const handleKeyDown = (0, import_react38.useCallback)(
|
|
13256
13333
|
(event) => {
|
|
@@ -13269,7 +13346,7 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13269
13346
|
if (shouldShowMenu) {
|
|
13270
13347
|
if (item) {
|
|
13271
13348
|
handleUpdateSelection(item);
|
|
13272
|
-
} else if (allowArbitraryValues) {
|
|
13349
|
+
} else if (props.mode === "string" && props.allowArbitraryValues) {
|
|
13273
13350
|
comboboxState.submitArbitraryFilter(filter);
|
|
13274
13351
|
handleBlur();
|
|
13275
13352
|
} else {
|
|
@@ -13299,7 +13376,7 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13299
13376
|
}
|
|
13300
13377
|
handled = true;
|
|
13301
13378
|
}
|
|
13302
|
-
} else if (allowArbitraryValues && filter !== "") {
|
|
13379
|
+
} else if (props.mode === "string" && props.allowArbitraryValues && filter !== "") {
|
|
13303
13380
|
comboboxState.submitArbitraryFilter(filter);
|
|
13304
13381
|
handleBlur();
|
|
13305
13382
|
handled = true;
|
|
@@ -13334,17 +13411,9 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13334
13411
|
shouldShowMenu,
|
|
13335
13412
|
comboboxState,
|
|
13336
13413
|
tabBehavior,
|
|
13337
|
-
|
|
13414
|
+
props
|
|
13338
13415
|
]
|
|
13339
13416
|
);
|
|
13340
|
-
const handleChange = (0, import_react38.useCallback)(
|
|
13341
|
-
(value) => {
|
|
13342
|
-
if (readOnly) return;
|
|
13343
|
-
comboboxState.setFilter(value);
|
|
13344
|
-
onChange?.(value);
|
|
13345
|
-
},
|
|
13346
|
-
[onChange, readOnly, comboboxState]
|
|
13347
|
-
);
|
|
13348
13417
|
const typeaheadValue = comboboxState.getTypeaheadValue();
|
|
13349
13418
|
(0, import_react38.useImperativeHandle)(forwardedRef, () => ({
|
|
13350
13419
|
focus: () => {
|
|
@@ -13355,7 +13424,11 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13355
13424
|
}
|
|
13356
13425
|
},
|
|
13357
13426
|
setValue: (value) => {
|
|
13358
|
-
|
|
13427
|
+
if (typeof value === "string") {
|
|
13428
|
+
comboboxState.setFilter(value);
|
|
13429
|
+
} else {
|
|
13430
|
+
comboboxState.setFilter(value.name);
|
|
13431
|
+
}
|
|
13359
13432
|
},
|
|
13360
13433
|
selectAllInputText: () => {
|
|
13361
13434
|
ref.current?.setSelectionRange(0, ref.current.value.length);
|
|
@@ -13369,23 +13442,24 @@ var Combobox = (0, import_react38.memo)(
|
|
|
13369
13442
|
return;
|
|
13370
13443
|
}
|
|
13371
13444
|
comboboxState.reset(
|
|
13372
|
-
openMenuBehavior === "showAllItems" ? "" :
|
|
13445
|
+
openMenuBehavior === "showAllItems" ? "" : initialValueString
|
|
13373
13446
|
);
|
|
13374
13447
|
ref.current?.focus();
|
|
13375
13448
|
},
|
|
13376
13449
|
[
|
|
13377
13450
|
shouldShowMenu,
|
|
13378
13451
|
openMenuBehavior,
|
|
13379
|
-
|
|
13452
|
+
initialValueString,
|
|
13380
13453
|
handleBlur,
|
|
13381
13454
|
comboboxState
|
|
13382
13455
|
]
|
|
13383
13456
|
);
|
|
13384
13457
|
(0, import_react38.useEffect)(() => {
|
|
13385
13458
|
if (!shouldBlur) return;
|
|
13459
|
+
if (document.activeElement !== ref.current) return;
|
|
13460
|
+
setShouldBlur(false);
|
|
13386
13461
|
ref.current?.focus();
|
|
13387
13462
|
handleBlur();
|
|
13388
|
-
setShouldBlur(false);
|
|
13389
13463
|
}, [shouldBlur, handleBlur]);
|
|
13390
13464
|
return /* @__PURE__ */ import_react38.default.createElement(
|
|
13391
13465
|
InputField.Root,
|
|
@@ -15199,42 +15273,46 @@ var import_react49 = __toESM(require("react"));
|
|
|
15199
15273
|
var useAutoResize = (value) => {
|
|
15200
15274
|
const textareaRef = (0, import_react49.useRef)(null);
|
|
15201
15275
|
(0, import_react49.useEffect)(() => {
|
|
15276
|
+
if (value === void 0) return;
|
|
15202
15277
|
if (!textareaRef.current) return;
|
|
15203
15278
|
textareaRef.current.style.height = "auto";
|
|
15204
15279
|
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
|
|
15205
15280
|
}, [value]);
|
|
15206
15281
|
return textareaRef;
|
|
15207
15282
|
};
|
|
15208
|
-
var
|
|
15209
|
-
(0, import_react49.forwardRef)(function
|
|
15283
|
+
var TextArea = (0, import_react49.memo)(
|
|
15284
|
+
(0, import_react49.forwardRef)(function TextArea2({
|
|
15210
15285
|
value,
|
|
15211
15286
|
onChangeText,
|
|
15212
15287
|
className,
|
|
15213
|
-
end,
|
|
15214
|
-
endClassName,
|
|
15215
15288
|
onChange,
|
|
15289
|
+
autoResize = false,
|
|
15216
15290
|
...rest
|
|
15217
15291
|
}, forwardedRef) {
|
|
15218
|
-
const
|
|
15292
|
+
const autoResizeRef = useAutoResize(
|
|
15293
|
+
autoResize ? value || rest.placeholder || "" : void 0
|
|
15294
|
+
);
|
|
15219
15295
|
const handleChange = (0, import_react49.useCallback)(
|
|
15220
15296
|
(event) => {
|
|
15221
|
-
onChangeText(event.target.value);
|
|
15297
|
+
onChangeText?.(event.target.value);
|
|
15222
15298
|
onChange?.(event);
|
|
15223
15299
|
},
|
|
15224
15300
|
[onChangeText, onChange]
|
|
15225
15301
|
);
|
|
15226
15302
|
const handleRef = (0, import_react49.useCallback)(
|
|
15227
15303
|
(value2) => {
|
|
15228
|
-
|
|
15304
|
+
if (autoResize) {
|
|
15305
|
+
autoResizeRef.current = value2;
|
|
15306
|
+
}
|
|
15229
15307
|
assignRef(forwardedRef, value2);
|
|
15230
15308
|
},
|
|
15231
|
-
[
|
|
15309
|
+
[autoResize, autoResizeRef, forwardedRef]
|
|
15232
15310
|
);
|
|
15233
|
-
return /* @__PURE__ */ import_react49.default.createElement(
|
|
15311
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
15234
15312
|
"textarea",
|
|
15235
15313
|
{
|
|
15236
15314
|
className: cx(
|
|
15237
|
-
`font-sans text-heading5 font-normal text-text bg-input-background flex-1 py-1 px-1.5 border-none outline-none min-h-
|
|
15315
|
+
`font-sans text-heading5 font-normal text-text bg-input-background flex-1 py-1 px-1.5 border-none outline-none min-h-6 w-full rounded resize-none placeholder:text-text-disabled focus:ring-2 focus:ring-primary read-only:text-text-disabled focus:z-interactable transition-all`,
|
|
15238
15316
|
className
|
|
15239
15317
|
),
|
|
15240
15318
|
ref: handleRef,
|
|
@@ -15242,7 +15320,27 @@ var AutoResizingTextArea = (0, import_react49.memo)(
|
|
|
15242
15320
|
onChange: handleChange,
|
|
15243
15321
|
value
|
|
15244
15322
|
}
|
|
15245
|
-
)
|
|
15323
|
+
);
|
|
15324
|
+
})
|
|
15325
|
+
);
|
|
15326
|
+
var TextAreaRow = (0, import_react49.memo)(
|
|
15327
|
+
(0, import_react49.forwardRef)(function TextAreaRow2({
|
|
15328
|
+
className,
|
|
15329
|
+
textAreaClassName,
|
|
15330
|
+
textAreaRef,
|
|
15331
|
+
end,
|
|
15332
|
+
endClassName,
|
|
15333
|
+
...rest
|
|
15334
|
+
}, forwardedRef) {
|
|
15335
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
15336
|
+
"div",
|
|
15337
|
+
{
|
|
15338
|
+
ref: forwardedRef,
|
|
15339
|
+
className: cx("relative w-full h-full", className)
|
|
15340
|
+
},
|
|
15341
|
+
/* @__PURE__ */ import_react49.default.createElement(TextArea, { className: textAreaClassName, ...rest, ref: textAreaRef }),
|
|
15342
|
+
/* @__PURE__ */ import_react49.default.createElement("div", { className: cx("absolute right-1 top-4", endClassName) }, end)
|
|
15343
|
+
);
|
|
15246
15344
|
})
|
|
15247
15345
|
);
|
|
15248
15346
|
|
|
@@ -15551,32 +15649,39 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
|
15551
15649
|
}
|
|
15552
15650
|
|
|
15553
15651
|
// src/components/WorkspaceLayout.tsx
|
|
15554
|
-
var
|
|
15652
|
+
var WorkspaceLayout = (0, import_react54.forwardRef)(function WorkspaceLayout2({
|
|
15555
15653
|
autoSavePrefix,
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
rightSidebarContent: rightPanelContent,
|
|
15559
|
-
hasLeftSidebar = !!leftPanelContent,
|
|
15560
|
-
hasRightSidebar = !!rightPanelContent,
|
|
15561
|
-
onChangeLayoutState,
|
|
15562
|
-
leftSidebarInitialSize = 280,
|
|
15563
|
-
rightSidebarInitialSize = 400,
|
|
15564
|
-
leftSidebarMinSize,
|
|
15565
|
-
rightSidebarMinSize,
|
|
15566
|
-
leftSidebarCanResize = false,
|
|
15567
|
-
rightSidebarCanResize = false,
|
|
15654
|
+
left,
|
|
15655
|
+
right,
|
|
15568
15656
|
id,
|
|
15569
15657
|
className,
|
|
15570
|
-
style: style5
|
|
15658
|
+
style: style5,
|
|
15659
|
+
toolbar,
|
|
15660
|
+
children: children2,
|
|
15661
|
+
onChangeLayoutState,
|
|
15662
|
+
leftOptions: {
|
|
15663
|
+
initialSize: leftInitialSize = 280,
|
|
15664
|
+
minSize: leftMinSize,
|
|
15665
|
+
resizable: leftResizable = true,
|
|
15666
|
+
style: leftStyle,
|
|
15667
|
+
className: leftClassName
|
|
15668
|
+
} = {},
|
|
15669
|
+
rightOptions: {
|
|
15670
|
+
initialSize: rightInitialSize = 280,
|
|
15671
|
+
minSize: rightMinSize,
|
|
15672
|
+
resizable: rightResizable = true,
|
|
15673
|
+
style: rightStyle,
|
|
15674
|
+
className: rightClassName
|
|
15675
|
+
} = {}
|
|
15571
15676
|
}, forwardedRef) {
|
|
15572
15677
|
const windowSize = useWindowSize();
|
|
15573
15678
|
function getPercentage(size3) {
|
|
15574
15679
|
return typeof size3 === "string" ? parseFloat(size3) : size3 / windowSize.width * 100;
|
|
15575
15680
|
}
|
|
15576
|
-
const leftSidebarPercentage = getPercentage(
|
|
15577
|
-
const rightSidebarPercentage = getPercentage(
|
|
15578
|
-
const leftSidebarMinPercentage =
|
|
15579
|
-
const rightSidebarMinPercentage =
|
|
15681
|
+
const leftSidebarPercentage = getPercentage(leftInitialSize);
|
|
15682
|
+
const rightSidebarPercentage = getPercentage(rightInitialSize);
|
|
15683
|
+
const leftSidebarMinPercentage = leftMinSize !== void 0 ? getPercentage(leftMinSize) : void 0;
|
|
15684
|
+
const rightSidebarMinPercentage = rightMinSize !== void 0 ? getPercentage(rightMinSize) : void 0;
|
|
15580
15685
|
const panelGroupRef = (0, import_react54.useRef)(null);
|
|
15581
15686
|
const leftSidebarRef = (0, import_react54.useRef)(null);
|
|
15582
15687
|
const rightSidebarRef = (0, import_react54.useRef)(null);
|
|
@@ -15590,21 +15695,21 @@ var WorkspaceLayoutWithTheme = (0, import_react54.forwardRef)(function Workspace
|
|
|
15590
15695
|
);
|
|
15591
15696
|
usePreservePanelSize(panelGroupRef, handleChangeLayoutState);
|
|
15592
15697
|
(0, import_react54.useImperativeHandle)(forwardedRef, () => ({
|
|
15593
|
-
|
|
15698
|
+
setLeftExpanded: (expanded) => {
|
|
15594
15699
|
if (expanded) {
|
|
15595
15700
|
leftSidebarRef.current?.expand();
|
|
15596
15701
|
} else {
|
|
15597
15702
|
leftSidebarRef.current?.collapse();
|
|
15598
15703
|
}
|
|
15599
15704
|
},
|
|
15600
|
-
|
|
15705
|
+
setRightExpanded: (expanded) => {
|
|
15601
15706
|
if (expanded) {
|
|
15602
15707
|
rightSidebarRef.current?.expand();
|
|
15603
15708
|
} else {
|
|
15604
15709
|
rightSidebarRef.current?.collapse();
|
|
15605
15710
|
}
|
|
15606
15711
|
},
|
|
15607
|
-
|
|
15712
|
+
toggleSides: () => {
|
|
15608
15713
|
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
15609
15714
|
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
15610
15715
|
if (isLeftSidebarExpanded || isRightSidebarExpanded) {
|
|
@@ -15615,7 +15720,7 @@ var WorkspaceLayoutWithTheme = (0, import_react54.forwardRef)(function Workspace
|
|
|
15615
15720
|
rightSidebarRef.current?.expand();
|
|
15616
15721
|
}
|
|
15617
15722
|
},
|
|
15618
|
-
|
|
15723
|
+
toggleLeft: () => {
|
|
15619
15724
|
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
15620
15725
|
if (isLeftSidebarExpanded) {
|
|
15621
15726
|
leftSidebarRef.current?.collapse();
|
|
@@ -15623,7 +15728,7 @@ var WorkspaceLayoutWithTheme = (0, import_react54.forwardRef)(function Workspace
|
|
|
15623
15728
|
leftSidebarRef.current?.expand();
|
|
15624
15729
|
}
|
|
15625
15730
|
},
|
|
15626
|
-
|
|
15731
|
+
toggleRight: () => {
|
|
15627
15732
|
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
15628
15733
|
if (isRightSidebarExpanded) {
|
|
15629
15734
|
rightSidebarRef.current?.collapse();
|
|
@@ -15645,56 +15750,38 @@ var WorkspaceLayoutWithTheme = (0, import_react54.forwardRef)(function Workspace
|
|
|
15645
15750
|
}
|
|
15646
15751
|
}
|
|
15647
15752
|
});
|
|
15648
|
-
const centerPanelPercentage = 100 - (
|
|
15753
|
+
const centerPanelPercentage = 100 - (left ? leftSidebarPercentage : 0) - (right ? rightSidebarPercentage : 0);
|
|
15649
15754
|
return /* @__PURE__ */ import_react54.default.createElement(
|
|
15650
15755
|
"div",
|
|
15651
15756
|
{
|
|
15652
15757
|
id,
|
|
15653
|
-
className,
|
|
15654
|
-
style:
|
|
15655
|
-
backgroundColor: cssVars.colors.canvasBackground,
|
|
15656
|
-
display: "flex",
|
|
15657
|
-
flexDirection: "row",
|
|
15658
|
-
...style5
|
|
15659
|
-
}
|
|
15758
|
+
className: cx("flex flex-col bg-canvas-background", className),
|
|
15759
|
+
style: style5
|
|
15660
15760
|
},
|
|
15661
|
-
|
|
15761
|
+
toolbar,
|
|
15762
|
+
/* @__PURE__ */ import_react54.default.createElement("div", { className: "flex flex-row flex-1" }, /* @__PURE__ */ import_react54.default.createElement(
|
|
15662
15763
|
import_react_resizable_panels.PanelGroup,
|
|
15663
15764
|
{
|
|
15664
15765
|
ref: panelGroupRef,
|
|
15665
15766
|
id: EDITOR_PANEL_GROUP_ID,
|
|
15767
|
+
className: "flex-1",
|
|
15666
15768
|
direction: "horizontal",
|
|
15667
|
-
autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : void 0
|
|
15668
|
-
style: { flex: "1" }
|
|
15769
|
+
autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : void 0
|
|
15669
15770
|
},
|
|
15670
|
-
|
|
15771
|
+
left && /* @__PURE__ */ import_react54.default.createElement(import_react54.default.Fragment, null, /* @__PURE__ */ import_react54.default.createElement(
|
|
15671
15772
|
import_react_resizable_panels.Panel,
|
|
15672
15773
|
{
|
|
15673
15774
|
id: LEFT_SIDEBAR_ID,
|
|
15775
|
+
className: "relative",
|
|
15674
15776
|
order: 1,
|
|
15675
15777
|
ref: leftSidebarRef,
|
|
15676
15778
|
defaultSize: leftSidebarPercentage,
|
|
15677
15779
|
minSize: leftSidebarMinPercentage ?? leftSidebarPercentage,
|
|
15678
|
-
...!
|
|
15679
|
-
collapsible: true
|
|
15680
|
-
style: {
|
|
15681
|
-
display: "flex",
|
|
15682
|
-
flexDirection: "row",
|
|
15683
|
-
position: "relative"
|
|
15684
|
-
}
|
|
15780
|
+
...!leftResizable && { maxSize: leftSidebarPercentage },
|
|
15781
|
+
collapsible: true
|
|
15685
15782
|
},
|
|
15686
|
-
internalLayoutState?.leftSidebarCollapsed ? null :
|
|
15687
|
-
), /* @__PURE__ */ import_react54.default.createElement(
|
|
15688
|
-
import_react_resizable_panels.PanelResizeHandle,
|
|
15689
|
-
{
|
|
15690
|
-
style: {
|
|
15691
|
-
cursor: "col-resize",
|
|
15692
|
-
width: "1px",
|
|
15693
|
-
height: "100%",
|
|
15694
|
-
backgroundColor: cssVars.colors.divider
|
|
15695
|
-
}
|
|
15696
|
-
}
|
|
15697
|
-
)),
|
|
15783
|
+
internalLayoutState?.leftSidebarCollapsed ? null : /* @__PURE__ */ import_react54.default.createElement(PanelInner, { style: leftStyle, className: leftClassName }, left)
|
|
15784
|
+
), /* @__PURE__ */ import_react54.default.createElement(import_react_resizable_panels.PanelResizeHandle, { className: "cursor-col-resize w-px h-full bg-divider" })),
|
|
15698
15785
|
/* @__PURE__ */ import_react54.default.createElement(
|
|
15699
15786
|
import_react_resizable_panels.Panel,
|
|
15700
15787
|
{
|
|
@@ -15702,49 +15789,45 @@ var WorkspaceLayoutWithTheme = (0, import_react54.forwardRef)(function Workspace
|
|
|
15702
15789
|
order: 2,
|
|
15703
15790
|
defaultSize: centerPanelPercentage,
|
|
15704
15791
|
minSize: 10,
|
|
15705
|
-
|
|
15706
|
-
display: "flex",
|
|
15707
|
-
flexDirection: "row",
|
|
15708
|
-
position: "relative"
|
|
15709
|
-
}
|
|
15792
|
+
className: "flex relative"
|
|
15710
15793
|
},
|
|
15711
|
-
|
|
15794
|
+
children2
|
|
15712
15795
|
),
|
|
15713
|
-
|
|
15714
|
-
import_react_resizable_panels.PanelResizeHandle,
|
|
15715
|
-
{
|
|
15716
|
-
style: {
|
|
15717
|
-
cursor: "col-resize",
|
|
15718
|
-
width: "1px",
|
|
15719
|
-
height: "100%",
|
|
15720
|
-
backgroundColor: cssVars.colors.divider
|
|
15721
|
-
}
|
|
15722
|
-
}
|
|
15723
|
-
), /* @__PURE__ */ import_react54.default.createElement(
|
|
15796
|
+
right && /* @__PURE__ */ import_react54.default.createElement(import_react54.default.Fragment, null, /* @__PURE__ */ import_react54.default.createElement(import_react_resizable_panels.PanelResizeHandle, { className: "cursor-col-resize w-px h-full bg-divider" }), /* @__PURE__ */ import_react54.default.createElement(
|
|
15724
15797
|
import_react_resizable_panels.Panel,
|
|
15725
15798
|
{
|
|
15726
15799
|
id: RIGHT_SIDEBAR_ID,
|
|
15800
|
+
className: "relative",
|
|
15727
15801
|
order: 3,
|
|
15728
15802
|
ref: rightSidebarRef,
|
|
15729
15803
|
minSize: rightSidebarMinPercentage ?? rightSidebarPercentage,
|
|
15730
15804
|
defaultSize: rightSidebarPercentage,
|
|
15731
|
-
...!
|
|
15805
|
+
...!rightResizable && {
|
|
15732
15806
|
maxSize: rightSidebarPercentage
|
|
15733
15807
|
},
|
|
15734
|
-
collapsible: true
|
|
15735
|
-
style: {
|
|
15736
|
-
display: "flex",
|
|
15737
|
-
flexDirection: "row",
|
|
15738
|
-
position: "relative"
|
|
15739
|
-
}
|
|
15808
|
+
collapsible: true
|
|
15740
15809
|
},
|
|
15741
|
-
internalLayoutState?.rightSidebarCollapsed ? null :
|
|
15810
|
+
internalLayoutState?.rightSidebarCollapsed ? null : /* @__PURE__ */ import_react54.default.createElement(PanelInner, { style: rightStyle, className: rightClassName }, right)
|
|
15742
15811
|
))
|
|
15743
|
-
)
|
|
15812
|
+
))
|
|
15744
15813
|
);
|
|
15745
15814
|
});
|
|
15746
|
-
var
|
|
15747
|
-
|
|
15815
|
+
var PanelInner = (0, import_react54.memo)(function PanelInner2({
|
|
15816
|
+
children: children2,
|
|
15817
|
+
style: style5,
|
|
15818
|
+
className
|
|
15819
|
+
}) {
|
|
15820
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
15821
|
+
"div",
|
|
15822
|
+
{
|
|
15823
|
+
style: style5,
|
|
15824
|
+
className: cx(
|
|
15825
|
+
"absolute inset-0 flex flex-col bg-sidebar-background",
|
|
15826
|
+
className
|
|
15827
|
+
)
|
|
15828
|
+
},
|
|
15829
|
+
children2
|
|
15830
|
+
);
|
|
15748
15831
|
});
|
|
15749
15832
|
|
|
15750
15833
|
// src/hooks/usePlatform.ts
|
|
@@ -16062,14 +16145,15 @@ function ToolbarMenu({
|
|
|
16062
16145
|
Button,
|
|
16063
16146
|
{
|
|
16064
16147
|
key: i,
|
|
16148
|
+
disabled: item.disabled,
|
|
16065
16149
|
onClick: () => {
|
|
16066
16150
|
if (onSelectMenuItem && item.value) {
|
|
16067
16151
|
onSelectMenuItem(item.value);
|
|
16068
16152
|
}
|
|
16069
16153
|
}
|
|
16070
16154
|
},
|
|
16071
|
-
item.
|
|
16072
|
-
item.
|
|
16155
|
+
item.title,
|
|
16156
|
+
item.icon && /* @__PURE__ */ import_react58.default.createElement(import_react58.default.Fragment, null, /* @__PURE__ */ import_react58.default.createElement(Spacer.Horizontal, { inline: true, size: 6 }), renderIcon(item.icon))
|
|
16073
16157
|
);
|
|
16074
16158
|
}
|
|
16075
16159
|
return /* @__PURE__ */ import_react58.default.createElement(
|
|
@@ -16083,7 +16167,7 @@ function ToolbarMenu({
|
|
|
16083
16167
|
}
|
|
16084
16168
|
}
|
|
16085
16169
|
},
|
|
16086
|
-
/* @__PURE__ */ import_react58.default.createElement(Button,
|
|
16170
|
+
/* @__PURE__ */ import_react58.default.createElement(Button, { disabled: item.disabled }, item.title, /* @__PURE__ */ import_react58.default.createElement(Spacer.Horizontal, { size: 6 }), /* @__PURE__ */ import_react58.default.createElement(import_noya_icons8.DropdownChevronIcon, null))
|
|
16087
16171
|
);
|
|
16088
16172
|
}));
|
|
16089
16173
|
}
|
|
@@ -16091,7 +16175,6 @@ function ToolbarMenu({
|
|
|
16091
16175
|
0 && (module.exports = {
|
|
16092
16176
|
ActivityIndicator,
|
|
16093
16177
|
AnimatePresence,
|
|
16094
|
-
AutoResizingTextArea,
|
|
16095
16178
|
Avatar,
|
|
16096
16179
|
AvatarStack,
|
|
16097
16180
|
BaseToolbar,
|
|
@@ -16155,6 +16238,8 @@ function ToolbarMenu({
|
|
|
16155
16238
|
Spacer,
|
|
16156
16239
|
Switch,
|
|
16157
16240
|
Text,
|
|
16241
|
+
TextArea,
|
|
16242
|
+
TextAreaRow,
|
|
16158
16243
|
Toast,
|
|
16159
16244
|
ToastProvider,
|
|
16160
16245
|
Toolbar,
|