@rufous/ui 0.2.77 → 0.2.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/dist/main.cjs +26 -2
- package/dist/main.css +1 -1
- package/dist/main.js +124 -100
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -1528,6 +1528,7 @@ var React65 = __toESM(require("react"), 1);
|
|
|
1528
1528
|
var import_react14 = require("react");
|
|
1529
1529
|
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
1530
1530
|
var import_lucide_react = require("lucide-react");
|
|
1531
|
+
var DialogDepthContext = React65.createContext(0);
|
|
1531
1532
|
var BaseDialog = ({
|
|
1532
1533
|
open = false,
|
|
1533
1534
|
onConfirm,
|
|
@@ -1561,6 +1562,21 @@ var BaseDialog = ({
|
|
|
1561
1562
|
const { themeConfig } = useRufousTheme();
|
|
1562
1563
|
const [isSubmitting, setIsSubmitting] = (0, import_react14.useState)(false);
|
|
1563
1564
|
const sxClass = useSx(sx);
|
|
1565
|
+
const depth = (0, import_react14.useContext)(DialogDepthContext);
|
|
1566
|
+
const overlayZ = 2e3 + depth * 200;
|
|
1567
|
+
const portalZ = overlayZ + 100;
|
|
1568
|
+
(0, import_react14.useEffect)(() => {
|
|
1569
|
+
if (!open) return;
|
|
1570
|
+
const el = document.documentElement;
|
|
1571
|
+
const prev = el.style.getPropertyValue("--rf-dialog-portal-z");
|
|
1572
|
+
const prevVal = parseInt(prev || "0");
|
|
1573
|
+
if (portalZ > prevVal) {
|
|
1574
|
+
el.style.setProperty("--rf-dialog-portal-z", String(portalZ));
|
|
1575
|
+
}
|
|
1576
|
+
return () => {
|
|
1577
|
+
el.style.setProperty("--rf-dialog-portal-z", prev || "");
|
|
1578
|
+
};
|
|
1579
|
+
}, [open, portalZ]);
|
|
1564
1580
|
if (!open && !TransitionComponent) return null;
|
|
1565
1581
|
const isButtonLoading = isSubmitting || loading;
|
|
1566
1582
|
const renderButtons = () => /* @__PURE__ */ React65.createElement(React65.Fragment, null, showCancelButton && /* @__PURE__ */ React65.createElement(
|
|
@@ -1629,6 +1645,14 @@ var BaseDialog = ({
|
|
|
1629
1645
|
},
|
|
1630
1646
|
dialogInner
|
|
1631
1647
|
) : /* @__PURE__ */ React65.createElement("div", { className: containerClass, style: containerStyle }, dialogInner);
|
|
1648
|
+
const overlayNode = (content) => /* @__PURE__ */ React65.createElement(
|
|
1649
|
+
"div",
|
|
1650
|
+
{
|
|
1651
|
+
className: `dialog-overlay ${size === "fullScreen" ? "overlay-fullscreen" : ""}`,
|
|
1652
|
+
style: { zIndex: overlayZ }
|
|
1653
|
+
},
|
|
1654
|
+
/* @__PURE__ */ React65.createElement(DialogDepthContext.Provider, { value: depth + 1 }, content)
|
|
1655
|
+
);
|
|
1632
1656
|
if (TransitionComponent) {
|
|
1633
1657
|
return import_react_dom.default.createPortal(
|
|
1634
1658
|
/* @__PURE__ */ React65.createElement(
|
|
@@ -1641,13 +1665,13 @@ var BaseDialog = ({
|
|
|
1641
1665
|
TransitionProps?.onExited?.();
|
|
1642
1666
|
}
|
|
1643
1667
|
},
|
|
1644
|
-
|
|
1668
|
+
overlayNode(dialogContent)
|
|
1645
1669
|
),
|
|
1646
1670
|
document.body
|
|
1647
1671
|
);
|
|
1648
1672
|
}
|
|
1649
1673
|
return import_react_dom.default.createPortal(
|
|
1650
|
-
|
|
1674
|
+
overlayNode(dialogContent),
|
|
1651
1675
|
document.body
|
|
1652
1676
|
);
|
|
1653
1677
|
};
|
package/dist/main.css
CHANGED
package/dist/main.js
CHANGED
|
@@ -1353,9 +1353,10 @@ IconButton.displayName = "IconButton";
|
|
|
1353
1353
|
|
|
1354
1354
|
// lib/Dialogs/BaseDialog.tsx
|
|
1355
1355
|
import * as React65 from "react";
|
|
1356
|
-
import { useState as useState2 } from "react";
|
|
1356
|
+
import { useState as useState2, useContext, useEffect as useEffect2 } from "react";
|
|
1357
1357
|
import ReactDOM from "react-dom";
|
|
1358
1358
|
import { X } from "lucide-react";
|
|
1359
|
+
var DialogDepthContext = React65.createContext(0);
|
|
1359
1360
|
var BaseDialog = ({
|
|
1360
1361
|
open = false,
|
|
1361
1362
|
onConfirm,
|
|
@@ -1389,6 +1390,21 @@ var BaseDialog = ({
|
|
|
1389
1390
|
const { themeConfig } = useRufousTheme();
|
|
1390
1391
|
const [isSubmitting, setIsSubmitting] = useState2(false);
|
|
1391
1392
|
const sxClass = useSx(sx);
|
|
1393
|
+
const depth = useContext(DialogDepthContext);
|
|
1394
|
+
const overlayZ = 2e3 + depth * 200;
|
|
1395
|
+
const portalZ = overlayZ + 100;
|
|
1396
|
+
useEffect2(() => {
|
|
1397
|
+
if (!open) return;
|
|
1398
|
+
const el = document.documentElement;
|
|
1399
|
+
const prev = el.style.getPropertyValue("--rf-dialog-portal-z");
|
|
1400
|
+
const prevVal = parseInt(prev || "0");
|
|
1401
|
+
if (portalZ > prevVal) {
|
|
1402
|
+
el.style.setProperty("--rf-dialog-portal-z", String(portalZ));
|
|
1403
|
+
}
|
|
1404
|
+
return () => {
|
|
1405
|
+
el.style.setProperty("--rf-dialog-portal-z", prev || "");
|
|
1406
|
+
};
|
|
1407
|
+
}, [open, portalZ]);
|
|
1392
1408
|
if (!open && !TransitionComponent) return null;
|
|
1393
1409
|
const isButtonLoading = isSubmitting || loading;
|
|
1394
1410
|
const renderButtons = () => /* @__PURE__ */ React65.createElement(React65.Fragment, null, showCancelButton && /* @__PURE__ */ React65.createElement(
|
|
@@ -1457,6 +1473,14 @@ var BaseDialog = ({
|
|
|
1457
1473
|
},
|
|
1458
1474
|
dialogInner
|
|
1459
1475
|
) : /* @__PURE__ */ React65.createElement("div", { className: containerClass, style: containerStyle }, dialogInner);
|
|
1476
|
+
const overlayNode = (content) => /* @__PURE__ */ React65.createElement(
|
|
1477
|
+
"div",
|
|
1478
|
+
{
|
|
1479
|
+
className: `dialog-overlay ${size === "fullScreen" ? "overlay-fullscreen" : ""}`,
|
|
1480
|
+
style: { zIndex: overlayZ }
|
|
1481
|
+
},
|
|
1482
|
+
/* @__PURE__ */ React65.createElement(DialogDepthContext.Provider, { value: depth + 1 }, content)
|
|
1483
|
+
);
|
|
1460
1484
|
if (TransitionComponent) {
|
|
1461
1485
|
return ReactDOM.createPortal(
|
|
1462
1486
|
/* @__PURE__ */ React65.createElement(
|
|
@@ -1469,13 +1493,13 @@ var BaseDialog = ({
|
|
|
1469
1493
|
TransitionProps?.onExited?.();
|
|
1470
1494
|
}
|
|
1471
1495
|
},
|
|
1472
|
-
|
|
1496
|
+
overlayNode(dialogContent)
|
|
1473
1497
|
),
|
|
1474
1498
|
document.body
|
|
1475
1499
|
);
|
|
1476
1500
|
}
|
|
1477
1501
|
return ReactDOM.createPortal(
|
|
1478
|
-
|
|
1502
|
+
overlayNode(dialogContent),
|
|
1479
1503
|
document.body
|
|
1480
1504
|
);
|
|
1481
1505
|
};
|
|
@@ -1483,13 +1507,13 @@ var BaseDialog_default = BaseDialog;
|
|
|
1483
1507
|
|
|
1484
1508
|
// lib/Contexts/rufousThemeProvider.tsx
|
|
1485
1509
|
import React66, {
|
|
1486
|
-
createContext,
|
|
1487
|
-
useContext,
|
|
1488
|
-
useEffect as
|
|
1510
|
+
createContext as createContext2,
|
|
1511
|
+
useContext as useContext2,
|
|
1512
|
+
useEffect as useEffect3,
|
|
1489
1513
|
useMemo,
|
|
1490
1514
|
useState as useState3
|
|
1491
1515
|
} from "react";
|
|
1492
|
-
var RufousThemeContext =
|
|
1516
|
+
var RufousThemeContext = createContext2(null);
|
|
1493
1517
|
var RufousThemeProvider = ({ children }) => {
|
|
1494
1518
|
const [committedThemeKey, setCommittedThemeKey] = useState3("default");
|
|
1495
1519
|
const [previewThemeKey, setPreviewThemeKey] = useState3("default");
|
|
@@ -1503,7 +1527,7 @@ var RufousThemeProvider = ({ children }) => {
|
|
|
1503
1527
|
console.error("Error fetching general settings:", err);
|
|
1504
1528
|
}
|
|
1505
1529
|
};
|
|
1506
|
-
|
|
1530
|
+
useEffect3(() => {
|
|
1507
1531
|
getGeneralSettings();
|
|
1508
1532
|
}, []);
|
|
1509
1533
|
const fullTheme = useMemo(() => {
|
|
@@ -1542,7 +1566,7 @@ var RufousThemeProvider = ({ children }) => {
|
|
|
1542
1566
|
)
|
|
1543
1567
|
);
|
|
1544
1568
|
};
|
|
1545
|
-
var useRufousTheme = () =>
|
|
1569
|
+
var useRufousTheme = () => useContext2(RufousThemeContext);
|
|
1546
1570
|
|
|
1547
1571
|
// lib/CheckBoxes/CheckBox.jsx
|
|
1548
1572
|
import React67 from "react";
|
|
@@ -1718,7 +1742,7 @@ var TextField = forwardRef3(({
|
|
|
1718
1742
|
TextField.displayName = "TextField";
|
|
1719
1743
|
|
|
1720
1744
|
// lib/TextFields/AddressLookup.tsx
|
|
1721
|
-
import React69, { useState as useState4, useRef as useRef3, useEffect as
|
|
1745
|
+
import React69, { useState as useState4, useRef as useRef3, useEffect as useEffect4 } from "react";
|
|
1722
1746
|
import Axios from "axios";
|
|
1723
1747
|
import { Country, State, City } from "country-state-city";
|
|
1724
1748
|
var AddressLookup = ({
|
|
@@ -1749,7 +1773,7 @@ var AddressLookup = ({
|
|
|
1749
1773
|
const countries = Country.getAllCountries();
|
|
1750
1774
|
const [states, setStates] = useState4([]);
|
|
1751
1775
|
const [cities, setCities] = useState4([]);
|
|
1752
|
-
|
|
1776
|
+
useEffect4(() => {
|
|
1753
1777
|
const handleClickOutside = (event) => {
|
|
1754
1778
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
1755
1779
|
setShowSuggestions(false);
|
|
@@ -1758,7 +1782,7 @@ var AddressLookup = ({
|
|
|
1758
1782
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1759
1783
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1760
1784
|
}, []);
|
|
1761
|
-
|
|
1785
|
+
useEffect4(() => {
|
|
1762
1786
|
if (value.country || value.state || value.city || value.pincode) {
|
|
1763
1787
|
setGoogleFields({
|
|
1764
1788
|
country: !!value.country,
|
|
@@ -1768,7 +1792,7 @@ var AddressLookup = ({
|
|
|
1768
1792
|
});
|
|
1769
1793
|
}
|
|
1770
1794
|
}, []);
|
|
1771
|
-
|
|
1795
|
+
useEffect4(() => {
|
|
1772
1796
|
if (value.country) {
|
|
1773
1797
|
const country = countries.find((c) => c.name === value.country);
|
|
1774
1798
|
if (country) {
|
|
@@ -1781,7 +1805,7 @@ var AddressLookup = ({
|
|
|
1781
1805
|
setStates([]);
|
|
1782
1806
|
}
|
|
1783
1807
|
}, [value.country]);
|
|
1784
|
-
|
|
1808
|
+
useEffect4(() => {
|
|
1785
1809
|
if (value.state && value.country) {
|
|
1786
1810
|
const country = countries.find((c) => c.name === value.country);
|
|
1787
1811
|
if (country) {
|
|
@@ -2018,7 +2042,7 @@ var AddressLookup_default = AddressLookup;
|
|
|
2018
2042
|
import React70, {
|
|
2019
2043
|
useState as useState5,
|
|
2020
2044
|
useRef as useRef4,
|
|
2021
|
-
useEffect as
|
|
2045
|
+
useEffect as useEffect5,
|
|
2022
2046
|
useCallback
|
|
2023
2047
|
} from "react";
|
|
2024
2048
|
import { createPortal } from "react-dom";
|
|
@@ -2179,13 +2203,13 @@ var ScrollColumn = ({ items, selected, onSelect, infinite = true }) => {
|
|
|
2179
2203
|
const virtualItems = infinite ? Array(MULTIPLIER).fill(items).flat() : items;
|
|
2180
2204
|
const centerOffset = infinite ? Math.floor(MULTIPLIER / 2) * items.length : 0;
|
|
2181
2205
|
const VISUAL_OFFSET = 54;
|
|
2182
|
-
|
|
2206
|
+
useEffect5(() => {
|
|
2183
2207
|
if (listRef.current) {
|
|
2184
2208
|
const targetIndex = centerOffset + selected;
|
|
2185
2209
|
listRef.current.scrollTop = targetIndex * ITEM_H - (infinite ? VISUAL_OFFSET : 0);
|
|
2186
2210
|
}
|
|
2187
2211
|
}, [centerOffset, infinite, selected]);
|
|
2188
|
-
|
|
2212
|
+
useEffect5(() => {
|
|
2189
2213
|
if (listRef.current && !isInternalScroll.current) {
|
|
2190
2214
|
const targetIndex = centerOffset + selected;
|
|
2191
2215
|
listRef.current.scrollTo({
|
|
@@ -2437,7 +2461,7 @@ var DateField = ({
|
|
|
2437
2461
|
const pickerRef = useRef4(null);
|
|
2438
2462
|
const [dropUp, setDropUp] = useState5(false);
|
|
2439
2463
|
const inputId = useRef4(`rf-df-${Math.random().toString(36).substring(2, 11)}`).current;
|
|
2440
|
-
|
|
2464
|
+
useEffect5(() => {
|
|
2441
2465
|
if (value === void 0) return;
|
|
2442
2466
|
if (!value) {
|
|
2443
2467
|
setSelectedDate(null);
|
|
@@ -2460,7 +2484,7 @@ var DateField = ({
|
|
|
2460
2484
|
setInputStr(str);
|
|
2461
2485
|
}
|
|
2462
2486
|
}, [value, type]);
|
|
2463
|
-
|
|
2487
|
+
useEffect5(() => {
|
|
2464
2488
|
if (!open) return;
|
|
2465
2489
|
const handler = (e) => {
|
|
2466
2490
|
const target = e.target;
|
|
@@ -2471,7 +2495,7 @@ var DateField = ({
|
|
|
2471
2495
|
document.addEventListener("mousedown", handler);
|
|
2472
2496
|
return () => document.removeEventListener("mousedown", handler);
|
|
2473
2497
|
}, [open]);
|
|
2474
|
-
|
|
2498
|
+
useEffect5(() => {
|
|
2475
2499
|
if (!open || !containerRef.current) return;
|
|
2476
2500
|
const rect = containerRef.current.getBoundingClientRect();
|
|
2477
2501
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
@@ -2766,7 +2790,7 @@ DateField.displayName = "DateField";
|
|
|
2766
2790
|
import React71, {
|
|
2767
2791
|
useState as useState6,
|
|
2768
2792
|
useRef as useRef5,
|
|
2769
|
-
useEffect as
|
|
2793
|
+
useEffect as useEffect6
|
|
2770
2794
|
} from "react";
|
|
2771
2795
|
var WEEKDAYS2 = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
2772
2796
|
var MONTHS2 = [
|
|
@@ -3062,7 +3086,7 @@ var DateRangeField = ({
|
|
|
3062
3086
|
const [leftViewMonth, setLeftViewMonth] = useState6(() => today2.getMonth());
|
|
3063
3087
|
const containerRef = useRef5(null);
|
|
3064
3088
|
const inputId = useRef5(`rf-dr-${Math.random().toString(36).substr(2, 9)}`).current;
|
|
3065
|
-
|
|
3089
|
+
useEffect6(() => {
|
|
3066
3090
|
const s2 = value?.start ? isoToDate2(value.start) : null;
|
|
3067
3091
|
const e = value?.end ? isoToDate2(value.end) : null;
|
|
3068
3092
|
setDraftStart(s2);
|
|
@@ -3071,10 +3095,10 @@ var DateRangeField = ({
|
|
|
3071
3095
|
setEndInputStr(e ? formatShort(e) : "");
|
|
3072
3096
|
setActivePreset(detectPreset(s2, e));
|
|
3073
3097
|
}, [value?.start, value?.end]);
|
|
3074
|
-
|
|
3098
|
+
useEffect6(() => {
|
|
3075
3099
|
setActivePreset(detectPreset(draftStart, draftEnd));
|
|
3076
3100
|
}, [draftStart?.getTime(), draftEnd?.getTime()]);
|
|
3077
|
-
|
|
3101
|
+
useEffect6(() => {
|
|
3078
3102
|
if (!open) return;
|
|
3079
3103
|
const handler = (e) => {
|
|
3080
3104
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3419,7 +3443,7 @@ DateRangeField.displayName = "DateRangeField";
|
|
|
3419
3443
|
import React72, {
|
|
3420
3444
|
useState as useState7,
|
|
3421
3445
|
useRef as useRef6,
|
|
3422
|
-
useEffect as
|
|
3446
|
+
useEffect as useEffect7,
|
|
3423
3447
|
useCallback as useCallback2
|
|
3424
3448
|
} from "react";
|
|
3425
3449
|
import ReactDOM2 from "react-dom";
|
|
@@ -3540,7 +3564,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
3540
3564
|
onInputChange?.("");
|
|
3541
3565
|
}
|
|
3542
3566
|
}, [freeSolo, multiple, value, onInputChange, onClose]);
|
|
3543
|
-
|
|
3567
|
+
useEffect7(() => {
|
|
3544
3568
|
if (!open) return;
|
|
3545
3569
|
const handleOutside = (e) => {
|
|
3546
3570
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3556,7 +3580,7 @@ function AutocompleteInner(props, _ref) {
|
|
|
3556
3580
|
window.removeEventListener("resize", calcPopupStyle);
|
|
3557
3581
|
};
|
|
3558
3582
|
}, [open, closePopup, calcPopupStyle]);
|
|
3559
|
-
|
|
3583
|
+
useEffect7(() => {
|
|
3560
3584
|
if (controlledInput !== void 0) return;
|
|
3561
3585
|
if (!multiple) {
|
|
3562
3586
|
const v = value;
|
|
@@ -3831,7 +3855,7 @@ var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
|
3831
3855
|
};
|
|
3832
3856
|
|
|
3833
3857
|
// lib/DataGrid/DataGrid.tsx
|
|
3834
|
-
import React74, { useState as useState8, useMemo as useMemo2, useRef as useRef8, useEffect as
|
|
3858
|
+
import React74, { useState as useState8, useMemo as useMemo2, useRef as useRef8, useEffect as useEffect8 } from "react";
|
|
3835
3859
|
import {
|
|
3836
3860
|
ChevronUp,
|
|
3837
3861
|
ChevronDown,
|
|
@@ -3947,7 +3971,7 @@ function DataGrid({
|
|
|
3947
3971
|
{ column: initialFilterCol, operator: getDefaultOperator(initialColumnsProp[0]?.type), value: "", logic: "AND" }
|
|
3948
3972
|
]);
|
|
3949
3973
|
const [colSearch, setColSearch] = useState8("");
|
|
3950
|
-
|
|
3974
|
+
useEffect8(() => {
|
|
3951
3975
|
const handleMouseMove = (e) => {
|
|
3952
3976
|
if (!resizingColumn) return;
|
|
3953
3977
|
const col = resolvedColumns.find((c) => String(c.field) === resizingColumn);
|
|
@@ -3967,7 +3991,7 @@ function DataGrid({
|
|
|
3967
3991
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
3968
3992
|
};
|
|
3969
3993
|
}, [resizingColumn, startX, startWidth, resolvedColumns]);
|
|
3970
|
-
|
|
3994
|
+
useEffect8(() => {
|
|
3971
3995
|
const handleClickOutside = (e) => {
|
|
3972
3996
|
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
3973
3997
|
setActiveMenu(null);
|
|
@@ -3976,7 +4000,7 @@ function DataGrid({
|
|
|
3976
4000
|
document.addEventListener("mousedown", handleClickOutside);
|
|
3977
4001
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3978
4002
|
}, []);
|
|
3979
|
-
|
|
4003
|
+
useEffect8(() => {
|
|
3980
4004
|
setColumnWidths((prev) => {
|
|
3981
4005
|
const next = { ...prev };
|
|
3982
4006
|
initialColumnsProp.forEach((col) => {
|
|
@@ -4490,7 +4514,7 @@ function DataGrid({
|
|
|
4490
4514
|
import React75, {
|
|
4491
4515
|
useState as useState9,
|
|
4492
4516
|
useRef as useRef9,
|
|
4493
|
-
useEffect as
|
|
4517
|
+
useEffect as useEffect9,
|
|
4494
4518
|
useCallback as useCallback3
|
|
4495
4519
|
} from "react";
|
|
4496
4520
|
import ReactDOM3 from "react-dom";
|
|
@@ -4557,7 +4581,7 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4557
4581
|
if (open) closePopup();
|
|
4558
4582
|
else openPopup();
|
|
4559
4583
|
}, [open, openPopup, closePopup]);
|
|
4560
|
-
|
|
4584
|
+
useEffect9(() => {
|
|
4561
4585
|
if (!open) return;
|
|
4562
4586
|
const handleOutside = (e) => {
|
|
4563
4587
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -4728,7 +4752,7 @@ Select.displayName = "Select";
|
|
|
4728
4752
|
import React76, {
|
|
4729
4753
|
useState as useState10,
|
|
4730
4754
|
useRef as useRef10,
|
|
4731
|
-
useEffect as
|
|
4755
|
+
useEffect as useEffect10,
|
|
4732
4756
|
useCallback as useCallback4
|
|
4733
4757
|
} from "react";
|
|
4734
4758
|
function clamp(val, min, max) {
|
|
@@ -4787,7 +4811,7 @@ var Slider = React76.forwardRef(function Slider2(props, ref) {
|
|
|
4787
4811
|
const raw = min + ratio * (max - min);
|
|
4788
4812
|
return clamp(snapToStep(raw, min, step), min, max);
|
|
4789
4813
|
}, [min, max, step, orientation]);
|
|
4790
|
-
|
|
4814
|
+
useEffect10(() => {
|
|
4791
4815
|
if (dragging === null) return;
|
|
4792
4816
|
const onMove = (e) => {
|
|
4793
4817
|
const newVal = getValueFromPointer(e);
|
|
@@ -4997,10 +5021,10 @@ var Switch = React77.forwardRef(function Switch2(props, ref) {
|
|
|
4997
5021
|
Switch.displayName = "Switch";
|
|
4998
5022
|
|
|
4999
5023
|
// lib/RadioGroup/RadioGroup.tsx
|
|
5000
|
-
import React78, { useRef as useRef12, createContext as
|
|
5001
|
-
var RadioGroupContext =
|
|
5024
|
+
import React78, { useRef as useRef12, createContext as createContext3, useContext as useContext3 } from "react";
|
|
5025
|
+
var RadioGroupContext = createContext3({});
|
|
5002
5026
|
var Radio = React78.forwardRef(function Radio2(props, ref) {
|
|
5003
|
-
const ctx =
|
|
5027
|
+
const ctx = useContext3(RadioGroupContext);
|
|
5004
5028
|
const {
|
|
5005
5029
|
value,
|
|
5006
5030
|
label,
|
|
@@ -5257,13 +5281,13 @@ Rating.displayName = "Rating";
|
|
|
5257
5281
|
|
|
5258
5282
|
// lib/ToggleButton/ToggleButton.tsx
|
|
5259
5283
|
import React80, {
|
|
5260
|
-
createContext as
|
|
5261
|
-
useContext as
|
|
5284
|
+
createContext as createContext4,
|
|
5285
|
+
useContext as useContext4
|
|
5262
5286
|
} from "react";
|
|
5263
|
-
var ToggleGroupContext =
|
|
5287
|
+
var ToggleGroupContext = createContext4({});
|
|
5264
5288
|
var ToggleButton = React80.forwardRef(
|
|
5265
5289
|
function ToggleButton2(props, ref) {
|
|
5266
|
-
const ctx =
|
|
5290
|
+
const ctx = useContext4(ToggleGroupContext);
|
|
5267
5291
|
const { value, children, disabled: disabledProp, selected: selectedProp, sx } = props;
|
|
5268
5292
|
const sxClass = useSx(sx);
|
|
5269
5293
|
let isSelected = false;
|
|
@@ -5889,7 +5913,7 @@ Skeleton.displayName = "Skeleton";
|
|
|
5889
5913
|
// lib/Tooltip/Tooltip.tsx
|
|
5890
5914
|
import React87, {
|
|
5891
5915
|
useCallback as useCallback5,
|
|
5892
|
-
useEffect as
|
|
5916
|
+
useEffect as useEffect11,
|
|
5893
5917
|
useRef as useRef14,
|
|
5894
5918
|
useState as useState13
|
|
5895
5919
|
} from "react";
|
|
@@ -6022,7 +6046,7 @@ var Tooltip = ({
|
|
|
6022
6046
|
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
6023
6047
|
}
|
|
6024
6048
|
}, [placement, followCursor]);
|
|
6025
|
-
|
|
6049
|
+
useEffect11(() => {
|
|
6026
6050
|
if (isOpen) {
|
|
6027
6051
|
requestAnimationFrame(() => {
|
|
6028
6052
|
updatePosition();
|
|
@@ -6058,7 +6082,7 @@ var Tooltip = ({
|
|
|
6058
6082
|
},
|
|
6059
6083
|
[isOpen, followCursor, updatePosition]
|
|
6060
6084
|
);
|
|
6061
|
-
|
|
6085
|
+
useEffect11(() => {
|
|
6062
6086
|
return () => clearTimers();
|
|
6063
6087
|
}, [clearTimers]);
|
|
6064
6088
|
const childProps = {};
|
|
@@ -6448,8 +6472,8 @@ CardActions.displayName = "CardActions";
|
|
|
6448
6472
|
|
|
6449
6473
|
// lib/Accordion/Accordion.tsx
|
|
6450
6474
|
import * as React93 from "react";
|
|
6451
|
-
import { useState as useState14, useContext as
|
|
6452
|
-
var AccordionContext =
|
|
6475
|
+
import { useState as useState14, useContext as useContext5, createContext as createContext5 } from "react";
|
|
6476
|
+
var AccordionContext = createContext5({
|
|
6453
6477
|
expanded: false,
|
|
6454
6478
|
disabled: false,
|
|
6455
6479
|
toggle: () => {
|
|
@@ -6513,7 +6537,7 @@ var ChevronIcon = () => /* @__PURE__ */ React93.createElement(
|
|
|
6513
6537
|
var AccordionSummary = React93.forwardRef(
|
|
6514
6538
|
({ expandIcon, children, sx, className, style, ...rest }, ref) => {
|
|
6515
6539
|
const sxClass = useSx(sx);
|
|
6516
|
-
const { expanded, toggle, disabled } =
|
|
6540
|
+
const { expanded, toggle, disabled } = useContext5(AccordionContext);
|
|
6517
6541
|
const classes = [
|
|
6518
6542
|
"rf-accordion-summary",
|
|
6519
6543
|
expanded ? "rf-accordion-summary-expanded" : "",
|
|
@@ -6545,7 +6569,7 @@ AccordionSummary.displayName = "AccordionSummary";
|
|
|
6545
6569
|
var AccordionDetails = React93.forwardRef(
|
|
6546
6570
|
({ children, sx, className, style, ...rest }, ref) => {
|
|
6547
6571
|
const sxClass = useSx(sx);
|
|
6548
|
-
const { expanded } =
|
|
6572
|
+
const { expanded } = useContext5(AccordionContext);
|
|
6549
6573
|
const wrapperClasses = [
|
|
6550
6574
|
"rf-accordion-details-wrapper",
|
|
6551
6575
|
expanded ? "rf-accordion-details-wrapper-open" : ""
|
|
@@ -6562,7 +6586,7 @@ AccordionDetails.displayName = "AccordionDetails";
|
|
|
6562
6586
|
|
|
6563
6587
|
// lib/Tabs/Tabs.tsx
|
|
6564
6588
|
import React94, {
|
|
6565
|
-
useEffect as
|
|
6589
|
+
useEffect as useEffect12,
|
|
6566
6590
|
useLayoutEffect,
|
|
6567
6591
|
useRef as useRef15,
|
|
6568
6592
|
useState as useState15,
|
|
@@ -6655,7 +6679,7 @@ var Tabs = ({
|
|
|
6655
6679
|
useLayoutEffect(() => {
|
|
6656
6680
|
updateIndicator();
|
|
6657
6681
|
}, [value, orientation]);
|
|
6658
|
-
|
|
6682
|
+
useEffect12(() => {
|
|
6659
6683
|
const observer = new ResizeObserver(() => {
|
|
6660
6684
|
updateIndicator();
|
|
6661
6685
|
});
|
|
@@ -7014,7 +7038,7 @@ Stepper.displayName = "Stepper";
|
|
|
7014
7038
|
|
|
7015
7039
|
// lib/Menu/Menu.tsx
|
|
7016
7040
|
import React97, {
|
|
7017
|
-
useEffect as
|
|
7041
|
+
useEffect as useEffect13,
|
|
7018
7042
|
useRef as useRef16,
|
|
7019
7043
|
useState as useState17
|
|
7020
7044
|
} from "react";
|
|
@@ -7111,12 +7135,12 @@ var Menu = ({
|
|
|
7111
7135
|
const paperRef = useRef16(null);
|
|
7112
7136
|
const [menuStyle, setMenuStyle] = useState17({});
|
|
7113
7137
|
const [mounted, setMounted] = useState17(false);
|
|
7114
|
-
|
|
7138
|
+
useEffect13(() => {
|
|
7115
7139
|
if (open) {
|
|
7116
7140
|
setMounted(true);
|
|
7117
7141
|
}
|
|
7118
7142
|
}, [open]);
|
|
7119
|
-
|
|
7143
|
+
useEffect13(() => {
|
|
7120
7144
|
if (!open || !anchorEl || !paperRef.current) return;
|
|
7121
7145
|
const computePosition3 = () => {
|
|
7122
7146
|
if (!anchorEl || !paperRef.current) return;
|
|
@@ -7142,7 +7166,7 @@ var Menu = ({
|
|
|
7142
7166
|
};
|
|
7143
7167
|
requestAnimationFrame(computePosition3);
|
|
7144
7168
|
}, [open, mounted, anchorEl, anchorOrigin, transformOrigin]);
|
|
7145
|
-
|
|
7169
|
+
useEffect13(() => {
|
|
7146
7170
|
if (!open) return;
|
|
7147
7171
|
const handleKeyDown = (e) => {
|
|
7148
7172
|
if (e.key === "Escape") {
|
|
@@ -7177,7 +7201,7 @@ Menu.displayName = "Menu";
|
|
|
7177
7201
|
|
|
7178
7202
|
// lib/Drawer/Drawer.tsx
|
|
7179
7203
|
import React98, {
|
|
7180
|
-
useEffect as
|
|
7204
|
+
useEffect as useEffect14,
|
|
7181
7205
|
useState as useState18
|
|
7182
7206
|
} from "react";
|
|
7183
7207
|
import ReactDOM6 from "react-dom";
|
|
@@ -7197,7 +7221,7 @@ var Drawer = ({
|
|
|
7197
7221
|
const sxClass = useSx(sx);
|
|
7198
7222
|
const paperSxClass = useSx(PaperProps?.sx);
|
|
7199
7223
|
const [mounted, setMounted] = useState18(open || variant === "permanent" || keepMounted);
|
|
7200
|
-
|
|
7224
|
+
useEffect14(() => {
|
|
7201
7225
|
if (open || variant === "permanent") {
|
|
7202
7226
|
setMounted(true);
|
|
7203
7227
|
} else if (!keepMounted) {
|
|
@@ -7205,7 +7229,7 @@ var Drawer = ({
|
|
|
7205
7229
|
return () => clearTimeout(t);
|
|
7206
7230
|
}
|
|
7207
7231
|
}, [open, variant, keepMounted]);
|
|
7208
|
-
|
|
7232
|
+
useEffect14(() => {
|
|
7209
7233
|
if (!open || variant === "permanent") return;
|
|
7210
7234
|
const handleKeyDown = (e) => {
|
|
7211
7235
|
if (e.key === "Escape") onClose?.();
|
|
@@ -7213,7 +7237,7 @@ var Drawer = ({
|
|
|
7213
7237
|
document.addEventListener("keydown", handleKeyDown);
|
|
7214
7238
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
7215
7239
|
}, [open, variant, onClose]);
|
|
7216
|
-
|
|
7240
|
+
useEffect14(() => {
|
|
7217
7241
|
if (variant !== "temporary") return;
|
|
7218
7242
|
if (open) {
|
|
7219
7243
|
const prev = document.body.style.overflow;
|
|
@@ -7290,7 +7314,7 @@ Drawer.displayName = "Drawer";
|
|
|
7290
7314
|
// lib/Snackbar/Snackbar.tsx
|
|
7291
7315
|
import React99, {
|
|
7292
7316
|
useCallback as useCallback6,
|
|
7293
|
-
useEffect as
|
|
7317
|
+
useEffect as useEffect15,
|
|
7294
7318
|
useRef as useRef17,
|
|
7295
7319
|
useState as useState19
|
|
7296
7320
|
} from "react";
|
|
@@ -7331,7 +7355,7 @@ var Snackbar = ({
|
|
|
7331
7355
|
onClose("timeout");
|
|
7332
7356
|
}, autoHideDuration);
|
|
7333
7357
|
}, [autoHideDuration, onClose, clearTimers]);
|
|
7334
|
-
|
|
7358
|
+
useEffect15(() => {
|
|
7335
7359
|
if (open) {
|
|
7336
7360
|
setMounted(true);
|
|
7337
7361
|
setTransitionState("entering");
|
|
@@ -7347,7 +7371,7 @@ var Snackbar = ({
|
|
|
7347
7371
|
}
|
|
7348
7372
|
return clearTimers;
|
|
7349
7373
|
}, [open, startHideTimer, clearTimers]);
|
|
7350
|
-
|
|
7374
|
+
useEffect15(() => {
|
|
7351
7375
|
if (!open) return;
|
|
7352
7376
|
const handleKeyDown = (e) => {
|
|
7353
7377
|
if (e.key === "Escape") onClose?.("escapeKeyDown");
|
|
@@ -7453,7 +7477,7 @@ Link.displayName = "Link";
|
|
|
7453
7477
|
|
|
7454
7478
|
// lib/Popper/Popper.tsx
|
|
7455
7479
|
import React101, {
|
|
7456
|
-
useEffect as
|
|
7480
|
+
useEffect as useEffect16,
|
|
7457
7481
|
useLayoutEffect as useLayoutEffect2,
|
|
7458
7482
|
useRef as useRef18,
|
|
7459
7483
|
useState as useState20
|
|
@@ -7542,7 +7566,7 @@ var Popper = ({
|
|
|
7542
7566
|
const [fadeState, setFadeState] = useState20(
|
|
7543
7567
|
open ? "entered" : "exited"
|
|
7544
7568
|
);
|
|
7545
|
-
|
|
7569
|
+
useEffect16(() => {
|
|
7546
7570
|
if (open) {
|
|
7547
7571
|
setMounted(true);
|
|
7548
7572
|
setFadeState("entering");
|
|
@@ -7607,7 +7631,7 @@ Popper.displayName = "Popper";
|
|
|
7607
7631
|
|
|
7608
7632
|
// lib/Popover/Popover.tsx
|
|
7609
7633
|
import React102, {
|
|
7610
|
-
useEffect as
|
|
7634
|
+
useEffect as useEffect17,
|
|
7611
7635
|
useLayoutEffect as useLayoutEffect3,
|
|
7612
7636
|
useRef as useRef19,
|
|
7613
7637
|
useState as useState21
|
|
@@ -7642,7 +7666,7 @@ var Popover = ({
|
|
|
7642
7666
|
const paperRef = useRef19(null);
|
|
7643
7667
|
const [posStyle, setPosStyle] = useState21({});
|
|
7644
7668
|
const [mounted, setMounted] = useState21(open || keepMounted);
|
|
7645
|
-
|
|
7669
|
+
useEffect17(() => {
|
|
7646
7670
|
if (open) {
|
|
7647
7671
|
setMounted(true);
|
|
7648
7672
|
} else if (!keepMounted) {
|
|
@@ -7674,7 +7698,7 @@ var Popover = ({
|
|
|
7674
7698
|
window.removeEventListener("resize", compute);
|
|
7675
7699
|
};
|
|
7676
7700
|
}, [open, anchorEl, anchorOrigin, transformOrigin, mounted]);
|
|
7677
|
-
|
|
7701
|
+
useEffect17(() => {
|
|
7678
7702
|
if (!open) return;
|
|
7679
7703
|
const handleKeyDown = (e) => {
|
|
7680
7704
|
if (e.key === "Escape") onClose?.();
|
|
@@ -7725,7 +7749,7 @@ Popover.displayName = "Popover";
|
|
|
7725
7749
|
// lib/Transitions/Transitions.tsx
|
|
7726
7750
|
import React103, {
|
|
7727
7751
|
cloneElement as cloneElement3,
|
|
7728
|
-
useEffect as
|
|
7752
|
+
useEffect as useEffect18,
|
|
7729
7753
|
useRef as useRef20,
|
|
7730
7754
|
useState as useState22
|
|
7731
7755
|
} from "react";
|
|
@@ -7739,7 +7763,7 @@ function useTransitionState(inProp, timeout, onEnter, onExited) {
|
|
|
7739
7763
|
const [mounted, setMounted] = useState22(false);
|
|
7740
7764
|
const timerRef = useRef20(null);
|
|
7741
7765
|
const isFirstRender = useRef20(true);
|
|
7742
|
-
|
|
7766
|
+
useEffect18(() => {
|
|
7743
7767
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
7744
7768
|
if (inProp) {
|
|
7745
7769
|
setMounted(true);
|
|
@@ -7886,7 +7910,7 @@ var Collapse = ({
|
|
|
7886
7910
|
const [size, setSize] = useState22(
|
|
7887
7911
|
inProp ? "auto" : collapsedSize
|
|
7888
7912
|
);
|
|
7889
|
-
|
|
7913
|
+
useEffect18(() => {
|
|
7890
7914
|
if (!innerRef.current) return;
|
|
7891
7915
|
const natural = orientation === "vertical" ? innerRef.current.scrollHeight : innerRef.current.scrollWidth;
|
|
7892
7916
|
if (inProp) {
|
|
@@ -8072,7 +8096,7 @@ ImageField.displayName = "ImageField";
|
|
|
8072
8096
|
import React105, {
|
|
8073
8097
|
useState as useState24,
|
|
8074
8098
|
useRef as useRef22,
|
|
8075
|
-
useEffect as
|
|
8099
|
+
useEffect as useEffect19,
|
|
8076
8100
|
useCallback as useCallback8,
|
|
8077
8101
|
forwardRef as forwardRef10
|
|
8078
8102
|
} from "react";
|
|
@@ -8148,7 +8172,7 @@ var PhoneField = forwardRef10(function PhoneField2(props, ref) {
|
|
|
8148
8172
|
const [focusedIdx, setFocusedIdx] = useState24(-1);
|
|
8149
8173
|
const [search, setSearch] = useState24("");
|
|
8150
8174
|
const prevValueRef = useRef22(value);
|
|
8151
|
-
|
|
8175
|
+
useEffect19(() => {
|
|
8152
8176
|
if (value === prevValueRef.current) return;
|
|
8153
8177
|
prevValueRef.current = value;
|
|
8154
8178
|
const digits2 = sanitizeValue(value);
|
|
@@ -8172,7 +8196,7 @@ var PhoneField = forwardRef10(function PhoneField2(props, ref) {
|
|
|
8172
8196
|
setFocusedIdx(-1);
|
|
8173
8197
|
setSearch("");
|
|
8174
8198
|
}, []);
|
|
8175
|
-
|
|
8199
|
+
useEffect19(() => {
|
|
8176
8200
|
if (!open) return;
|
|
8177
8201
|
const handler = (e) => {
|
|
8178
8202
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -8182,7 +8206,7 @@ var PhoneField = forwardRef10(function PhoneField2(props, ref) {
|
|
|
8182
8206
|
document.addEventListener("mousedown", handler);
|
|
8183
8207
|
return () => document.removeEventListener("mousedown", handler);
|
|
8184
8208
|
}, [open, closeDropdown]);
|
|
8185
|
-
|
|
8209
|
+
useEffect19(() => {
|
|
8186
8210
|
if (!open || !containerRef.current || !popupRef.current) return;
|
|
8187
8211
|
const reference = containerRef.current;
|
|
8188
8212
|
const floating = popupRef.current;
|
|
@@ -8376,7 +8400,7 @@ var PhoneField = forwardRef10(function PhoneField2(props, ref) {
|
|
|
8376
8400
|
PhoneField.displayName = "PhoneField";
|
|
8377
8401
|
|
|
8378
8402
|
// lib/RufousTextEditor/RufousTextEditor.tsx
|
|
8379
|
-
import React116, { useMemo as useMemo4, useCallback as useCallback13, useState as useState34, useRef as useRef30, useEffect as
|
|
8403
|
+
import React116, { useMemo as useMemo4, useCallback as useCallback13, useState as useState34, useRef as useRef30, useEffect as useEffect28 } from "react";
|
|
8380
8404
|
import { createPortal as createPortal8 } from "react-dom";
|
|
8381
8405
|
import { useEditor, EditorContent, EditorContext, FloatingMenu, BubbleMenu } from "@tiptap/react";
|
|
8382
8406
|
import StarterKit from "@tiptap/starter-kit";
|
|
@@ -8402,7 +8426,7 @@ import { ReactRenderer } from "@tiptap/react";
|
|
|
8402
8426
|
import tippy from "tippy.js";
|
|
8403
8427
|
|
|
8404
8428
|
// lib/RufousTextEditor/MentionList.tsx
|
|
8405
|
-
import React106, { forwardRef as forwardRef11, useEffect as
|
|
8429
|
+
import React106, { forwardRef as forwardRef11, useEffect as useEffect20, useImperativeHandle, useState as useState25 } from "react";
|
|
8406
8430
|
var MentionList = forwardRef11((props, ref) => {
|
|
8407
8431
|
const [selectedIndex, setSelectedIndex] = useState25(0);
|
|
8408
8432
|
const selectItem = (index) => {
|
|
@@ -8411,7 +8435,7 @@ var MentionList = forwardRef11((props, ref) => {
|
|
|
8411
8435
|
props.command({ id: item.id, label: item.shortName || item.name });
|
|
8412
8436
|
}
|
|
8413
8437
|
};
|
|
8414
|
-
|
|
8438
|
+
useEffect20(() => setSelectedIndex(0), [props.items]);
|
|
8415
8439
|
useImperativeHandle(ref, () => ({
|
|
8416
8440
|
onKeyDown: ({ event }) => {
|
|
8417
8441
|
if (event.key === "ArrowUp") {
|
|
@@ -8498,11 +8522,11 @@ function createMentionSuggestion(users) {
|
|
|
8498
8522
|
}
|
|
8499
8523
|
|
|
8500
8524
|
// lib/RufousTextEditor/Toolbar.tsx
|
|
8501
|
-
import React112, { useState as useState30, useRef as useRef26, useEffect as
|
|
8525
|
+
import React112, { useState as useState30, useRef as useRef26, useEffect as useEffect24, useCallback as useCallback12 } from "react";
|
|
8502
8526
|
import { createPortal as createPortal4 } from "react-dom";
|
|
8503
8527
|
|
|
8504
8528
|
// lib/RufousTextEditor/TextToSpeech.tsx
|
|
8505
|
-
import React107, { useState as useState26, useEffect as
|
|
8529
|
+
import React107, { useState as useState26, useEffect as useEffect21, useRef as useRef23, useCallback as useCallback9, forwardRef as forwardRef12, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
8506
8530
|
var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
8507
8531
|
const [speaking, setSpeaking] = useState26(false);
|
|
8508
8532
|
const [paused, setPaused] = useState26(false);
|
|
@@ -8512,7 +8536,7 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
|
8512
8536
|
const [showPanel, setShowPanel] = useState26(false);
|
|
8513
8537
|
const utteranceRef = useRef23(null);
|
|
8514
8538
|
const panelRef = useRef23(null);
|
|
8515
|
-
|
|
8539
|
+
useEffect21(() => {
|
|
8516
8540
|
const synth = window.speechSynthesis;
|
|
8517
8541
|
const loadVoices = () => {
|
|
8518
8542
|
const available = synth.getVoices();
|
|
@@ -8530,7 +8554,7 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
|
8530
8554
|
synth.removeEventListener("voiceschanged", loadVoices);
|
|
8531
8555
|
};
|
|
8532
8556
|
}, [selectedVoice]);
|
|
8533
|
-
|
|
8557
|
+
useEffect21(() => {
|
|
8534
8558
|
const handleClick = (e) => {
|
|
8535
8559
|
if (panelRef.current && !panelRef.current.contains(e.target)) {
|
|
8536
8560
|
setShowPanel(false);
|
|
@@ -8648,7 +8672,7 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
|
8648
8672
|
var TextToSpeech_default = TextToSpeech;
|
|
8649
8673
|
|
|
8650
8674
|
// lib/RufousTextEditor/SpeechToText.tsx
|
|
8651
|
-
import React108, { useState as useState27, useRef as useRef24, useCallback as useCallback10, useEffect as
|
|
8675
|
+
import React108, { useState as useState27, useRef as useRef24, useCallback as useCallback10, useEffect as useEffect22, forwardRef as forwardRef13, useImperativeHandle as useImperativeHandle3 } from "react";
|
|
8652
8676
|
var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
8653
8677
|
const [listening, setListening] = useState27(false);
|
|
8654
8678
|
const [showPanel, setShowPanel] = useState27(false);
|
|
@@ -8659,7 +8683,7 @@ var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
|
8659
8683
|
const isListeningRef = useRef24(false);
|
|
8660
8684
|
const SpeechRecognitionAPI = typeof window !== "undefined" ? window.SpeechRecognition || window.webkitSpeechRecognition : null;
|
|
8661
8685
|
const supported = !!SpeechRecognitionAPI;
|
|
8662
|
-
|
|
8686
|
+
useEffect22(() => {
|
|
8663
8687
|
const handleClick = (e) => {
|
|
8664
8688
|
if (panelRef.current && !panelRef.current.contains(e.target)) {
|
|
8665
8689
|
setShowPanel(false);
|
|
@@ -8811,7 +8835,7 @@ var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
|
8811
8835
|
var SpeechToText_default = SpeechToText;
|
|
8812
8836
|
|
|
8813
8837
|
// lib/RufousTextEditor/AICommands.tsx
|
|
8814
|
-
import React109, { useState as useState28, useRef as useRef25, useEffect as
|
|
8838
|
+
import React109, { useState as useState28, useRef as useRef25, useEffect as useEffect23, useCallback as useCallback11 } from "react";
|
|
8815
8839
|
import { createPortal as createPortal2 } from "react-dom";
|
|
8816
8840
|
var AI_COMMANDS = [
|
|
8817
8841
|
{ id: "improve", label: "Improve writing", prompt: "Improve the following text to make it clearer, more engaging, and well-structured. Return only the improved text, no explanations." },
|
|
@@ -8868,7 +8892,7 @@ var AICommands = ({ editor, onAICommand }) => {
|
|
|
8868
8892
|
const [selectionRange, setSelectionRange] = useState28(null);
|
|
8869
8893
|
const [previousResults, setPreviousResults] = useState28([]);
|
|
8870
8894
|
const panelRef = useRef25(null);
|
|
8871
|
-
|
|
8895
|
+
useEffect23(() => {
|
|
8872
8896
|
const handleClick = (e) => {
|
|
8873
8897
|
if (panelRef.current && !panelRef.current.contains(e.target)) {
|
|
8874
8898
|
setOpen(false);
|
|
@@ -10071,7 +10095,7 @@ var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
|
|
|
10071
10095
|
const [open, setOpen] = useState30(false);
|
|
10072
10096
|
const ref = useRef26(null);
|
|
10073
10097
|
const menuRef = useRef26(null);
|
|
10074
|
-
|
|
10098
|
+
useEffect24(() => {
|
|
10075
10099
|
const handleClick = (e) => {
|
|
10076
10100
|
const target = e.target;
|
|
10077
10101
|
const inTrigger = ref.current?.contains(target);
|
|
@@ -10083,7 +10107,7 @@ var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
|
|
|
10083
10107
|
document.addEventListener("mousedown", handleClick);
|
|
10084
10108
|
return () => document.removeEventListener("mousedown", handleClick);
|
|
10085
10109
|
}, []);
|
|
10086
|
-
|
|
10110
|
+
useEffect24(() => {
|
|
10087
10111
|
if (!open || !menuRef.current || !ref.current) return;
|
|
10088
10112
|
const menu = menuRef.current;
|
|
10089
10113
|
const trigger2 = ref.current;
|
|
@@ -10384,7 +10408,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10384
10408
|
const ttsRef = useRef26(null);
|
|
10385
10409
|
const sttRef = useRef26(null);
|
|
10386
10410
|
const show = (id) => !visibleButtons || visibleButtons.has(id);
|
|
10387
|
-
|
|
10411
|
+
useEffect24(() => {
|
|
10388
10412
|
if (!editor) return;
|
|
10389
10413
|
const onTransaction = () => setEditorState((n) => n + 1);
|
|
10390
10414
|
editor.on("transaction", onTransaction);
|
|
@@ -11023,7 +11047,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
11023
11047
|
var Toolbar_default = Toolbar;
|
|
11024
11048
|
|
|
11025
11049
|
// lib/RufousTextEditor/ImageToolbar.tsx
|
|
11026
|
-
import React113, { useState as useState31, useEffect as
|
|
11050
|
+
import React113, { useState as useState31, useEffect as useEffect25, useRef as useRef27 } from "react";
|
|
11027
11051
|
import { createPortal as createPortal5 } from "react-dom";
|
|
11028
11052
|
var ALIGNMENTS = [
|
|
11029
11053
|
{ value: "left", label: "Left", icon: "\u2630" },
|
|
@@ -11042,7 +11066,7 @@ var ImagePropertiesModal = ({ editor, node, onClose }) => {
|
|
|
11042
11066
|
const [lockRatio, setLockRatio] = useState31(true);
|
|
11043
11067
|
const [naturalWidth, setNaturalWidth] = useState31(0);
|
|
11044
11068
|
const [naturalHeight, setNaturalHeight] = useState31(0);
|
|
11045
|
-
|
|
11069
|
+
useEffect25(() => {
|
|
11046
11070
|
if (src) {
|
|
11047
11071
|
const img = new window.Image();
|
|
11048
11072
|
img.onload = () => {
|
|
@@ -11167,7 +11191,7 @@ var ImageToolbar = ({ editor }) => {
|
|
|
11167
11191
|
const [copyStatus, setCopyStatus] = useState31("");
|
|
11168
11192
|
const [pos, setPos] = useState31(null);
|
|
11169
11193
|
const toolbarRef = useRef27(null);
|
|
11170
|
-
|
|
11194
|
+
useEffect25(() => {
|
|
11171
11195
|
if (!editor) return;
|
|
11172
11196
|
const update = () => {
|
|
11173
11197
|
const { selection } = editor.state;
|
|
@@ -11303,7 +11327,7 @@ var ImageToolbar = ({ editor }) => {
|
|
|
11303
11327
|
var ImageToolbar_default = ImageToolbar;
|
|
11304
11328
|
|
|
11305
11329
|
// lib/RufousTextEditor/VideoToolbar.tsx
|
|
11306
|
-
import React114, { useState as useState32, useEffect as
|
|
11330
|
+
import React114, { useState as useState32, useEffect as useEffect26, useRef as useRef28 } from "react";
|
|
11307
11331
|
import { createPortal as createPortal6 } from "react-dom";
|
|
11308
11332
|
var ALIGNMENTS2 = [
|
|
11309
11333
|
{ value: "left", label: "Left", icon: "\u2630" },
|
|
@@ -11420,7 +11444,7 @@ var VideoToolbar = ({ editor }) => {
|
|
|
11420
11444
|
const [copyStatus, setCopyStatus] = useState32("");
|
|
11421
11445
|
const [pos, setPos] = useState32(null);
|
|
11422
11446
|
const toolbarRef = useRef28(null);
|
|
11423
|
-
|
|
11447
|
+
useEffect26(() => {
|
|
11424
11448
|
if (!editor) return;
|
|
11425
11449
|
const update = () => {
|
|
11426
11450
|
const { selection } = editor.state;
|
|
@@ -11544,7 +11568,7 @@ var VideoToolbar = ({ editor }) => {
|
|
|
11544
11568
|
var VideoToolbar_default = VideoToolbar;
|
|
11545
11569
|
|
|
11546
11570
|
// lib/RufousTextEditor/TableToolbar.tsx
|
|
11547
|
-
import React115, { useState as useState33, useEffect as
|
|
11571
|
+
import React115, { useState as useState33, useEffect as useEffect27, useRef as useRef29 } from "react";
|
|
11548
11572
|
import { createPortal as createPortal7 } from "react-dom";
|
|
11549
11573
|
var IconAddRowBefore = () => /* @__PURE__ */ React115.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React115.createElement("path", { d: "M20 3H4c-.55 0-1 .45-1 1v16c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zm-1 8H5V5h14v6zm0 8H5v-6h14v6z" }), /* @__PURE__ */ React115.createElement("path", { d: "M9 6h2v1.5h1.5v2H11V11H9V9.5H7.5v-2H9z" }));
|
|
11550
11574
|
var IconAddRowAfter = () => /* @__PURE__ */ React115.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React115.createElement("path", { d: "M20 3H4c-.55 0-1 .45-1 1v16c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zm-1 8H5V5h14v6zm0 8H5v-6h14v6z" }), /* @__PURE__ */ React115.createElement("path", { d: "M9 14h2v1.5h1.5v2H11V19H9v-1.5H7.5v-2H9z" }));
|
|
@@ -11559,7 +11583,7 @@ var IconToggleHeader = () => /* @__PURE__ */ React115.createElement("svg", { wid
|
|
|
11559
11583
|
var TableToolbar = ({ editor }) => {
|
|
11560
11584
|
const [pos, setPos] = useState33(null);
|
|
11561
11585
|
const toolbarRef = useRef29(null);
|
|
11562
|
-
|
|
11586
|
+
useEffect27(() => {
|
|
11563
11587
|
if (!editor) return;
|
|
11564
11588
|
const update = () => {
|
|
11565
11589
|
if (!editor.isActive("table")) {
|
|
@@ -11882,10 +11906,10 @@ var RufousTextEditor = ({
|
|
|
11882
11906
|
const mentionSuggestion = useMemo4(() => createMentionSuggestion(mentions), [mentions]);
|
|
11883
11907
|
const onChangeRef = useRef30(onChange);
|
|
11884
11908
|
const onBlurRef = useRef30(onBlur);
|
|
11885
|
-
|
|
11909
|
+
useEffect28(() => {
|
|
11886
11910
|
onChangeRef.current = onChange;
|
|
11887
11911
|
}, [onChange]);
|
|
11888
|
-
|
|
11912
|
+
useEffect28(() => {
|
|
11889
11913
|
onBlurRef.current = onBlur;
|
|
11890
11914
|
}, [onBlur]);
|
|
11891
11915
|
const isEditable = editable && !disabled;
|
|
@@ -11987,7 +12011,7 @@ var RufousTextEditor = ({
|
|
|
11987
12011
|
}
|
|
11988
12012
|
});
|
|
11989
12013
|
const wrapperRef = useRef30(null);
|
|
11990
|
-
|
|
12014
|
+
useEffect28(() => {
|
|
11991
12015
|
if (!editor) return;
|
|
11992
12016
|
let blurTimer = null;
|
|
11993
12017
|
const handler = ({ event }) => {
|
|
@@ -12050,10 +12074,10 @@ var RufousTextEditor = ({
|
|
|
12050
12074
|
setLinkSelection({ from, to });
|
|
12051
12075
|
setLinkModalOpen(true);
|
|
12052
12076
|
}, [editor]);
|
|
12053
|
-
|
|
12077
|
+
useEffect28(() => {
|
|
12054
12078
|
setLinkRef.current = setLink;
|
|
12055
12079
|
}, [setLink]);
|
|
12056
|
-
|
|
12080
|
+
useEffect28(() => {
|
|
12057
12081
|
if (!editor?.view) return;
|
|
12058
12082
|
const handleKeyDown = (event) => {
|
|
12059
12083
|
if ((event.ctrlKey || event.metaKey) && event.key === "k") {
|