@rufous/ui 0.3.22 → 0.3.23
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 +22 -12
- package/dist/main.js +114 -104
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -9612,6 +9612,14 @@ function SmartSelect({
|
|
|
9612
9612
|
(0, import_react51.useEffect)(() => () => {
|
|
9613
9613
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
9614
9614
|
}, []);
|
|
9615
|
+
const [inputValue, setInputValue] = (0, import_react51.useState)(
|
|
9616
|
+
() => !multiple && value != null ? getOptionLabel(value) : ""
|
|
9617
|
+
);
|
|
9618
|
+
(0, import_react51.useEffect)(() => {
|
|
9619
|
+
if (!multiple) {
|
|
9620
|
+
setInputValue(value != null ? getOptionLabel(value) : "");
|
|
9621
|
+
}
|
|
9622
|
+
}, [value, multiple, getOptionLabel]);
|
|
9615
9623
|
const getValue = (0, import_react51.useCallback)(
|
|
9616
9624
|
(o) => getOptionValue ? getOptionValue(o) : String(getOptionLabel(o)),
|
|
9617
9625
|
[getOptionValue, getOptionLabel]
|
|
@@ -9642,14 +9650,15 @@ function SmartSelect({
|
|
|
9642
9650
|
}
|
|
9643
9651
|
return value != null ? /* @__PURE__ */ new Set([getValue(value)]) : /* @__PURE__ */ new Set();
|
|
9644
9652
|
}, [multiple, value, getValue]);
|
|
9645
|
-
const handleInputChange = (0, import_react51.useCallback)((_,
|
|
9653
|
+
const handleInputChange = (0, import_react51.useCallback)((_, inputValue2) => {
|
|
9654
|
+
setInputValue(inputValue2);
|
|
9646
9655
|
if (!onSearchChange) return;
|
|
9647
9656
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
9648
|
-
if (!
|
|
9657
|
+
if (!inputValue2) {
|
|
9649
9658
|
onSearchChange("", 0);
|
|
9650
9659
|
return;
|
|
9651
9660
|
}
|
|
9652
|
-
const q =
|
|
9661
|
+
const q = inputValue2.toLowerCase();
|
|
9653
9662
|
let localCount = 0;
|
|
9654
9663
|
for (const opt of flatOptionsList) {
|
|
9655
9664
|
if (getOptionLabel(opt).toLowerCase().includes(q) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q)) {
|
|
@@ -9660,10 +9669,10 @@ function SmartSelect({
|
|
|
9660
9669
|
if (localCount >= searchThreshold) return;
|
|
9661
9670
|
const needed = searchThreshold - localCount;
|
|
9662
9671
|
if (debounceMs <= 0) {
|
|
9663
|
-
onSearchChange(
|
|
9672
|
+
onSearchChange(inputValue2, needed);
|
|
9664
9673
|
} else {
|
|
9665
9674
|
debounceTimer.current = setTimeout(() => {
|
|
9666
|
-
onSearchChange(
|
|
9675
|
+
onSearchChange(inputValue2, needed);
|
|
9667
9676
|
}, debounceMs);
|
|
9668
9677
|
}
|
|
9669
9678
|
}, [onSearchChange, debounceMs, searchThreshold, flatOptionsList, getOptionLabel, getOptionSubLabel]);
|
|
@@ -9742,13 +9751,13 @@ function SmartSelect({
|
|
|
9742
9751
|
/* @__PURE__ */ import_react51.default.createElement("span", { className: "rf-select__option-check", "aria-hidden": "true" }, /* @__PURE__ */ import_react51.default.createElement(CheckIcon3, null))
|
|
9743
9752
|
);
|
|
9744
9753
|
}, [depthMap, getValue, getOptionLabel, getOptionSubLabel, selectedKeys]);
|
|
9745
|
-
const computedFilterOptions = (0, import_react51.useCallback)((opts,
|
|
9746
|
-
if (filterOptionsProp) return filterOptionsProp(opts,
|
|
9754
|
+
const computedFilterOptions = (0, import_react51.useCallback)((opts, inputValue2) => {
|
|
9755
|
+
if (filterOptionsProp) return filterOptionsProp(opts, inputValue2);
|
|
9747
9756
|
if (multiple) {
|
|
9748
9757
|
const selected = opts.filter((o) => selectedKeys.has(getValue(o)));
|
|
9749
9758
|
const unselected = opts.filter((o) => !selectedKeys.has(getValue(o)));
|
|
9750
|
-
if (!
|
|
9751
|
-
const q2 =
|
|
9759
|
+
if (!inputValue2) return [...selected, ...unselected];
|
|
9760
|
+
const q2 = inputValue2.toLowerCase();
|
|
9752
9761
|
const filteredUnselected = unselected.filter(
|
|
9753
9762
|
(opt) => getOptionLabel(opt).toLowerCase().includes(q2) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q2)
|
|
9754
9763
|
).slice(0, searchThreshold);
|
|
@@ -9756,7 +9765,7 @@ function SmartSelect({
|
|
|
9756
9765
|
}
|
|
9757
9766
|
if (value != null) {
|
|
9758
9767
|
const selectedLabel = getOptionLabel(value);
|
|
9759
|
-
if (
|
|
9768
|
+
if (inputValue2 === selectedLabel) {
|
|
9760
9769
|
const selectedKey = getValue(value);
|
|
9761
9770
|
return [
|
|
9762
9771
|
...opts.filter((o) => getValue(o) === selectedKey),
|
|
@@ -9764,8 +9773,8 @@ function SmartSelect({
|
|
|
9764
9773
|
];
|
|
9765
9774
|
}
|
|
9766
9775
|
}
|
|
9767
|
-
if (!
|
|
9768
|
-
const q =
|
|
9776
|
+
if (!inputValue2) return opts;
|
|
9777
|
+
const q = inputValue2.toLowerCase();
|
|
9769
9778
|
return opts.filter(
|
|
9770
9779
|
(opt) => getOptionLabel(opt).toLowerCase().includes(q) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q)
|
|
9771
9780
|
).slice(0, searchThreshold);
|
|
@@ -9776,6 +9785,7 @@ function SmartSelect({
|
|
|
9776
9785
|
options: displayOptions,
|
|
9777
9786
|
value: value ?? (multiple ? [] : null),
|
|
9778
9787
|
onChange: handleChange,
|
|
9788
|
+
inputValue: multiple ? void 0 : inputValue,
|
|
9779
9789
|
onInputChange: handleInputChange,
|
|
9780
9790
|
multiple,
|
|
9781
9791
|
limitTags,
|
package/dist/main.js
CHANGED
|
@@ -9480,7 +9480,7 @@ function UserSelectionField({
|
|
|
9480
9480
|
}
|
|
9481
9481
|
|
|
9482
9482
|
// lib/SmartSelect/SmartSelect.tsx
|
|
9483
|
-
import React108, { useCallback as useCallback11, useEffect as useEffect21, useMemo as useMemo3, useRef as useRef25 } from "react";
|
|
9483
|
+
import React108, { useCallback as useCallback11, useEffect as useEffect21, useMemo as useMemo3, useRef as useRef25, useState as useState26 } from "react";
|
|
9484
9484
|
var CheckIcon3 = () => /* @__PURE__ */ React108.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React108.createElement("polyline", { points: "20 6 9 17 4 12" }));
|
|
9485
9485
|
function flattenTree(options, getChildren, depth = 0) {
|
|
9486
9486
|
return options.flatMap((opt) => [
|
|
@@ -9536,6 +9536,14 @@ function SmartSelect({
|
|
|
9536
9536
|
useEffect21(() => () => {
|
|
9537
9537
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
9538
9538
|
}, []);
|
|
9539
|
+
const [inputValue, setInputValue] = useState26(
|
|
9540
|
+
() => !multiple && value != null ? getOptionLabel(value) : ""
|
|
9541
|
+
);
|
|
9542
|
+
useEffect21(() => {
|
|
9543
|
+
if (!multiple) {
|
|
9544
|
+
setInputValue(value != null ? getOptionLabel(value) : "");
|
|
9545
|
+
}
|
|
9546
|
+
}, [value, multiple, getOptionLabel]);
|
|
9539
9547
|
const getValue = useCallback11(
|
|
9540
9548
|
(o) => getOptionValue ? getOptionValue(o) : String(getOptionLabel(o)),
|
|
9541
9549
|
[getOptionValue, getOptionLabel]
|
|
@@ -9566,14 +9574,15 @@ function SmartSelect({
|
|
|
9566
9574
|
}
|
|
9567
9575
|
return value != null ? /* @__PURE__ */ new Set([getValue(value)]) : /* @__PURE__ */ new Set();
|
|
9568
9576
|
}, [multiple, value, getValue]);
|
|
9569
|
-
const handleInputChange = useCallback11((_,
|
|
9577
|
+
const handleInputChange = useCallback11((_, inputValue2) => {
|
|
9578
|
+
setInputValue(inputValue2);
|
|
9570
9579
|
if (!onSearchChange) return;
|
|
9571
9580
|
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
9572
|
-
if (!
|
|
9581
|
+
if (!inputValue2) {
|
|
9573
9582
|
onSearchChange("", 0);
|
|
9574
9583
|
return;
|
|
9575
9584
|
}
|
|
9576
|
-
const q =
|
|
9585
|
+
const q = inputValue2.toLowerCase();
|
|
9577
9586
|
let localCount = 0;
|
|
9578
9587
|
for (const opt of flatOptionsList) {
|
|
9579
9588
|
if (getOptionLabel(opt).toLowerCase().includes(q) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q)) {
|
|
@@ -9584,10 +9593,10 @@ function SmartSelect({
|
|
|
9584
9593
|
if (localCount >= searchThreshold) return;
|
|
9585
9594
|
const needed = searchThreshold - localCount;
|
|
9586
9595
|
if (debounceMs <= 0) {
|
|
9587
|
-
onSearchChange(
|
|
9596
|
+
onSearchChange(inputValue2, needed);
|
|
9588
9597
|
} else {
|
|
9589
9598
|
debounceTimer.current = setTimeout(() => {
|
|
9590
|
-
onSearchChange(
|
|
9599
|
+
onSearchChange(inputValue2, needed);
|
|
9591
9600
|
}, debounceMs);
|
|
9592
9601
|
}
|
|
9593
9602
|
}, [onSearchChange, debounceMs, searchThreshold, flatOptionsList, getOptionLabel, getOptionSubLabel]);
|
|
@@ -9666,13 +9675,13 @@ function SmartSelect({
|
|
|
9666
9675
|
/* @__PURE__ */ React108.createElement("span", { className: "rf-select__option-check", "aria-hidden": "true" }, /* @__PURE__ */ React108.createElement(CheckIcon3, null))
|
|
9667
9676
|
);
|
|
9668
9677
|
}, [depthMap, getValue, getOptionLabel, getOptionSubLabel, selectedKeys]);
|
|
9669
|
-
const computedFilterOptions = useCallback11((opts,
|
|
9670
|
-
if (filterOptionsProp) return filterOptionsProp(opts,
|
|
9678
|
+
const computedFilterOptions = useCallback11((opts, inputValue2) => {
|
|
9679
|
+
if (filterOptionsProp) return filterOptionsProp(opts, inputValue2);
|
|
9671
9680
|
if (multiple) {
|
|
9672
9681
|
const selected = opts.filter((o) => selectedKeys.has(getValue(o)));
|
|
9673
9682
|
const unselected = opts.filter((o) => !selectedKeys.has(getValue(o)));
|
|
9674
|
-
if (!
|
|
9675
|
-
const q2 =
|
|
9683
|
+
if (!inputValue2) return [...selected, ...unselected];
|
|
9684
|
+
const q2 = inputValue2.toLowerCase();
|
|
9676
9685
|
const filteredUnselected = unselected.filter(
|
|
9677
9686
|
(opt) => getOptionLabel(opt).toLowerCase().includes(q2) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q2)
|
|
9678
9687
|
).slice(0, searchThreshold);
|
|
@@ -9680,7 +9689,7 @@ function SmartSelect({
|
|
|
9680
9689
|
}
|
|
9681
9690
|
if (value != null) {
|
|
9682
9691
|
const selectedLabel = getOptionLabel(value);
|
|
9683
|
-
if (
|
|
9692
|
+
if (inputValue2 === selectedLabel) {
|
|
9684
9693
|
const selectedKey = getValue(value);
|
|
9685
9694
|
return [
|
|
9686
9695
|
...opts.filter((o) => getValue(o) === selectedKey),
|
|
@@ -9688,8 +9697,8 @@ function SmartSelect({
|
|
|
9688
9697
|
];
|
|
9689
9698
|
}
|
|
9690
9699
|
}
|
|
9691
|
-
if (!
|
|
9692
|
-
const q =
|
|
9700
|
+
if (!inputValue2) return opts;
|
|
9701
|
+
const q = inputValue2.toLowerCase();
|
|
9693
9702
|
return opts.filter(
|
|
9694
9703
|
(opt) => getOptionLabel(opt).toLowerCase().includes(q) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q)
|
|
9695
9704
|
).slice(0, searchThreshold);
|
|
@@ -9700,6 +9709,7 @@ function SmartSelect({
|
|
|
9700
9709
|
options: displayOptions,
|
|
9701
9710
|
value: value ?? (multiple ? [] : null),
|
|
9702
9711
|
onChange: handleChange,
|
|
9712
|
+
inputValue: multiple ? void 0 : inputValue,
|
|
9703
9713
|
onInputChange: handleInputChange,
|
|
9704
9714
|
multiple,
|
|
9705
9715
|
limitTags,
|
|
@@ -9726,7 +9736,7 @@ function SmartSelect({
|
|
|
9726
9736
|
}
|
|
9727
9737
|
|
|
9728
9738
|
// lib/RufousTextEditor/RufousTextEditor.tsx
|
|
9729
|
-
import React119, { useMemo as useMemo5, useCallback as useCallback16, useState as
|
|
9739
|
+
import React119, { useMemo as useMemo5, useCallback as useCallback16, useState as useState36, useRef as useRef33, useEffect as useEffect30 } from "react";
|
|
9730
9740
|
import { createPortal as createPortal8 } from "react-dom";
|
|
9731
9741
|
import { useEditor, EditorContent, EditorContext, FloatingMenu, BubbleMenu } from "@tiptap/react";
|
|
9732
9742
|
import StarterKit from "@tiptap/starter-kit";
|
|
@@ -9752,9 +9762,9 @@ import { ReactRenderer } from "@tiptap/react";
|
|
|
9752
9762
|
import tippy from "tippy.js";
|
|
9753
9763
|
|
|
9754
9764
|
// lib/RufousTextEditor/MentionList.tsx
|
|
9755
|
-
import React109, { forwardRef as forwardRef11, useEffect as useEffect22, useImperativeHandle, useState as
|
|
9765
|
+
import React109, { forwardRef as forwardRef11, useEffect as useEffect22, useImperativeHandle, useState as useState27 } from "react";
|
|
9756
9766
|
var MentionList = forwardRef11((props, ref) => {
|
|
9757
|
-
const [selectedIndex, setSelectedIndex] =
|
|
9767
|
+
const [selectedIndex, setSelectedIndex] = useState27(0);
|
|
9758
9768
|
const selectItem = (index) => {
|
|
9759
9769
|
const item = props.items[index];
|
|
9760
9770
|
if (item) {
|
|
@@ -9848,18 +9858,18 @@ function createMentionSuggestion(users) {
|
|
|
9848
9858
|
}
|
|
9849
9859
|
|
|
9850
9860
|
// lib/RufousTextEditor/Toolbar.tsx
|
|
9851
|
-
import React115, { useState as
|
|
9861
|
+
import React115, { useState as useState32, useRef as useRef29, useEffect as useEffect26, useCallback as useCallback15 } from "react";
|
|
9852
9862
|
import { createPortal as createPortal4 } from "react-dom";
|
|
9853
9863
|
|
|
9854
9864
|
// lib/RufousTextEditor/TextToSpeech.tsx
|
|
9855
|
-
import React110, { useState as
|
|
9865
|
+
import React110, { useState as useState28, useEffect as useEffect23, useRef as useRef26, useCallback as useCallback12, forwardRef as forwardRef12, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
9856
9866
|
var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
9857
|
-
const [speaking, setSpeaking] =
|
|
9858
|
-
const [paused, setPaused] =
|
|
9859
|
-
const [voices, setVoices] =
|
|
9860
|
-
const [selectedVoice, setSelectedVoice] =
|
|
9861
|
-
const [rate, setRate] =
|
|
9862
|
-
const [showPanel, setShowPanel] =
|
|
9867
|
+
const [speaking, setSpeaking] = useState28(false);
|
|
9868
|
+
const [paused, setPaused] = useState28(false);
|
|
9869
|
+
const [voices, setVoices] = useState28([]);
|
|
9870
|
+
const [selectedVoice, setSelectedVoice] = useState28("");
|
|
9871
|
+
const [rate, setRate] = useState28(1);
|
|
9872
|
+
const [showPanel, setShowPanel] = useState28(false);
|
|
9863
9873
|
const utteranceRef = useRef26(null);
|
|
9864
9874
|
const panelRef = useRef26(null);
|
|
9865
9875
|
useEffect23(() => {
|
|
@@ -9997,12 +10007,12 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
|
9997
10007
|
var TextToSpeech_default = TextToSpeech;
|
|
9998
10008
|
|
|
9999
10009
|
// lib/RufousTextEditor/SpeechToText.tsx
|
|
10000
|
-
import React111, { useState as
|
|
10010
|
+
import React111, { useState as useState29, useRef as useRef27, useCallback as useCallback13, useEffect as useEffect24, forwardRef as forwardRef13, useImperativeHandle as useImperativeHandle3 } from "react";
|
|
10001
10011
|
var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
10002
|
-
const [listening, setListening] =
|
|
10003
|
-
const [showPanel, setShowPanel] =
|
|
10004
|
-
const [language, setLanguage] =
|
|
10005
|
-
const [interim, setInterim] =
|
|
10012
|
+
const [listening, setListening] = useState29(false);
|
|
10013
|
+
const [showPanel, setShowPanel] = useState29(false);
|
|
10014
|
+
const [language, setLanguage] = useState29("en-US");
|
|
10015
|
+
const [interim, setInterim] = useState29("");
|
|
10006
10016
|
const recognitionRef = useRef27(null);
|
|
10007
10017
|
const panelRef = useRef27(null);
|
|
10008
10018
|
const isListeningRef = useRef27(false);
|
|
@@ -10159,7 +10169,7 @@ var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
|
10159
10169
|
var SpeechToText_default = SpeechToText;
|
|
10160
10170
|
|
|
10161
10171
|
// lib/RufousTextEditor/AICommands.tsx
|
|
10162
|
-
import React112, { useState as
|
|
10172
|
+
import React112, { useState as useState30, useRef as useRef28, useEffect as useEffect25, useCallback as useCallback14 } from "react";
|
|
10163
10173
|
import { createPortal as createPortal2 } from "react-dom";
|
|
10164
10174
|
var AI_COMMANDS = [
|
|
10165
10175
|
{ 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." },
|
|
@@ -10207,14 +10217,14 @@ var callOpenAI = async (prompt, text, previousResults = []) => {
|
|
|
10207
10217
|
return data.choices?.[0]?.message?.content?.trim() || "";
|
|
10208
10218
|
};
|
|
10209
10219
|
var AICommands = ({ editor, onAICommand }) => {
|
|
10210
|
-
const [open, setOpen] =
|
|
10211
|
-
const [showModal, setShowModal] =
|
|
10212
|
-
const [loading, setLoading] =
|
|
10213
|
-
const [promptText, setPromptText] =
|
|
10214
|
-
const [resultText, setResultText] =
|
|
10215
|
-
const [originalText, setOriginalText] =
|
|
10216
|
-
const [selectionRange, setSelectionRange] =
|
|
10217
|
-
const [previousResults, setPreviousResults] =
|
|
10220
|
+
const [open, setOpen] = useState30(false);
|
|
10221
|
+
const [showModal, setShowModal] = useState30(false);
|
|
10222
|
+
const [loading, setLoading] = useState30(false);
|
|
10223
|
+
const [promptText, setPromptText] = useState30("");
|
|
10224
|
+
const [resultText, setResultText] = useState30("");
|
|
10225
|
+
const [originalText, setOriginalText] = useState30("");
|
|
10226
|
+
const [selectionRange, setSelectionRange] = useState30(null);
|
|
10227
|
+
const [previousResults, setPreviousResults] = useState30([]);
|
|
10218
10228
|
const panelRef = useRef28(null);
|
|
10219
10229
|
useEffect25(() => {
|
|
10220
10230
|
const handleClick = (e) => {
|
|
@@ -10364,7 +10374,7 @@ var AICommands = ({ editor, onAICommand }) => {
|
|
|
10364
10374
|
var AICommands_default = AICommands;
|
|
10365
10375
|
|
|
10366
10376
|
// lib/RufousTextEditor/TranslateModal.tsx
|
|
10367
|
-
import React113, { useState as
|
|
10377
|
+
import React113, { useState as useState31, useMemo as useMemo4 } from "react";
|
|
10368
10378
|
import { createPortal as createPortal3 } from "react-dom";
|
|
10369
10379
|
var LANGUAGES = [
|
|
10370
10380
|
{ code: "af", name: "Afrikaans" },
|
|
@@ -10504,12 +10514,12 @@ async function translateText(text, sourceLang, targetLang) {
|
|
|
10504
10514
|
return null;
|
|
10505
10515
|
}
|
|
10506
10516
|
var TranslateModal = ({ editor, onClose, onTranslate, initialSource, initialTarget, onLangChange }) => {
|
|
10507
|
-
const [sourceLang, setSourceLang] =
|
|
10508
|
-
const [targetLang, setTargetLang] =
|
|
10509
|
-
const [sourceFilter, setSourceFilter] =
|
|
10510
|
-
const [targetFilter, setTargetFilter] =
|
|
10511
|
-
const [translating, setTranslating] =
|
|
10512
|
-
const [error, setError] =
|
|
10517
|
+
const [sourceLang, setSourceLang] = useState31(initialSource || "en");
|
|
10518
|
+
const [targetLang, setTargetLang] = useState31(initialTarget || "hi");
|
|
10519
|
+
const [sourceFilter, setSourceFilter] = useState31("");
|
|
10520
|
+
const [targetFilter, setTargetFilter] = useState31("");
|
|
10521
|
+
const [translating, setTranslating] = useState31(false);
|
|
10522
|
+
const [error, setError] = useState31("");
|
|
10513
10523
|
const filteredSource = useMemo4(() => LANGUAGES.filter(
|
|
10514
10524
|
(l) => l.name.toLowerCase().includes(sourceFilter.toLowerCase()) || l.code.toLowerCase().includes(sourceFilter.toLowerCase())
|
|
10515
10525
|
), [sourceFilter]);
|
|
@@ -11413,7 +11423,7 @@ var SPECIAL_CHARS = [
|
|
|
11413
11423
|
"\xA2"
|
|
11414
11424
|
];
|
|
11415
11425
|
var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
|
|
11416
|
-
const [open, setOpen] =
|
|
11426
|
+
const [open, setOpen] = useState32(false);
|
|
11417
11427
|
const ref = useRef29(null);
|
|
11418
11428
|
const menuRef = useRef29(null);
|
|
11419
11429
|
useEffect26(() => {
|
|
@@ -11471,8 +11481,8 @@ var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
|
|
|
11471
11481
|
));
|
|
11472
11482
|
};
|
|
11473
11483
|
var InsertPanel = ({ editor, onClose, mode = "video" }) => {
|
|
11474
|
-
const [activeTab, setActiveTab] =
|
|
11475
|
-
const [url, setUrl] =
|
|
11484
|
+
const [activeTab, setActiveTab] = useState32("link");
|
|
11485
|
+
const [url, setUrl] = useState32("");
|
|
11476
11486
|
const extractIframeSrc = (html) => {
|
|
11477
11487
|
const match = html.match(/<iframe[^>]+src=["']([^"']+)["']/);
|
|
11478
11488
|
return match ? match[1] : null;
|
|
@@ -11542,9 +11552,9 @@ var InsertPanel = ({ editor, onClose, mode = "video" }) => {
|
|
|
11542
11552
|
), /* @__PURE__ */ React115.createElement("button", { className: "insert-panel-btn", onClick: handleInsert }, "Insert"));
|
|
11543
11553
|
};
|
|
11544
11554
|
var ImagePanel = ({ editor, onClose, onImageUpload }) => {
|
|
11545
|
-
const [activeTab, setActiveTab] =
|
|
11546
|
-
const [url, setUrl] =
|
|
11547
|
-
const [isDragging, setIsDragging] =
|
|
11555
|
+
const [activeTab, setActiveTab] = useState32("upload");
|
|
11556
|
+
const [url, setUrl] = useState32("");
|
|
11557
|
+
const [isDragging, setIsDragging] = useState32(false);
|
|
11548
11558
|
const fileInputRef = useRef29(null);
|
|
11549
11559
|
const getBase64 = (file) => {
|
|
11550
11560
|
return new Promise((resolve, reject) => {
|
|
@@ -11635,8 +11645,8 @@ var ImagePanel = ({ editor, onClose, onImageUpload }) => {
|
|
|
11635
11645
|
};
|
|
11636
11646
|
var MAX_GRID = 10;
|
|
11637
11647
|
var TableGridSelector = ({ editor, onClose }) => {
|
|
11638
|
-
const [hoverRow, setHoverRow] =
|
|
11639
|
-
const [hoverCol, setHoverCol] =
|
|
11648
|
+
const [hoverRow, setHoverRow] = useState32(0);
|
|
11649
|
+
const [hoverCol, setHoverCol] = useState32(0);
|
|
11640
11650
|
const handleInsert = () => {
|
|
11641
11651
|
if (!editor || hoverRow === 0 || hoverCol === 0) return;
|
|
11642
11652
|
editor.chain().focus().insertTable({ rows: hoverRow, cols: hoverCol, withHeaderRow: true }).run();
|
|
@@ -11674,9 +11684,9 @@ var TableGridSelector = ({ editor, onClose }) => {
|
|
|
11674
11684
|
)));
|
|
11675
11685
|
};
|
|
11676
11686
|
var ColorPickerPanel = ({ editor, onClose }) => {
|
|
11677
|
-
const [tab, setTab] =
|
|
11678
|
-
const [activeBg, setActiveBg] =
|
|
11679
|
-
const [activeText, setActiveText] =
|
|
11687
|
+
const [tab, setTab] = useState32("background");
|
|
11688
|
+
const [activeBg, setActiveBg] = useState32(() => editor.getAttributes("highlight").color || null);
|
|
11689
|
+
const [activeText, setActiveText] = useState32(() => editor.getAttributes("textStyle").color || null);
|
|
11680
11690
|
const activeColor = tab === "background" ? activeBg : activeText;
|
|
11681
11691
|
const applyColor = (color) => {
|
|
11682
11692
|
if (tab === "background") {
|
|
@@ -11721,8 +11731,8 @@ var ColorPickerPanel = ({ editor, onClose }) => {
|
|
|
11721
11731
|
)))), /* @__PURE__ */ React115.createElement("div", { className: "color-picker-footer" }, /* @__PURE__ */ React115.createElement("div", { className: "color-picker-preview", style: { background: activeColor || "#000" } }), /* @__PURE__ */ React115.createElement(Tooltip, { title: "Remove color", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "color-picker-remove", onClick: removeColor }, "\u2713"))));
|
|
11722
11732
|
};
|
|
11723
11733
|
var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTextToSpeech, onClose, onImageUpload, visibleButtons, isFullscreen, onToggleFullscreen }) => {
|
|
11724
|
-
const [, setEditorState] =
|
|
11725
|
-
const [todoEnabled, setTodoEnabled] =
|
|
11734
|
+
const [, setEditorState] = useState32(0);
|
|
11735
|
+
const [todoEnabled, setTodoEnabled] = useState32(false);
|
|
11726
11736
|
const ttsRef = useRef29(null);
|
|
11727
11737
|
const sttRef = useRef29(null);
|
|
11728
11738
|
const show = (id) => !visibleButtons || visibleButtons.has(id);
|
|
@@ -11736,11 +11746,11 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
11736
11746
|
if (!editor) return;
|
|
11737
11747
|
editor.chain().focus().insertContent(char).run();
|
|
11738
11748
|
}, [editor]);
|
|
11739
|
-
const [copySuccess, setCopySuccess] =
|
|
11740
|
-
const [translateSource, setTranslateSource] =
|
|
11741
|
-
const [translateTarget, setTranslateTarget] =
|
|
11742
|
-
const [translateStatus, setTranslateStatus] =
|
|
11743
|
-
const [showTranslateModal, setShowTranslateModal] =
|
|
11749
|
+
const [copySuccess, setCopySuccess] = useState32(false);
|
|
11750
|
+
const [translateSource, setTranslateSource] = useState32("en");
|
|
11751
|
+
const [translateTarget, setTranslateTarget] = useState32("hi");
|
|
11752
|
+
const [translateStatus, setTranslateStatus] = useState32("");
|
|
11753
|
+
const [showTranslateModal, setShowTranslateModal] = useState32(false);
|
|
11744
11754
|
const handleCopy = useCallback15(async () => {
|
|
11745
11755
|
if (!editor) return;
|
|
11746
11756
|
const { from, to, empty } = editor.state.selection;
|
|
@@ -12349,7 +12359,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
12349
12359
|
var Toolbar_default = Toolbar;
|
|
12350
12360
|
|
|
12351
12361
|
// lib/RufousTextEditor/ImageToolbar.tsx
|
|
12352
|
-
import React116, { useState as
|
|
12362
|
+
import React116, { useState as useState33, useEffect as useEffect27, useRef as useRef30 } from "react";
|
|
12353
12363
|
import { createPortal as createPortal5 } from "react-dom";
|
|
12354
12364
|
var ALIGNMENTS = [
|
|
12355
12365
|
{ value: "left", label: "Left", icon: "\u2630" },
|
|
@@ -12357,17 +12367,17 @@ var ALIGNMENTS = [
|
|
|
12357
12367
|
{ value: "right", label: "Right", icon: "\u2263" }
|
|
12358
12368
|
];
|
|
12359
12369
|
var ImagePropertiesModal = ({ editor, node, onClose }) => {
|
|
12360
|
-
const [activeTab, setActiveTab] =
|
|
12361
|
-
const [src, setSrc] =
|
|
12362
|
-
const [title, setTitle] =
|
|
12363
|
-
const [alt, setAlt] =
|
|
12364
|
-
const [link, setLink] =
|
|
12365
|
-
const [openInNewTab, setOpenInNewTab] =
|
|
12366
|
-
const [width, setWidth] =
|
|
12367
|
-
const [height, setHeight] =
|
|
12368
|
-
const [lockRatio, setLockRatio] =
|
|
12369
|
-
const [naturalWidth, setNaturalWidth] =
|
|
12370
|
-
const [naturalHeight, setNaturalHeight] =
|
|
12370
|
+
const [activeTab, setActiveTab] = useState33("image");
|
|
12371
|
+
const [src, setSrc] = useState33(node?.attrs?.src || "");
|
|
12372
|
+
const [title, setTitle] = useState33(node?.attrs?.title || "");
|
|
12373
|
+
const [alt, setAlt] = useState33(node?.attrs?.alt || "");
|
|
12374
|
+
const [link, setLink] = useState33("");
|
|
12375
|
+
const [openInNewTab, setOpenInNewTab] = useState33(false);
|
|
12376
|
+
const [width, setWidth] = useState33("");
|
|
12377
|
+
const [height, setHeight] = useState33("");
|
|
12378
|
+
const [lockRatio, setLockRatio] = useState33(true);
|
|
12379
|
+
const [naturalWidth, setNaturalWidth] = useState33(0);
|
|
12380
|
+
const [naturalHeight, setNaturalHeight] = useState33(0);
|
|
12371
12381
|
useEffect27(() => {
|
|
12372
12382
|
if (src) {
|
|
12373
12383
|
const img = new window.Image();
|
|
@@ -12486,11 +12496,11 @@ var ImagePropertiesModal = ({ editor, node, onClose }) => {
|
|
|
12486
12496
|
), "Open link in new tab")) : /* @__PURE__ */ React116.createElement(React116.Fragment, null, /* @__PURE__ */ React116.createElement("label", { className: "modal-label" }, "CSS Class"), /* @__PURE__ */ React116.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. rounded shadow" }), /* @__PURE__ */ React116.createElement("label", { className: "modal-label" }, "Inline Style"), /* @__PURE__ */ React116.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. border: 1px solid #ccc" }))))), /* @__PURE__ */ React116.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React116.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React116.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "Cancel"), /* @__PURE__ */ React116.createElement("button", { className: "modal-btn-delete", onClick: handleDelete }, "Delete")), /* @__PURE__ */ React116.createElement("button", { className: "modal-btn-apply", onClick: handleApply }, "Apply"))));
|
|
12487
12497
|
};
|
|
12488
12498
|
var ImageToolbar = ({ editor }) => {
|
|
12489
|
-
const [showModal, setShowModal] =
|
|
12490
|
-
const [showAlign, setShowAlign] =
|
|
12491
|
-
const [showVAlign, setShowVAlign] =
|
|
12492
|
-
const [copyStatus, setCopyStatus] =
|
|
12493
|
-
const [pos, setPos] =
|
|
12499
|
+
const [showModal, setShowModal] = useState33(false);
|
|
12500
|
+
const [showAlign, setShowAlign] = useState33(false);
|
|
12501
|
+
const [showVAlign, setShowVAlign] = useState33(false);
|
|
12502
|
+
const [copyStatus, setCopyStatus] = useState33("");
|
|
12503
|
+
const [pos, setPos] = useState33(null);
|
|
12494
12504
|
const toolbarRef = useRef30(null);
|
|
12495
12505
|
useEffect27(() => {
|
|
12496
12506
|
if (!editor) return;
|
|
@@ -12628,7 +12638,7 @@ var ImageToolbar = ({ editor }) => {
|
|
|
12628
12638
|
var ImageToolbar_default = ImageToolbar;
|
|
12629
12639
|
|
|
12630
12640
|
// lib/RufousTextEditor/VideoToolbar.tsx
|
|
12631
|
-
import React117, { useState as
|
|
12641
|
+
import React117, { useState as useState34, useEffect as useEffect28, useRef as useRef31 } from "react";
|
|
12632
12642
|
import { createPortal as createPortal6 } from "react-dom";
|
|
12633
12643
|
var ALIGNMENTS2 = [
|
|
12634
12644
|
{ value: "left", label: "Left", icon: "\u2630" },
|
|
@@ -12637,10 +12647,10 @@ var ALIGNMENTS2 = [
|
|
|
12637
12647
|
];
|
|
12638
12648
|
var VIDEO_TYPES = ["youtube", "video"];
|
|
12639
12649
|
var VideoPropertiesModal = ({ editor, node, nodeType, onClose }) => {
|
|
12640
|
-
const [src, setSrc] =
|
|
12641
|
-
const [width, setWidth] =
|
|
12642
|
-
const [height, setHeight] =
|
|
12643
|
-
const [lockRatio, setLockRatio] =
|
|
12650
|
+
const [src, setSrc] = useState34(node?.attrs?.src || "");
|
|
12651
|
+
const [width, setWidth] = useState34(String(node?.attrs?.width || 640));
|
|
12652
|
+
const [height, setHeight] = useState34(String(node?.attrs?.height || 360));
|
|
12653
|
+
const [lockRatio, setLockRatio] = useState34(true);
|
|
12644
12654
|
const handleWidthChange = (val) => {
|
|
12645
12655
|
setWidth(val);
|
|
12646
12656
|
if (lockRatio) {
|
|
@@ -12738,11 +12748,11 @@ var VideoPropertiesModal = ({ editor, node, nodeType, onClose }) => {
|
|
|
12738
12748
|
)))), /* @__PURE__ */ React117.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React117.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React117.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "Cancel"), /* @__PURE__ */ React117.createElement("button", { className: "modal-btn-delete", onClick: handleDelete }, "Delete")), /* @__PURE__ */ React117.createElement("button", { className: "modal-btn-apply", onClick: handleApply }, "Apply"))));
|
|
12739
12749
|
};
|
|
12740
12750
|
var VideoToolbar = ({ editor }) => {
|
|
12741
|
-
const [showModal, setShowModal] =
|
|
12742
|
-
const [showSize, setShowSize] =
|
|
12743
|
-
const [showAlign, setShowAlign] =
|
|
12744
|
-
const [copyStatus, setCopyStatus] =
|
|
12745
|
-
const [pos, setPos] =
|
|
12751
|
+
const [showModal, setShowModal] = useState34(false);
|
|
12752
|
+
const [showSize, setShowSize] = useState34(false);
|
|
12753
|
+
const [showAlign, setShowAlign] = useState34(false);
|
|
12754
|
+
const [copyStatus, setCopyStatus] = useState34("");
|
|
12755
|
+
const [pos, setPos] = useState34(null);
|
|
12746
12756
|
const toolbarRef = useRef31(null);
|
|
12747
12757
|
useEffect28(() => {
|
|
12748
12758
|
if (!editor) return;
|
|
@@ -12868,7 +12878,7 @@ var VideoToolbar = ({ editor }) => {
|
|
|
12868
12878
|
var VideoToolbar_default = VideoToolbar;
|
|
12869
12879
|
|
|
12870
12880
|
// lib/RufousTextEditor/TableToolbar.tsx
|
|
12871
|
-
import React118, { useState as
|
|
12881
|
+
import React118, { useState as useState35, useEffect as useEffect29, useRef as useRef32 } from "react";
|
|
12872
12882
|
import { createPortal as createPortal7 } from "react-dom";
|
|
12873
12883
|
var IconAddRowBefore = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.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__ */ React118.createElement("path", { d: "M9 6h2v1.5h1.5v2H11V11H9V9.5H7.5v-2H9z" }));
|
|
12874
12884
|
var IconAddRowAfter = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.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__ */ React118.createElement("path", { d: "M9 14h2v1.5h1.5v2H11V19H9v-1.5H7.5v-2H9z" }));
|
|
@@ -12881,7 +12891,7 @@ var IconMergeCells = () => /* @__PURE__ */ React118.createElement("svg", { width
|
|
|
12881
12891
|
var IconSplitCell = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.createElement("path", { d: "M3 3h18v18H3V3zm2 2v5h6V5H5zm8 0v5h6V5h-6zM5 13v6h6v-6H5zm8 0v6h6v-6h-6z" }));
|
|
12882
12892
|
var IconToggleHeader = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.createElement("path", { d: "M3 3h18v18H3V3zm2 2v4h14V5H5zm0 6v8h14v-8H5z" }), /* @__PURE__ */ React118.createElement("rect", { x: "5", y: "5", width: "14", height: "4", opacity: "0.4" }));
|
|
12883
12893
|
var TableToolbar = ({ editor }) => {
|
|
12884
|
-
const [pos, setPos] =
|
|
12894
|
+
const [pos, setPos] = useState35(null);
|
|
12885
12895
|
const toolbarRef = useRef32(null);
|
|
12886
12896
|
useEffect29(() => {
|
|
12887
12897
|
if (!editor) return;
|
|
@@ -13248,13 +13258,13 @@ var RufousTextEditor = ({
|
|
|
13248
13258
|
};
|
|
13249
13259
|
}, [editor]);
|
|
13250
13260
|
const setLinkRef = useRef33(null);
|
|
13251
|
-
const [linkModalOpen, setLinkModalOpen] =
|
|
13252
|
-
const [linkUrl, setLinkUrl] =
|
|
13253
|
-
const [linkText, setLinkText] =
|
|
13254
|
-
const [linkClassName, setLinkClassName] =
|
|
13255
|
-
const [linkNewTab, setLinkNewTab] =
|
|
13256
|
-
const [linkNoFollow, setLinkNoFollow] =
|
|
13257
|
-
const [linkSelection, setLinkSelection] =
|
|
13261
|
+
const [linkModalOpen, setLinkModalOpen] = useState36(false);
|
|
13262
|
+
const [linkUrl, setLinkUrl] = useState36("");
|
|
13263
|
+
const [linkText, setLinkText] = useState36("");
|
|
13264
|
+
const [linkClassName, setLinkClassName] = useState36("");
|
|
13265
|
+
const [linkNewTab, setLinkNewTab] = useState36(true);
|
|
13266
|
+
const [linkNoFollow, setLinkNoFollow] = useState36(true);
|
|
13267
|
+
const [linkSelection, setLinkSelection] = useState36(null);
|
|
13258
13268
|
const setLink = useCallback16(() => {
|
|
13259
13269
|
if (!editor) return;
|
|
13260
13270
|
const attrs = editor.getAttributes("link");
|
|
@@ -13380,7 +13390,7 @@ var RufousTextEditor = ({
|
|
|
13380
13390
|
setLinkSelection(null);
|
|
13381
13391
|
editor?.chain().focus().run();
|
|
13382
13392
|
}, [editor]);
|
|
13383
|
-
const [saveStatus, setSaveStatus] =
|
|
13393
|
+
const [saveStatus, setSaveStatus] = useState36("");
|
|
13384
13394
|
const handleSave = useCallback16(() => {
|
|
13385
13395
|
if (!editor || !onSaveProp) return;
|
|
13386
13396
|
onSaveProp(editor.getHTML(), editor.getJSON());
|
|
@@ -13392,7 +13402,7 @@ var RufousTextEditor = ({
|
|
|
13392
13402
|
onExportProp(editor.getHTML(), editor.getJSON());
|
|
13393
13403
|
}, [editor, onExportProp]);
|
|
13394
13404
|
const providerValue = useMemo5(() => ({ editor }), [editor]);
|
|
13395
|
-
const [isFullscreen, setIsFullscreen] =
|
|
13405
|
+
const [isFullscreen, setIsFullscreen] = useState36(false);
|
|
13396
13406
|
const toggleFullscreen = useCallback16(() => setIsFullscreen((prev) => !prev), []);
|
|
13397
13407
|
const wrapperJsx = /* @__PURE__ */ React119.createElement(
|
|
13398
13408
|
"div",
|
|
@@ -13715,10 +13725,10 @@ function getCitiesByName(name, exact = false) {
|
|
|
13715
13725
|
}
|
|
13716
13726
|
|
|
13717
13727
|
// lib/utils/useLocationSearch.ts
|
|
13718
|
-
import { useState as
|
|
13728
|
+
import { useState as useState37, useEffect as useEffect31, useRef as useRef34, useCallback as useCallback17 } from "react";
|
|
13719
13729
|
function useDebounced(searcher, debounceMs) {
|
|
13720
|
-
const [query, setQuery] =
|
|
13721
|
-
const [results, setResults] =
|
|
13730
|
+
const [query, setQuery] = useState37("");
|
|
13731
|
+
const [results, setResults] = useState37([]);
|
|
13722
13732
|
const timer = useRef34(null);
|
|
13723
13733
|
useEffect31(() => () => {
|
|
13724
13734
|
if (timer.current) clearTimeout(timer.current);
|