ssovee-os-web-ui 0.1.76 → 0.1.78
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/README.md +27 -0
- package/dist/index.cjs +238 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +9 -0
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +174 -27
- package/dist/index.js.map +1 -1
- package/dist/sdk.cjs +2 -2
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.js +2 -2
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React23 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var react = require('@phosphor-icons/react');
|
|
6
|
+
require('tinymce/tinymce');
|
|
7
|
+
require('tinymce/icons/default/icons');
|
|
8
|
+
require('tinymce/themes/silver');
|
|
9
|
+
require('tinymce/models/dom/model');
|
|
10
|
+
require('tinymce/skins/ui/oxide/skin.css');
|
|
11
|
+
require('tinymce/skins/ui/oxide/content.css');
|
|
12
|
+
require('tinymce/skins/content/default/content.css');
|
|
6
13
|
var Editor = require('@monaco-editor/react');
|
|
7
14
|
var uaParserJs = require('ua-parser-js');
|
|
8
15
|
|
|
@@ -26,7 +33,7 @@ function _interopNamespace(e) {
|
|
|
26
33
|
return Object.freeze(n);
|
|
27
34
|
}
|
|
28
35
|
|
|
29
|
-
var
|
|
36
|
+
var React23__namespace = /*#__PURE__*/_interopNamespace(React23);
|
|
30
37
|
var Editor__default = /*#__PURE__*/_interopDefault(Editor);
|
|
31
38
|
|
|
32
39
|
// src/components/Button.tsx
|
|
@@ -35,7 +42,7 @@ var Editor__default = /*#__PURE__*/_interopDefault(Editor);
|
|
|
35
42
|
function cn(...inputs) {
|
|
36
43
|
return inputs.filter(Boolean).join(" ");
|
|
37
44
|
}
|
|
38
|
-
var Button =
|
|
45
|
+
var Button = React23__namespace.default.forwardRef(
|
|
39
46
|
({
|
|
40
47
|
className,
|
|
41
48
|
variant = "primary",
|
|
@@ -171,7 +178,7 @@ var Typography = ({
|
|
|
171
178
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { className: classes, children });
|
|
172
179
|
};
|
|
173
180
|
var Typography_default = Typography;
|
|
174
|
-
var Input =
|
|
181
|
+
var Input = React23__namespace.default.forwardRef(
|
|
175
182
|
({
|
|
176
183
|
className,
|
|
177
184
|
variant = "default",
|
|
@@ -249,7 +256,7 @@ var Input = React22__namespace.default.forwardRef(
|
|
|
249
256
|
);
|
|
250
257
|
Input.displayName = "Input";
|
|
251
258
|
var Input_default = Input;
|
|
252
|
-
var TextArea =
|
|
259
|
+
var TextArea = React23__namespace.default.forwardRef(
|
|
253
260
|
({
|
|
254
261
|
className,
|
|
255
262
|
variant = "default",
|
|
@@ -306,6 +313,146 @@ var TextArea = React22__namespace.default.forwardRef(
|
|
|
306
313
|
);
|
|
307
314
|
TextArea.displayName = "TextArea";
|
|
308
315
|
var TextArea_default = TextArea;
|
|
316
|
+
var DEFAULT_PLUGINS = [
|
|
317
|
+
"advlist",
|
|
318
|
+
"autolink",
|
|
319
|
+
"lists",
|
|
320
|
+
"link",
|
|
321
|
+
"image",
|
|
322
|
+
"charmap",
|
|
323
|
+
"preview",
|
|
324
|
+
"anchor",
|
|
325
|
+
"searchreplace",
|
|
326
|
+
"visualblocks",
|
|
327
|
+
"code",
|
|
328
|
+
"fullscreen",
|
|
329
|
+
"insertdatetime",
|
|
330
|
+
"media",
|
|
331
|
+
"table",
|
|
332
|
+
"wordcount"
|
|
333
|
+
];
|
|
334
|
+
var DEFAULT_TOOLBAR = "undo redo | blocks | bold italic underline strikethrough | alignleft aligncenter alignright | bullist numlist outdent indent | link image media | code fullscreen";
|
|
335
|
+
var RichEditor = React23__namespace.default.forwardRef(
|
|
336
|
+
({
|
|
337
|
+
value = "",
|
|
338
|
+
onChange,
|
|
339
|
+
label,
|
|
340
|
+
helperText,
|
|
341
|
+
error,
|
|
342
|
+
fullWidth = false,
|
|
343
|
+
height = "220px",
|
|
344
|
+
menubar = false,
|
|
345
|
+
toolbar = DEFAULT_TOOLBAR,
|
|
346
|
+
className,
|
|
347
|
+
plugins = DEFAULT_PLUGINS,
|
|
348
|
+
disabled = false,
|
|
349
|
+
placeholder,
|
|
350
|
+
rows,
|
|
351
|
+
...props
|
|
352
|
+
}, ref) => {
|
|
353
|
+
const editorId = React23.useId().replace(/:/g, "");
|
|
354
|
+
const textareaRef = React23.useRef(null);
|
|
355
|
+
const hasTinymce = typeof window !== "undefined" && Boolean(window.tinymce);
|
|
356
|
+
React23.useEffect(() => {
|
|
357
|
+
if (typeof window === "undefined" || !textareaRef.current || !window.tinymce) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const tinymceApi = window.tinymce;
|
|
361
|
+
const existingEditor = tinymceApi.get(editorId);
|
|
362
|
+
if (existingEditor) {
|
|
363
|
+
existingEditor.remove();
|
|
364
|
+
}
|
|
365
|
+
tinymceApi.init({
|
|
366
|
+
target: textareaRef.current,
|
|
367
|
+
selector: void 0,
|
|
368
|
+
skin: "oxide",
|
|
369
|
+
content_css: "default",
|
|
370
|
+
height,
|
|
371
|
+
menubar,
|
|
372
|
+
toolbar,
|
|
373
|
+
plugins,
|
|
374
|
+
statusbar: false,
|
|
375
|
+
resize: false,
|
|
376
|
+
branding: false,
|
|
377
|
+
promotion: false,
|
|
378
|
+
placeholder,
|
|
379
|
+
readonly: disabled,
|
|
380
|
+
content_style: "body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.6; }",
|
|
381
|
+
setup: (editor) => {
|
|
382
|
+
editor.on("init", () => {
|
|
383
|
+
editor.setContent(value ?? "");
|
|
384
|
+
});
|
|
385
|
+
editor.on("input change keyup", () => {
|
|
386
|
+
onChange?.(editor.getContent());
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
return () => {
|
|
391
|
+
const activeEditor = tinymceApi.get(editorId);
|
|
392
|
+
activeEditor?.remove();
|
|
393
|
+
};
|
|
394
|
+
}, [disabled, editorId, height, menubar, onChange, placeholder, plugins, toolbar, value]);
|
|
395
|
+
React23.useEffect(() => {
|
|
396
|
+
const tinymceApi = window?.tinymce;
|
|
397
|
+
const activeEditor = tinymceApi?.get(editorId);
|
|
398
|
+
if (activeEditor && activeEditor.getContent() !== (value ?? "")) {
|
|
399
|
+
activeEditor.setContent(value ?? "");
|
|
400
|
+
}
|
|
401
|
+
}, [editorId, value]);
|
|
402
|
+
const fallbackTextArea = /* @__PURE__ */ jsxRuntime.jsx(
|
|
403
|
+
"textarea",
|
|
404
|
+
{
|
|
405
|
+
ref: textareaRef,
|
|
406
|
+
id: editorId,
|
|
407
|
+
value,
|
|
408
|
+
onChange: (event) => onChange?.(event.currentTarget.value),
|
|
409
|
+
disabled,
|
|
410
|
+
placeholder,
|
|
411
|
+
rows: rows ?? 7,
|
|
412
|
+
"aria-label": label ?? props["aria-label"] ?? "Rich text editor",
|
|
413
|
+
className: cn(
|
|
414
|
+
"w-full min-h-[200px] rounded-[6px] border border-surface-1 bg-primary px-3 py-2 text-base text-neutral-700 transition-all duration-200 focus:border-brand-color focus:outline-none focus:ring-1 focus:ring-brand-color/50 placeholder:text-neutral-400",
|
|
415
|
+
error && "border-red-500 focus:border-red-500 focus:ring-red-500/50",
|
|
416
|
+
disabled && "cursor-not-allowed opacity-60",
|
|
417
|
+
fullWidth && "w-full"
|
|
418
|
+
),
|
|
419
|
+
...props
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cn("flex flex-col gap-1", fullWidth && "w-full", className), children: [
|
|
423
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-neutral-500 dark:text-white", htmlFor: editorId, children: label }),
|
|
424
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
425
|
+
"div",
|
|
426
|
+
{
|
|
427
|
+
className: cn(
|
|
428
|
+
"overflow-hidden rounded-[6px] border border-surface-1 bg-white transition-all duration-200",
|
|
429
|
+
fullWidth && "w-full",
|
|
430
|
+
error && "border-red-500"
|
|
431
|
+
),
|
|
432
|
+
style: { minHeight: height },
|
|
433
|
+
children: hasTinymce ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
434
|
+
"textarea",
|
|
435
|
+
{
|
|
436
|
+
ref: textareaRef,
|
|
437
|
+
id: editorId,
|
|
438
|
+
defaultValue: value,
|
|
439
|
+
"aria-label": label ?? props["aria-label"] ?? "Rich text editor",
|
|
440
|
+
disabled,
|
|
441
|
+
style: { display: "none" },
|
|
442
|
+
...props
|
|
443
|
+
}
|
|
444
|
+
) : fallbackTextArea
|
|
445
|
+
}
|
|
446
|
+
),
|
|
447
|
+
(error || helperText) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1", children: [
|
|
448
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(Typography_default, { variant: "p", className: "text-xs text-red-500", children: error }),
|
|
449
|
+
helperText && !error && /* @__PURE__ */ jsxRuntime.jsx(Typography_default, { variant: "p", className: "text-xs text-neutral-400", children: helperText })
|
|
450
|
+
] })
|
|
451
|
+
] });
|
|
452
|
+
}
|
|
453
|
+
);
|
|
454
|
+
RichEditor.displayName = "RichEditor";
|
|
455
|
+
var RichEditor_default = RichEditor;
|
|
309
456
|
var CodeEditor = ({
|
|
310
457
|
value,
|
|
311
458
|
onChange,
|
|
@@ -328,7 +475,7 @@ var CodeEditor = ({
|
|
|
328
475
|
) });
|
|
329
476
|
};
|
|
330
477
|
var CodeEditor_default = CodeEditor;
|
|
331
|
-
var Select =
|
|
478
|
+
var Select = React23__namespace.default.forwardRef(
|
|
332
479
|
({
|
|
333
480
|
className,
|
|
334
481
|
options,
|
|
@@ -408,7 +555,7 @@ var Select = React22__namespace.default.forwardRef(
|
|
|
408
555
|
);
|
|
409
556
|
Select.displayName = "Select";
|
|
410
557
|
var Select_default = Select;
|
|
411
|
-
var Checkbox =
|
|
558
|
+
var Checkbox = React23__namespace.default.forwardRef(
|
|
412
559
|
({
|
|
413
560
|
className,
|
|
414
561
|
variant = "default",
|
|
@@ -483,7 +630,7 @@ var Checkbox = React22__namespace.default.forwardRef(
|
|
|
483
630
|
);
|
|
484
631
|
Checkbox.displayName = "Checkbox";
|
|
485
632
|
var Checkbox_default = Checkbox;
|
|
486
|
-
var Toggle =
|
|
633
|
+
var Toggle = React23__namespace.default.forwardRef(
|
|
487
634
|
({
|
|
488
635
|
checked,
|
|
489
636
|
onChange,
|
|
@@ -589,10 +736,10 @@ var Dropdown = ({
|
|
|
589
736
|
className,
|
|
590
737
|
trigger
|
|
591
738
|
}) => {
|
|
592
|
-
const [isOpen, setIsOpen] =
|
|
593
|
-
const dropdownRef =
|
|
739
|
+
const [isOpen, setIsOpen] = React23.useState(false);
|
|
740
|
+
const dropdownRef = React23.useRef(null);
|
|
594
741
|
const selectedOption = options.find((option) => option.value === value);
|
|
595
|
-
|
|
742
|
+
React23.useEffect(() => {
|
|
596
743
|
const handleClickOutside = (event) => {
|
|
597
744
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
598
745
|
setIsOpen(false);
|
|
@@ -719,9 +866,9 @@ var ImageWithPlaceholder = ({
|
|
|
719
866
|
};
|
|
720
867
|
const resolvedSrc = resolveSrc(src);
|
|
721
868
|
const initialSrc = isValidSrc(resolvedSrc) ? resolvedSrc : fallbackSrc;
|
|
722
|
-
const [imgSrc, setImgSrc] =
|
|
723
|
-
const [hasError, setHasError] =
|
|
724
|
-
|
|
869
|
+
const [imgSrc, setImgSrc] = React23.useState(initialSrc);
|
|
870
|
+
const [hasError, setHasError] = React23.useState(!isValidSrc(resolvedSrc));
|
|
871
|
+
React23.useEffect(() => {
|
|
725
872
|
const nextResolvedSrc = resolveSrc(src);
|
|
726
873
|
if (isValidSrc(nextResolvedSrc)) {
|
|
727
874
|
setImgSrc(nextResolvedSrc);
|
|
@@ -930,8 +1077,8 @@ var Toast = ({
|
|
|
930
1077
|
showCloseButton = true,
|
|
931
1078
|
className
|
|
932
1079
|
}) => {
|
|
933
|
-
const [isShowing, setIsShowing] =
|
|
934
|
-
|
|
1080
|
+
const [isShowing, setIsShowing] = React23.useState(false);
|
|
1081
|
+
React23.useEffect(() => {
|
|
935
1082
|
if (isVisible) {
|
|
936
1083
|
setIsShowing(true);
|
|
937
1084
|
let timer = null;
|
|
@@ -1155,7 +1302,7 @@ var Modal = ({
|
|
|
1155
1302
|
closeOnEscape = true,
|
|
1156
1303
|
className
|
|
1157
1304
|
}) => {
|
|
1158
|
-
|
|
1305
|
+
React23.useEffect(() => {
|
|
1159
1306
|
if (!isOpen) return;
|
|
1160
1307
|
const handleEscape = (e) => {
|
|
1161
1308
|
if (e.key === "Escape" && closeOnEscape) {
|
|
@@ -1222,7 +1369,7 @@ var Modal = ({
|
|
|
1222
1369
|
);
|
|
1223
1370
|
};
|
|
1224
1371
|
var Modal_default = Modal;
|
|
1225
|
-
var Card =
|
|
1372
|
+
var Card = React23__namespace.default.forwardRef(
|
|
1226
1373
|
({
|
|
1227
1374
|
className,
|
|
1228
1375
|
variant = "default",
|
|
@@ -1260,7 +1407,7 @@ var Card = React22__namespace.default.forwardRef(
|
|
|
1260
1407
|
);
|
|
1261
1408
|
Card.displayName = "Card";
|
|
1262
1409
|
var Card_default = Card;
|
|
1263
|
-
var Badge =
|
|
1410
|
+
var Badge = React23__namespace.default.forwardRef(
|
|
1264
1411
|
({
|
|
1265
1412
|
className,
|
|
1266
1413
|
variant = "default",
|
|
@@ -1315,7 +1462,7 @@ var Avatar = ({
|
|
|
1315
1462
|
className,
|
|
1316
1463
|
onClick
|
|
1317
1464
|
}) => {
|
|
1318
|
-
const [imgError, setImgError] =
|
|
1465
|
+
const [imgError, setImgError] = React23.useState(false);
|
|
1319
1466
|
const sizeClasses = {
|
|
1320
1467
|
sm: "w-8 h-8 text-xs",
|
|
1321
1468
|
md: "w-10 h-10 text-sm",
|
|
@@ -1338,7 +1485,7 @@ var Avatar = ({
|
|
|
1338
1485
|
}
|
|
1339
1486
|
) }) });
|
|
1340
1487
|
};
|
|
1341
|
-
const handleImgError =
|
|
1488
|
+
const handleImgError = React23.useCallback(() => {
|
|
1342
1489
|
setImgError(true);
|
|
1343
1490
|
}, []);
|
|
1344
1491
|
const isSrcAvailable = typeof src === "string" && src.trim() !== "";
|
|
@@ -1410,8 +1557,8 @@ var Tooltip = ({
|
|
|
1410
1557
|
delay = 200,
|
|
1411
1558
|
className
|
|
1412
1559
|
}) => {
|
|
1413
|
-
const [isVisible, setIsVisible] =
|
|
1414
|
-
const [timeoutId, setTimeoutId] =
|
|
1560
|
+
const [isVisible, setIsVisible] = React23.useState(false);
|
|
1561
|
+
const [timeoutId, setTimeoutId] = React23.useState(null);
|
|
1415
1562
|
const showTooltip = () => {
|
|
1416
1563
|
const id = setTimeout(() => setIsVisible(true), delay);
|
|
1417
1564
|
setTimeoutId(id);
|
|
@@ -1603,12 +1750,12 @@ var matchShortcut = (event, shortcut, os) => {
|
|
|
1603
1750
|
return pressed.every((k) => keySet.has(k));
|
|
1604
1751
|
};
|
|
1605
1752
|
var useShortcutFormatter = () => {
|
|
1606
|
-
const [os, setOS] =
|
|
1607
|
-
const listenersRef =
|
|
1608
|
-
|
|
1753
|
+
const [os, setOS] = React23.useState("windows");
|
|
1754
|
+
const listenersRef = React23.useRef(/* @__PURE__ */ new Map());
|
|
1755
|
+
React23.useEffect(() => {
|
|
1609
1756
|
setOS(detectOS());
|
|
1610
1757
|
}, []);
|
|
1611
|
-
|
|
1758
|
+
React23.useEffect(() => {
|
|
1612
1759
|
const handleKeyDown = (event) => {
|
|
1613
1760
|
for (const shortcut of globalKeyboardShortcuts) {
|
|
1614
1761
|
if (matchShortcut(event, shortcut.shortcut, os)) {
|
|
@@ -1651,7 +1798,7 @@ var useShortcutFormatter = () => {
|
|
|
1651
1798
|
};
|
|
1652
1799
|
};
|
|
1653
1800
|
var useShortcutFormatter_default = useShortcutFormatter;
|
|
1654
|
-
var SearchInput =
|
|
1801
|
+
var SearchInput = React23__namespace.default.forwardRef(
|
|
1655
1802
|
({
|
|
1656
1803
|
onSearch,
|
|
1657
1804
|
placeholder = "Search...",
|
|
@@ -1666,11 +1813,11 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1666
1813
|
isActive = true,
|
|
1667
1814
|
...props
|
|
1668
1815
|
}, ref) => {
|
|
1669
|
-
const [searchValue, setSearchValue] =
|
|
1670
|
-
const inputRef =
|
|
1671
|
-
|
|
1816
|
+
const [searchValue, setSearchValue] = React23__namespace.default.useState(value || "");
|
|
1817
|
+
const inputRef = React23.useRef(null);
|
|
1818
|
+
React23.useImperativeHandle(ref, () => inputRef.current);
|
|
1672
1819
|
const { addShortcutListener, removeShortcutListener, formatKeys, getShortcutByCommand } = useShortcutFormatter_default();
|
|
1673
|
-
|
|
1820
|
+
React23.useEffect(() => {
|
|
1674
1821
|
setSearchValue(value ?? "");
|
|
1675
1822
|
}, [value]);
|
|
1676
1823
|
const handleChange = (e) => {
|
|
@@ -1679,7 +1826,7 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1679
1826
|
onChange?.(e);
|
|
1680
1827
|
onSearch?.(newValue);
|
|
1681
1828
|
};
|
|
1682
|
-
const handleClear =
|
|
1829
|
+
const handleClear = React23.useCallback(() => {
|
|
1683
1830
|
setSearchValue("");
|
|
1684
1831
|
onSearch?.("");
|
|
1685
1832
|
const syntheticEvent = {
|
|
@@ -1687,7 +1834,7 @@ var SearchInput = React22__namespace.default.forwardRef(
|
|
|
1687
1834
|
};
|
|
1688
1835
|
onChange?.(syntheticEvent);
|
|
1689
1836
|
}, [onChange, onSearch]);
|
|
1690
|
-
|
|
1837
|
+
React23.useEffect(() => {
|
|
1691
1838
|
if (!enableKeyboardShortcuts || !isActive) return;
|
|
1692
1839
|
const handleFocusSearch = (e) => {
|
|
1693
1840
|
e?.preventDefault();
|
|
@@ -1817,8 +1964,8 @@ var FileUpload = ({
|
|
|
1817
1964
|
children,
|
|
1818
1965
|
dragAndDrop = false
|
|
1819
1966
|
}) => {
|
|
1820
|
-
const fileInputRef =
|
|
1821
|
-
const [isDragOver, setIsDragOver] =
|
|
1967
|
+
const fileInputRef = React23.useRef(null);
|
|
1968
|
+
const [isDragOver, setIsDragOver] = React23__namespace.default.useState(false);
|
|
1822
1969
|
const handleFileSelect = (files) => {
|
|
1823
1970
|
if (!files) return;
|
|
1824
1971
|
const fileArray = Array.from(files);
|
|
@@ -2116,7 +2263,7 @@ var Pagination = ({
|
|
|
2116
2263
|
] });
|
|
2117
2264
|
};
|
|
2118
2265
|
var Pagination_default = Pagination;
|
|
2119
|
-
var Radio =
|
|
2266
|
+
var Radio = React23__namespace.default.forwardRef(
|
|
2120
2267
|
({
|
|
2121
2268
|
className,
|
|
2122
2269
|
label,
|
|
@@ -2181,7 +2328,7 @@ var Radio = React22__namespace.default.forwardRef(
|
|
|
2181
2328
|
Radio.displayName = "Radio";
|
|
2182
2329
|
var Radio_default = Radio;
|
|
2183
2330
|
var Accordion = ({ items, active = -1 }) => {
|
|
2184
|
-
const [activeIndex, setActiveIndex] =
|
|
2331
|
+
const [activeIndex, setActiveIndex] = React23.useState(active);
|
|
2185
2332
|
const toggleAccordion = (index) => {
|
|
2186
2333
|
setActiveIndex(activeIndex === index ? null : index);
|
|
2187
2334
|
};
|
|
@@ -2222,8 +2369,8 @@ var Tabs = ({
|
|
|
2222
2369
|
buttonClassName = "flex items-center gap-1 px-[8px] py-[2px] text-[13px] cursor-pointer transition-all duration-300 text-neutral-300 rounded-[6px] m-[8px]",
|
|
2223
2370
|
activeButtonClassName = "bg-surface-3 text-neutral-400"
|
|
2224
2371
|
}) => {
|
|
2225
|
-
const [activeTab, setActiveTab] =
|
|
2226
|
-
|
|
2372
|
+
const [activeTab, setActiveTab] = React23.useState(defaultActiveTab);
|
|
2373
|
+
React23.useEffect(() => {
|
|
2227
2374
|
setActiveTab(defaultActiveTab);
|
|
2228
2375
|
}, [defaultActiveTab]);
|
|
2229
2376
|
const handleTabClick = (index) => {
|
|
@@ -2262,11 +2409,11 @@ function renderPluginChild(child, app, api, reloadKey) {
|
|
|
2262
2409
|
const renderFn = child;
|
|
2263
2410
|
return renderFn({ app, api });
|
|
2264
2411
|
}
|
|
2265
|
-
return
|
|
2266
|
-
if (!
|
|
2412
|
+
return React23.Children.map(child, (node, index) => {
|
|
2413
|
+
if (!React23.isValidElement(node)) {
|
|
2267
2414
|
return node;
|
|
2268
2415
|
}
|
|
2269
|
-
return
|
|
2416
|
+
return React23.cloneElement(
|
|
2270
2417
|
node,
|
|
2271
2418
|
{
|
|
2272
2419
|
key: `${reloadKey}-${index}`,
|
|
@@ -2298,20 +2445,20 @@ function PluginPlayground({
|
|
|
2298
2445
|
onClose,
|
|
2299
2446
|
onMinimize
|
|
2300
2447
|
}) {
|
|
2301
|
-
const [mockUser] =
|
|
2302
|
-
const [mockToken] =
|
|
2303
|
-
const [isMinimized, setIsMinimized] =
|
|
2304
|
-
const [isClosed, setIsClosed] =
|
|
2305
|
-
const [isActive, setIsActive] =
|
|
2306
|
-
const [isNightMode, setIsNightMode] =
|
|
2307
|
-
|
|
2448
|
+
const [mockUser] = React23.useState(DEFAULT_MOCK_USER);
|
|
2449
|
+
const [mockToken] = React23.useState(DEFAULT_TOKEN);
|
|
2450
|
+
const [isMinimized, setIsMinimized] = React23.useState(false);
|
|
2451
|
+
const [isClosed, setIsClosed] = React23.useState(false);
|
|
2452
|
+
const [isActive, setIsActive] = React23.useState(true);
|
|
2453
|
+
const [isNightMode, setIsNightMode] = React23.useState(true);
|
|
2454
|
+
React23.useEffect(() => {
|
|
2308
2455
|
if (typeof window === "undefined") return;
|
|
2309
2456
|
const storedTheme = window.localStorage.getItem("plugin-playground-theme");
|
|
2310
2457
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2311
2458
|
const shouldUseDark = storedTheme ? storedTheme === "dark" : prefersDark;
|
|
2312
2459
|
setIsNightMode(shouldUseDark);
|
|
2313
2460
|
}, []);
|
|
2314
|
-
|
|
2461
|
+
React23.useEffect(() => {
|
|
2315
2462
|
if (typeof document === "undefined") return;
|
|
2316
2463
|
document.documentElement.classList.toggle("dark", isNightMode);
|
|
2317
2464
|
window.localStorage.setItem(
|
|
@@ -2321,28 +2468,28 @@ function PluginPlayground({
|
|
|
2321
2468
|
}, [isNightMode]);
|
|
2322
2469
|
const title = metadata.title ?? metadata.name ?? "Plugin Playground";
|
|
2323
2470
|
const slug = metadata.slug ?? "local-plugin";
|
|
2324
|
-
const defaultSize =
|
|
2471
|
+
const defaultSize = React23.useMemo(() => getDefaultSize(metadata), [metadata]);
|
|
2325
2472
|
const canvasBackground = backgroundImage ?? metadata.backgroundImage ?? DEFAULT_BACKGROUND;
|
|
2326
2473
|
const isWindowResizable = metadata.windowSize?.isAppWindowResizing ?? metadata.isResizing ?? true;
|
|
2327
|
-
const minimizeWindow =
|
|
2474
|
+
const minimizeWindow = React23.useCallback(() => {
|
|
2328
2475
|
setIsActive(false);
|
|
2329
2476
|
setIsMinimized(true);
|
|
2330
2477
|
setIsClosed(false);
|
|
2331
2478
|
onMinimize?.(true);
|
|
2332
2479
|
}, [onMinimize]);
|
|
2333
|
-
const closeWindow =
|
|
2480
|
+
const closeWindow = React23.useCallback(() => {
|
|
2334
2481
|
setIsActive(false);
|
|
2335
2482
|
setIsClosed(true);
|
|
2336
2483
|
setIsMinimized(false);
|
|
2337
2484
|
onClose?.();
|
|
2338
2485
|
}, [onClose]);
|
|
2339
|
-
const restoreWindow =
|
|
2486
|
+
const restoreWindow = React23.useCallback(() => {
|
|
2340
2487
|
setIsActive(true);
|
|
2341
2488
|
setIsClosed(false);
|
|
2342
2489
|
setIsMinimized(false);
|
|
2343
2490
|
onMinimize?.(false);
|
|
2344
2491
|
}, [onMinimize]);
|
|
2345
|
-
const mockApi =
|
|
2492
|
+
const mockApi = React23.useMemo(
|
|
2346
2493
|
() => ({
|
|
2347
2494
|
showToast: (message, type) => {
|
|
2348
2495
|
console.info(`[playground:${type}] ${message}`);
|
|
@@ -2359,7 +2506,7 @@ function PluginPlayground({
|
|
|
2359
2506
|
}),
|
|
2360
2507
|
[mockToken, mockUser]
|
|
2361
2508
|
);
|
|
2362
|
-
const appProps =
|
|
2509
|
+
const appProps = React23.useMemo(
|
|
2363
2510
|
() => ({
|
|
2364
2511
|
name: title,
|
|
2365
2512
|
slug,
|
|
@@ -2529,13 +2676,13 @@ var WindowWithSideMenu = ({
|
|
|
2529
2676
|
removeShortcutListener,
|
|
2530
2677
|
getShortcutByCommand
|
|
2531
2678
|
} = useShortcutFormatter_default();
|
|
2532
|
-
const [state, dispatch] =
|
|
2679
|
+
const [state, dispatch] = React23.useReducer(reducer, {
|
|
2533
2680
|
...initialState,
|
|
2534
2681
|
windowSize: app.windowSize.windowSize ?? defaultSize,
|
|
2535
2682
|
defaultSize: app.windowSize.windowSize ?? defaultSize
|
|
2536
2683
|
});
|
|
2537
|
-
const windowRef =
|
|
2538
|
-
|
|
2684
|
+
const windowRef = React23.useRef(null);
|
|
2685
|
+
React23.useEffect(() => {
|
|
2539
2686
|
if (app.isMinimize !== state.isMinimized) {
|
|
2540
2687
|
dispatch({ type: "SYNC_MINIMIZE_STATE", payload: app.isMinimize });
|
|
2541
2688
|
}
|
|
@@ -2596,7 +2743,7 @@ var WindowWithSideMenu = ({
|
|
|
2596
2743
|
document.body.style.userSelect = "none";
|
|
2597
2744
|
dispatch({ type: "START_RESIZE", payload: { x: e.clientX, y: e.clientY } });
|
|
2598
2745
|
};
|
|
2599
|
-
|
|
2746
|
+
React23.useEffect(() => {
|
|
2600
2747
|
if (state.isDragging || state.resizeStart) {
|
|
2601
2748
|
window.addEventListener("mousemove", handleMouseMove);
|
|
2602
2749
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -2607,7 +2754,7 @@ var WindowWithSideMenu = ({
|
|
|
2607
2754
|
document.body.style.userSelect = "";
|
|
2608
2755
|
};
|
|
2609
2756
|
}, [state.isDragging, state.resizeStart]);
|
|
2610
|
-
|
|
2757
|
+
React23.useEffect(() => {
|
|
2611
2758
|
if (windowRef.current) {
|
|
2612
2759
|
windowRef.current.addEventListener("click", () => {
|
|
2613
2760
|
if (app?.callback) {
|
|
@@ -2616,7 +2763,7 @@ var WindowWithSideMenu = ({
|
|
|
2616
2763
|
});
|
|
2617
2764
|
}
|
|
2618
2765
|
}, [app?.slug, windowRef]);
|
|
2619
|
-
|
|
2766
|
+
React23.useEffect(() => {
|
|
2620
2767
|
const handleExitApp = () => {
|
|
2621
2768
|
if (app?.callback) {
|
|
2622
2769
|
app?.callback("CLOSE_APP");
|
|
@@ -2627,7 +2774,7 @@ var WindowWithSideMenu = ({
|
|
|
2627
2774
|
removeShortcutListener("exit_app", handleExitApp);
|
|
2628
2775
|
};
|
|
2629
2776
|
}, [app?.slug, app.isActive]);
|
|
2630
|
-
|
|
2777
|
+
React23.useEffect(() => {
|
|
2631
2778
|
const handleMinimize = () => {
|
|
2632
2779
|
if (app?.slug && app.isActive) {
|
|
2633
2780
|
dispatch({
|
|
@@ -2644,7 +2791,7 @@ var WindowWithSideMenu = ({
|
|
|
2644
2791
|
removeShortcutListener("minimize_app", handleMinimize);
|
|
2645
2792
|
};
|
|
2646
2793
|
}, [app?.slug, app.isActive, state.isMinimized, state.windowSize]);
|
|
2647
|
-
|
|
2794
|
+
React23.useEffect(() => {
|
|
2648
2795
|
const handleMaximize = () => {
|
|
2649
2796
|
if (app?.slug && app.isActive) {
|
|
2650
2797
|
dispatch({
|
|
@@ -2815,7 +2962,7 @@ var WindowWithSideMenu = ({
|
|
|
2815
2962
|
style: {
|
|
2816
2963
|
maxHeight: `${state.windowSize.height - 37}px`
|
|
2817
2964
|
},
|
|
2818
|
-
children:
|
|
2965
|
+
children: React23.isValidElement(children) && typeof children.type !== "string" ? React23__namespace.default.cloneElement(children, {
|
|
2819
2966
|
windowSize: state.windowSize,
|
|
2820
2967
|
isAppWindowResizing: state.resizeStart !== null
|
|
2821
2968
|
}) : children
|
|
@@ -2921,13 +3068,13 @@ var WindowWithoutSideMenu = ({
|
|
|
2921
3068
|
removeShortcutListener,
|
|
2922
3069
|
getShortcutByCommand
|
|
2923
3070
|
} = useShortcutFormatter_default();
|
|
2924
|
-
const [state, dispatch] =
|
|
3071
|
+
const [state, dispatch] = React23.useReducer(reducer2, {
|
|
2925
3072
|
...initialState2,
|
|
2926
3073
|
windowSize: app.windowSize.windowSize ?? defaultSize,
|
|
2927
3074
|
defaultSize: app.windowSize.windowSize ?? defaultSize
|
|
2928
3075
|
});
|
|
2929
|
-
const windowRef =
|
|
2930
|
-
|
|
3076
|
+
const windowRef = React23.useRef(null);
|
|
3077
|
+
React23.useEffect(() => {
|
|
2931
3078
|
if (app.isMinimize !== state.isMinimized) {
|
|
2932
3079
|
dispatch({ type: "SYNC_MINIMIZE_STATE", payload: app.isMinimize });
|
|
2933
3080
|
}
|
|
@@ -2984,7 +3131,7 @@ var WindowWithoutSideMenu = ({
|
|
|
2984
3131
|
document.body.style.userSelect = "none";
|
|
2985
3132
|
dispatch({ type: "START_RESIZE", payload: { x: e.clientX, y: e.clientY } });
|
|
2986
3133
|
};
|
|
2987
|
-
|
|
3134
|
+
React23.useEffect(() => {
|
|
2988
3135
|
if (state.isDragging || state.resizeStart) {
|
|
2989
3136
|
window.addEventListener("mousemove", handleMouseMove);
|
|
2990
3137
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -2995,7 +3142,7 @@ var WindowWithoutSideMenu = ({
|
|
|
2995
3142
|
document.body.style.userSelect = "";
|
|
2996
3143
|
};
|
|
2997
3144
|
}, [state.isDragging, state.resizeStart]);
|
|
2998
|
-
|
|
3145
|
+
React23.useEffect(() => {
|
|
2999
3146
|
if (windowRef.current) {
|
|
3000
3147
|
windowRef.current.addEventListener("click", () => {
|
|
3001
3148
|
if (app?.callback) {
|
|
@@ -3004,7 +3151,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3004
3151
|
});
|
|
3005
3152
|
}
|
|
3006
3153
|
}, [app?.slug, windowRef]);
|
|
3007
|
-
|
|
3154
|
+
React23.useEffect(() => {
|
|
3008
3155
|
const handleExitApp = () => {
|
|
3009
3156
|
if (app?.callback) {
|
|
3010
3157
|
app?.callback("CLOSE_APP");
|
|
@@ -3015,7 +3162,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3015
3162
|
removeShortcutListener("exit_app", handleExitApp);
|
|
3016
3163
|
};
|
|
3017
3164
|
}, [app?.slug, app.isActive]);
|
|
3018
|
-
|
|
3165
|
+
React23.useEffect(() => {
|
|
3019
3166
|
const handleMinimize = () => {
|
|
3020
3167
|
if (app?.slug && app.isActive) {
|
|
3021
3168
|
dispatch({
|
|
@@ -3032,7 +3179,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3032
3179
|
removeShortcutListener("minimize_app", handleMinimize);
|
|
3033
3180
|
};
|
|
3034
3181
|
}, [app?.slug, app.isActive, state.isMinimized, state.windowSize]);
|
|
3035
|
-
|
|
3182
|
+
React23.useEffect(() => {
|
|
3036
3183
|
const handleMaximize = () => {
|
|
3037
3184
|
if (app?.slug && app.isActive) {
|
|
3038
3185
|
dispatch({
|
|
@@ -3148,7 +3295,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3148
3295
|
style: {
|
|
3149
3296
|
maxHeight: `${state.windowSize.height - 37}px`
|
|
3150
3297
|
},
|
|
3151
|
-
children:
|
|
3298
|
+
children: React23.isValidElement(children) && typeof children.type !== "string" ? React23__namespace.default.cloneElement(children, {
|
|
3152
3299
|
windowSize: state.windowSize,
|
|
3153
3300
|
isAppWindowResizing: state.resizeStart !== null
|
|
3154
3301
|
}) : children
|
|
@@ -3171,7 +3318,7 @@ var WindowWithoutSideMenu = ({
|
|
|
3171
3318
|
);
|
|
3172
3319
|
};
|
|
3173
3320
|
var WindowWithoutSideMenu_default = WindowWithoutSideMenu;
|
|
3174
|
-
var Table =
|
|
3321
|
+
var Table = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3175
3322
|
"table",
|
|
3176
3323
|
{
|
|
3177
3324
|
ref,
|
|
@@ -3180,9 +3327,9 @@ var Table = React22__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
3180
3327
|
}
|
|
3181
3328
|
) }));
|
|
3182
3329
|
Table.displayName = "Table";
|
|
3183
|
-
var TableHeader =
|
|
3330
|
+
var TableHeader = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b text-neutral-400 bg-surface-2", className), ...props }));
|
|
3184
3331
|
TableHeader.displayName = "TableHeader";
|
|
3185
|
-
var TableBody =
|
|
3332
|
+
var TableBody = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3186
3333
|
"tbody",
|
|
3187
3334
|
{
|
|
3188
3335
|
ref,
|
|
@@ -3191,7 +3338,7 @@ var TableBody = React22__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3191
3338
|
}
|
|
3192
3339
|
));
|
|
3193
3340
|
TableBody.displayName = "TableBody";
|
|
3194
|
-
var TableFooter =
|
|
3341
|
+
var TableFooter = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3195
3342
|
"tfoot",
|
|
3196
3343
|
{
|
|
3197
3344
|
ref,
|
|
@@ -3203,7 +3350,7 @@ var TableFooter = React22__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
3203
3350
|
}
|
|
3204
3351
|
));
|
|
3205
3352
|
TableFooter.displayName = "TableFooter";
|
|
3206
|
-
var TableRow =
|
|
3353
|
+
var TableRow = React23__namespace.forwardRef(({ className, onClick, ...props }, ref) => {
|
|
3207
3354
|
const isInteractive = typeof onClick === "function";
|
|
3208
3355
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3209
3356
|
"tr",
|
|
@@ -3220,7 +3367,7 @@ var TableRow = React22__namespace.forwardRef(({ className, onClick, ...props },
|
|
|
3220
3367
|
);
|
|
3221
3368
|
});
|
|
3222
3369
|
TableRow.displayName = "TableRow";
|
|
3223
|
-
var TableHead =
|
|
3370
|
+
var TableHead = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3224
3371
|
"th",
|
|
3225
3372
|
{
|
|
3226
3373
|
ref,
|
|
@@ -3232,7 +3379,7 @@ var TableHead = React22__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3232
3379
|
}
|
|
3233
3380
|
));
|
|
3234
3381
|
TableHead.displayName = "TableHead";
|
|
3235
|
-
var TableCell =
|
|
3382
|
+
var TableCell = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3236
3383
|
"td",
|
|
3237
3384
|
{
|
|
3238
3385
|
ref,
|
|
@@ -3241,7 +3388,7 @@ var TableCell = React22__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3241
3388
|
}
|
|
3242
3389
|
));
|
|
3243
3390
|
TableCell.displayName = "TableCell";
|
|
3244
|
-
var TableCaption =
|
|
3391
|
+
var TableCaption = React23__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3245
3392
|
"caption",
|
|
3246
3393
|
{
|
|
3247
3394
|
ref,
|
|
@@ -3251,16 +3398,16 @@ var TableCaption = React22__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
3251
3398
|
));
|
|
3252
3399
|
TableCaption.displayName = "TableCaption";
|
|
3253
3400
|
var useGridClasses = (windowSize, gridRules) => {
|
|
3254
|
-
const deviceType =
|
|
3401
|
+
const deviceType = React23.useMemo(() => {
|
|
3255
3402
|
if (windowSize.width <= 640) return "mobile";
|
|
3256
3403
|
if (windowSize.width <= 1024) return "tablet";
|
|
3257
3404
|
return "desktop";
|
|
3258
3405
|
}, [windowSize]);
|
|
3259
|
-
const gridClasses =
|
|
3406
|
+
const gridClasses = React23.useMemo(() => {
|
|
3260
3407
|
const classes = {};
|
|
3261
3408
|
for (const element in gridRules) {
|
|
3262
|
-
const classRules = gridRules[element];
|
|
3263
|
-
const colSpan = classRules["col-span"][deviceType];
|
|
3409
|
+
const classRules = gridRules[element] ?? {};
|
|
3410
|
+
const colSpan = classRules["col-span"]?.[deviceType] ?? "12";
|
|
3264
3411
|
classes[element] = `col-span-${deviceType}-${colSpan}`;
|
|
3265
3412
|
}
|
|
3266
3413
|
return classes;
|
|
@@ -3269,8 +3416,8 @@ var useGridClasses = (windowSize, gridRules) => {
|
|
|
3269
3416
|
};
|
|
3270
3417
|
var useGridClasses_default = useGridClasses;
|
|
3271
3418
|
var useDeviceSupport = () => {
|
|
3272
|
-
const [isSupported, setIsSupported] =
|
|
3273
|
-
|
|
3419
|
+
const [isSupported, setIsSupported] = React23.useState(true);
|
|
3420
|
+
React23.useEffect(() => {
|
|
3274
3421
|
function checkSupport() {
|
|
3275
3422
|
const ua = typeof window !== "undefined" ? window.navigator.userAgent : "";
|
|
3276
3423
|
const width = typeof window !== "undefined" ? window.innerWidth : 1920;
|
|
@@ -3396,7 +3543,7 @@ var useSound = () => {
|
|
|
3396
3543
|
audio.currentTime = 0;
|
|
3397
3544
|
await audio.play();
|
|
3398
3545
|
};
|
|
3399
|
-
const playSound =
|
|
3546
|
+
const playSound = React23.useCallback((type) => {
|
|
3400
3547
|
if (typeof window === "undefined") {
|
|
3401
3548
|
return;
|
|
3402
3549
|
}
|
|
@@ -3463,6 +3610,7 @@ exports.Pagination = Pagination_default;
|
|
|
3463
3610
|
exports.PluginPlayground = PluginPlayground;
|
|
3464
3611
|
exports.Progress = Progress_default;
|
|
3465
3612
|
exports.Radio = Radio_default;
|
|
3613
|
+
exports.RichEditor = RichEditor_default;
|
|
3466
3614
|
exports.SearchInput = SearchInput_default;
|
|
3467
3615
|
exports.Select = Select_default;
|
|
3468
3616
|
exports.Skeleton = Skeleton_default;
|