@underverse-ui/underverse 1.0.13 → 1.0.14
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/index.cjs +1130 -765
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +1026 -663
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -101,6 +101,8 @@ __export(index_exports, {
|
|
|
101
101
|
MonthYearPicker: () => MonthYearPicker,
|
|
102
102
|
MonthYearPickerBase: () => MonthYearPicker,
|
|
103
103
|
MultiCombobox: () => MultiCombobox,
|
|
104
|
+
MusicPlayer: () => MusicPlayer,
|
|
105
|
+
MusicPlayerDefault: () => MusicPlayer_default,
|
|
104
106
|
NotificationBadge: () => NotificationBadge,
|
|
105
107
|
NotificationModal: () => NotificationModal_default,
|
|
106
108
|
NumberInput: () => NumberInput,
|
|
@@ -16686,9 +16688,370 @@ function ColorPicker({
|
|
|
16686
16688
|
) });
|
|
16687
16689
|
}
|
|
16688
16690
|
|
|
16689
|
-
// ../../components/ui/
|
|
16690
|
-
var import_react22 =
|
|
16691
|
+
// ../../components/ui/MusicPlayer.tsx
|
|
16692
|
+
var import_react22 = require("react");
|
|
16693
|
+
var import_lucide_react32 = require("lucide-react");
|
|
16691
16694
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
16695
|
+
var AUDIO_FILE = "/music/As 30 Melhores M\xFAsicas Pop 2025 Top Hits em Ingl\xEAs As M\xFAsicas Pop Mais Escutad.mp3";
|
|
16696
|
+
var DEFAULT_PLAYLIST = [
|
|
16697
|
+
{ id: 1, title: "Someone You Loved", artist: "Lewis Capaldi", duration: "3:07", audioUrl: AUDIO_FILE, startTime: 0, endTime: 187 },
|
|
16698
|
+
{
|
|
16699
|
+
id: 2,
|
|
16700
|
+
title: "Love Me Like You Do",
|
|
16701
|
+
artist: "Ellie Goulding",
|
|
16702
|
+
duration: "3:30",
|
|
16703
|
+
audioUrl: AUDIO_FILE,
|
|
16704
|
+
startTime: 187,
|
|
16705
|
+
endTime: 397
|
|
16706
|
+
},
|
|
16707
|
+
{ id: 3, title: "All Of Me", artist: "John Legend", duration: "5:06", audioUrl: AUDIO_FILE, startTime: 397, endTime: 703 },
|
|
16708
|
+
{
|
|
16709
|
+
id: 4,
|
|
16710
|
+
title: "Always Remember Us This Way",
|
|
16711
|
+
artist: "Lady Gaga",
|
|
16712
|
+
duration: "3:20",
|
|
16713
|
+
audioUrl: AUDIO_FILE,
|
|
16714
|
+
startTime: 703,
|
|
16715
|
+
endTime: 903
|
|
16716
|
+
},
|
|
16717
|
+
{ id: 5, title: "Everytime We Touch", artist: "Cascada", duration: "2:52", audioUrl: AUDIO_FILE, startTime: 903, endTime: 1075 },
|
|
16718
|
+
{ id: 6, title: "At My Worst", artist: "Pink Sweat$", duration: "2:43", audioUrl: AUDIO_FILE, startTime: 1075, endTime: 1238 },
|
|
16719
|
+
{ id: 7, title: "Sweet But Psycho", artist: "Ava Max", duration: "2:19", audioUrl: AUDIO_FILE, startTime: 1238, endTime: 1377 },
|
|
16720
|
+
{ id: 8, title: "Love Is Gone", artist: "SLANDER", duration: "2:56", audioUrl: AUDIO_FILE, startTime: 1377, endTime: 1553 },
|
|
16721
|
+
{ id: 9, title: "Bad Liar", artist: "Imagine Dragons", duration: "4:16", audioUrl: AUDIO_FILE, startTime: 1553, endTime: 1809 },
|
|
16722
|
+
{ id: 10, title: "Dusk Till Dawn", artist: "ZAYN ft. Sia", duration: "3:43", audioUrl: AUDIO_FILE, startTime: 1809, endTime: 2032 },
|
|
16723
|
+
{ id: 11, title: "Flowers", artist: "Miley Cyrus", duration: "3:43", audioUrl: AUDIO_FILE, startTime: 2032, endTime: 2255 },
|
|
16724
|
+
{
|
|
16725
|
+
id: 12,
|
|
16726
|
+
title: "You Broke Me First",
|
|
16727
|
+
artist: "Tate McRae",
|
|
16728
|
+
duration: "3:01",
|
|
16729
|
+
audioUrl: AUDIO_FILE,
|
|
16730
|
+
startTime: 2255,
|
|
16731
|
+
endTime: 2436
|
|
16732
|
+
},
|
|
16733
|
+
{
|
|
16734
|
+
id: 13,
|
|
16735
|
+
title: "Symphony",
|
|
16736
|
+
artist: "Clean Bandit ft. Zara Larsson",
|
|
16737
|
+
duration: "2:00",
|
|
16738
|
+
audioUrl: AUDIO_FILE,
|
|
16739
|
+
startTime: 2436,
|
|
16740
|
+
endTime: 2557
|
|
16741
|
+
},
|
|
16742
|
+
{
|
|
16743
|
+
id: 14,
|
|
16744
|
+
title: "Dancing With Your Ghost",
|
|
16745
|
+
artist: "Sasha Alex Sloan",
|
|
16746
|
+
duration: "3:01",
|
|
16747
|
+
audioUrl: AUDIO_FILE,
|
|
16748
|
+
startTime: 2557,
|
|
16749
|
+
endTime: 2738
|
|
16750
|
+
},
|
|
16751
|
+
{
|
|
16752
|
+
id: 15,
|
|
16753
|
+
title: "Let Me Down Slowly",
|
|
16754
|
+
artist: "Alec Benjamin",
|
|
16755
|
+
duration: "3:33",
|
|
16756
|
+
audioUrl: AUDIO_FILE,
|
|
16757
|
+
startTime: 2738,
|
|
16758
|
+
endTime: 2951
|
|
16759
|
+
},
|
|
16760
|
+
{ id: 16, title: "Impossible", artist: "James Arthur", duration: "3:26", audioUrl: AUDIO_FILE, startTime: 2951, endTime: 3157 },
|
|
16761
|
+
{ id: 17, title: "Perfect", artist: "Ed Sheeran", duration: "3:30", audioUrl: AUDIO_FILE, startTime: 3157, endTime: 3367 },
|
|
16762
|
+
{
|
|
16763
|
+
id: 18,
|
|
16764
|
+
title: "La La La",
|
|
16765
|
+
artist: "Naughty Boy ft. Sam Smith",
|
|
16766
|
+
duration: "2:30",
|
|
16767
|
+
audioUrl: AUDIO_FILE,
|
|
16768
|
+
startTime: 3367,
|
|
16769
|
+
endTime: 3517
|
|
16770
|
+
},
|
|
16771
|
+
{
|
|
16772
|
+
id: 19,
|
|
16773
|
+
title: "Somewhere Only We Know",
|
|
16774
|
+
artist: "Keane",
|
|
16775
|
+
duration: "3:29",
|
|
16776
|
+
audioUrl: AUDIO_FILE,
|
|
16777
|
+
startTime: 3517,
|
|
16778
|
+
endTime: 3726
|
|
16779
|
+
},
|
|
16780
|
+
{ id: 20, title: "Diamonds", artist: "Rihanna", duration: "3:05", audioUrl: AUDIO_FILE, startTime: 3726, endTime: 3911 },
|
|
16781
|
+
{ id: 21, title: "Infinity", artist: "Jaymes Young", duration: "3:12", audioUrl: AUDIO_FILE, startTime: 3911, endTime: 4103 },
|
|
16782
|
+
{ id: 22, title: "Memories", artist: "Maroon 5", duration: "3:17", audioUrl: AUDIO_FILE, startTime: 4103, endTime: 4300 },
|
|
16783
|
+
{ id: 23, title: "Closer", artist: "The Chainsmokers", duration: "3:04", audioUrl: AUDIO_FILE, startTime: 4300, endTime: 4484 },
|
|
16784
|
+
{ id: 24, title: "Save Your Tears", artist: "The Weeknd", duration: "3:10", audioUrl: AUDIO_FILE, startTime: 4484, endTime: 4674 },
|
|
16785
|
+
{ id: 25, title: "Stereo Love", artist: "Edward Maya", duration: "3:10", audioUrl: AUDIO_FILE, startTime: 4674, endTime: 4864 },
|
|
16786
|
+
{
|
|
16787
|
+
id: 26,
|
|
16788
|
+
title: "Shallow",
|
|
16789
|
+
artist: "Lady Gaga & Bradley Cooper",
|
|
16790
|
+
duration: "3:30",
|
|
16791
|
+
audioUrl: AUDIO_FILE,
|
|
16792
|
+
startTime: 4864,
|
|
16793
|
+
endTime: 5074
|
|
16794
|
+
},
|
|
16795
|
+
{ id: 27, title: "Toxic", artist: "Britney Spears", duration: "2:34", audioUrl: AUDIO_FILE, startTime: 5074, endTime: 5228 },
|
|
16796
|
+
{ id: 28, title: "Some Say", artist: "Nea", duration: "2:57", audioUrl: AUDIO_FILE, startTime: 5228, endTime: 5405 },
|
|
16797
|
+
{ id: 29, title: "Love Someone", artist: "Lukas Graham", duration: "3:24", audioUrl: AUDIO_FILE, startTime: 5405, endTime: 5609 },
|
|
16798
|
+
{
|
|
16799
|
+
id: 30,
|
|
16800
|
+
title: "You Are The Reason",
|
|
16801
|
+
artist: "Calum Scott",
|
|
16802
|
+
duration: "3:24",
|
|
16803
|
+
audioUrl: AUDIO_FILE,
|
|
16804
|
+
startTime: 5609,
|
|
16805
|
+
endTime: 5813
|
|
16806
|
+
}
|
|
16807
|
+
];
|
|
16808
|
+
var MusicPlayer = ({
|
|
16809
|
+
playlist = DEFAULT_PLAYLIST,
|
|
16810
|
+
autoPlay = false,
|
|
16811
|
+
showPlaylist: initialShowPlaylist = true,
|
|
16812
|
+
className = ""
|
|
16813
|
+
}) => {
|
|
16814
|
+
const [currentSongIndex, setCurrentSongIndex] = (0, import_react22.useState)(0);
|
|
16815
|
+
const [isPlaying, setIsPlaying] = (0, import_react22.useState)(false);
|
|
16816
|
+
const [currentTime, setCurrentTime] = (0, import_react22.useState)(0);
|
|
16817
|
+
const [duration, setDuration] = (0, import_react22.useState)(0);
|
|
16818
|
+
const [volume, setVolume] = (0, import_react22.useState)(1);
|
|
16819
|
+
const [isMuted, setIsMuted] = (0, import_react22.useState)(false);
|
|
16820
|
+
const [showPlaylist, setShowPlaylist] = (0, import_react22.useState)(initialShowPlaylist);
|
|
16821
|
+
const audioRef = (0, import_react22.useRef)(null);
|
|
16822
|
+
const currentSong = playlist[currentSongIndex];
|
|
16823
|
+
(0, import_react22.useEffect)(() => {
|
|
16824
|
+
if (audioRef.current) {
|
|
16825
|
+
audioRef.current.volume = volume;
|
|
16826
|
+
}
|
|
16827
|
+
}, [volume]);
|
|
16828
|
+
(0, import_react22.useEffect)(() => {
|
|
16829
|
+
if (autoPlay && audioRef.current) {
|
|
16830
|
+
audioRef.current.play().catch(() => {
|
|
16831
|
+
setIsPlaying(false);
|
|
16832
|
+
});
|
|
16833
|
+
}
|
|
16834
|
+
}, [autoPlay]);
|
|
16835
|
+
const togglePlay = () => {
|
|
16836
|
+
if (audioRef.current) {
|
|
16837
|
+
if (isPlaying) {
|
|
16838
|
+
audioRef.current.pause();
|
|
16839
|
+
} else {
|
|
16840
|
+
audioRef.current.play();
|
|
16841
|
+
}
|
|
16842
|
+
setIsPlaying(!isPlaying);
|
|
16843
|
+
}
|
|
16844
|
+
};
|
|
16845
|
+
const playNext = () => {
|
|
16846
|
+
setCurrentSongIndex((prev) => (prev + 1) % playlist.length);
|
|
16847
|
+
setIsPlaying(true);
|
|
16848
|
+
};
|
|
16849
|
+
const playPrevious = () => {
|
|
16850
|
+
setCurrentSongIndex((prev) => (prev - 1 + playlist.length) % playlist.length);
|
|
16851
|
+
setIsPlaying(true);
|
|
16852
|
+
};
|
|
16853
|
+
const handleTimeUpdate = () => {
|
|
16854
|
+
if (audioRef.current) {
|
|
16855
|
+
const time = audioRef.current.currentTime;
|
|
16856
|
+
setCurrentTime(time);
|
|
16857
|
+
if (currentSong.endTime && time >= currentSong.endTime) {
|
|
16858
|
+
playNext();
|
|
16859
|
+
}
|
|
16860
|
+
}
|
|
16861
|
+
};
|
|
16862
|
+
const handleLoadedMetadata = () => {
|
|
16863
|
+
if (audioRef.current) {
|
|
16864
|
+
if (currentSong.startTime !== void 0 && currentSong.endTime !== void 0) {
|
|
16865
|
+
setDuration(currentSong.endTime - currentSong.startTime);
|
|
16866
|
+
} else {
|
|
16867
|
+
setDuration(audioRef.current.duration);
|
|
16868
|
+
}
|
|
16869
|
+
}
|
|
16870
|
+
};
|
|
16871
|
+
const handleSeek = (e) => {
|
|
16872
|
+
const relativeTime = parseFloat(e.target.value);
|
|
16873
|
+
setCurrentTime(relativeTime);
|
|
16874
|
+
if (audioRef.current) {
|
|
16875
|
+
const absoluteTime = (currentSong.startTime || 0) + relativeTime;
|
|
16876
|
+
audioRef.current.currentTime = absoluteTime;
|
|
16877
|
+
}
|
|
16878
|
+
};
|
|
16879
|
+
const handleVolumeChange = (e) => {
|
|
16880
|
+
const newVolume = parseFloat(e.target.value);
|
|
16881
|
+
setVolume(newVolume);
|
|
16882
|
+
setIsMuted(newVolume === 0);
|
|
16883
|
+
};
|
|
16884
|
+
const toggleMute = () => {
|
|
16885
|
+
if (isMuted) {
|
|
16886
|
+
setVolume(1);
|
|
16887
|
+
setIsMuted(false);
|
|
16888
|
+
} else {
|
|
16889
|
+
setVolume(0);
|
|
16890
|
+
setIsMuted(true);
|
|
16891
|
+
}
|
|
16892
|
+
};
|
|
16893
|
+
const formatTime3 = (time) => {
|
|
16894
|
+
if (isNaN(time)) return "0:00";
|
|
16895
|
+
const displayTime = currentSong.startTime !== void 0 ? time - currentSong.startTime : time;
|
|
16896
|
+
const minutes = Math.floor(displayTime / 60);
|
|
16897
|
+
const seconds = Math.floor(displayTime % 60);
|
|
16898
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
16899
|
+
};
|
|
16900
|
+
const playSong = (index) => {
|
|
16901
|
+
setCurrentSongIndex(index);
|
|
16902
|
+
setIsPlaying(true);
|
|
16903
|
+
};
|
|
16904
|
+
(0, import_react22.useEffect)(() => {
|
|
16905
|
+
if (audioRef.current) {
|
|
16906
|
+
if (currentSong.startTime !== void 0) {
|
|
16907
|
+
audioRef.current.currentTime = currentSong.startTime;
|
|
16908
|
+
}
|
|
16909
|
+
if (isPlaying) {
|
|
16910
|
+
audioRef.current.play();
|
|
16911
|
+
}
|
|
16912
|
+
}
|
|
16913
|
+
}, [currentSongIndex, currentSong.startTime, isPlaying]);
|
|
16914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `music-player-container bg-card dark:bg-card border border-border rounded-2xl shadow-2xl overflow-hidden ${className}`, children: [
|
|
16915
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("audio", { ref: audioRef, src: currentSong.audioUrl, onTimeUpdate: handleTimeUpdate, onLoadedMetadata: handleLoadedMetadata, onEnded: playNext }),
|
|
16916
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-6", children: [
|
|
16917
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "text-center mb-6", children: [
|
|
16918
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "w-48 h-48 mx-auto mb-4 bg-primary/10 dark:bg-primary/20 border border-primary/30 rounded-2xl shadow-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "text-6xl", children: "\u{1F3B5}" }) }),
|
|
16919
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h2", { className: "text-2xl font-bold text-foreground mb-1", children: currentSong.title }),
|
|
16920
|
+
currentSong.artist && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-muted-foreground", children: currentSong.artist })
|
|
16921
|
+
] }),
|
|
16922
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "mb-4", children: [
|
|
16923
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
16924
|
+
"input",
|
|
16925
|
+
{
|
|
16926
|
+
type: "range",
|
|
16927
|
+
min: "0",
|
|
16928
|
+
max: duration || 0,
|
|
16929
|
+
value: currentTime,
|
|
16930
|
+
onChange: handleSeek,
|
|
16931
|
+
className: "w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer slider"
|
|
16932
|
+
}
|
|
16933
|
+
),
|
|
16934
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-sm text-muted-foreground mt-1", children: [
|
|
16935
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: formatTime3(currentTime) }),
|
|
16936
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: formatTime3(duration) })
|
|
16937
|
+
] })
|
|
16938
|
+
] }),
|
|
16939
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-center gap-4 mb-6", children: [
|
|
16940
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
16941
|
+
"button",
|
|
16942
|
+
{
|
|
16943
|
+
onClick: playPrevious,
|
|
16944
|
+
className: "w-12 h-12 flex items-center justify-center rounded-full bg-secondary hover:bg-secondary/80 transition-colors text-secondary-foreground",
|
|
16945
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.SkipBack, { size: 24 })
|
|
16946
|
+
}
|
|
16947
|
+
),
|
|
16948
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
16949
|
+
"button",
|
|
16950
|
+
{
|
|
16951
|
+
onClick: togglePlay,
|
|
16952
|
+
className: "w-16 h-16 flex items-center justify-center rounded-full bg-primary hover:bg-primary/90 transition-colors text-primary-foreground shadow-lg",
|
|
16953
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.Pause, { size: 32 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.Play, { size: 32, className: "ml-1" })
|
|
16954
|
+
}
|
|
16955
|
+
),
|
|
16956
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
16957
|
+
"button",
|
|
16958
|
+
{
|
|
16959
|
+
onClick: playNext,
|
|
16960
|
+
className: "w-12 h-12 flex items-center justify-center rounded-full bg-secondary hover:bg-secondary/80 transition-colors text-secondary-foreground",
|
|
16961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.SkipForward, { size: 24 })
|
|
16962
|
+
}
|
|
16963
|
+
)
|
|
16964
|
+
] }),
|
|
16965
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
16966
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { onClick: toggleMute, className: "text-foreground hover:text-primary transition-colors", children: isMuted || volume === 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.VolumeX, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.Volume2, { size: 20 }) }),
|
|
16967
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
16968
|
+
"input",
|
|
16969
|
+
{
|
|
16970
|
+
type: "range",
|
|
16971
|
+
min: "0",
|
|
16972
|
+
max: "1",
|
|
16973
|
+
step: "0.01",
|
|
16974
|
+
value: volume,
|
|
16975
|
+
onChange: handleVolumeChange,
|
|
16976
|
+
className: "flex-1 h-2 bg-muted rounded-lg appearance-none cursor-pointer"
|
|
16977
|
+
}
|
|
16978
|
+
)
|
|
16979
|
+
] }),
|
|
16980
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
16981
|
+
"button",
|
|
16982
|
+
{
|
|
16983
|
+
onClick: () => setShowPlaylist(!showPlaylist),
|
|
16984
|
+
className: "flex items-center gap-2 px-4 py-2 bg-secondary hover:bg-secondary/80 rounded-lg text-secondary-foreground transition-colors",
|
|
16985
|
+
children: [
|
|
16986
|
+
showPlaylist ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.X, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react32.List, { size: 20 }),
|
|
16987
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: showPlaylist ? "Hide Playlist" : "Show Playlist" })
|
|
16988
|
+
]
|
|
16989
|
+
}
|
|
16990
|
+
) })
|
|
16991
|
+
] }),
|
|
16992
|
+
showPlaylist && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "bg-muted/50 backdrop-blur-sm max-h-96 overflow-y-auto border-t border-border", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-4", children: [
|
|
16993
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("h3", { className: "text-lg font-semibold text-foreground mb-3", children: [
|
|
16994
|
+
"Playlist (",
|
|
16995
|
+
playlist.length,
|
|
16996
|
+
" songs)"
|
|
16997
|
+
] }),
|
|
16998
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "space-y-2", children: playlist.map((song, index) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
16999
|
+
"div",
|
|
17000
|
+
{
|
|
17001
|
+
onClick: () => playSong(index),
|
|
17002
|
+
className: `flex items-center gap-3 p-3 rounded-lg cursor-pointer transition-all ${index === currentSongIndex ? "bg-primary/20 border border-primary shadow-lg" : "bg-secondary/30 hover:bg-secondary/50"}`,
|
|
17003
|
+
children: [
|
|
17004
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-semibold", children: index === currentSongIndex && isPlaying ? "\u25B6" : index + 1 }),
|
|
17005
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
17006
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-foreground font-medium truncate", children: song.title }),
|
|
17007
|
+
song.artist && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-muted-foreground text-sm truncate", children: song.artist })
|
|
17008
|
+
] }),
|
|
17009
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "text-muted-foreground text-sm shrink-0", children: song.duration })
|
|
17010
|
+
]
|
|
17011
|
+
},
|
|
17012
|
+
song.id
|
|
17013
|
+
)) })
|
|
17014
|
+
] }) }),
|
|
17015
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
17016
|
+
"style",
|
|
17017
|
+
{
|
|
17018
|
+
dangerouslySetInnerHTML: {
|
|
17019
|
+
__html: `
|
|
17020
|
+
.music-player-container input[type="range"]::-webkit-slider-thumb {
|
|
17021
|
+
-webkit-appearance: none;
|
|
17022
|
+
appearance: none;
|
|
17023
|
+
width: 16px;
|
|
17024
|
+
height: 16px;
|
|
17025
|
+
border-radius: 50%;
|
|
17026
|
+
background: hsl(var(--primary));
|
|
17027
|
+
cursor: pointer;
|
|
17028
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
17029
|
+
}
|
|
17030
|
+
|
|
17031
|
+
.music-player-container input[type="range"]::-moz-range-thumb {
|
|
17032
|
+
width: 16px;
|
|
17033
|
+
height: 16px;
|
|
17034
|
+
border-radius: 50%;
|
|
17035
|
+
background: hsl(var(--primary));
|
|
17036
|
+
cursor: pointer;
|
|
17037
|
+
border: none;
|
|
17038
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
17039
|
+
}
|
|
17040
|
+
|
|
17041
|
+
.music-player-container input[type="range"]::-webkit-slider-runnable-track {
|
|
17042
|
+
background: linear-gradient(to right, hsl(var(--primary)) var(--progress, 0%), hsl(var(--muted)) var(--progress, 0%));
|
|
17043
|
+
}
|
|
17044
|
+
`
|
|
17045
|
+
}
|
|
17046
|
+
}
|
|
17047
|
+
)
|
|
17048
|
+
] });
|
|
17049
|
+
};
|
|
17050
|
+
var MusicPlayer_default = MusicPlayer;
|
|
17051
|
+
|
|
17052
|
+
// ../../components/ui/Grid.tsx
|
|
17053
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
17054
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
16692
17055
|
var BP_MIN = {
|
|
16693
17056
|
sm: 640,
|
|
16694
17057
|
md: 768,
|
|
@@ -16727,7 +17090,7 @@ function getVariantClasses(variant = "default", outlined) {
|
|
|
16727
17090
|
};
|
|
16728
17091
|
return variants[variant] || "";
|
|
16729
17092
|
}
|
|
16730
|
-
var GridRoot =
|
|
17093
|
+
var GridRoot = import_react23.default.forwardRef(
|
|
16731
17094
|
({
|
|
16732
17095
|
columns,
|
|
16733
17096
|
rows,
|
|
@@ -16752,7 +17115,7 @@ var GridRoot = import_react22.default.forwardRef(
|
|
|
16752
17115
|
children,
|
|
16753
17116
|
...rest
|
|
16754
17117
|
}, ref) => {
|
|
16755
|
-
const id = (0,
|
|
17118
|
+
const id = (0, import_react23.useId)().replace(/[:]/g, "");
|
|
16756
17119
|
const baseClass = `uv-grid-${id}`;
|
|
16757
17120
|
const baseCols = toTemplateCols(columns, minColumnWidth);
|
|
16758
17121
|
const baseRows = toTemplateRows(rows);
|
|
@@ -16795,7 +17158,7 @@ var GridRoot = import_react22.default.forwardRef(
|
|
|
16795
17158
|
css += `}}`;
|
|
16796
17159
|
});
|
|
16797
17160
|
}
|
|
16798
|
-
return /* @__PURE__ */ (0,
|
|
17161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
16799
17162
|
"div",
|
|
16800
17163
|
{
|
|
16801
17164
|
ref,
|
|
@@ -16803,7 +17166,7 @@ var GridRoot = import_react22.default.forwardRef(
|
|
|
16803
17166
|
style,
|
|
16804
17167
|
...rest,
|
|
16805
17168
|
children: [
|
|
16806
|
-
/* @__PURE__ */ (0,
|
|
17169
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("style", { dangerouslySetInnerHTML: { __html: css } }),
|
|
16807
17170
|
children
|
|
16808
17171
|
]
|
|
16809
17172
|
}
|
|
@@ -16811,7 +17174,7 @@ var GridRoot = import_react22.default.forwardRef(
|
|
|
16811
17174
|
}
|
|
16812
17175
|
);
|
|
16813
17176
|
GridRoot.displayName = "Grid";
|
|
16814
|
-
var GridItem =
|
|
17177
|
+
var GridItem = import_react23.default.forwardRef(
|
|
16815
17178
|
({
|
|
16816
17179
|
colSpan,
|
|
16817
17180
|
rowSpan,
|
|
@@ -16845,8 +17208,8 @@ var GridItem = import_react22.default.forwardRef(
|
|
|
16845
17208
|
st.opacity = 0;
|
|
16846
17209
|
st.animation = `uvGridItemFadeIn 0.5s ease-out forwards`;
|
|
16847
17210
|
}
|
|
16848
|
-
return /* @__PURE__ */ (0,
|
|
16849
|
-
animationDelay != null && /* @__PURE__ */ (0,
|
|
17211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
17212
|
+
animationDelay != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16850
17213
|
"style",
|
|
16851
17214
|
{
|
|
16852
17215
|
dangerouslySetInnerHTML: {
|
|
@@ -16854,7 +17217,7 @@ var GridItem = import_react22.default.forwardRef(
|
|
|
16854
17217
|
}
|
|
16855
17218
|
}
|
|
16856
17219
|
),
|
|
16857
|
-
/* @__PURE__ */ (0,
|
|
17220
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16858
17221
|
"div",
|
|
16859
17222
|
{
|
|
16860
17223
|
ref,
|
|
@@ -16875,19 +17238,19 @@ var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
|
16875
17238
|
var Grid_default = Grid;
|
|
16876
17239
|
|
|
16877
17240
|
// ../../components/ui/LineChart.tsx
|
|
16878
|
-
var
|
|
17241
|
+
var import_react25 = require("react");
|
|
16879
17242
|
|
|
16880
17243
|
// ../../components/ui/ChartTooltip.tsx
|
|
16881
|
-
var
|
|
17244
|
+
var import_react24 = require("react");
|
|
16882
17245
|
var import_react_dom6 = require("react-dom");
|
|
16883
|
-
var
|
|
17246
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
16884
17247
|
function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, secondaryValue, items, containerRef }) {
|
|
16885
|
-
const [isMounted, setIsMounted] = (0,
|
|
16886
|
-
const [position, setPosition] = (0,
|
|
16887
|
-
(0,
|
|
17248
|
+
const [isMounted, setIsMounted] = (0, import_react24.useState)(false);
|
|
17249
|
+
const [position, setPosition] = (0, import_react24.useState)(null);
|
|
17250
|
+
(0, import_react24.useEffect)(() => {
|
|
16888
17251
|
setIsMounted(true);
|
|
16889
17252
|
}, []);
|
|
16890
|
-
(0,
|
|
17253
|
+
(0, import_react24.useEffect)(() => {
|
|
16891
17254
|
if (visible && containerRef?.current) {
|
|
16892
17255
|
const rect = containerRef.current.getBoundingClientRect();
|
|
16893
17256
|
setPosition({
|
|
@@ -16897,7 +17260,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
|
|
|
16897
17260
|
}
|
|
16898
17261
|
}, [visible, x, y, containerRef]);
|
|
16899
17262
|
if (!visible || !isMounted || !position) return null;
|
|
16900
|
-
const tooltipContent = /* @__PURE__ */ (0,
|
|
17263
|
+
const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
16901
17264
|
"div",
|
|
16902
17265
|
{
|
|
16903
17266
|
style: {
|
|
@@ -16909,7 +17272,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
|
|
|
16909
17272
|
animation: "chartTooltipFadeIn 0.15s ease-out"
|
|
16910
17273
|
},
|
|
16911
17274
|
children: [
|
|
16912
|
-
/* @__PURE__ */ (0,
|
|
17275
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
16913
17276
|
"div",
|
|
16914
17277
|
{
|
|
16915
17278
|
className: cn("bg-popover text-popover-foreground border border-border", "rounded-2xl shadow-xl px-3 py-2 text-sm", "backdrop-blur-sm"),
|
|
@@ -16919,20 +17282,20 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
|
|
|
16919
17282
|
boxShadow: "0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 10px -2px rgba(0, 0, 0, 0.3)"
|
|
16920
17283
|
},
|
|
16921
17284
|
children: [
|
|
16922
|
-
label && /* @__PURE__ */ (0,
|
|
16923
|
-
items && items.length > 0 ? /* @__PURE__ */ (0,
|
|
16924
|
-
item.color && /* @__PURE__ */ (0,
|
|
16925
|
-
/* @__PURE__ */ (0,
|
|
17285
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "text-muted-foreground text-xs mb-1", children: label }),
|
|
17286
|
+
items && items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex flex-col gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
17287
|
+
item.color && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "w-2 h-2 rounded-full shrink-0", style: { backgroundColor: item.color } }),
|
|
17288
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
16926
17289
|
item.label,
|
|
16927
17290
|
":"
|
|
16928
17291
|
] }),
|
|
16929
|
-
/* @__PURE__ */ (0,
|
|
16930
|
-
] }, i)) }) : /* @__PURE__ */ (0,
|
|
16931
|
-
/* @__PURE__ */ (0,
|
|
16932
|
-
color && /* @__PURE__ */ (0,
|
|
16933
|
-
/* @__PURE__ */ (0,
|
|
17292
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-semibold ml-auto", children: item.value })
|
|
17293
|
+
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
17294
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
17295
|
+
color && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "w-2 h-2 rounded-full shrink-0", style: { backgroundColor: color } }),
|
|
17296
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-semibold", children: value })
|
|
16934
17297
|
] }),
|
|
16935
|
-
secondaryLabel && /* @__PURE__ */ (0,
|
|
17298
|
+
secondaryLabel && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "text-muted-foreground text-xs mt-1", children: [
|
|
16936
17299
|
secondaryLabel,
|
|
16937
17300
|
": ",
|
|
16938
17301
|
secondaryValue
|
|
@@ -16941,7 +17304,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
|
|
|
16941
17304
|
]
|
|
16942
17305
|
}
|
|
16943
17306
|
),
|
|
16944
|
-
/* @__PURE__ */ (0,
|
|
17307
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("style", { children: `
|
|
16945
17308
|
@keyframes chartTooltipFadeIn {
|
|
16946
17309
|
from { opacity: 0; transform: translateX(-5px); }
|
|
16947
17310
|
to { opacity: 1; transform: translateX(0); }
|
|
@@ -16954,7 +17317,7 @@ function ChartTooltip({ x, y, visible, label, value, color, secondaryLabel, seco
|
|
|
16954
17317
|
}
|
|
16955
17318
|
|
|
16956
17319
|
// ../../components/ui/LineChart.tsx
|
|
16957
|
-
var
|
|
17320
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
16958
17321
|
function LineChart({
|
|
16959
17322
|
data,
|
|
16960
17323
|
width = 400,
|
|
@@ -16969,12 +17332,12 @@ function LineChart({
|
|
|
16969
17332
|
curved = true,
|
|
16970
17333
|
className = ""
|
|
16971
17334
|
}) {
|
|
16972
|
-
const svgRef = (0,
|
|
17335
|
+
const svgRef = (0, import_react25.useRef)(null);
|
|
16973
17336
|
const padding = { top: 20, right: 20, bottom: 40, left: 40 };
|
|
16974
17337
|
const chartWidth = width - padding.left - padding.right;
|
|
16975
17338
|
const chartHeight = height - padding.top - padding.bottom;
|
|
16976
|
-
const [hoveredPoint, setHoveredPoint] = (0,
|
|
16977
|
-
const { minValue, maxValue, points, linePath, areaPath } = (0,
|
|
17339
|
+
const [hoveredPoint, setHoveredPoint] = (0, import_react25.useState)(null);
|
|
17340
|
+
const { minValue, maxValue, points, linePath, areaPath } = (0, import_react25.useMemo)(() => {
|
|
16978
17341
|
if (!data.length) return { minValue: 0, maxValue: 0, points: [], linePath: "", areaPath: "" };
|
|
16979
17342
|
const values = data.map((d) => d.value);
|
|
16980
17343
|
const min = Math.min(...values);
|
|
@@ -17009,7 +17372,7 @@ function LineChart({
|
|
|
17009
17372
|
}
|
|
17010
17373
|
return { minValue: min, maxValue: max, points: pts, linePath: path, areaPath: area };
|
|
17011
17374
|
}, [data, chartWidth, chartHeight, curved, padding.left, padding.top]);
|
|
17012
|
-
const gridLines = (0,
|
|
17375
|
+
const gridLines = (0, import_react25.useMemo)(() => {
|
|
17013
17376
|
const lines = [];
|
|
17014
17377
|
const steps = 5;
|
|
17015
17378
|
for (let i = 0; i <= steps; i++) {
|
|
@@ -17019,14 +17382,14 @@ function LineChart({
|
|
|
17019
17382
|
}
|
|
17020
17383
|
return lines;
|
|
17021
17384
|
}, [minValue, maxValue, chartHeight, padding.top]);
|
|
17022
|
-
return /* @__PURE__ */ (0,
|
|
17023
|
-
/* @__PURE__ */ (0,
|
|
17024
|
-
showGrid && /* @__PURE__ */ (0,
|
|
17025
|
-
/* @__PURE__ */ (0,
|
|
17026
|
-
/* @__PURE__ */ (0,
|
|
17385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
17386
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
17387
|
+
showGrid && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("g", { children: [
|
|
17388
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("line", { x1: padding.left, y1: line.y, x2: width - padding.right, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
17389
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("text", { x: padding.left - 8, y: line.y + 4, textAnchor: "end", fontSize: "10", fill: "currentColor", className: "text-muted-foreground", children: line.value.toFixed(0) })
|
|
17027
17390
|
] }, i)) }),
|
|
17028
|
-
fillColor && areaPath && /* @__PURE__ */ (0,
|
|
17029
|
-
linePath && /* @__PURE__ */ (0,
|
|
17391
|
+
fillColor && areaPath && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: areaPath, fill: fillColor, opacity: 0.2, className: animated ? "animate-[fadeIn_0.6s_ease-out]" : "" }),
|
|
17392
|
+
linePath && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17030
17393
|
"path",
|
|
17031
17394
|
{
|
|
17032
17395
|
d: linePath,
|
|
@@ -17043,14 +17406,14 @@ function LineChart({
|
|
|
17043
17406
|
} : void 0
|
|
17044
17407
|
}
|
|
17045
17408
|
),
|
|
17046
|
-
showDots && points.map((point, i) => /* @__PURE__ */ (0,
|
|
17409
|
+
showDots && points.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
17047
17410
|
"g",
|
|
17048
17411
|
{
|
|
17049
17412
|
onMouseEnter: () => setHoveredPoint({ x: point.x, y: point.y, label: point.label, value: point.value }),
|
|
17050
17413
|
onMouseLeave: () => setHoveredPoint(null),
|
|
17051
17414
|
className: "cursor-pointer",
|
|
17052
17415
|
children: [
|
|
17053
|
-
/* @__PURE__ */ (0,
|
|
17416
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17054
17417
|
"circle",
|
|
17055
17418
|
{
|
|
17056
17419
|
cx: point.x,
|
|
@@ -17061,14 +17424,14 @@ function LineChart({
|
|
|
17061
17424
|
style: animated ? { animationDelay: `${i * 0.05}s`, animationFillMode: "both" } : void 0
|
|
17062
17425
|
}
|
|
17063
17426
|
),
|
|
17064
|
-
/* @__PURE__ */ (0,
|
|
17065
|
-
showValues && /* @__PURE__ */ (0,
|
|
17427
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("circle", { cx: point.x, cy: point.y, r: 16, fill: "transparent" }),
|
|
17428
|
+
showValues && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("text", { x: point.x, y: point.y - 12, textAnchor: "middle", fontSize: "10", fontWeight: "500", className: "text-foreground", fill: "currentColor", children: point.value })
|
|
17066
17429
|
]
|
|
17067
17430
|
},
|
|
17068
17431
|
i
|
|
17069
17432
|
)),
|
|
17070
|
-
hoveredPoint && /* @__PURE__ */ (0,
|
|
17071
|
-
/* @__PURE__ */ (0,
|
|
17433
|
+
hoveredPoint && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("g", { className: "pointer-events-none", children: [
|
|
17434
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17072
17435
|
"line",
|
|
17073
17436
|
{
|
|
17074
17437
|
x1: hoveredPoint.x,
|
|
@@ -17081,7 +17444,7 @@ function LineChart({
|
|
|
17081
17444
|
opacity: 0.5
|
|
17082
17445
|
}
|
|
17083
17446
|
),
|
|
17084
|
-
/* @__PURE__ */ (0,
|
|
17447
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17085
17448
|
"line",
|
|
17086
17449
|
{
|
|
17087
17450
|
x1: padding.left,
|
|
@@ -17095,8 +17458,8 @@ function LineChart({
|
|
|
17095
17458
|
}
|
|
17096
17459
|
)
|
|
17097
17460
|
] }),
|
|
17098
|
-
showLabels && points.map((point, i) => /* @__PURE__ */ (0,
|
|
17099
|
-
/* @__PURE__ */ (0,
|
|
17461
|
+
showLabels && points.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("text", { x: point.x, y: height - 10, textAnchor: "middle", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: point.label }, i)),
|
|
17462
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("style", { children: `
|
|
17100
17463
|
@keyframes drawLine {
|
|
17101
17464
|
from { stroke-dashoffset: 1000; }
|
|
17102
17465
|
to { stroke-dashoffset: 0; }
|
|
@@ -17111,7 +17474,7 @@ function LineChart({
|
|
|
17111
17474
|
}
|
|
17112
17475
|
` })
|
|
17113
17476
|
] }),
|
|
17114
|
-
/* @__PURE__ */ (0,
|
|
17477
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
17115
17478
|
ChartTooltip,
|
|
17116
17479
|
{
|
|
17117
17480
|
x: hoveredPoint?.x ?? 0,
|
|
@@ -17127,8 +17490,8 @@ function LineChart({
|
|
|
17127
17490
|
}
|
|
17128
17491
|
|
|
17129
17492
|
// ../../components/ui/BarChart.tsx
|
|
17130
|
-
var
|
|
17131
|
-
var
|
|
17493
|
+
var import_react26 = require("react");
|
|
17494
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
17132
17495
|
function BarChart({
|
|
17133
17496
|
data,
|
|
17134
17497
|
width = 400,
|
|
@@ -17143,12 +17506,12 @@ function BarChart({
|
|
|
17143
17506
|
barGap = 0.3,
|
|
17144
17507
|
className = ""
|
|
17145
17508
|
}) {
|
|
17146
|
-
const svgRef = (0,
|
|
17509
|
+
const svgRef = (0, import_react26.useRef)(null);
|
|
17147
17510
|
const padding = horizontal ? { top: 20, right: 40, bottom: 20, left: 80 } : { top: 20, right: 20, bottom: 40, left: 40 };
|
|
17148
17511
|
const chartWidth = width - padding.left - padding.right;
|
|
17149
17512
|
const chartHeight = height - padding.top - padding.bottom;
|
|
17150
|
-
const [hoveredBar, setHoveredBar] = (0,
|
|
17151
|
-
const { maxValue, bars, gridLines } = (0,
|
|
17513
|
+
const [hoveredBar, setHoveredBar] = (0, import_react26.useState)(null);
|
|
17514
|
+
const { maxValue, bars, gridLines } = (0, import_react26.useMemo)(() => {
|
|
17152
17515
|
if (!data.length) return { maxValue: 0, bars: [], gridLines: [] };
|
|
17153
17516
|
const max = Math.max(...data.map((d) => d.value));
|
|
17154
17517
|
const barCount = data.length;
|
|
@@ -17197,16 +17560,16 @@ function BarChart({
|
|
|
17197
17560
|
}
|
|
17198
17561
|
return { maxValue: max, bars: barsData, gridLines: lines };
|
|
17199
17562
|
}, [data, chartWidth, chartHeight, horizontal, barGap, padding, width, height]);
|
|
17200
|
-
return /* @__PURE__ */ (0,
|
|
17201
|
-
/* @__PURE__ */ (0,
|
|
17202
|
-
showGrid && /* @__PURE__ */ (0,
|
|
17203
|
-
/* @__PURE__ */ (0,
|
|
17204
|
-
/* @__PURE__ */ (0,
|
|
17205
|
-
] }) : /* @__PURE__ */ (0,
|
|
17206
|
-
/* @__PURE__ */ (0,
|
|
17207
|
-
/* @__PURE__ */ (0,
|
|
17563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
17564
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
17565
|
+
showGrid && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("g", { children: horizontal ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
17566
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("line", { x1: line.x, y1: line.y1, x2: line.x, y2: line.y2, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
17567
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("text", { x: line.x, y: height - 8, textAnchor: "middle", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: line.value.toFixed(0) })
|
|
17568
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
17569
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("line", { x1: line.x1, y1: line.y, x2: line.x2, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
17570
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("text", { x: padding.left - 8, y: line.y + 4, textAnchor: "end", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: line.value.toFixed(0) })
|
|
17208
17571
|
] }) }, i)) }),
|
|
17209
|
-
bars.map((bar, i) => /* @__PURE__ */ (0,
|
|
17572
|
+
bars.map((bar, i) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
17210
17573
|
"g",
|
|
17211
17574
|
{
|
|
17212
17575
|
onMouseEnter: () => setHoveredBar({
|
|
@@ -17219,7 +17582,7 @@ function BarChart({
|
|
|
17219
17582
|
onMouseLeave: () => setHoveredBar(null),
|
|
17220
17583
|
className: "cursor-pointer",
|
|
17221
17584
|
children: [
|
|
17222
|
-
/* @__PURE__ */ (0,
|
|
17585
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
17223
17586
|
"rect",
|
|
17224
17587
|
{
|
|
17225
17588
|
x: bar.x,
|
|
@@ -17235,7 +17598,7 @@ function BarChart({
|
|
|
17235
17598
|
...horizontal ? { width: 0 } : { height: 0, y: padding.top + chartHeight }
|
|
17236
17599
|
} : void 0,
|
|
17237
17600
|
children: [
|
|
17238
|
-
/* @__PURE__ */ (0,
|
|
17601
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
17239
17602
|
"animate",
|
|
17240
17603
|
{
|
|
17241
17604
|
attributeName: horizontal ? "width" : "height",
|
|
@@ -17246,11 +17609,11 @@ function BarChart({
|
|
|
17246
17609
|
fill: "freeze"
|
|
17247
17610
|
}
|
|
17248
17611
|
),
|
|
17249
|
-
!horizontal && /* @__PURE__ */ (0,
|
|
17612
|
+
!horizontal && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("animate", { attributeName: "y", from: padding.top + chartHeight, to: bar.y, dur: "0.5s", begin: `${i * 0.1}s`, fill: "freeze" })
|
|
17250
17613
|
]
|
|
17251
17614
|
}
|
|
17252
17615
|
),
|
|
17253
|
-
showValues && /* @__PURE__ */ (0,
|
|
17616
|
+
showValues && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
17254
17617
|
"text",
|
|
17255
17618
|
{
|
|
17256
17619
|
x: horizontal ? bar.x + bar.width + 8 : bar.x + bar.width / 2,
|
|
@@ -17264,7 +17627,7 @@ function BarChart({
|
|
|
17264
17627
|
children: bar.value
|
|
17265
17628
|
}
|
|
17266
17629
|
),
|
|
17267
|
-
showLabels && /* @__PURE__ */ (0,
|
|
17630
|
+
showLabels && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
17268
17631
|
"text",
|
|
17269
17632
|
{
|
|
17270
17633
|
x: horizontal ? padding.left - 8 : bar.x + bar.width / 2,
|
|
@@ -17280,7 +17643,7 @@ function BarChart({
|
|
|
17280
17643
|
},
|
|
17281
17644
|
i
|
|
17282
17645
|
)),
|
|
17283
|
-
/* @__PURE__ */ (0,
|
|
17646
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("style", { children: `
|
|
17284
17647
|
@keyframes growHeight {
|
|
17285
17648
|
from { height: 0; }
|
|
17286
17649
|
}
|
|
@@ -17293,7 +17656,7 @@ function BarChart({
|
|
|
17293
17656
|
}
|
|
17294
17657
|
` })
|
|
17295
17658
|
] }),
|
|
17296
|
-
/* @__PURE__ */ (0,
|
|
17659
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
17297
17660
|
ChartTooltip,
|
|
17298
17661
|
{
|
|
17299
17662
|
x: hoveredBar?.x ?? 0,
|
|
@@ -17309,8 +17672,8 @@ function BarChart({
|
|
|
17309
17672
|
}
|
|
17310
17673
|
|
|
17311
17674
|
// ../../components/ui/PieChart.tsx
|
|
17312
|
-
var
|
|
17313
|
-
var
|
|
17675
|
+
var import_react27 = require("react");
|
|
17676
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
17314
17677
|
function PieChart({
|
|
17315
17678
|
data,
|
|
17316
17679
|
size = 200,
|
|
@@ -17323,11 +17686,11 @@ function PieChart({
|
|
|
17323
17686
|
startAngle = -90,
|
|
17324
17687
|
className = ""
|
|
17325
17688
|
}) {
|
|
17326
|
-
const containerRef = (0,
|
|
17689
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
17327
17690
|
const center = size / 2;
|
|
17328
17691
|
const radius = size / 2 - 10;
|
|
17329
17692
|
const innerRadius = donut ? radius - donutWidth : 0;
|
|
17330
|
-
const { segments, total } = (0,
|
|
17693
|
+
const { segments, total } = (0, import_react27.useMemo)(() => {
|
|
17331
17694
|
if (!data.length) return { segments: [], total: 0 };
|
|
17332
17695
|
const sum = data.reduce((acc, d) => acc + d.value, 0);
|
|
17333
17696
|
let currentAngle = startAngle;
|
|
@@ -17373,11 +17736,11 @@ function PieChart({
|
|
|
17373
17736
|
});
|
|
17374
17737
|
return { segments: segs, total: sum };
|
|
17375
17738
|
}, [data, center, radius, innerRadius, donut, startAngle]);
|
|
17376
|
-
const [hoveredSegment, setHoveredSegment] = (0,
|
|
17377
|
-
return /* @__PURE__ */ (0,
|
|
17378
|
-
/* @__PURE__ */ (0,
|
|
17379
|
-
/* @__PURE__ */ (0,
|
|
17380
|
-
segments.map((seg, i) => /* @__PURE__ */ (0,
|
|
17739
|
+
const [hoveredSegment, setHoveredSegment] = (0, import_react27.useState)(null);
|
|
17740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { ref: containerRef, className: `relative flex items-center gap-6 ${className}`, children: [
|
|
17741
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("svg", { width: size + 40, height: size + 40, className: "overflow-visible", style: { fontFamily: "inherit" }, children: [
|
|
17742
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("g", { transform: `translate(20, 20)`, children: [
|
|
17743
|
+
segments.map((seg, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
17381
17744
|
"g",
|
|
17382
17745
|
{
|
|
17383
17746
|
onMouseEnter: () => setHoveredSegment({
|
|
@@ -17390,7 +17753,7 @@ function PieChart({
|
|
|
17390
17753
|
}),
|
|
17391
17754
|
onMouseLeave: () => setHoveredSegment(null),
|
|
17392
17755
|
children: [
|
|
17393
|
-
/* @__PURE__ */ (0,
|
|
17756
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
17394
17757
|
"path",
|
|
17395
17758
|
{
|
|
17396
17759
|
d: seg.path,
|
|
@@ -17406,7 +17769,7 @@ function PieChart({
|
|
|
17406
17769
|
}
|
|
17407
17770
|
}
|
|
17408
17771
|
),
|
|
17409
|
-
showLabels && /* @__PURE__ */ (0,
|
|
17772
|
+
showLabels && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
17410
17773
|
"text",
|
|
17411
17774
|
{
|
|
17412
17775
|
x: seg.labelX,
|
|
@@ -17423,12 +17786,12 @@ function PieChart({
|
|
|
17423
17786
|
},
|
|
17424
17787
|
i
|
|
17425
17788
|
)),
|
|
17426
|
-
donut && /* @__PURE__ */ (0,
|
|
17427
|
-
/* @__PURE__ */ (0,
|
|
17428
|
-
/* @__PURE__ */ (0,
|
|
17789
|
+
donut && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("g", { children: [
|
|
17790
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("text", { x: center, y: center - 5, textAnchor: "middle", fontSize: "12", className: "text-muted-foreground", fill: "currentColor", children: "Total" }),
|
|
17791
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("text", { x: center, y: center + 15, textAnchor: "middle", fontSize: "18", fontWeight: "600", className: "text-foreground", fill: "currentColor", children: total })
|
|
17429
17792
|
] })
|
|
17430
17793
|
] }),
|
|
17431
|
-
/* @__PURE__ */ (0,
|
|
17794
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("style", { children: `
|
|
17432
17795
|
@keyframes pieSlice {
|
|
17433
17796
|
from {
|
|
17434
17797
|
opacity: 0;
|
|
@@ -17445,20 +17808,20 @@ function PieChart({
|
|
|
17445
17808
|
}
|
|
17446
17809
|
` })
|
|
17447
17810
|
] }),
|
|
17448
|
-
showLegend && /* @__PURE__ */ (0,
|
|
17811
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex flex-col gap-2", children: segments.map((seg, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
17449
17812
|
"div",
|
|
17450
17813
|
{
|
|
17451
17814
|
className: "flex items-center gap-2 text-sm",
|
|
17452
17815
|
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.1 + 0.3}s forwards` } : void 0,
|
|
17453
17816
|
children: [
|
|
17454
|
-
/* @__PURE__ */ (0,
|
|
17455
|
-
/* @__PURE__ */ (0,
|
|
17456
|
-
/* @__PURE__ */ (0,
|
|
17817
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "w-3 h-3 rounded-md shrink-0", style: { backgroundColor: seg.color } }),
|
|
17818
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-muted-foreground", children: seg.label }),
|
|
17819
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-foreground font-medium ml-auto", children: showPercentage ? `${(seg.percentage * 100).toFixed(0)}%` : seg.value })
|
|
17457
17820
|
]
|
|
17458
17821
|
},
|
|
17459
17822
|
i
|
|
17460
17823
|
)) }),
|
|
17461
|
-
/* @__PURE__ */ (0,
|
|
17824
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
17462
17825
|
ChartTooltip,
|
|
17463
17826
|
{
|
|
17464
17827
|
x: hoveredSegment?.x ?? center,
|
|
@@ -17474,8 +17837,8 @@ function PieChart({
|
|
|
17474
17837
|
}
|
|
17475
17838
|
|
|
17476
17839
|
// ../../components/ui/AreaChart.tsx
|
|
17477
|
-
var
|
|
17478
|
-
var
|
|
17840
|
+
var import_react28 = require("react");
|
|
17841
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
17479
17842
|
function getCatmullRomSpline(points) {
|
|
17480
17843
|
if (points.length < 2) return "";
|
|
17481
17844
|
if (points.length === 2) {
|
|
@@ -17509,12 +17872,12 @@ function AreaChart({
|
|
|
17509
17872
|
curved = true,
|
|
17510
17873
|
className = ""
|
|
17511
17874
|
}) {
|
|
17512
|
-
const containerRef = (0,
|
|
17875
|
+
const containerRef = (0, import_react28.useRef)(null);
|
|
17513
17876
|
const padding = { top: 20, right: 20, bottom: 40, left: 50 };
|
|
17514
17877
|
const chartWidth = width - padding.left - padding.right;
|
|
17515
17878
|
const chartHeight = height - padding.top - padding.bottom;
|
|
17516
|
-
const [hoveredPoint, setHoveredPoint] = (0,
|
|
17517
|
-
const { processedSeries, gridLines, maxValue, labels } = (0,
|
|
17879
|
+
const [hoveredPoint, setHoveredPoint] = (0, import_react28.useState)(null);
|
|
17880
|
+
const { processedSeries, gridLines, maxValue, labels } = (0, import_react28.useMemo)(() => {
|
|
17518
17881
|
if (!series.length || !series[0]?.data?.length) {
|
|
17519
17882
|
return { processedSeries: [], gridLines: [], maxValue: 0, labels: [] };
|
|
17520
17883
|
}
|
|
@@ -17582,13 +17945,13 @@ function AreaChart({
|
|
|
17582
17945
|
}
|
|
17583
17946
|
return { processedSeries: processed, gridLines: lines, maxValue: max, labels: allLabels };
|
|
17584
17947
|
}, [series, chartWidth, chartHeight, padding, stacked, curved]);
|
|
17585
|
-
return /* @__PURE__ */ (0,
|
|
17586
|
-
/* @__PURE__ */ (0,
|
|
17587
|
-
showGrid && /* @__PURE__ */ (0,
|
|
17588
|
-
/* @__PURE__ */ (0,
|
|
17589
|
-
/* @__PURE__ */ (0,
|
|
17948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { ref: containerRef, className: `relative flex flex-col gap-4 ${className}`, children: [
|
|
17949
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("svg", { width, height, className: "overflow-visible", style: { fontFamily: "inherit" }, children: [
|
|
17950
|
+
showGrid && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("g", { children: [
|
|
17951
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("line", { x1: padding.left, y1: line.y, x2: width - padding.right, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
17952
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("text", { x: padding.left - 8, y: line.y + 4, textAnchor: "end", fontSize: "10", className: "text-muted-foreground", fill: "currentColor", children: line.value.toFixed(0) })
|
|
17590
17953
|
] }, i)) }),
|
|
17591
|
-
[...processedSeries].reverse().map((s, i) => /* @__PURE__ */ (0,
|
|
17954
|
+
[...processedSeries].reverse().map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
17592
17955
|
"path",
|
|
17593
17956
|
{
|
|
17594
17957
|
d: s.areaPath,
|
|
@@ -17602,7 +17965,7 @@ function AreaChart({
|
|
|
17602
17965
|
},
|
|
17603
17966
|
`area-${i}`
|
|
17604
17967
|
)),
|
|
17605
|
-
processedSeries.map((s, i) => /* @__PURE__ */ (0,
|
|
17968
|
+
processedSeries.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
17606
17969
|
"path",
|
|
17607
17970
|
{
|
|
17608
17971
|
d: s.linePath,
|
|
@@ -17620,7 +17983,7 @@ function AreaChart({
|
|
|
17620
17983
|
`line-${i}`
|
|
17621
17984
|
)),
|
|
17622
17985
|
showDots && processedSeries.map(
|
|
17623
|
-
(s, seriesIdx) => s.points.map((point, i) => /* @__PURE__ */ (0,
|
|
17986
|
+
(s, seriesIdx) => s.points.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
17624
17987
|
"g",
|
|
17625
17988
|
{
|
|
17626
17989
|
onMouseEnter: () => {
|
|
@@ -17639,7 +18002,7 @@ function AreaChart({
|
|
|
17639
18002
|
onMouseLeave: () => setHoveredPoint(null),
|
|
17640
18003
|
className: "cursor-pointer",
|
|
17641
18004
|
children: [
|
|
17642
|
-
/* @__PURE__ */ (0,
|
|
18005
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
17643
18006
|
"circle",
|
|
17644
18007
|
{
|
|
17645
18008
|
cx: point.x,
|
|
@@ -17655,17 +18018,17 @@ function AreaChart({
|
|
|
17655
18018
|
} : void 0
|
|
17656
18019
|
}
|
|
17657
18020
|
),
|
|
17658
|
-
/* @__PURE__ */ (0,
|
|
18021
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("circle", { cx: point.x, cy: point.y, r: 12, fill: "transparent" })
|
|
17659
18022
|
]
|
|
17660
18023
|
},
|
|
17661
18024
|
`dot-${seriesIdx}-${i}`
|
|
17662
18025
|
))
|
|
17663
18026
|
),
|
|
17664
|
-
showLabels && /* @__PURE__ */ (0,
|
|
18027
|
+
showLabels && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("g", { className: "text-muted-foreground", children: labels.map((label, i) => {
|
|
17665
18028
|
const x = padding.left + i / (labels.length - 1) * chartWidth;
|
|
17666
|
-
return /* @__PURE__ */ (0,
|
|
18029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("text", { x, y: height - 10, textAnchor: "middle", fontSize: "10", fill: "currentColor", children: label }, i);
|
|
17667
18030
|
}) }),
|
|
17668
|
-
hoveredPoint && /* @__PURE__ */ (0,
|
|
18031
|
+
hoveredPoint && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("g", { className: "pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
17669
18032
|
"line",
|
|
17670
18033
|
{
|
|
17671
18034
|
x1: hoveredPoint.x,
|
|
@@ -17679,7 +18042,7 @@ function AreaChart({
|
|
|
17679
18042
|
className: "text-foreground"
|
|
17680
18043
|
}
|
|
17681
18044
|
) }),
|
|
17682
|
-
/* @__PURE__ */ (0,
|
|
18045
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("style", { children: `
|
|
17683
18046
|
@keyframes drawLine {
|
|
17684
18047
|
to {
|
|
17685
18048
|
stroke-dashoffset: 0;
|
|
@@ -17701,19 +18064,19 @@ function AreaChart({
|
|
|
17701
18064
|
}
|
|
17702
18065
|
` })
|
|
17703
18066
|
] }),
|
|
17704
|
-
showLegend && /* @__PURE__ */ (0,
|
|
18067
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex items-center justify-center gap-6", children: series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
17705
18068
|
"div",
|
|
17706
18069
|
{
|
|
17707
18070
|
className: "flex items-center gap-2 text-sm",
|
|
17708
18071
|
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.1 + 0.5}s forwards` } : void 0,
|
|
17709
18072
|
children: [
|
|
17710
|
-
/* @__PURE__ */ (0,
|
|
17711
|
-
/* @__PURE__ */ (0,
|
|
18073
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "w-3 h-3 rounded-md", style: { backgroundColor: s.color } }),
|
|
18074
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-muted-foreground", children: s.name })
|
|
17712
18075
|
]
|
|
17713
18076
|
},
|
|
17714
18077
|
i
|
|
17715
18078
|
)) }),
|
|
17716
|
-
/* @__PURE__ */ (0,
|
|
18079
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
17717
18080
|
ChartTooltip,
|
|
17718
18081
|
{
|
|
17719
18082
|
x: hoveredPoint?.x ?? 0,
|
|
@@ -17728,8 +18091,8 @@ function AreaChart({
|
|
|
17728
18091
|
}
|
|
17729
18092
|
|
|
17730
18093
|
// ../../components/ui/Sparkline.tsx
|
|
17731
|
-
var
|
|
17732
|
-
var
|
|
18094
|
+
var import_react29 = require("react");
|
|
18095
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
17733
18096
|
function getCatmullRomSpline2(points) {
|
|
17734
18097
|
if (points.length < 2) return "";
|
|
17735
18098
|
if (points.length === 2) {
|
|
@@ -17767,7 +18130,7 @@ function Sparkline({
|
|
|
17767
18130
|
const padding = 4;
|
|
17768
18131
|
const chartWidth = width - padding * 2;
|
|
17769
18132
|
const chartHeight = height - padding * 2;
|
|
17770
|
-
const { points, linePath, areaPath, lineLength, trend } = (0,
|
|
18133
|
+
const { points, linePath, areaPath, lineLength, trend } = (0, import_react29.useMemo)(() => {
|
|
17771
18134
|
const normalizedData = data.map((d) => typeof d === "number" ? d : d.value);
|
|
17772
18135
|
if (!normalizedData.length) {
|
|
17773
18136
|
return { points: [], linePath: "", areaPath: "", lineLength: 0, trend: 0 };
|
|
@@ -17791,8 +18154,8 @@ function Sparkline({
|
|
|
17791
18154
|
return { points: pts, linePath: line, areaPath: area, lineLength: length, trend: trendValue };
|
|
17792
18155
|
}, [data, chartWidth, chartHeight, padding, curved]);
|
|
17793
18156
|
const effectiveFillColor = fillColor || color;
|
|
17794
|
-
return /* @__PURE__ */ (0,
|
|
17795
|
-
showFill && /* @__PURE__ */ (0,
|
|
18157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
18158
|
+
showFill && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
17796
18159
|
"path",
|
|
17797
18160
|
{
|
|
17798
18161
|
d: areaPath,
|
|
@@ -17801,7 +18164,7 @@ function Sparkline({
|
|
|
17801
18164
|
style: animated ? { opacity: 0, animation: "fadeIn 0.5s ease-out 0.3s forwards" } : void 0
|
|
17802
18165
|
}
|
|
17803
18166
|
),
|
|
17804
|
-
/* @__PURE__ */ (0,
|
|
18167
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
17805
18168
|
"path",
|
|
17806
18169
|
{
|
|
17807
18170
|
d: linePath,
|
|
@@ -17817,7 +18180,7 @@ function Sparkline({
|
|
|
17817
18180
|
} : void 0
|
|
17818
18181
|
}
|
|
17819
18182
|
),
|
|
17820
|
-
showDots && points.map((point, i) => /* @__PURE__ */ (0,
|
|
18183
|
+
showDots && points.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
17821
18184
|
"circle",
|
|
17822
18185
|
{
|
|
17823
18186
|
cx: point.x,
|
|
@@ -17831,7 +18194,7 @@ function Sparkline({
|
|
|
17831
18194
|
},
|
|
17832
18195
|
i
|
|
17833
18196
|
)),
|
|
17834
|
-
showEndDot && !showDots && points.length > 0 && /* @__PURE__ */ (0,
|
|
18197
|
+
showEndDot && !showDots && points.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
17835
18198
|
"circle",
|
|
17836
18199
|
{
|
|
17837
18200
|
cx: points[points.length - 1].x,
|
|
@@ -17846,7 +18209,7 @@ function Sparkline({
|
|
|
17846
18209
|
} : void 0
|
|
17847
18210
|
}
|
|
17848
18211
|
),
|
|
17849
|
-
/* @__PURE__ */ (0,
|
|
18212
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("style", { children: `
|
|
17850
18213
|
@keyframes drawLine {
|
|
17851
18214
|
to {
|
|
17852
18215
|
stroke-dashoffset: 0;
|
|
@@ -17871,8 +18234,8 @@ function Sparkline({
|
|
|
17871
18234
|
}
|
|
17872
18235
|
|
|
17873
18236
|
// ../../components/ui/RadarChart.tsx
|
|
17874
|
-
var
|
|
17875
|
-
var
|
|
18237
|
+
var import_react30 = require("react");
|
|
18238
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
17876
18239
|
function RadarChart({
|
|
17877
18240
|
series,
|
|
17878
18241
|
size = 300,
|
|
@@ -17883,11 +18246,11 @@ function RadarChart({
|
|
|
17883
18246
|
animated = true,
|
|
17884
18247
|
className = ""
|
|
17885
18248
|
}) {
|
|
17886
|
-
const containerRef = (0,
|
|
18249
|
+
const containerRef = (0, import_react30.useRef)(null);
|
|
17887
18250
|
const center = size / 2;
|
|
17888
18251
|
const radius = size / 2 - 40;
|
|
17889
|
-
const [hoveredPoint, setHoveredPoint] = (0,
|
|
17890
|
-
const { axes, processedSeries, levelPaths } = (0,
|
|
18252
|
+
const [hoveredPoint, setHoveredPoint] = (0, import_react30.useState)(null);
|
|
18253
|
+
const { axes, processedSeries, levelPaths } = (0, import_react30.useMemo)(() => {
|
|
17891
18254
|
if (!series.length || !series[0]?.data?.length) {
|
|
17892
18255
|
return { axes: [], processedSeries: [], levelPaths: [] };
|
|
17893
18256
|
}
|
|
@@ -17937,12 +18300,12 @@ function RadarChart({
|
|
|
17937
18300
|
});
|
|
17938
18301
|
return { axes: axesData, processedSeries: processed, levelPaths: levelsData };
|
|
17939
18302
|
}, [series, center, radius, levels]);
|
|
17940
|
-
return /* @__PURE__ */ (0,
|
|
17941
|
-
/* @__PURE__ */ (0,
|
|
17942
|
-
/* @__PURE__ */ (0,
|
|
17943
|
-
/* @__PURE__ */ (0,
|
|
17944
|
-
processedSeries.map((s, i) => /* @__PURE__ */ (0,
|
|
17945
|
-
/* @__PURE__ */ (0,
|
|
18303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { ref: containerRef, className: `relative flex flex-col gap-4 ${className}`, children: [
|
|
18304
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("svg", { width: size, height: size, className: "overflow-visible", style: { fontFamily: "inherit" }, children: [
|
|
18305
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { className: "text-muted-foreground/20", children: levelPaths.map((level, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("path", { d: level.path, fill: "none", stroke: "currentColor", strokeWidth: 1 }, i)) }),
|
|
18306
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { className: "text-muted-foreground/30", children: axes.map((axis, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("line", { x1: center, y1: center, x2: axis.x, y2: axis.y, stroke: "currentColor", strokeWidth: 1 }, i)) }),
|
|
18307
|
+
processedSeries.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("g", { children: [
|
|
18308
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
17946
18309
|
"path",
|
|
17947
18310
|
{
|
|
17948
18311
|
d: s.path,
|
|
@@ -17960,7 +18323,7 @@ function RadarChart({
|
|
|
17960
18323
|
} : void 0
|
|
17961
18324
|
}
|
|
17962
18325
|
),
|
|
17963
|
-
s.points.map((point, j) => /* @__PURE__ */ (0,
|
|
18326
|
+
s.points.map((point, j) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
17964
18327
|
"g",
|
|
17965
18328
|
{
|
|
17966
18329
|
onMouseEnter: () => {
|
|
@@ -17979,7 +18342,7 @@ function RadarChart({
|
|
|
17979
18342
|
onMouseLeave: () => setHoveredPoint(null),
|
|
17980
18343
|
className: "cursor-pointer",
|
|
17981
18344
|
children: [
|
|
17982
|
-
/* @__PURE__ */ (0,
|
|
18345
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
17983
18346
|
"circle",
|
|
17984
18347
|
{
|
|
17985
18348
|
cx: point.x,
|
|
@@ -17995,12 +18358,12 @@ function RadarChart({
|
|
|
17995
18358
|
} : void 0
|
|
17996
18359
|
}
|
|
17997
18360
|
),
|
|
17998
|
-
/* @__PURE__ */ (0,
|
|
18361
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("circle", { cx: point.x, cy: point.y, r: 12, fill: "transparent" })
|
|
17999
18362
|
]
|
|
18000
18363
|
},
|
|
18001
18364
|
j
|
|
18002
18365
|
)),
|
|
18003
|
-
showValues && s.points.map((point, j) => /* @__PURE__ */ (0,
|
|
18366
|
+
showValues && s.points.map((point, j) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
18004
18367
|
"text",
|
|
18005
18368
|
{
|
|
18006
18369
|
x: point.x,
|
|
@@ -18016,8 +18379,8 @@ function RadarChart({
|
|
|
18016
18379
|
`val-${j}`
|
|
18017
18380
|
))
|
|
18018
18381
|
] }, i)),
|
|
18019
|
-
showLabels && /* @__PURE__ */ (0,
|
|
18020
|
-
/* @__PURE__ */ (0,
|
|
18382
|
+
showLabels && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { className: "text-muted-foreground", children: axes.map((axis, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("text", { x: axis.labelX, y: axis.labelY, textAnchor: "middle", dominantBaseline: "middle", fontSize: "11", fill: "currentColor", children: axis.label }, i)) }),
|
|
18383
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("style", { children: `
|
|
18021
18384
|
@keyframes radarPop {
|
|
18022
18385
|
from {
|
|
18023
18386
|
opacity: 0;
|
|
@@ -18044,19 +18407,19 @@ function RadarChart({
|
|
|
18044
18407
|
}
|
|
18045
18408
|
` })
|
|
18046
18409
|
] }),
|
|
18047
|
-
showLegend && /* @__PURE__ */ (0,
|
|
18410
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "flex items-center justify-center gap-6", children: series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
18048
18411
|
"div",
|
|
18049
18412
|
{
|
|
18050
18413
|
className: "flex items-center gap-2 text-sm",
|
|
18051
18414
|
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.1 + 0.5}s forwards` } : void 0,
|
|
18052
18415
|
children: [
|
|
18053
|
-
/* @__PURE__ */ (0,
|
|
18054
|
-
/* @__PURE__ */ (0,
|
|
18416
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "w-3 h-3 rounded-md", style: { backgroundColor: s.color } }),
|
|
18417
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-muted-foreground", children: s.name })
|
|
18055
18418
|
]
|
|
18056
18419
|
},
|
|
18057
18420
|
i
|
|
18058
18421
|
)) }),
|
|
18059
|
-
/* @__PURE__ */ (0,
|
|
18422
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
18060
18423
|
ChartTooltip,
|
|
18061
18424
|
{
|
|
18062
18425
|
x: hoveredPoint?.x ?? 0,
|
|
@@ -18071,8 +18434,8 @@ function RadarChart({
|
|
|
18071
18434
|
}
|
|
18072
18435
|
|
|
18073
18436
|
// ../../components/ui/GaugeChart.tsx
|
|
18074
|
-
var
|
|
18075
|
-
var
|
|
18437
|
+
var import_react31 = require("react");
|
|
18438
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
18076
18439
|
function GaugeChart({
|
|
18077
18440
|
value,
|
|
18078
18441
|
min = 0,
|
|
@@ -18091,7 +18454,7 @@ function GaugeChart({
|
|
|
18091
18454
|
}) {
|
|
18092
18455
|
const center = size / 2;
|
|
18093
18456
|
const radius = center - thickness / 2 - 10;
|
|
18094
|
-
const { backgroundPath, valuePath, percentage, needleAngle } = (0,
|
|
18457
|
+
const { backgroundPath, valuePath, percentage, needleAngle } = (0, import_react31.useMemo)(() => {
|
|
18095
18458
|
const normalizedValue = Math.min(Math.max(value, min), max);
|
|
18096
18459
|
const pct = (normalizedValue - min) / (max - min);
|
|
18097
18460
|
const totalAngle = endAngle - startAngle;
|
|
@@ -18120,8 +18483,8 @@ function GaugeChart({
|
|
|
18120
18483
|
const needleAngleRad = needleAngle * Math.PI / 180;
|
|
18121
18484
|
const needleX = center + needleLength * Math.cos(needleAngleRad);
|
|
18122
18485
|
const needleY = center + needleLength * Math.sin(needleAngleRad);
|
|
18123
|
-
return /* @__PURE__ */ (0,
|
|
18124
|
-
/* @__PURE__ */ (0,
|
|
18486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("svg", { width: size, height: size * 0.7, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
18487
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
18125
18488
|
"path",
|
|
18126
18489
|
{
|
|
18127
18490
|
d: backgroundPath,
|
|
@@ -18132,7 +18495,7 @@ function GaugeChart({
|
|
|
18132
18495
|
className: !backgroundColor ? "text-muted-foreground/20" : ""
|
|
18133
18496
|
}
|
|
18134
18497
|
),
|
|
18135
|
-
/* @__PURE__ */ (0,
|
|
18498
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
18136
18499
|
"path",
|
|
18137
18500
|
{
|
|
18138
18501
|
d: valuePath,
|
|
@@ -18147,7 +18510,7 @@ function GaugeChart({
|
|
|
18147
18510
|
} : void 0
|
|
18148
18511
|
}
|
|
18149
18512
|
),
|
|
18150
|
-
/* @__PURE__ */ (0,
|
|
18513
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
18151
18514
|
"g",
|
|
18152
18515
|
{
|
|
18153
18516
|
style: animated ? {
|
|
@@ -18160,14 +18523,14 @@ function GaugeChart({
|
|
|
18160
18523
|
transformOrigin: `${center}px ${center}px`
|
|
18161
18524
|
},
|
|
18162
18525
|
children: [
|
|
18163
|
-
/* @__PURE__ */ (0,
|
|
18164
|
-
/* @__PURE__ */ (0,
|
|
18165
|
-
/* @__PURE__ */ (0,
|
|
18526
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("line", { x1: center, y1: center, x2: center + needleLength, y2: center, stroke: color, strokeWidth: 3, strokeLinecap: "round" }),
|
|
18527
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("circle", { cx: center, cy: center, r: 8, fill: color }),
|
|
18528
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("circle", { cx: center, cy: center, r: 4, className: "text-background", fill: "currentColor" })
|
|
18166
18529
|
]
|
|
18167
18530
|
}
|
|
18168
18531
|
),
|
|
18169
|
-
showMinMax && /* @__PURE__ */ (0,
|
|
18170
|
-
/* @__PURE__ */ (0,
|
|
18532
|
+
showMinMax && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("g", { className: "text-muted-foreground", children: [
|
|
18533
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
18171
18534
|
"text",
|
|
18172
18535
|
{
|
|
18173
18536
|
x: center + (radius + 20) * Math.cos(startAngle * Math.PI / 180),
|
|
@@ -18178,7 +18541,7 @@ function GaugeChart({
|
|
|
18178
18541
|
children: min
|
|
18179
18542
|
}
|
|
18180
18543
|
),
|
|
18181
|
-
/* @__PURE__ */ (0,
|
|
18544
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
18182
18545
|
"text",
|
|
18183
18546
|
{
|
|
18184
18547
|
x: center + (radius + 20) * Math.cos(endAngle * Math.PI / 180),
|
|
@@ -18190,8 +18553,8 @@ function GaugeChart({
|
|
|
18190
18553
|
}
|
|
18191
18554
|
)
|
|
18192
18555
|
] }),
|
|
18193
|
-
showValue && /* @__PURE__ */ (0,
|
|
18194
|
-
/* @__PURE__ */ (0,
|
|
18556
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("g", { children: [
|
|
18557
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
18195
18558
|
"text",
|
|
18196
18559
|
{
|
|
18197
18560
|
x: center,
|
|
@@ -18205,7 +18568,7 @@ function GaugeChart({
|
|
|
18205
18568
|
children: value
|
|
18206
18569
|
}
|
|
18207
18570
|
),
|
|
18208
|
-
label && /* @__PURE__ */ (0,
|
|
18571
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
18209
18572
|
"text",
|
|
18210
18573
|
{
|
|
18211
18574
|
x: center,
|
|
@@ -18219,7 +18582,7 @@ function GaugeChart({
|
|
|
18219
18582
|
}
|
|
18220
18583
|
)
|
|
18221
18584
|
] }),
|
|
18222
|
-
/* @__PURE__ */ (0,
|
|
18585
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("style", { children: `
|
|
18223
18586
|
@keyframes drawArc {
|
|
18224
18587
|
to {
|
|
18225
18588
|
stroke-dashoffset: 0;
|
|
@@ -18239,22 +18602,22 @@ function GaugeChart({
|
|
|
18239
18602
|
}
|
|
18240
18603
|
|
|
18241
18604
|
// ../../components/ui/ClientOnly.tsx
|
|
18242
|
-
var
|
|
18243
|
-
var
|
|
18605
|
+
var import_react32 = require("react");
|
|
18606
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
18244
18607
|
function ClientOnly({ children, fallback = null }) {
|
|
18245
|
-
const [hasMounted, setHasMounted] = (0,
|
|
18246
|
-
(0,
|
|
18608
|
+
const [hasMounted, setHasMounted] = (0, import_react32.useState)(false);
|
|
18609
|
+
(0, import_react32.useEffect)(() => {
|
|
18247
18610
|
setHasMounted(true);
|
|
18248
18611
|
}, []);
|
|
18249
18612
|
if (!hasMounted) {
|
|
18250
|
-
return /* @__PURE__ */ (0,
|
|
18613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: fallback });
|
|
18251
18614
|
}
|
|
18252
|
-
return /* @__PURE__ */ (0,
|
|
18615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children });
|
|
18253
18616
|
}
|
|
18254
18617
|
|
|
18255
18618
|
// ../../components/ui/Loading.tsx
|
|
18256
|
-
var
|
|
18257
|
-
var
|
|
18619
|
+
var import_lucide_react33 = require("lucide-react");
|
|
18620
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
18258
18621
|
var LoadingSpinner = ({
|
|
18259
18622
|
size = "md",
|
|
18260
18623
|
className,
|
|
@@ -18270,8 +18633,8 @@ var LoadingSpinner = ({
|
|
|
18270
18633
|
foreground: "text-foreground",
|
|
18271
18634
|
muted: "text-muted-foreground"
|
|
18272
18635
|
};
|
|
18273
|
-
return /* @__PURE__ */ (0,
|
|
18274
|
-
|
|
18636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
18637
|
+
import_lucide_react33.Activity,
|
|
18275
18638
|
{
|
|
18276
18639
|
className: cn(
|
|
18277
18640
|
"animate-spin",
|
|
@@ -18291,7 +18654,7 @@ var LoadingDots = ({
|
|
|
18291
18654
|
foreground: "bg-foreground",
|
|
18292
18655
|
muted: "bg-muted-foreground"
|
|
18293
18656
|
};
|
|
18294
|
-
return /* @__PURE__ */ (0,
|
|
18657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: cn("flex items-center space-x-1", className), children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
18295
18658
|
"div",
|
|
18296
18659
|
{
|
|
18297
18660
|
className: cn(
|
|
@@ -18313,7 +18676,7 @@ var LoadingBar = ({
|
|
|
18313
18676
|
label
|
|
18314
18677
|
}) => {
|
|
18315
18678
|
const pct = progress ? Math.min(Math.max(progress, 0), 100) : void 0;
|
|
18316
|
-
return /* @__PURE__ */ (0,
|
|
18679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
18317
18680
|
"div",
|
|
18318
18681
|
{
|
|
18319
18682
|
className: cn("w-full bg-muted rounded-full h-2", className),
|
|
@@ -18322,7 +18685,7 @@ var LoadingBar = ({
|
|
|
18322
18685
|
"aria-valuemax": pct === void 0 ? void 0 : 100,
|
|
18323
18686
|
"aria-valuenow": pct === void 0 ? void 0 : Math.round(pct),
|
|
18324
18687
|
"aria-label": label || "Loading",
|
|
18325
|
-
children: /* @__PURE__ */ (0,
|
|
18688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
18326
18689
|
"div",
|
|
18327
18690
|
{
|
|
18328
18691
|
className: cn(
|
|
@@ -18339,9 +18702,9 @@ var LoadingBar = ({
|
|
|
18339
18702
|
};
|
|
18340
18703
|
|
|
18341
18704
|
// ../../components/ui/Table.tsx
|
|
18342
|
-
var
|
|
18343
|
-
var
|
|
18344
|
-
var Table =
|
|
18705
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
18706
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
18707
|
+
var Table = import_react33.default.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
18345
18708
|
"div",
|
|
18346
18709
|
{
|
|
18347
18710
|
className: cn(
|
|
@@ -18351,20 +18714,20 @@ var Table = import_react32.default.forwardRef(({ className, containerClassName,
|
|
|
18351
18714
|
"backdrop-blur-sm transition-all duration-300",
|
|
18352
18715
|
containerClassName
|
|
18353
18716
|
),
|
|
18354
|
-
children: /* @__PURE__ */ (0,
|
|
18717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props })
|
|
18355
18718
|
}
|
|
18356
18719
|
));
|
|
18357
18720
|
Table.displayName = "Table";
|
|
18358
|
-
var TableHeader =
|
|
18721
|
+
var TableHeader = import_react33.default.forwardRef(({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border", "bg-muted", className), ...props, children: [
|
|
18359
18722
|
children,
|
|
18360
18723
|
filterRow
|
|
18361
18724
|
] }));
|
|
18362
18725
|
TableHeader.displayName = "TableHeader";
|
|
18363
|
-
var TableBody =
|
|
18726
|
+
var TableBody = import_react33.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
18364
18727
|
TableBody.displayName = "TableBody";
|
|
18365
|
-
var TableFooter =
|
|
18728
|
+
var TableFooter = import_react33.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
18366
18729
|
TableFooter.displayName = "TableFooter";
|
|
18367
|
-
var TableRow =
|
|
18730
|
+
var TableRow = import_react33.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
18368
18731
|
"tr",
|
|
18369
18732
|
{
|
|
18370
18733
|
ref,
|
|
@@ -18378,7 +18741,7 @@ var TableRow = import_react32.default.forwardRef(({ className, ...props }, ref)
|
|
|
18378
18741
|
}
|
|
18379
18742
|
));
|
|
18380
18743
|
TableRow.displayName = "TableRow";
|
|
18381
|
-
var TableHead =
|
|
18744
|
+
var TableHead = import_react33.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
18382
18745
|
"th",
|
|
18383
18746
|
{
|
|
18384
18747
|
ref,
|
|
@@ -18387,17 +18750,17 @@ var TableHead = import_react32.default.forwardRef(({ className, ...props }, ref)
|
|
|
18387
18750
|
}
|
|
18388
18751
|
));
|
|
18389
18752
|
TableHead.displayName = "TableHead";
|
|
18390
|
-
var TableCell =
|
|
18753
|
+
var TableCell = import_react33.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
18391
18754
|
TableCell.displayName = "TableCell";
|
|
18392
|
-
var TableCaption =
|
|
18755
|
+
var TableCaption = import_react33.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
18393
18756
|
TableCaption.displayName = "TableCaption";
|
|
18394
18757
|
|
|
18395
18758
|
// ../../components/ui/DataTable/DataTable.tsx
|
|
18396
|
-
var
|
|
18397
|
-
var
|
|
18759
|
+
var import_lucide_react34 = require("lucide-react");
|
|
18760
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
18398
18761
|
|
|
18399
18762
|
// ../../components/ui/DataTable/components/Pagination.tsx
|
|
18400
|
-
var
|
|
18763
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
18401
18764
|
function DataTablePagination({
|
|
18402
18765
|
totalItems,
|
|
18403
18766
|
curPage,
|
|
@@ -18408,16 +18771,16 @@ function DataTablePagination({
|
|
|
18408
18771
|
}) {
|
|
18409
18772
|
const totalPages = Math.ceil(totalItems / curPageSize);
|
|
18410
18773
|
if (!(totalItems > 0 && totalPages > 1)) return null;
|
|
18411
|
-
return /* @__PURE__ */ (0,
|
|
18412
|
-
/* @__PURE__ */ (0,
|
|
18774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center justify-between gap-2 px-1 pt-3 text-xs text-muted-foreground", children: [
|
|
18775
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "tabular-nums", children: [
|
|
18413
18776
|
(curPage - 1) * curPageSize + 1,
|
|
18414
18777
|
"-",
|
|
18415
18778
|
Math.min(curPage * curPageSize, totalItems),
|
|
18416
18779
|
"/",
|
|
18417
18780
|
totalItems
|
|
18418
18781
|
] }),
|
|
18419
|
-
/* @__PURE__ */ (0,
|
|
18420
|
-
/* @__PURE__ */ (0,
|
|
18782
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-0.5", children: [
|
|
18783
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
18421
18784
|
Button_default,
|
|
18422
18785
|
{
|
|
18423
18786
|
variant: "ghost",
|
|
@@ -18425,7 +18788,7 @@ function DataTablePagination({
|
|
|
18425
18788
|
className: "h-7 w-7 p-0 rounded-full",
|
|
18426
18789
|
onClick: () => setCurPage(Math.max(1, curPage - 1)),
|
|
18427
18790
|
disabled: curPage === 1,
|
|
18428
|
-
children: /* @__PURE__ */ (0,
|
|
18791
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
18429
18792
|
}
|
|
18430
18793
|
),
|
|
18431
18794
|
(() => {
|
|
@@ -18442,7 +18805,7 @@ function DataTablePagination({
|
|
|
18442
18805
|
pages.push(totalPages);
|
|
18443
18806
|
}
|
|
18444
18807
|
return pages.map(
|
|
18445
|
-
(p, i) => p === "..." ? /* @__PURE__ */ (0,
|
|
18808
|
+
(p, i) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "px-1 text-muted-foreground/60", children: "\u2026" }, `dots-${i}`) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
18446
18809
|
"button",
|
|
18447
18810
|
{
|
|
18448
18811
|
onClick: () => setCurPage(p),
|
|
@@ -18456,7 +18819,7 @@ function DataTablePagination({
|
|
|
18456
18819
|
)
|
|
18457
18820
|
);
|
|
18458
18821
|
})(),
|
|
18459
|
-
/* @__PURE__ */ (0,
|
|
18822
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
18460
18823
|
Button_default,
|
|
18461
18824
|
{
|
|
18462
18825
|
variant: "ghost",
|
|
@@ -18464,11 +18827,11 @@ function DataTablePagination({
|
|
|
18464
18827
|
className: "h-7 w-7 p-0 rounded-full",
|
|
18465
18828
|
onClick: () => setCurPage(Math.min(totalPages, curPage + 1)),
|
|
18466
18829
|
disabled: curPage === totalPages,
|
|
18467
|
-
children: /* @__PURE__ */ (0,
|
|
18830
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
18468
18831
|
}
|
|
18469
18832
|
)
|
|
18470
18833
|
] }),
|
|
18471
|
-
pageSizeOptions && /* @__PURE__ */ (0,
|
|
18834
|
+
pageSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
18472
18835
|
Combobox,
|
|
18473
18836
|
{
|
|
18474
18837
|
options: pageSizeOptions.map(String),
|
|
@@ -18582,7 +18945,7 @@ function getLeafColumnsWithFixedInheritance(columns, inheritedFixed) {
|
|
|
18582
18945
|
}
|
|
18583
18946
|
|
|
18584
18947
|
// ../../components/ui/DataTable/components/Toolbar.tsx
|
|
18585
|
-
var
|
|
18948
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
18586
18949
|
function DataTableToolbar({
|
|
18587
18950
|
caption,
|
|
18588
18951
|
toolbar,
|
|
@@ -18598,14 +18961,14 @@ function DataTableToolbar({
|
|
|
18598
18961
|
labels,
|
|
18599
18962
|
t
|
|
18600
18963
|
}) {
|
|
18601
|
-
return /* @__PURE__ */ (0,
|
|
18602
|
-
/* @__PURE__ */ (0,
|
|
18603
|
-
/* @__PURE__ */ (0,
|
|
18604
|
-
enableDensityToggle && /* @__PURE__ */ (0,
|
|
18964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
18965
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "text-sm text-muted-foreground", children: caption }),
|
|
18966
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
18967
|
+
enableDensityToggle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
18605
18968
|
DropdownMenu_default,
|
|
18606
18969
|
{
|
|
18607
|
-
trigger: /* @__PURE__ */ (0,
|
|
18608
|
-
/* @__PURE__ */ (0,
|
|
18970
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
18971
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) }),
|
|
18609
18972
|
labels?.density || t("density")
|
|
18610
18973
|
] }),
|
|
18611
18974
|
items: [
|
|
@@ -18617,11 +18980,11 @@ function DataTableToolbar({
|
|
|
18617
18980
|
),
|
|
18618
18981
|
enableColumnVisibilityToggle && (() => {
|
|
18619
18982
|
const leafCols = getLeafColumns(columns);
|
|
18620
|
-
return /* @__PURE__ */ (0,
|
|
18983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
18621
18984
|
DropdownMenu_default,
|
|
18622
18985
|
{
|
|
18623
|
-
trigger: /* @__PURE__ */ (0,
|
|
18624
|
-
/* @__PURE__ */ (0,
|
|
18986
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
18987
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
18625
18988
|
"path",
|
|
18626
18989
|
{
|
|
18627
18990
|
strokeLinecap: "round",
|
|
@@ -18632,15 +18995,15 @@ function DataTableToolbar({
|
|
|
18632
18995
|
) }),
|
|
18633
18996
|
labels?.columns || t("columns")
|
|
18634
18997
|
] }),
|
|
18635
|
-
children: leafCols.map((c) => /* @__PURE__ */ (0,
|
|
18998
|
+
children: leafCols.map((c) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
18636
18999
|
DropdownMenuItem,
|
|
18637
19000
|
{
|
|
18638
19001
|
onClick: () => {
|
|
18639
19002
|
setVisibleCols((prev) => prev.includes(c.key) ? prev.filter((k) => k !== c.key) : [...prev, c.key]);
|
|
18640
19003
|
},
|
|
18641
19004
|
children: [
|
|
18642
|
-
/* @__PURE__ */ (0,
|
|
18643
|
-
/* @__PURE__ */ (0,
|
|
19005
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("input", { type: "checkbox", className: "mr-2 rounded-md border-border", readOnly: true, checked: visibleCols.includes(c.key) }),
|
|
19006
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "truncate", children: c.title })
|
|
18644
19007
|
]
|
|
18645
19008
|
},
|
|
18646
19009
|
c.key
|
|
@@ -18648,11 +19011,11 @@ function DataTableToolbar({
|
|
|
18648
19011
|
}
|
|
18649
19012
|
);
|
|
18650
19013
|
})(),
|
|
18651
|
-
enableHeaderAlignToggle && /* @__PURE__ */ (0,
|
|
19014
|
+
enableHeaderAlignToggle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
18652
19015
|
DropdownMenu_default,
|
|
18653
19016
|
{
|
|
18654
|
-
trigger: /* @__PURE__ */ (0,
|
|
18655
|
-
/* @__PURE__ */ (0,
|
|
19017
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
19018
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h10M4 18h16" }) }),
|
|
18656
19019
|
labels?.headerAlign || t("headerAlign")
|
|
18657
19020
|
] }),
|
|
18658
19021
|
items: [
|
|
@@ -18668,10 +19031,10 @@ function DataTableToolbar({
|
|
|
18668
19031
|
}
|
|
18669
19032
|
|
|
18670
19033
|
// ../../components/ui/DataTable/hooks/useDebounced.ts
|
|
18671
|
-
var
|
|
19034
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
18672
19035
|
function useDebounced(value, delay = 300) {
|
|
18673
|
-
const [debounced, setDebounced] =
|
|
18674
|
-
|
|
19036
|
+
const [debounced, setDebounced] = import_react34.default.useState(value);
|
|
19037
|
+
import_react34.default.useEffect(() => {
|
|
18675
19038
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
18676
19039
|
return () => clearTimeout(id);
|
|
18677
19040
|
}, [value, delay]);
|
|
@@ -18679,10 +19042,10 @@ function useDebounced(value, delay = 300) {
|
|
|
18679
19042
|
}
|
|
18680
19043
|
|
|
18681
19044
|
// ../../components/ui/DataTable/hooks/usePageSizeStorage.ts
|
|
18682
|
-
var
|
|
19045
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
18683
19046
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
18684
|
-
const loadedFromStorage =
|
|
18685
|
-
const [curPageSize, setCurPageSize] =
|
|
19047
|
+
const loadedFromStorage = import_react35.default.useRef(false);
|
|
19048
|
+
const [curPageSize, setCurPageSize] = import_react35.default.useState(() => {
|
|
18686
19049
|
if (typeof window === "undefined" || !storageKey) return pageSize;
|
|
18687
19050
|
try {
|
|
18688
19051
|
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
@@ -18697,11 +19060,11 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
18697
19060
|
}
|
|
18698
19061
|
return pageSize;
|
|
18699
19062
|
});
|
|
18700
|
-
const hasMounted =
|
|
18701
|
-
|
|
19063
|
+
const hasMounted = import_react35.default.useRef(false);
|
|
19064
|
+
import_react35.default.useEffect(() => {
|
|
18702
19065
|
hasMounted.current = true;
|
|
18703
19066
|
}, []);
|
|
18704
|
-
|
|
19067
|
+
import_react35.default.useEffect(() => {
|
|
18705
19068
|
if (typeof window === "undefined" || !storageKey) return;
|
|
18706
19069
|
if (!hasMounted.current) return;
|
|
18707
19070
|
try {
|
|
@@ -18709,7 +19072,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
18709
19072
|
} catch {
|
|
18710
19073
|
}
|
|
18711
19074
|
}, [curPageSize, storageKey]);
|
|
18712
|
-
|
|
19075
|
+
import_react35.default.useEffect(() => {
|
|
18713
19076
|
if (storageKey && loadedFromStorage.current) return;
|
|
18714
19077
|
setCurPageSize(pageSize);
|
|
18715
19078
|
}, [pageSize, storageKey]);
|
|
@@ -18717,7 +19080,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
18717
19080
|
}
|
|
18718
19081
|
|
|
18719
19082
|
// ../../components/ui/DataTable/hooks/useStickyColumns.ts
|
|
18720
|
-
var
|
|
19083
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
18721
19084
|
|
|
18722
19085
|
// ../../components/ui/DataTable/utils/columns.ts
|
|
18723
19086
|
function getColumnWidth(col, fallback = 150) {
|
|
@@ -18735,9 +19098,9 @@ function getColumnWidth(col, fallback = 150) {
|
|
|
18735
19098
|
|
|
18736
19099
|
// ../../components/ui/DataTable/hooks/useStickyColumns.ts
|
|
18737
19100
|
function useStickyColumns(columns, visibleKeys) {
|
|
18738
|
-
const visibleColumns =
|
|
18739
|
-
const leafColumns =
|
|
18740
|
-
const stickyPositions =
|
|
19101
|
+
const visibleColumns = import_react36.default.useMemo(() => filterVisibleColumns(columns, visibleKeys), [columns, visibleKeys]);
|
|
19102
|
+
const leafColumns = import_react36.default.useMemo(() => getLeafColumnsWithFixedInheritance(visibleColumns), [visibleColumns]);
|
|
19103
|
+
const stickyPositions = import_react36.default.useMemo(() => {
|
|
18741
19104
|
const positions = {};
|
|
18742
19105
|
let leftOffset = 0;
|
|
18743
19106
|
for (const col of leafColumns) {
|
|
@@ -18756,7 +19119,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
18756
19119
|
}
|
|
18757
19120
|
return positions;
|
|
18758
19121
|
}, [leafColumns]);
|
|
18759
|
-
const getStickyColumnStyle =
|
|
19122
|
+
const getStickyColumnStyle = import_react36.default.useCallback(
|
|
18760
19123
|
(col) => {
|
|
18761
19124
|
if (!col.fixed) return {};
|
|
18762
19125
|
const pos = stickyPositions[col.key];
|
|
@@ -18767,7 +19130,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
18767
19130
|
},
|
|
18768
19131
|
[stickyPositions]
|
|
18769
19132
|
);
|
|
18770
|
-
const getStickyHeaderClass =
|
|
19133
|
+
const getStickyHeaderClass = import_react36.default.useCallback((col) => {
|
|
18771
19134
|
if (!col.fixed) return "";
|
|
18772
19135
|
return cn(
|
|
18773
19136
|
"sticky",
|
|
@@ -18776,7 +19139,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
18776
19139
|
"z-50 bg-muted!"
|
|
18777
19140
|
);
|
|
18778
19141
|
}, []);
|
|
18779
|
-
const getStickyCellClass =
|
|
19142
|
+
const getStickyCellClass = import_react36.default.useCallback((col, isStripedRow) => {
|
|
18780
19143
|
if (!col.fixed) return "";
|
|
18781
19144
|
return cn(
|
|
18782
19145
|
"sticky z-10",
|
|
@@ -18785,7 +19148,7 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
18785
19148
|
isStripedRow ? "bg-muted/50!" : "bg-card!"
|
|
18786
19149
|
);
|
|
18787
19150
|
}, []);
|
|
18788
|
-
const getStickyHeaderCellStyle =
|
|
19151
|
+
const getStickyHeaderCellStyle = import_react36.default.useCallback(
|
|
18789
19152
|
(headerCell) => {
|
|
18790
19153
|
const col = headerCell.column;
|
|
18791
19154
|
if (headerCell.isLeaf) {
|
|
@@ -18891,7 +19254,7 @@ function validateColumns(columns) {
|
|
|
18891
19254
|
}
|
|
18892
19255
|
|
|
18893
19256
|
// ../../components/ui/DataTable/DataTable.tsx
|
|
18894
|
-
var
|
|
19257
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
18895
19258
|
function DataTable({
|
|
18896
19259
|
columns,
|
|
18897
19260
|
data,
|
|
@@ -18916,20 +19279,20 @@ function DataTable({
|
|
|
18916
19279
|
labels
|
|
18917
19280
|
}) {
|
|
18918
19281
|
const t = useTranslations("Common");
|
|
18919
|
-
const [headerAlign, setHeaderAlign] =
|
|
18920
|
-
const [visibleCols, setVisibleCols] =
|
|
18921
|
-
const [filters, setFilters] =
|
|
18922
|
-
const [sort, setSort] =
|
|
18923
|
-
const [density, setDensity] =
|
|
18924
|
-
const [curPage, setCurPage] =
|
|
19282
|
+
const [headerAlign, setHeaderAlign] = import_react37.default.useState("left");
|
|
19283
|
+
const [visibleCols, setVisibleCols] = import_react37.default.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
19284
|
+
const [filters, setFilters] = import_react37.default.useState({});
|
|
19285
|
+
const [sort, setSort] = import_react37.default.useState(null);
|
|
19286
|
+
const [density, setDensity] = import_react37.default.useState("normal");
|
|
19287
|
+
const [curPage, setCurPage] = import_react37.default.useState(page);
|
|
18925
19288
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
18926
|
-
|
|
19289
|
+
import_react37.default.useEffect(() => {
|
|
18927
19290
|
if (process.env.NODE_ENV === "development") {
|
|
18928
19291
|
const warnings = validateColumns(columns);
|
|
18929
19292
|
warnings.forEach((w) => console.warn(`[DataTable] ${w}`));
|
|
18930
19293
|
}
|
|
18931
19294
|
}, [columns]);
|
|
18932
|
-
|
|
19295
|
+
import_react37.default.useEffect(() => {
|
|
18933
19296
|
const newColKeys = columns.filter((c) => c.visible !== false).map((c) => c.key);
|
|
18934
19297
|
setVisibleCols((prev) => {
|
|
18935
19298
|
const uniqueKeys = /* @__PURE__ */ new Set([...prev, ...newColKeys]);
|
|
@@ -18937,12 +19300,12 @@ function DataTable({
|
|
|
18937
19300
|
});
|
|
18938
19301
|
}, [columns]);
|
|
18939
19302
|
const debouncedFilters = useDebounced(filters, 350);
|
|
18940
|
-
|
|
19303
|
+
import_react37.default.useEffect(() => {
|
|
18941
19304
|
setCurPage(page);
|
|
18942
19305
|
}, [page]);
|
|
18943
19306
|
const isServerMode = Boolean(onQueryChange);
|
|
18944
|
-
const hasEmittedQuery =
|
|
18945
|
-
|
|
19307
|
+
const hasEmittedQuery = import_react37.default.useRef(false);
|
|
19308
|
+
import_react37.default.useEffect(() => {
|
|
18946
19309
|
if (!onQueryChange) return;
|
|
18947
19310
|
if (!hasEmittedQuery.current) {
|
|
18948
19311
|
hasEmittedQuery.current = true;
|
|
@@ -18952,14 +19315,14 @@ function DataTable({
|
|
|
18952
19315
|
}, [debouncedFilters, sort, curPage, curPageSize, onQueryChange]);
|
|
18953
19316
|
const densityRowClass = density === "compact" ? "h-9" : density === "comfortable" ? "h-14" : "h-12";
|
|
18954
19317
|
const cellPadding = density === "compact" ? "py-1.5 px-3" : density === "comfortable" ? "py-3 px-4" : "py-2.5 px-4";
|
|
18955
|
-
const visibleColsSet =
|
|
18956
|
-
const visibleColumns =
|
|
19318
|
+
const visibleColsSet = import_react37.default.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
19319
|
+
const visibleColumns = import_react37.default.useMemo(() => {
|
|
18957
19320
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
18958
19321
|
}, [columns, visibleColsSet]);
|
|
18959
|
-
const leafColumns =
|
|
19322
|
+
const leafColumns = import_react37.default.useMemo(() => {
|
|
18960
19323
|
return getLeafColumns(visibleColumns);
|
|
18961
19324
|
}, [visibleColumns]);
|
|
18962
|
-
const totalColumnsWidth =
|
|
19325
|
+
const totalColumnsWidth = import_react37.default.useMemo(() => {
|
|
18963
19326
|
return leafColumns.reduce((sum, col) => sum + getColumnWidth(col), 0);
|
|
18964
19327
|
}, [leafColumns]);
|
|
18965
19328
|
const { getStickyCellClass, getStickyColumnStyle, getStickyHeaderClass, getStickyHeaderCellStyle } = useStickyColumns(
|
|
@@ -18976,7 +19339,7 @@ function DataTable({
|
|
|
18976
19339
|
const k = col.key;
|
|
18977
19340
|
const commonProps = { className: "h-8 w-full text-sm" };
|
|
18978
19341
|
if (col.filter.type === "text") {
|
|
18979
|
-
return /* @__PURE__ */ (0,
|
|
19342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
18980
19343
|
Input_default,
|
|
18981
19344
|
{
|
|
18982
19345
|
...commonProps,
|
|
@@ -18991,7 +19354,7 @@ function DataTable({
|
|
|
18991
19354
|
}
|
|
18992
19355
|
if (col.filter.type === "select") {
|
|
18993
19356
|
const options = col.filter.options || [];
|
|
18994
|
-
return /* @__PURE__ */ (0,
|
|
19357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
18995
19358
|
Combobox,
|
|
18996
19359
|
{
|
|
18997
19360
|
options: ["", ...options],
|
|
@@ -19007,7 +19370,7 @@ function DataTable({
|
|
|
19007
19370
|
);
|
|
19008
19371
|
}
|
|
19009
19372
|
if (col.filter.type === "date") {
|
|
19010
|
-
return /* @__PURE__ */ (0,
|
|
19373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19011
19374
|
DatePicker,
|
|
19012
19375
|
{
|
|
19013
19376
|
placeholder: col.filter.placeholder || `Select ${String(col.title)}`,
|
|
@@ -19021,10 +19384,10 @@ function DataTable({
|
|
|
19021
19384
|
}
|
|
19022
19385
|
return null;
|
|
19023
19386
|
};
|
|
19024
|
-
const headerRows =
|
|
19387
|
+
const headerRows = import_react37.default.useMemo(() => buildHeaderRows(visibleColumns), [visibleColumns]);
|
|
19025
19388
|
const renderHeaderContent = (col, isLeaf) => {
|
|
19026
19389
|
if (!isLeaf) {
|
|
19027
|
-
return /* @__PURE__ */ (0,
|
|
19390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19028
19391
|
"div",
|
|
19029
19392
|
{
|
|
19030
19393
|
className: cn(
|
|
@@ -19033,15 +19396,15 @@ function DataTable({
|
|
|
19033
19396
|
col.align === "center" && "justify-center",
|
|
19034
19397
|
!col.align && "justify-start"
|
|
19035
19398
|
),
|
|
19036
|
-
children: /* @__PURE__ */ (0,
|
|
19399
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "font-medium text-sm whitespace-nowrap", children: col.title })
|
|
19037
19400
|
}
|
|
19038
19401
|
);
|
|
19039
19402
|
}
|
|
19040
19403
|
const isRightAlign = col.align === "right" || !col.align && headerAlign === "right";
|
|
19041
19404
|
const isCenterAlign = col.align === "center" || !col.align && headerAlign === "center";
|
|
19042
|
-
const titleContent = /* @__PURE__ */ (0,
|
|
19043
|
-
/* @__PURE__ */ (0,
|
|
19044
|
-
col.sortable && /* @__PURE__ */ (0,
|
|
19405
|
+
const titleContent = /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
19406
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "font-medium text-sm whitespace-nowrap", children: col.title }),
|
|
19407
|
+
col.sortable && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19045
19408
|
"button",
|
|
19046
19409
|
{
|
|
19047
19410
|
className: cn(
|
|
@@ -19058,8 +19421,8 @@ function DataTable({
|
|
|
19058
19421
|
},
|
|
19059
19422
|
"aria-label": "Sort",
|
|
19060
19423
|
title: `Sort by ${String(col.title)}`,
|
|
19061
|
-
children: /* @__PURE__ */ (0,
|
|
19062
|
-
/* @__PURE__ */ (0,
|
|
19424
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", className: "inline-block", children: [
|
|
19425
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19063
19426
|
"path",
|
|
19064
19427
|
{
|
|
19065
19428
|
d: "M7 8l3-3 3 3",
|
|
@@ -19070,7 +19433,7 @@ function DataTable({
|
|
|
19070
19433
|
opacity: sort?.key === col.key && sort.order === "asc" ? 1 : 0.4
|
|
19071
19434
|
}
|
|
19072
19435
|
),
|
|
19073
|
-
/* @__PURE__ */ (0,
|
|
19436
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19074
19437
|
"path",
|
|
19075
19438
|
{
|
|
19076
19439
|
d: "M7 12l3 3 3-3",
|
|
@@ -19085,11 +19448,11 @@ function DataTable({
|
|
|
19085
19448
|
}
|
|
19086
19449
|
)
|
|
19087
19450
|
] });
|
|
19088
|
-
const filterContent = col.filter ? /* @__PURE__ */ (0,
|
|
19451
|
+
const filterContent = col.filter ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19089
19452
|
Popover,
|
|
19090
19453
|
{
|
|
19091
19454
|
placement: "bottom-start",
|
|
19092
|
-
trigger: /* @__PURE__ */ (0,
|
|
19455
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19093
19456
|
"button",
|
|
19094
19457
|
{
|
|
19095
19458
|
className: cn(
|
|
@@ -19098,13 +19461,13 @@ function DataTable({
|
|
|
19098
19461
|
),
|
|
19099
19462
|
"aria-label": "Filter",
|
|
19100
19463
|
title: `Filter by ${String(col.title)}`,
|
|
19101
|
-
children: /* @__PURE__ */ (0,
|
|
19464
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_lucide_react34.Filter, { className: "w-4 h-4" })
|
|
19102
19465
|
}
|
|
19103
19466
|
),
|
|
19104
|
-
children: /* @__PURE__ */ (0,
|
|
19105
|
-
/* @__PURE__ */ (0,
|
|
19106
|
-
/* @__PURE__ */ (0,
|
|
19107
|
-
filters[col.key] !== void 0 && filters[col.key] !== null && filters[col.key] !== "" && /* @__PURE__ */ (0,
|
|
19467
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "p-3 w-64 space-y-3", children: [
|
|
19468
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
19469
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "text-sm font-medium", children: col.title }),
|
|
19470
|
+
filters[col.key] !== void 0 && filters[col.key] !== null && filters[col.key] !== "" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19108
19471
|
"button",
|
|
19109
19472
|
{
|
|
19110
19473
|
onClick: () => {
|
|
@@ -19120,7 +19483,7 @@ function DataTable({
|
|
|
19120
19483
|
] })
|
|
19121
19484
|
}
|
|
19122
19485
|
) : null;
|
|
19123
|
-
return /* @__PURE__ */ (0,
|
|
19486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19124
19487
|
"div",
|
|
19125
19488
|
{
|
|
19126
19489
|
className: cn(
|
|
@@ -19129,23 +19492,23 @@ function DataTable({
|
|
|
19129
19492
|
isCenterAlign && "justify-center",
|
|
19130
19493
|
!isRightAlign && !isCenterAlign && "justify-start"
|
|
19131
19494
|
),
|
|
19132
|
-
children: isRightAlign ? /* @__PURE__ */ (0,
|
|
19495
|
+
children: isRightAlign ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
19133
19496
|
filterContent,
|
|
19134
19497
|
titleContent
|
|
19135
|
-
] }) : /* @__PURE__ */ (0,
|
|
19498
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
19136
19499
|
titleContent,
|
|
19137
19500
|
filterContent
|
|
19138
19501
|
] })
|
|
19139
19502
|
}
|
|
19140
19503
|
);
|
|
19141
19504
|
};
|
|
19142
|
-
const renderHeader = /* @__PURE__ */ (0,
|
|
19505
|
+
const renderHeader = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, { children: headerRows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableRow, { children: row.map((headerCell, cellIndex) => {
|
|
19143
19506
|
const { column: col, colSpan, rowSpan, isLeaf } = headerCell;
|
|
19144
19507
|
const prevCell = cellIndex > 0 ? row[cellIndex - 1] : null;
|
|
19145
19508
|
const prevCol = prevCell?.column;
|
|
19146
19509
|
const isAfterFixedLeft = prevCol?.fixed === "left";
|
|
19147
19510
|
const showBorderLeft = columnDividers && cellIndex > 0 && !isAfterFixedLeft && !col.fixed;
|
|
19148
|
-
return /* @__PURE__ */ (0,
|
|
19511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19149
19512
|
TableHead,
|
|
19150
19513
|
{
|
|
19151
19514
|
colSpan,
|
|
@@ -19165,7 +19528,7 @@ function DataTable({
|
|
|
19165
19528
|
col.key
|
|
19166
19529
|
);
|
|
19167
19530
|
}) }, `header-row-${rowIndex}`)) });
|
|
19168
|
-
const processedData =
|
|
19531
|
+
const processedData = import_react37.default.useMemo(() => {
|
|
19169
19532
|
if (isServerMode) return data;
|
|
19170
19533
|
let result = [...data];
|
|
19171
19534
|
if (Object.keys(filters).length > 0) {
|
|
@@ -19197,12 +19560,12 @@ function DataTable({
|
|
|
19197
19560
|
return result;
|
|
19198
19561
|
}, [data, isServerMode, filters, sort, columns]);
|
|
19199
19562
|
const totalItems = isServerMode ? total : processedData.length;
|
|
19200
|
-
const displayedData = isServerMode ? data :
|
|
19563
|
+
const displayedData = isServerMode ? data : import_react37.default.useMemo(() => {
|
|
19201
19564
|
const start = (curPage - 1) * curPageSize;
|
|
19202
19565
|
return processedData.slice(start, start + curPageSize);
|
|
19203
19566
|
}, [processedData, curPage, curPageSize]);
|
|
19204
|
-
return /* @__PURE__ */ (0,
|
|
19205
|
-
/* @__PURE__ */ (0,
|
|
19567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: cn("space-y-2", className), children: [
|
|
19568
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19206
19569
|
DataTableToolbar,
|
|
19207
19570
|
{
|
|
19208
19571
|
caption,
|
|
@@ -19220,7 +19583,7 @@ function DataTable({
|
|
|
19220
19583
|
t
|
|
19221
19584
|
}
|
|
19222
19585
|
),
|
|
19223
|
-
/* @__PURE__ */ (0,
|
|
19586
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19224
19587
|
"div",
|
|
19225
19588
|
{
|
|
19226
19589
|
className: cn("relative rounded-2xl md:rounded-3xl border border-border/50", loading2 && "opacity-60 pointer-events-none"),
|
|
@@ -19229,7 +19592,7 @@ function DataTable({
|
|
|
19229
19592
|
overflowY: "auto",
|
|
19230
19593
|
overflowX: "auto"
|
|
19231
19594
|
} : { overflowX: "auto" },
|
|
19232
|
-
children: /* @__PURE__ */ (0,
|
|
19595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
19233
19596
|
Table,
|
|
19234
19597
|
{
|
|
19235
19598
|
containerClassName: cn("border-0 md:border-0 rounded-none md:rounded-none shadow-none bg-transparent", "overflow-visible"),
|
|
@@ -19239,11 +19602,11 @@ function DataTable({
|
|
|
19239
19602
|
),
|
|
19240
19603
|
style: { minWidth: totalColumnsWidth > 0 ? `${totalColumnsWidth}px` : void 0 },
|
|
19241
19604
|
children: [
|
|
19242
|
-
/* @__PURE__ */ (0,
|
|
19243
|
-
/* @__PURE__ */ (0,
|
|
19244
|
-
/* @__PURE__ */ (0,
|
|
19245
|
-
/* @__PURE__ */ (0,
|
|
19246
|
-
/* @__PURE__ */ (0,
|
|
19605
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableHeader, { children: renderHeader }),
|
|
19606
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableBody, { children: loading2 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableCell, { colSpan: leafColumns.length, className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center justify-center gap-2 text-muted-foreground", children: [
|
|
19607
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
19608
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
19609
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19247
19610
|
"path",
|
|
19248
19611
|
{
|
|
19249
19612
|
className: "opacity-75",
|
|
@@ -19252,13 +19615,13 @@ function DataTable({
|
|
|
19252
19615
|
}
|
|
19253
19616
|
)
|
|
19254
19617
|
] }),
|
|
19255
|
-
/* @__PURE__ */ (0,
|
|
19618
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "text-sm", children: [
|
|
19256
19619
|
t("loading"),
|
|
19257
19620
|
"\u2026"
|
|
19258
19621
|
] })
|
|
19259
|
-
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ (0,
|
|
19622
|
+
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableCell, { colSpan: leafColumns.length, className: "text-center py-6 text-muted-foreground", children: t("noData") }) }) : displayedData.map((row, idx) => {
|
|
19260
19623
|
const isLastRow = idx === displayedData.length - 1;
|
|
19261
|
-
return /* @__PURE__ */ (0,
|
|
19624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19262
19625
|
TableRow,
|
|
19263
19626
|
{
|
|
19264
19627
|
className: cn(densityRowClass),
|
|
@@ -19272,7 +19635,7 @@ function DataTable({
|
|
|
19272
19635
|
const prevCol = colIdx > 0 ? leafColumns[colIdx - 1] : null;
|
|
19273
19636
|
const isAfterFixedLeft = prevCol?.fixed === "left";
|
|
19274
19637
|
const showBorderLeft = columnDividers && colIdx > 0 && !isAfterFixedLeft && !col.fixed;
|
|
19275
|
-
return /* @__PURE__ */ (0,
|
|
19638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19276
19639
|
TableCell,
|
|
19277
19640
|
{
|
|
19278
19641
|
style: getStickyColumnStyle(col),
|
|
@@ -19300,7 +19663,7 @@ function DataTable({
|
|
|
19300
19663
|
)
|
|
19301
19664
|
}
|
|
19302
19665
|
),
|
|
19303
|
-
/* @__PURE__ */ (0,
|
|
19666
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19304
19667
|
DataTablePagination,
|
|
19305
19668
|
{
|
|
19306
19669
|
totalItems,
|
|
@@ -19316,10 +19679,10 @@ function DataTable({
|
|
|
19316
19679
|
var DataTable_default = DataTable;
|
|
19317
19680
|
|
|
19318
19681
|
// ../../components/ui/Form.tsx
|
|
19319
|
-
var
|
|
19682
|
+
var React60 = __toESM(require("react"), 1);
|
|
19320
19683
|
var import_react_hook_form = require("react-hook-form");
|
|
19321
|
-
var
|
|
19322
|
-
var FormConfigContext =
|
|
19684
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
19685
|
+
var FormConfigContext = React60.createContext({ size: "md" });
|
|
19323
19686
|
var FormWrapper = ({
|
|
19324
19687
|
children,
|
|
19325
19688
|
onSubmit,
|
|
@@ -19332,24 +19695,24 @@ var FormWrapper = ({
|
|
|
19332
19695
|
const methods = (0, import_react_hook_form.useForm)({
|
|
19333
19696
|
defaultValues: initialValues
|
|
19334
19697
|
});
|
|
19335
|
-
|
|
19698
|
+
React60.useEffect(() => {
|
|
19336
19699
|
if (initialValues) {
|
|
19337
19700
|
methods.reset(initialValues);
|
|
19338
19701
|
}
|
|
19339
19702
|
}, [JSON.stringify(initialValues)]);
|
|
19340
19703
|
const { validationSchema: _, ...formProps } = props;
|
|
19341
|
-
return /* @__PURE__ */ (0,
|
|
19704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react_hook_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
19342
19705
|
};
|
|
19343
19706
|
var Form = FormWrapper;
|
|
19344
|
-
var FormFieldContext =
|
|
19707
|
+
var FormFieldContext = React60.createContext({});
|
|
19345
19708
|
var FormField = ({
|
|
19346
19709
|
...props
|
|
19347
19710
|
}) => {
|
|
19348
|
-
return /* @__PURE__ */ (0,
|
|
19711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react_hook_form.Controller, { ...props }) });
|
|
19349
19712
|
};
|
|
19350
19713
|
var useFormField = () => {
|
|
19351
|
-
const fieldContext =
|
|
19352
|
-
const itemContext =
|
|
19714
|
+
const fieldContext = React60.useContext(FormFieldContext);
|
|
19715
|
+
const itemContext = React60.useContext(FormItemContext);
|
|
19353
19716
|
const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
|
|
19354
19717
|
if (!fieldContext) {
|
|
19355
19718
|
try {
|
|
@@ -19370,27 +19733,27 @@ var useFormField = () => {
|
|
|
19370
19733
|
...fieldState
|
|
19371
19734
|
};
|
|
19372
19735
|
};
|
|
19373
|
-
var FormItemContext =
|
|
19374
|
-
var FormItem =
|
|
19375
|
-
const id =
|
|
19376
|
-
return /* @__PURE__ */ (0,
|
|
19736
|
+
var FormItemContext = React60.createContext({});
|
|
19737
|
+
var FormItem = React60.forwardRef(({ className, ...props }, ref) => {
|
|
19738
|
+
const id = React60.useId();
|
|
19739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
19377
19740
|
});
|
|
19378
19741
|
FormItem.displayName = "FormItem";
|
|
19379
|
-
var FormLabel =
|
|
19742
|
+
var FormLabel = React60.forwardRef(
|
|
19380
19743
|
({ className, children, required, ...props }, ref) => {
|
|
19381
19744
|
const { error, formItemId } = useFormField();
|
|
19382
|
-
const config =
|
|
19745
|
+
const config = React60.useContext(FormConfigContext);
|
|
19383
19746
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
19384
|
-
return /* @__PURE__ */ (0,
|
|
19747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
|
|
19385
19748
|
children,
|
|
19386
|
-
required && /* @__PURE__ */ (0,
|
|
19749
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
19387
19750
|
] });
|
|
19388
19751
|
}
|
|
19389
19752
|
);
|
|
19390
19753
|
FormLabel.displayName = "FormLabel";
|
|
19391
|
-
var FormControl =
|
|
19754
|
+
var FormControl = React60.forwardRef(({ ...props }, ref) => {
|
|
19392
19755
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
19393
|
-
return /* @__PURE__ */ (0,
|
|
19756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
19394
19757
|
"div",
|
|
19395
19758
|
{
|
|
19396
19759
|
ref,
|
|
@@ -19402,37 +19765,37 @@ var FormControl = React59.forwardRef(({ ...props }, ref) => {
|
|
|
19402
19765
|
);
|
|
19403
19766
|
});
|
|
19404
19767
|
FormControl.displayName = "FormControl";
|
|
19405
|
-
var FormDescription =
|
|
19768
|
+
var FormDescription = React60.forwardRef(({ className, ...props }, ref) => {
|
|
19406
19769
|
const { formDescriptionId } = useFormField();
|
|
19407
|
-
return /* @__PURE__ */ (0,
|
|
19770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
19408
19771
|
});
|
|
19409
19772
|
FormDescription.displayName = "FormDescription";
|
|
19410
|
-
var FormMessage =
|
|
19773
|
+
var FormMessage = React60.forwardRef(({ className, children, ...props }, ref) => {
|
|
19411
19774
|
const { error, formMessageId } = useFormField();
|
|
19412
19775
|
const body = error ? String(error?.message) : children;
|
|
19413
19776
|
if (!body) {
|
|
19414
19777
|
return null;
|
|
19415
19778
|
}
|
|
19416
|
-
return /* @__PURE__ */ (0,
|
|
19779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
19417
19780
|
});
|
|
19418
19781
|
FormMessage.displayName = "FormMessage";
|
|
19419
|
-
var FormInput =
|
|
19782
|
+
var FormInput = React60.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
19420
19783
|
FormField,
|
|
19421
19784
|
{
|
|
19422
19785
|
name,
|
|
19423
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
19424
|
-
/* @__PURE__ */ (0,
|
|
19425
|
-
/* @__PURE__ */ (0,
|
|
19786
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(FormItem, { children: [
|
|
19787
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Input_default, { size: props.size ?? size, ...field, ...props }) }),
|
|
19788
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormMessage, {})
|
|
19426
19789
|
] })
|
|
19427
19790
|
}
|
|
19428
19791
|
) }));
|
|
19429
19792
|
FormInput.displayName = "FormInput";
|
|
19430
|
-
var FormCheckbox =
|
|
19793
|
+
var FormCheckbox = React60.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
19431
19794
|
FormField,
|
|
19432
19795
|
{
|
|
19433
19796
|
name,
|
|
19434
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
19435
|
-
/* @__PURE__ */ (0,
|
|
19797
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(FormItem, { children: [
|
|
19798
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
19436
19799
|
Checkbox,
|
|
19437
19800
|
{
|
|
19438
19801
|
ref,
|
|
@@ -19446,21 +19809,21 @@ var FormCheckbox = React59.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
19446
19809
|
...props
|
|
19447
19810
|
}
|
|
19448
19811
|
) }),
|
|
19449
|
-
/* @__PURE__ */ (0,
|
|
19812
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormMessage, {})
|
|
19450
19813
|
] })
|
|
19451
19814
|
}
|
|
19452
19815
|
) }));
|
|
19453
19816
|
FormCheckbox.displayName = "FormCheckbox";
|
|
19454
|
-
var FormActions =
|
|
19817
|
+
var FormActions = React60.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
19455
19818
|
FormActions.displayName = "FormActions";
|
|
19456
|
-
var FormSubmitButton =
|
|
19457
|
-
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0,
|
|
19819
|
+
var FormSubmitButton = React60.forwardRef(
|
|
19820
|
+
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) })
|
|
19458
19821
|
);
|
|
19459
19822
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
19460
19823
|
|
|
19461
19824
|
// ../../components/ui/NotificationModal.tsx
|
|
19462
|
-
var
|
|
19463
|
-
var
|
|
19825
|
+
var import_lucide_react35 = require("lucide-react");
|
|
19826
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
19464
19827
|
function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }) {
|
|
19465
19828
|
const t = useTranslations("Common");
|
|
19466
19829
|
if (!notification) return null;
|
|
@@ -19481,20 +19844,20 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
19481
19844
|
onClose();
|
|
19482
19845
|
}
|
|
19483
19846
|
};
|
|
19484
|
-
return /* @__PURE__ */ (0,
|
|
19485
|
-
/* @__PURE__ */ (0,
|
|
19486
|
-
/* @__PURE__ */ (0,
|
|
19487
|
-
/* @__PURE__ */ (0,
|
|
19847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Modal_default, { isOpen, onClose, title: titleText || t("notifications"), size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-4", children: [
|
|
19848
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-2 pb-2 border-b border-border", children: [
|
|
19849
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: cn("w-2 h-2 rounded-full", !notification.is_read ? "bg-primary" : "bg-border") }),
|
|
19850
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-xs text-muted-foreground", children: !notification.is_read ? t("newNotification") : t("readStatus") })
|
|
19488
19851
|
] }),
|
|
19489
|
-
notification.title && /* @__PURE__ */ (0,
|
|
19490
|
-
notification.body && /* @__PURE__ */ (0,
|
|
19491
|
-
/* @__PURE__ */ (0,
|
|
19492
|
-
/* @__PURE__ */ (0,
|
|
19493
|
-
hasLink && /* @__PURE__ */ (0,
|
|
19494
|
-
/* @__PURE__ */ (0,
|
|
19852
|
+
notification.title && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: notification.title }),
|
|
19853
|
+
notification.body && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "text-sm text-muted-foreground whitespace-pre-wrap leading-relaxed", children: notification.body }),
|
|
19854
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "text-xs text-muted-foreground border-t border-border pt-2", children: formatTime3(notification.created_at) }),
|
|
19855
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-2 justify-end pt-2", children: [
|
|
19856
|
+
hasLink && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Button_default, { variant: "primary", size: "sm", onClick: handleLinkClick, className: "gap-2", children: [
|
|
19857
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_lucide_react35.ExternalLink, { className: "w-4 h-4" }),
|
|
19495
19858
|
openLinkText || t("openLink")
|
|
19496
19859
|
] }),
|
|
19497
|
-
/* @__PURE__ */ (0,
|
|
19860
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button_default, { variant: "ghost", size: "sm", onClick: onClose, children: closeText || t("close") })
|
|
19498
19861
|
] })
|
|
19499
19862
|
] }) });
|
|
19500
19863
|
}
|
|
@@ -19503,10 +19866,10 @@ var NotificationModal_default = NotificationModal;
|
|
|
19503
19866
|
// ../../components/ui/FloatingContacts.tsx
|
|
19504
19867
|
var import_link2 = __toESM(require("next/link"), 1);
|
|
19505
19868
|
var import_navigation = require("next/navigation");
|
|
19506
|
-
var
|
|
19507
|
-
var
|
|
19869
|
+
var import_lucide_react36 = require("lucide-react");
|
|
19870
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
19508
19871
|
function MessengerIcon(props) {
|
|
19509
|
-
return /* @__PURE__ */ (0,
|
|
19872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("svg", { viewBox: "0 0 24 24", width: 24, height: 24, "aria-hidden": "true", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
19510
19873
|
"path",
|
|
19511
19874
|
{
|
|
19512
19875
|
d: "M12 2C6.477 2 2 6.145 2 11.235c0 2.93 1.35 5.542 3.464 7.25v3.515l3.344-1.836c.894.247 1.843.375 2.192.375 5.523 0 10-4.145 10-9.235S17.523 2 12 2zm.994 12.444l-2.563-2.73-5.004 2.73 5.507-5.84 2.626 2.729 4.942-2.729-5.508 5.84z",
|
|
@@ -19515,7 +19878,7 @@ function MessengerIcon(props) {
|
|
|
19515
19878
|
) });
|
|
19516
19879
|
}
|
|
19517
19880
|
function ZaloIcon(props) {
|
|
19518
|
-
return /* @__PURE__ */ (0,
|
|
19881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("svg", { viewBox: "0 0 48 48", width: 20, height: 20, "aria-hidden": "true", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
19519
19882
|
"path",
|
|
19520
19883
|
{
|
|
19521
19884
|
fill: "white",
|
|
@@ -19524,7 +19887,7 @@ function ZaloIcon(props) {
|
|
|
19524
19887
|
) });
|
|
19525
19888
|
}
|
|
19526
19889
|
function InstagramIcon(props) {
|
|
19527
|
-
return /* @__PURE__ */ (0,
|
|
19890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("svg", { viewBox: "0 0 24 24", width: 20, height: 20, "aria-hidden": "true", fill: "white", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z" }) });
|
|
19528
19891
|
}
|
|
19529
19892
|
function FloatingContacts({ className }) {
|
|
19530
19893
|
const pathname = (0, import_navigation.usePathname)();
|
|
@@ -19559,8 +19922,8 @@ function FloatingContacts({ className }) {
|
|
|
19559
19922
|
external: true
|
|
19560
19923
|
}
|
|
19561
19924
|
];
|
|
19562
|
-
return /* @__PURE__ */ (0,
|
|
19563
|
-
/* @__PURE__ */ (0,
|
|
19925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: cn("fixed bottom-6 right-4 z-100000", "flex flex-col items-end gap-3", className), "aria-label": "Quick contacts", children: [
|
|
19926
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
19564
19927
|
import_link2.default,
|
|
19565
19928
|
{
|
|
19566
19929
|
href: `tel:${hotline.replace(/\D/g, "")}`,
|
|
@@ -19571,10 +19934,10 @@ function FloatingContacts({ className }) {
|
|
|
19571
19934
|
"hover:scale-105 active:scale-95 transition-transform",
|
|
19572
19935
|
"bg-[#22c55e]"
|
|
19573
19936
|
),
|
|
19574
|
-
children: /* @__PURE__ */ (0,
|
|
19937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_lucide_react36.Phone, { className: "w-6 h-6" })
|
|
19575
19938
|
}
|
|
19576
19939
|
),
|
|
19577
|
-
moreItems.map(({ key, href, label, bg, Icon, external }) => /* @__PURE__ */ (0,
|
|
19940
|
+
moreItems.map(({ key, href, label, bg, Icon, external }) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
19578
19941
|
import_link2.default,
|
|
19579
19942
|
{
|
|
19580
19943
|
href,
|
|
@@ -19586,7 +19949,7 @@ function FloatingContacts({ className }) {
|
|
|
19586
19949
|
"hover:scale-105 active:scale-95 transition-transform",
|
|
19587
19950
|
bg
|
|
19588
19951
|
),
|
|
19589
|
-
children: /* @__PURE__ */ (0,
|
|
19952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Icon, { className: "w-6 h-6" })
|
|
19590
19953
|
},
|
|
19591
19954
|
key
|
|
19592
19955
|
))
|
|
@@ -19594,17 +19957,17 @@ function FloatingContacts({ className }) {
|
|
|
19594
19957
|
}
|
|
19595
19958
|
|
|
19596
19959
|
// ../../components/ui/AccessDenied.tsx
|
|
19597
|
-
var
|
|
19598
|
-
var
|
|
19960
|
+
var import_lucide_react37 = require("lucide-react");
|
|
19961
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
19599
19962
|
var VARIANT_STYLES = {
|
|
19600
19963
|
destructive: { bg: "bg-destructive/5", border: "border-destructive/20", text: "text-destructive" },
|
|
19601
19964
|
warning: { bg: "bg-warning/5", border: "border-warning/20", text: "text-warning" },
|
|
19602
19965
|
info: { bg: "bg-info/5", border: "border-info/20", text: "text-info" }
|
|
19603
19966
|
};
|
|
19604
19967
|
var DEFAULT_ICONS = {
|
|
19605
|
-
destructive:
|
|
19606
|
-
warning:
|
|
19607
|
-
info:
|
|
19968
|
+
destructive: import_lucide_react37.ShieldAlert,
|
|
19969
|
+
warning: import_lucide_react37.Ban,
|
|
19970
|
+
info: import_lucide_react37.Lock
|
|
19608
19971
|
};
|
|
19609
19972
|
function AccessDenied({
|
|
19610
19973
|
title = "Access Restricted",
|
|
@@ -19616,36 +19979,36 @@ function AccessDenied({
|
|
|
19616
19979
|
}) {
|
|
19617
19980
|
const styles = VARIANT_STYLES[variant];
|
|
19618
19981
|
const UsedIcon = Icon || DEFAULT_ICONS[variant];
|
|
19619
|
-
return /* @__PURE__ */ (0,
|
|
19620
|
-
/* @__PURE__ */ (0,
|
|
19621
|
-
/* @__PURE__ */ (0,
|
|
19622
|
-
/* @__PURE__ */ (0,
|
|
19623
|
-
/* @__PURE__ */ (0,
|
|
19982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Card_default, { className: cn("p-8 text-center shadow-sm", styles.bg, styles.border, className), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
19983
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: cn("p-3 rounded-lg", styles.bg.replace("/5", "/10")), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(UsedIcon, { className: cn("w-8 h-8", styles.text) }) }),
|
|
19984
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
19985
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("h3", { className: cn("font-semibold mb-2", styles.text), children: title }),
|
|
19986
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("p", { className: cn(styles.text.replace("text-", "text-") + "/80", "text-sm"), children: description })
|
|
19624
19987
|
] }),
|
|
19625
|
-
children && /* @__PURE__ */ (0,
|
|
19988
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "mt-2 flex flex-wrap gap-2 justify-center", children })
|
|
19626
19989
|
] }) });
|
|
19627
19990
|
}
|
|
19628
19991
|
|
|
19629
19992
|
// ../../components/ui/ThemeToggleHeadless.tsx
|
|
19630
|
-
var
|
|
19631
|
-
var
|
|
19993
|
+
var import_lucide_react38 = require("lucide-react");
|
|
19994
|
+
var import_react38 = require("react");
|
|
19632
19995
|
var import_react_dom7 = require("react-dom");
|
|
19633
|
-
var
|
|
19996
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
19634
19997
|
function ThemeToggleHeadless({
|
|
19635
19998
|
theme,
|
|
19636
19999
|
onChange,
|
|
19637
20000
|
labels,
|
|
19638
20001
|
className
|
|
19639
20002
|
}) {
|
|
19640
|
-
const [isOpen, setIsOpen] = (0,
|
|
19641
|
-
const [mounted, setMounted] = (0,
|
|
19642
|
-
const triggerRef = (0,
|
|
19643
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
19644
|
-
(0,
|
|
20003
|
+
const [isOpen, setIsOpen] = (0, import_react38.useState)(false);
|
|
20004
|
+
const [mounted, setMounted] = (0, import_react38.useState)(false);
|
|
20005
|
+
const triggerRef = (0, import_react38.useRef)(null);
|
|
20006
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react38.useState)(null);
|
|
20007
|
+
(0, import_react38.useEffect)(() => setMounted(true), []);
|
|
19645
20008
|
const themes = [
|
|
19646
|
-
{ value: "light", label: labels?.light ?? "Light", icon:
|
|
19647
|
-
{ value: "dark", label: labels?.dark ?? "Dark", icon:
|
|
19648
|
-
{ value: "system", label: labels?.system ?? "System", icon:
|
|
20009
|
+
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react38.Sun },
|
|
20010
|
+
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react38.Moon },
|
|
20011
|
+
{ value: "system", label: labels?.system ?? "System", icon: import_lucide_react38.Monitor }
|
|
19649
20012
|
];
|
|
19650
20013
|
const current = mounted ? themes.find((t) => t.value === theme) || themes[2] : themes[2];
|
|
19651
20014
|
const CurrentIcon = current.icon;
|
|
@@ -19659,8 +20022,8 @@ function ThemeToggleHeadless({
|
|
|
19659
20022
|
const top = rect.bottom + scrollTop + 8;
|
|
19660
20023
|
return { top, left, width };
|
|
19661
20024
|
};
|
|
19662
|
-
return /* @__PURE__ */ (0,
|
|
19663
|
-
/* @__PURE__ */ (0,
|
|
20025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: cn("relative", className), children: [
|
|
20026
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
19664
20027
|
Button_default,
|
|
19665
20028
|
{
|
|
19666
20029
|
variant: "ghost",
|
|
@@ -19678,25 +20041,25 @@ function ThemeToggleHeadless({
|
|
|
19678
20041
|
"aria-haspopup": "menu",
|
|
19679
20042
|
"aria-expanded": isOpen,
|
|
19680
20043
|
"aria-label": labels?.heading ?? "Theme",
|
|
19681
|
-
children: /* @__PURE__ */ (0,
|
|
20044
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(CurrentIcon, { className: "h-5 w-5" })
|
|
19682
20045
|
}
|
|
19683
20046
|
),
|
|
19684
|
-
isOpen && /* @__PURE__ */ (0,
|
|
19685
|
-
typeof window !== "undefined" && (0, import_react_dom7.createPortal)(/* @__PURE__ */ (0,
|
|
20047
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
20048
|
+
typeof window !== "undefined" && (0, import_react_dom7.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
|
|
19686
20049
|
typeof window !== "undefined" && dropdownPosition && (0, import_react_dom7.createPortal)(
|
|
19687
|
-
/* @__PURE__ */ (0,
|
|
20050
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
19688
20051
|
"div",
|
|
19689
20052
|
{
|
|
19690
20053
|
className: "z-9999 bg-card border border-border rounded-lg shadow-lg overflow-hidden",
|
|
19691
20054
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
19692
20055
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19693
20056
|
role: "menu",
|
|
19694
|
-
children: /* @__PURE__ */ (0,
|
|
19695
|
-
/* @__PURE__ */ (0,
|
|
20057
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "p-2", children: [
|
|
20058
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border mb-2", children: labels?.heading ?? "Theme" }),
|
|
19696
20059
|
themes.map((opt) => {
|
|
19697
20060
|
const Icon = opt.icon;
|
|
19698
20061
|
const active = theme === opt.value;
|
|
19699
|
-
return /* @__PURE__ */ (0,
|
|
20062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
19700
20063
|
Button_default,
|
|
19701
20064
|
{
|
|
19702
20065
|
variant: "ghost",
|
|
@@ -19712,9 +20075,9 @@ function ThemeToggleHeadless({
|
|
|
19712
20075
|
role: "menuitemradio",
|
|
19713
20076
|
"aria-checked": active,
|
|
19714
20077
|
children: [
|
|
19715
|
-
/* @__PURE__ */ (0,
|
|
19716
|
-
/* @__PURE__ */ (0,
|
|
19717
|
-
active && /* @__PURE__ */ (0,
|
|
20078
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon, { className: "h-4 w-4" }),
|
|
20079
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "flex-1 text-left", children: opt.label }),
|
|
20080
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
19718
20081
|
]
|
|
19719
20082
|
},
|
|
19720
20083
|
opt.value
|
|
@@ -19730,10 +20093,10 @@ function ThemeToggleHeadless({
|
|
|
19730
20093
|
}
|
|
19731
20094
|
|
|
19732
20095
|
// ../../components/ui/LanguageSwitcherHeadless.tsx
|
|
19733
|
-
var
|
|
20096
|
+
var import_react39 = require("react");
|
|
19734
20097
|
var import_react_dom8 = require("react-dom");
|
|
19735
|
-
var
|
|
19736
|
-
var
|
|
20098
|
+
var import_lucide_react39 = require("lucide-react");
|
|
20099
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
19737
20100
|
function LanguageSwitcherHeadless({
|
|
19738
20101
|
locales,
|
|
19739
20102
|
currentLocale,
|
|
@@ -19741,9 +20104,9 @@ function LanguageSwitcherHeadless({
|
|
|
19741
20104
|
labels,
|
|
19742
20105
|
className
|
|
19743
20106
|
}) {
|
|
19744
|
-
const [isOpen, setIsOpen] = (0,
|
|
19745
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
19746
|
-
const triggerButtonRef = (0,
|
|
20107
|
+
const [isOpen, setIsOpen] = (0, import_react39.useState)(false);
|
|
20108
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react39.useState)(null);
|
|
20109
|
+
const triggerButtonRef = (0, import_react39.useRef)(null);
|
|
19747
20110
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
19748
20111
|
const calculatePosition = () => {
|
|
19749
20112
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -19755,8 +20118,8 @@ function LanguageSwitcherHeadless({
|
|
|
19755
20118
|
const top = rect.bottom + scrollTop + 8;
|
|
19756
20119
|
return { top, left, width };
|
|
19757
20120
|
};
|
|
19758
|
-
return /* @__PURE__ */ (0,
|
|
19759
|
-
/* @__PURE__ */ (0,
|
|
20121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: cn("relative", className), children: [
|
|
20122
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
19760
20123
|
Button_default,
|
|
19761
20124
|
{
|
|
19762
20125
|
variant: "ghost",
|
|
@@ -19775,22 +20138,22 @@ function LanguageSwitcherHeadless({
|
|
|
19775
20138
|
"aria-expanded": isOpen,
|
|
19776
20139
|
"aria-label": labels?.heading ?? "Language",
|
|
19777
20140
|
title: labels?.heading ?? "Language",
|
|
19778
|
-
children: /* @__PURE__ */ (0,
|
|
20141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_lucide_react39.Globe, { className: "h-5 w-5" })
|
|
19779
20142
|
}
|
|
19780
20143
|
),
|
|
19781
|
-
isOpen && /* @__PURE__ */ (0,
|
|
19782
|
-
typeof window !== "undefined" && (0, import_react_dom8.createPortal)(/* @__PURE__ */ (0,
|
|
20144
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
20145
|
+
typeof window !== "undefined" && (0, import_react_dom8.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
|
|
19783
20146
|
typeof window !== "undefined" && dropdownPosition && (0, import_react_dom8.createPortal)(
|
|
19784
|
-
/* @__PURE__ */ (0,
|
|
20147
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
19785
20148
|
"div",
|
|
19786
20149
|
{
|
|
19787
20150
|
className: "z-9999 bg-card border border-border rounded-lg shadow-lg overflow-hidden",
|
|
19788
20151
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
19789
20152
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19790
20153
|
role: "menu",
|
|
19791
|
-
children: /* @__PURE__ */ (0,
|
|
19792
|
-
/* @__PURE__ */ (0,
|
|
19793
|
-
locales.map((language) => /* @__PURE__ */ (0,
|
|
20154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "p-2", children: [
|
|
20155
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border mb-2", children: labels?.heading ?? "Language" }),
|
|
20156
|
+
locales.map((language) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
19794
20157
|
Button_default,
|
|
19795
20158
|
{
|
|
19796
20159
|
variant: "ghost",
|
|
@@ -19803,9 +20166,9 @@ function LanguageSwitcherHeadless({
|
|
|
19803
20166
|
role: "menuitemradio",
|
|
19804
20167
|
"aria-checked": currentLocale === language.code,
|
|
19805
20168
|
children: [
|
|
19806
|
-
language.flag && /* @__PURE__ */ (0,
|
|
19807
|
-
/* @__PURE__ */ (0,
|
|
19808
|
-
currentLocale === language.code && /* @__PURE__ */ (0,
|
|
20169
|
+
language.flag && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "text-lg", children: language.flag }),
|
|
20170
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "flex-1 text-left", children: language.name }),
|
|
20171
|
+
currentLocale === language.code && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
19809
20172
|
]
|
|
19810
20173
|
},
|
|
19811
20174
|
language.code
|
|
@@ -20235,7 +20598,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
20235
20598
|
};
|
|
20236
20599
|
|
|
20237
20600
|
// src/contexts/TranslationContext.tsx
|
|
20238
|
-
var
|
|
20601
|
+
var React62 = __toESM(require("react"), 1);
|
|
20239
20602
|
|
|
20240
20603
|
// locales/en.json
|
|
20241
20604
|
var en_default = {
|
|
@@ -20634,16 +20997,16 @@ var ja_default = {
|
|
|
20634
20997
|
};
|
|
20635
20998
|
|
|
20636
20999
|
// src/contexts/TranslationContext.tsx
|
|
20637
|
-
var
|
|
21000
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
20638
21001
|
var defaultTranslations2 = {
|
|
20639
21002
|
en: en_default,
|
|
20640
21003
|
vi: vi_default,
|
|
20641
21004
|
ko: ko_default,
|
|
20642
21005
|
ja: ja_default
|
|
20643
21006
|
};
|
|
20644
|
-
var TranslationContext2 =
|
|
21007
|
+
var TranslationContext2 = React62.createContext(null);
|
|
20645
21008
|
var TranslationProvider = ({ children, locale = "en", translations }) => {
|
|
20646
|
-
const t =
|
|
21009
|
+
const t = React62.useCallback(
|
|
20647
21010
|
(namespace) => {
|
|
20648
21011
|
return (key) => {
|
|
20649
21012
|
const mergedTranslations = {
|
|
@@ -20668,10 +21031,10 @@ var TranslationProvider = ({ children, locale = "en", translations }) => {
|
|
|
20668
21031
|
},
|
|
20669
21032
|
[locale, translations]
|
|
20670
21033
|
);
|
|
20671
|
-
return /* @__PURE__ */ (0,
|
|
21034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TranslationContext2.Provider, { value: { locale, t }, children });
|
|
20672
21035
|
};
|
|
20673
21036
|
var useUnderverseTranslations = (namespace) => {
|
|
20674
|
-
const context =
|
|
21037
|
+
const context = React62.useContext(TranslationContext2);
|
|
20675
21038
|
if (!context) {
|
|
20676
21039
|
return (key) => {
|
|
20677
21040
|
const parts = namespace.split(".");
|
|
@@ -20693,13 +21056,13 @@ var useUnderverseTranslations = (namespace) => {
|
|
|
20693
21056
|
return context.t(namespace);
|
|
20694
21057
|
};
|
|
20695
21058
|
var useUnderverseLocale = () => {
|
|
20696
|
-
const context =
|
|
21059
|
+
const context = React62.useContext(TranslationContext2);
|
|
20697
21060
|
return context?.locale || "en";
|
|
20698
21061
|
};
|
|
20699
21062
|
|
|
20700
21063
|
// src/hooks/useSmartTranslations.tsx
|
|
20701
|
-
var
|
|
20702
|
-
var
|
|
21064
|
+
var React63 = __toESM(require("react"), 1);
|
|
21065
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
20703
21066
|
var nextIntlHooks = null;
|
|
20704
21067
|
try {
|
|
20705
21068
|
const nextIntl = require("next-intl");
|
|
@@ -20710,12 +21073,12 @@ try {
|
|
|
20710
21073
|
} catch {
|
|
20711
21074
|
nextIntlHooks = null;
|
|
20712
21075
|
}
|
|
20713
|
-
var ForceInternalContext =
|
|
21076
|
+
var ForceInternalContext = React63.createContext(false);
|
|
20714
21077
|
var ForceInternalTranslationsProvider = ({ children }) => {
|
|
20715
|
-
return /* @__PURE__ */ (0,
|
|
21078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ForceInternalContext.Provider, { value: true, children });
|
|
20716
21079
|
};
|
|
20717
21080
|
function useSmartTranslations(namespace) {
|
|
20718
|
-
const forceInternal =
|
|
21081
|
+
const forceInternal = React63.useContext(ForceInternalContext);
|
|
20719
21082
|
const internalT = useUnderverseTranslations(namespace);
|
|
20720
21083
|
if (forceInternal || !nextIntlHooks?.useTranslations) {
|
|
20721
21084
|
return internalT;
|
|
@@ -20728,7 +21091,7 @@ function useSmartTranslations(namespace) {
|
|
|
20728
21091
|
}
|
|
20729
21092
|
}
|
|
20730
21093
|
function useSmartLocale() {
|
|
20731
|
-
const forceInternal =
|
|
21094
|
+
const forceInternal = React63.useContext(ForceInternalContext);
|
|
20732
21095
|
const internalLocale = useUnderverseLocale();
|
|
20733
21096
|
if (forceInternal || !nextIntlHooks?.useLocale) {
|
|
20734
21097
|
return internalLocale;
|
|
@@ -20742,9 +21105,9 @@ function useSmartLocale() {
|
|
|
20742
21105
|
}
|
|
20743
21106
|
|
|
20744
21107
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
20745
|
-
var
|
|
21108
|
+
var import_react51 = require("react");
|
|
20746
21109
|
var import_next_intl6 = require("next-intl");
|
|
20747
|
-
var
|
|
21110
|
+
var import_react52 = require("@tiptap/react");
|
|
20748
21111
|
|
|
20749
21112
|
// ../../components/ui/UEditor/extensions.ts
|
|
20750
21113
|
var import_extension_document = __toESM(require("@tiptap/extension-document"), 1);
|
|
@@ -20784,22 +21147,22 @@ var import_lowlight = require("lowlight");
|
|
|
20784
21147
|
// ../../components/ui/UEditor/slash-command.tsx
|
|
20785
21148
|
var import_core = require("@tiptap/core");
|
|
20786
21149
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
20787
|
-
var
|
|
20788
|
-
var
|
|
20789
|
-
var
|
|
21150
|
+
var import_react40 = require("@tiptap/react");
|
|
21151
|
+
var import_react41 = require("react");
|
|
21152
|
+
var import_lucide_react40 = require("lucide-react");
|
|
20790
21153
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
20791
|
-
var
|
|
20792
|
-
var CommandList = (0,
|
|
20793
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
20794
|
-
const listRef = (0,
|
|
20795
|
-
(0,
|
|
21154
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
21155
|
+
var CommandList = (0, import_react41.forwardRef)((props, ref) => {
|
|
21156
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react41.useState)(0);
|
|
21157
|
+
const listRef = (0, import_react41.useRef)(null);
|
|
21158
|
+
(0, import_react41.useEffect)(() => {
|
|
20796
21159
|
setSelectedIndex(0);
|
|
20797
21160
|
}, [props.items]);
|
|
20798
|
-
(0,
|
|
21161
|
+
(0, import_react41.useEffect)(() => {
|
|
20799
21162
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
20800
21163
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
20801
21164
|
}, [selectedIndex, props.items]);
|
|
20802
|
-
(0,
|
|
21165
|
+
(0, import_react41.useImperativeHandle)(ref, () => ({
|
|
20803
21166
|
onKeyDown: ({ event }) => {
|
|
20804
21167
|
if (event.key === "ArrowUp") {
|
|
20805
21168
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -20820,11 +21183,11 @@ var CommandList = (0, import_react40.forwardRef)((props, ref) => {
|
|
|
20820
21183
|
}
|
|
20821
21184
|
}));
|
|
20822
21185
|
if (props.items.length === 0) {
|
|
20823
|
-
return /* @__PURE__ */ (0,
|
|
21186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "w-72 p-4 text-center text-sm text-muted-foreground", children: "No results" });
|
|
20824
21187
|
}
|
|
20825
|
-
return /* @__PURE__ */ (0,
|
|
20826
|
-
/* @__PURE__ */ (0,
|
|
20827
|
-
/* @__PURE__ */ (0,
|
|
21188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { ref: listRef, className: "w-72 max-h-80 overflow-y-auto bg-card border border-border rounded-2xl shadow-lg", children: [
|
|
21189
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "px-3 py-2 border-b", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Basic Blocks" }) }),
|
|
21190
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "p-1", children: props.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
20828
21191
|
"button",
|
|
20829
21192
|
{
|
|
20830
21193
|
type: "button",
|
|
@@ -20835,19 +21198,19 @@ var CommandList = (0, import_react40.forwardRef)((props, ref) => {
|
|
|
20835
21198
|
selectedIndex === index ? "bg-accent" : "hover:bg-accent/50"
|
|
20836
21199
|
),
|
|
20837
21200
|
children: [
|
|
20838
|
-
/* @__PURE__ */ (0,
|
|
21201
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
20839
21202
|
"div",
|
|
20840
21203
|
{
|
|
20841
21204
|
className: cn(
|
|
20842
21205
|
"flex items-center justify-center w-10 h-10 rounded-lg mr-3 transition-colors",
|
|
20843
21206
|
selectedIndex === index ? "bg-primary/10" : "bg-muted/50 group-hover:bg-muted"
|
|
20844
21207
|
),
|
|
20845
|
-
children: /* @__PURE__ */ (0,
|
|
21208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(item.icon, { className: cn("w-5 h-5", selectedIndex === index ? "text-primary" : "text-muted-foreground") })
|
|
20846
21209
|
}
|
|
20847
21210
|
),
|
|
20848
|
-
/* @__PURE__ */ (0,
|
|
20849
|
-
/* @__PURE__ */ (0,
|
|
20850
|
-
/* @__PURE__ */ (0,
|
|
21211
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "text-left", children: [
|
|
21212
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: cn("text-sm font-medium", selectedIndex === index && "text-primary"), children: item.title }),
|
|
21213
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "text-xs text-muted-foreground", children: item.description })
|
|
20851
21214
|
] })
|
|
20852
21215
|
]
|
|
20853
21216
|
},
|
|
@@ -20859,7 +21222,7 @@ CommandList.displayName = "CommandList";
|
|
|
20859
21222
|
var getSuggestionItems = ({ query }) => {
|
|
20860
21223
|
return [
|
|
20861
21224
|
{
|
|
20862
|
-
icon:
|
|
21225
|
+
icon: import_lucide_react40.Type,
|
|
20863
21226
|
title: "Text",
|
|
20864
21227
|
description: "Start writing with plain text",
|
|
20865
21228
|
command: ({ editor, range }) => {
|
|
@@ -20867,7 +21230,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20867
21230
|
}
|
|
20868
21231
|
},
|
|
20869
21232
|
{
|
|
20870
|
-
icon:
|
|
21233
|
+
icon: import_lucide_react40.Heading1,
|
|
20871
21234
|
title: "Heading 1",
|
|
20872
21235
|
description: "Large section heading",
|
|
20873
21236
|
command: ({ editor, range }) => {
|
|
@@ -20875,7 +21238,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20875
21238
|
}
|
|
20876
21239
|
},
|
|
20877
21240
|
{
|
|
20878
|
-
icon:
|
|
21241
|
+
icon: import_lucide_react40.Heading2,
|
|
20879
21242
|
title: "Heading 2",
|
|
20880
21243
|
description: "Medium section heading",
|
|
20881
21244
|
command: ({ editor, range }) => {
|
|
@@ -20883,7 +21246,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20883
21246
|
}
|
|
20884
21247
|
},
|
|
20885
21248
|
{
|
|
20886
|
-
icon:
|
|
21249
|
+
icon: import_lucide_react40.Heading3,
|
|
20887
21250
|
title: "Heading 3",
|
|
20888
21251
|
description: "Small section heading",
|
|
20889
21252
|
command: ({ editor, range }) => {
|
|
@@ -20891,7 +21254,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20891
21254
|
}
|
|
20892
21255
|
},
|
|
20893
21256
|
{
|
|
20894
|
-
icon:
|
|
21257
|
+
icon: import_lucide_react40.List,
|
|
20895
21258
|
title: "Bullet List",
|
|
20896
21259
|
description: "Create a simple bullet list",
|
|
20897
21260
|
command: ({ editor, range }) => {
|
|
@@ -20899,7 +21262,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20899
21262
|
}
|
|
20900
21263
|
},
|
|
20901
21264
|
{
|
|
20902
|
-
icon:
|
|
21265
|
+
icon: import_lucide_react40.ListOrdered,
|
|
20903
21266
|
title: "Numbered List",
|
|
20904
21267
|
description: "Create a list with numbering",
|
|
20905
21268
|
command: ({ editor, range }) => {
|
|
@@ -20907,7 +21270,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20907
21270
|
}
|
|
20908
21271
|
},
|
|
20909
21272
|
{
|
|
20910
|
-
icon:
|
|
21273
|
+
icon: import_lucide_react40.ListTodo,
|
|
20911
21274
|
title: "Todo List",
|
|
20912
21275
|
description: "Track tasks with a todo list",
|
|
20913
21276
|
command: ({ editor, range }) => {
|
|
@@ -20915,7 +21278,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20915
21278
|
}
|
|
20916
21279
|
},
|
|
20917
21280
|
{
|
|
20918
|
-
icon:
|
|
21281
|
+
icon: import_lucide_react40.Quote,
|
|
20919
21282
|
title: "Quote",
|
|
20920
21283
|
description: "Capture a quote",
|
|
20921
21284
|
command: ({ editor, range }) => {
|
|
@@ -20923,7 +21286,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20923
21286
|
}
|
|
20924
21287
|
},
|
|
20925
21288
|
{
|
|
20926
|
-
icon:
|
|
21289
|
+
icon: import_lucide_react40.FileCode,
|
|
20927
21290
|
title: "Code Block",
|
|
20928
21291
|
description: "Display code with syntax highlighting",
|
|
20929
21292
|
command: ({ editor, range }) => {
|
|
@@ -20931,7 +21294,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20931
21294
|
}
|
|
20932
21295
|
},
|
|
20933
21296
|
{
|
|
20934
|
-
icon:
|
|
21297
|
+
icon: import_lucide_react40.Minus,
|
|
20935
21298
|
title: "Divider",
|
|
20936
21299
|
description: "Visually divide blocks",
|
|
20937
21300
|
command: ({ editor, range }) => {
|
|
@@ -20939,7 +21302,7 @@ var getSuggestionItems = ({ query }) => {
|
|
|
20939
21302
|
}
|
|
20940
21303
|
},
|
|
20941
21304
|
{
|
|
20942
|
-
icon:
|
|
21305
|
+
icon: import_lucide_react40.Table,
|
|
20943
21306
|
title: "Table",
|
|
20944
21307
|
description: "Insert a table",
|
|
20945
21308
|
command: ({ editor, range }) => {
|
|
@@ -20964,7 +21327,7 @@ var SlashCommand = import_core.Extension.create({
|
|
|
20964
21327
|
let popup;
|
|
20965
21328
|
return {
|
|
20966
21329
|
onStart: (props) => {
|
|
20967
|
-
component = new
|
|
21330
|
+
component = new import_react40.ReactRenderer(CommandList, {
|
|
20968
21331
|
props,
|
|
20969
21332
|
editor: props.editor
|
|
20970
21333
|
});
|
|
@@ -21106,10 +21469,10 @@ var ClipboardImages = import_core2.Extension.create({
|
|
|
21106
21469
|
// ../../components/ui/UEditor/emoji-suggestion.tsx
|
|
21107
21470
|
var import_core3 = require("@tiptap/core");
|
|
21108
21471
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
|
|
21109
|
-
var
|
|
21472
|
+
var import_react42 = require("@tiptap/react");
|
|
21110
21473
|
var import_state2 = require("@tiptap/pm/state");
|
|
21111
|
-
var
|
|
21112
|
-
var
|
|
21474
|
+
var import_react43 = require("react");
|
|
21475
|
+
var import_lucide_react41 = require("lucide-react");
|
|
21113
21476
|
var import_tippy2 = __toESM(require("tippy.js"), 1);
|
|
21114
21477
|
|
|
21115
21478
|
// ../../components/ui/UEditor/emojis.ts
|
|
@@ -21878,13 +22241,13 @@ var EMOJI_LIST = [
|
|
|
21878
22241
|
];
|
|
21879
22242
|
|
|
21880
22243
|
// ../../components/ui/UEditor/emoji-suggestion.tsx
|
|
21881
|
-
var
|
|
21882
|
-
var EmojiList = (0,
|
|
21883
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
21884
|
-
(0,
|
|
22244
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
22245
|
+
var EmojiList = (0, import_react43.forwardRef)((props, ref) => {
|
|
22246
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react43.useState)(0);
|
|
22247
|
+
(0, import_react43.useEffect)(() => {
|
|
21885
22248
|
setSelectedIndex(0);
|
|
21886
22249
|
}, [props.items]);
|
|
21887
|
-
(0,
|
|
22250
|
+
(0, import_react43.useImperativeHandle)(ref, () => ({
|
|
21888
22251
|
onKeyDown: ({ event }) => {
|
|
21889
22252
|
if (event.key === "ArrowUp") {
|
|
21890
22253
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -21913,15 +22276,15 @@ var EmojiList = (0, import_react42.forwardRef)((props, ref) => {
|
|
|
21913
22276
|
}
|
|
21914
22277
|
}));
|
|
21915
22278
|
if (props.items.length === 0) {
|
|
21916
|
-
return /* @__PURE__ */ (0,
|
|
22279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-80 p-4 text-center text-sm text-muted-foreground bg-card border border-border rounded-2xl shadow-lg", children: "No emoji found" });
|
|
21917
22280
|
}
|
|
21918
|
-
return /* @__PURE__ */ (0,
|
|
21919
|
-
/* @__PURE__ */ (0,
|
|
21920
|
-
/* @__PURE__ */ (0,
|
|
21921
|
-
/* @__PURE__ */ (0,
|
|
22281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "w-80 max-h-80 overflow-y-auto bg-card border border-border rounded-2xl shadow-lg", children: [
|
|
22282
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
22283
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react41.Smile, { className: "w-4 h-4 text-primary" }),
|
|
22284
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Emoji" })
|
|
21922
22285
|
] }) }),
|
|
21923
|
-
/* @__PURE__ */ (0,
|
|
21924
|
-
/* @__PURE__ */ (0,
|
|
22286
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "p-3", children: [
|
|
22287
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "grid grid-cols-8 gap-1", children: props.items.slice(0, 64).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
21925
22288
|
"button",
|
|
21926
22289
|
{
|
|
21927
22290
|
type: "button",
|
|
@@ -21935,7 +22298,7 @@ var EmojiList = (0, import_react42.forwardRef)((props, ref) => {
|
|
|
21935
22298
|
},
|
|
21936
22299
|
item.name
|
|
21937
22300
|
)) }),
|
|
21938
|
-
props.items.length > 64 && /* @__PURE__ */ (0,
|
|
22301
|
+
props.items.length > 64 && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "mt-2 text-xs text-center text-muted-foreground", children: [
|
|
21939
22302
|
"Showing first 64 of ",
|
|
21940
22303
|
props.items.length,
|
|
21941
22304
|
" emojis"
|
|
@@ -21971,7 +22334,7 @@ var EmojiSuggestion = import_core3.Extension.create({
|
|
|
21971
22334
|
let popup;
|
|
21972
22335
|
return {
|
|
21973
22336
|
onStart: (props) => {
|
|
21974
|
-
component = new
|
|
22337
|
+
component = new import_react42.ReactRenderer(EmojiList, {
|
|
21975
22338
|
props,
|
|
21976
22339
|
editor: props.editor
|
|
21977
22340
|
});
|
|
@@ -22016,11 +22379,11 @@ var EmojiSuggestion = import_core3.Extension.create({
|
|
|
22016
22379
|
});
|
|
22017
22380
|
|
|
22018
22381
|
// ../../components/ui/UEditor/resizable-image.tsx
|
|
22019
|
-
var
|
|
22382
|
+
var import_react44 = require("react");
|
|
22020
22383
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
22021
22384
|
var import_core4 = require("@tiptap/core");
|
|
22022
|
-
var
|
|
22023
|
-
var
|
|
22385
|
+
var import_react45 = require("@tiptap/react");
|
|
22386
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
22024
22387
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
22025
22388
|
var AXIS_LOCK_THRESHOLD_PX = 4;
|
|
22026
22389
|
function toNullableNumber(value) {
|
|
@@ -22036,15 +22399,15 @@ function clamp8(value, min, max) {
|
|
|
22036
22399
|
}
|
|
22037
22400
|
function ResizableImageNodeView(props) {
|
|
22038
22401
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
22039
|
-
const wrapperRef = (0,
|
|
22040
|
-
const imgRef = (0,
|
|
22041
|
-
const [isHovered, setIsHovered] = (0,
|
|
22042
|
-
const [isResizing, setIsResizing] = (0,
|
|
22402
|
+
const wrapperRef = (0, import_react44.useRef)(null);
|
|
22403
|
+
const imgRef = (0, import_react44.useRef)(null);
|
|
22404
|
+
const [isHovered, setIsHovered] = (0, import_react44.useState)(false);
|
|
22405
|
+
const [isResizing, setIsResizing] = (0, import_react44.useState)(false);
|
|
22043
22406
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
22044
22407
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
22045
22408
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
22046
|
-
const dragStateRef = (0,
|
|
22047
|
-
(0,
|
|
22409
|
+
const dragStateRef = (0, import_react44.useRef)(null);
|
|
22410
|
+
(0, import_react44.useEffect)(() => {
|
|
22048
22411
|
const img = imgRef.current;
|
|
22049
22412
|
if (!img) return;
|
|
22050
22413
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -22138,8 +22501,8 @@ function ResizableImageNodeView(props) {
|
|
|
22138
22501
|
const showHandle = selected || isHovered || isResizing;
|
|
22139
22502
|
const wrapperAlignClass = textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "";
|
|
22140
22503
|
const wrapperWidthClass = "w-fit";
|
|
22141
|
-
return /* @__PURE__ */ (0,
|
|
22142
|
-
|
|
22504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
22505
|
+
import_react45.NodeViewWrapper,
|
|
22143
22506
|
{
|
|
22144
22507
|
as: "div",
|
|
22145
22508
|
ref: wrapperRef,
|
|
@@ -22152,7 +22515,7 @@ function ResizableImageNodeView(props) {
|
|
|
22152
22515
|
},
|
|
22153
22516
|
contentEditable: false,
|
|
22154
22517
|
children: [
|
|
22155
|
-
/* @__PURE__ */ (0,
|
|
22518
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
22156
22519
|
"img",
|
|
22157
22520
|
{
|
|
22158
22521
|
ref: imgRef,
|
|
@@ -22171,7 +22534,7 @@ function ResizableImageNodeView(props) {
|
|
|
22171
22534
|
}
|
|
22172
22535
|
}
|
|
22173
22536
|
),
|
|
22174
|
-
showHandle && /* @__PURE__ */ (0,
|
|
22537
|
+
showHandle && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
22175
22538
|
"div",
|
|
22176
22539
|
{
|
|
22177
22540
|
"aria-hidden": "true",
|
|
@@ -22220,7 +22583,7 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
22220
22583
|
return ["img", (0, import_core4.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2)];
|
|
22221
22584
|
},
|
|
22222
22585
|
addNodeView() {
|
|
22223
|
-
return (0,
|
|
22586
|
+
return (0, import_react45.ReactNodeViewRenderer)(ResizableImageNodeView);
|
|
22224
22587
|
}
|
|
22225
22588
|
}).configure({
|
|
22226
22589
|
allowBase64: true,
|
|
@@ -22337,18 +22700,18 @@ function buildUEditorExtensions({
|
|
|
22337
22700
|
}
|
|
22338
22701
|
|
|
22339
22702
|
// ../../components/ui/UEditor/toolbar.tsx
|
|
22340
|
-
var
|
|
22703
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
22341
22704
|
var import_next_intl3 = require("next-intl");
|
|
22342
|
-
var
|
|
22705
|
+
var import_lucide_react45 = require("lucide-react");
|
|
22343
22706
|
|
|
22344
22707
|
// ../../components/ui/UEditor/colors.tsx
|
|
22345
|
-
var
|
|
22708
|
+
var import_react46 = require("react");
|
|
22346
22709
|
var import_next_intl = require("next-intl");
|
|
22347
|
-
var
|
|
22348
|
-
var
|
|
22710
|
+
var import_lucide_react42 = require("lucide-react");
|
|
22711
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
22349
22712
|
var useEditorColors = () => {
|
|
22350
22713
|
const t = (0, import_next_intl.useTranslations)("UEditor");
|
|
22351
|
-
const textColors = (0,
|
|
22714
|
+
const textColors = (0, import_react46.useMemo)(
|
|
22352
22715
|
() => [
|
|
22353
22716
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
22354
22717
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -22361,7 +22724,7 @@ var useEditorColors = () => {
|
|
|
22361
22724
|
],
|
|
22362
22725
|
[t]
|
|
22363
22726
|
);
|
|
22364
|
-
const highlightColors = (0,
|
|
22727
|
+
const highlightColors = (0, import_react46.useMemo)(
|
|
22365
22728
|
() => [
|
|
22366
22729
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
22367
22730
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -22382,9 +22745,9 @@ var EditorColorPalette = ({
|
|
|
22382
22745
|
currentColor,
|
|
22383
22746
|
onSelect,
|
|
22384
22747
|
label
|
|
22385
|
-
}) => /* @__PURE__ */ (0,
|
|
22386
|
-
/* @__PURE__ */ (0,
|
|
22387
|
-
/* @__PURE__ */ (0,
|
|
22748
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "p-2", children: [
|
|
22749
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider px-2", children: label }),
|
|
22750
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "grid grid-cols-4 gap-1.5 mt-2", children: colors.map((c) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
22388
22751
|
"button",
|
|
22389
22752
|
{
|
|
22390
22753
|
type: "button",
|
|
@@ -22397,8 +22760,8 @@ var EditorColorPalette = ({
|
|
|
22397
22760
|
style: { backgroundColor: c.color || "transparent" },
|
|
22398
22761
|
title: c.name,
|
|
22399
22762
|
children: [
|
|
22400
|
-
c.color === "" && /* @__PURE__ */ (0,
|
|
22401
|
-
c.color === "inherit" && /* @__PURE__ */ (0,
|
|
22763
|
+
c.color === "" && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_lucide_react42.X, { className: "w-4 h-4 text-muted-foreground" }),
|
|
22764
|
+
c.color === "inherit" && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "text-xs font-medium", children: "A" })
|
|
22402
22765
|
]
|
|
22403
22766
|
},
|
|
22404
22767
|
c.name
|
|
@@ -22406,10 +22769,10 @@ var EditorColorPalette = ({
|
|
|
22406
22769
|
] });
|
|
22407
22770
|
|
|
22408
22771
|
// ../../components/ui/UEditor/inputs.tsx
|
|
22409
|
-
var
|
|
22772
|
+
var import_react47 = require("react");
|
|
22410
22773
|
var import_next_intl2 = require("next-intl");
|
|
22411
|
-
var
|
|
22412
|
-
var
|
|
22774
|
+
var import_lucide_react43 = require("lucide-react");
|
|
22775
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
22413
22776
|
function normalizeUrl(raw) {
|
|
22414
22777
|
const url = raw.trim();
|
|
22415
22778
|
if (!url) return "";
|
|
@@ -22423,9 +22786,9 @@ var LinkInput = ({
|
|
|
22423
22786
|
initialUrl = ""
|
|
22424
22787
|
}) => {
|
|
22425
22788
|
const t = (0, import_next_intl2.useTranslations)("UEditor");
|
|
22426
|
-
const [url, setUrl] = (0,
|
|
22427
|
-
const inputRef = (0,
|
|
22428
|
-
(0,
|
|
22789
|
+
const [url, setUrl] = (0, import_react47.useState)(initialUrl);
|
|
22790
|
+
const inputRef = (0, import_react47.useRef)(null);
|
|
22791
|
+
(0, import_react47.useEffect)(() => {
|
|
22429
22792
|
inputRef.current?.focus();
|
|
22430
22793
|
inputRef.current?.select();
|
|
22431
22794
|
}, []);
|
|
@@ -22434,8 +22797,8 @@ var LinkInput = ({
|
|
|
22434
22797
|
const normalized = normalizeUrl(url);
|
|
22435
22798
|
if (normalized) onSubmit(normalized);
|
|
22436
22799
|
};
|
|
22437
|
-
return /* @__PURE__ */ (0,
|
|
22438
|
-
/* @__PURE__ */ (0,
|
|
22800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("form", { onSubmit: handleSubmit, className: "flex items-center gap-2 p-2", children: [
|
|
22801
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
22439
22802
|
"input",
|
|
22440
22803
|
{
|
|
22441
22804
|
ref: inputRef,
|
|
@@ -22446,16 +22809,16 @@ var LinkInput = ({
|
|
|
22446
22809
|
className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
22447
22810
|
}
|
|
22448
22811
|
),
|
|
22449
|
-
/* @__PURE__ */ (0,
|
|
22450
|
-
/* @__PURE__ */ (0,
|
|
22812
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_lucide_react43.Check, { className: "w-4 h-4" }) }),
|
|
22813
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_lucide_react43.X, { className: "w-4 h-4" }) })
|
|
22451
22814
|
] });
|
|
22452
22815
|
};
|
|
22453
22816
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
22454
22817
|
const t = (0, import_next_intl2.useTranslations)("UEditor");
|
|
22455
|
-
const [url, setUrl] = (0,
|
|
22456
|
-
const [alt, setAlt] = (0,
|
|
22457
|
-
const inputRef = (0,
|
|
22458
|
-
(0,
|
|
22818
|
+
const [url, setUrl] = (0, import_react47.useState)("");
|
|
22819
|
+
const [alt, setAlt] = (0, import_react47.useState)("");
|
|
22820
|
+
const inputRef = (0, import_react47.useRef)(null);
|
|
22821
|
+
(0, import_react47.useEffect)(() => {
|
|
22459
22822
|
inputRef.current?.focus();
|
|
22460
22823
|
}, []);
|
|
22461
22824
|
const handleSubmit = (e) => {
|
|
@@ -22464,10 +22827,10 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
22464
22827
|
onSubmit(url, alt);
|
|
22465
22828
|
}
|
|
22466
22829
|
};
|
|
22467
|
-
return /* @__PURE__ */ (0,
|
|
22468
|
-
/* @__PURE__ */ (0,
|
|
22469
|
-
/* @__PURE__ */ (0,
|
|
22470
|
-
/* @__PURE__ */ (0,
|
|
22830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("form", { onSubmit: handleSubmit, className: "p-3 space-y-3", children: [
|
|
22831
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
22832
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.urlLabel") }),
|
|
22833
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
22471
22834
|
"input",
|
|
22472
22835
|
{
|
|
22473
22836
|
ref: inputRef,
|
|
@@ -22479,9 +22842,9 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
22479
22842
|
}
|
|
22480
22843
|
)
|
|
22481
22844
|
] }),
|
|
22482
|
-
/* @__PURE__ */ (0,
|
|
22483
|
-
/* @__PURE__ */ (0,
|
|
22484
|
-
/* @__PURE__ */ (0,
|
|
22845
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
22846
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.altLabel") }),
|
|
22847
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
22485
22848
|
"input",
|
|
22486
22849
|
{
|
|
22487
22850
|
type: "text",
|
|
@@ -22492,8 +22855,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
22492
22855
|
}
|
|
22493
22856
|
)
|
|
22494
22857
|
] }),
|
|
22495
|
-
/* @__PURE__ */ (0,
|
|
22496
|
-
/* @__PURE__ */ (0,
|
|
22858
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex gap-2", children: [
|
|
22859
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
22497
22860
|
"button",
|
|
22498
22861
|
{
|
|
22499
22862
|
type: "submit",
|
|
@@ -22502,31 +22865,31 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
22502
22865
|
children: t("imageInput.addBtn")
|
|
22503
22866
|
}
|
|
22504
22867
|
),
|
|
22505
|
-
/* @__PURE__ */ (0,
|
|
22868
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { type: "button", onClick: onCancel, className: "px-4 py-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: t("imageInput.cancelBtn") })
|
|
22506
22869
|
] })
|
|
22507
22870
|
] });
|
|
22508
22871
|
};
|
|
22509
22872
|
|
|
22510
22873
|
// ../../components/ui/UEditor/emoji-picker.tsx
|
|
22511
|
-
var
|
|
22512
|
-
var
|
|
22513
|
-
var
|
|
22874
|
+
var import_react48 = require("react");
|
|
22875
|
+
var import_lucide_react44 = require("lucide-react");
|
|
22876
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
22514
22877
|
var CATEGORY_ICONS = {
|
|
22515
|
-
"smileys_people":
|
|
22516
|
-
"animals_nature":
|
|
22517
|
-
"food_drink":
|
|
22518
|
-
"activity":
|
|
22519
|
-
"objects":
|
|
22520
|
-
"symbols":
|
|
22521
|
-
"flags":
|
|
22878
|
+
"smileys_people": import_lucide_react44.Smile,
|
|
22879
|
+
"animals_nature": import_lucide_react44.Leaf,
|
|
22880
|
+
"food_drink": import_lucide_react44.Utensils,
|
|
22881
|
+
"activity": import_lucide_react44.Dumbbell,
|
|
22882
|
+
"objects": import_lucide_react44.Lightbulb,
|
|
22883
|
+
"symbols": import_lucide_react44.Hash,
|
|
22884
|
+
"flags": import_lucide_react44.Flag
|
|
22522
22885
|
};
|
|
22523
22886
|
var EmojiPicker = ({ onSelect, onClose }) => {
|
|
22524
|
-
const [search, setSearch] = (0,
|
|
22525
|
-
const [activeCategory, setActiveCategory] = (0,
|
|
22526
|
-
const scrollContainerRef = (0,
|
|
22527
|
-
const categoryRefs = (0,
|
|
22528
|
-
const isUserScrolling = (0,
|
|
22529
|
-
const filteredCategories = (0,
|
|
22887
|
+
const [search, setSearch] = (0, import_react48.useState)("");
|
|
22888
|
+
const [activeCategory, setActiveCategory] = (0, import_react48.useState)(EMOJI_LIST[0]?.id || "");
|
|
22889
|
+
const scrollContainerRef = (0, import_react48.useRef)(null);
|
|
22890
|
+
const categoryRefs = (0, import_react48.useRef)({});
|
|
22891
|
+
const isUserScrolling = (0, import_react48.useRef)(false);
|
|
22892
|
+
const filteredCategories = (0, import_react48.useMemo)(() => {
|
|
22530
22893
|
if (!search.trim()) return EMOJI_LIST;
|
|
22531
22894
|
const query = search.toLowerCase();
|
|
22532
22895
|
return EMOJI_LIST.map((category) => ({
|
|
@@ -22540,7 +22903,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22540
22903
|
onSelect(emoji);
|
|
22541
22904
|
setSearch("");
|
|
22542
22905
|
};
|
|
22543
|
-
(0,
|
|
22906
|
+
(0, import_react48.useEffect)(() => {
|
|
22544
22907
|
if (search) return;
|
|
22545
22908
|
const container = scrollContainerRef.current;
|
|
22546
22909
|
if (!container) return;
|
|
@@ -22580,13 +22943,13 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22580
22943
|
isUserScrolling.current = true;
|
|
22581
22944
|
}, 500);
|
|
22582
22945
|
};
|
|
22583
|
-
(0,
|
|
22946
|
+
(0, import_react48.useEffect)(() => {
|
|
22584
22947
|
isUserScrolling.current = true;
|
|
22585
22948
|
}, []);
|
|
22586
|
-
return /* @__PURE__ */ (0,
|
|
22587
|
-
/* @__PURE__ */ (0,
|
|
22588
|
-
/* @__PURE__ */ (0,
|
|
22589
|
-
/* @__PURE__ */ (0,
|
|
22949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "w-96 bg-card border border-border rounded-2xl shadow-xl overflow-hidden flex flex-col max-h-128", children: [
|
|
22950
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "p-3 border-b bg-muted/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "relative", children: [
|
|
22951
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_lucide_react44.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" }),
|
|
22952
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
22590
22953
|
"input",
|
|
22591
22954
|
{
|
|
22592
22955
|
type: "text",
|
|
@@ -22601,16 +22964,16 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22601
22964
|
)
|
|
22602
22965
|
}
|
|
22603
22966
|
),
|
|
22604
|
-
search && /* @__PURE__ */ (0,
|
|
22967
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
22605
22968
|
"button",
|
|
22606
22969
|
{
|
|
22607
22970
|
onClick: () => setSearch(""),
|
|
22608
22971
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
22609
|
-
children: /* @__PURE__ */ (0,
|
|
22972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_lucide_react44.X, { className: "w-4 h-4" })
|
|
22610
22973
|
}
|
|
22611
22974
|
)
|
|
22612
22975
|
] }) }),
|
|
22613
|
-
/* @__PURE__ */ (0,
|
|
22976
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
22614
22977
|
"div",
|
|
22615
22978
|
{
|
|
22616
22979
|
ref: scrollContainerRef,
|
|
@@ -22618,9 +22981,9 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22618
22981
|
style: { height: "20rem" },
|
|
22619
22982
|
children: search ? (
|
|
22620
22983
|
// Search Results
|
|
22621
|
-
filteredCategories.length > 0 ? filteredCategories.map((category) => /* @__PURE__ */ (0,
|
|
22622
|
-
/* @__PURE__ */ (0,
|
|
22623
|
-
/* @__PURE__ */ (0,
|
|
22984
|
+
filteredCategories.length > 0 ? filteredCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "mb-4", children: [
|
|
22985
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 sticky top-0 bg-card py-1", children: category.name }),
|
|
22986
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "grid grid-cols-9 gap-1", children: category.emojis.map((emoji) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
22624
22987
|
"button",
|
|
22625
22988
|
{
|
|
22626
22989
|
onClick: () => handleEmojiClick(emoji.emoji),
|
|
@@ -22634,22 +22997,22 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22634
22997
|
},
|
|
22635
22998
|
emoji.name
|
|
22636
22999
|
)) })
|
|
22637
|
-
] }, category.id)) : /* @__PURE__ */ (0,
|
|
22638
|
-
/* @__PURE__ */ (0,
|
|
22639
|
-
/* @__PURE__ */ (0,
|
|
22640
|
-
/* @__PURE__ */ (0,
|
|
23000
|
+
] }, category.id)) : /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-col items-center justify-center h-full text-center", children: [
|
|
23001
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-4xl mb-2", children: "\u{1F50D}" }),
|
|
23002
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-sm font-medium text-muted-foreground", children: "Kh\xF4ng t\xECm th\u1EA5y emoji" }),
|
|
23003
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-xs text-muted-foreground mt-1", children: "Th\u1EED t\u1EEB kh\xF3a kh\xE1c" })
|
|
22641
23004
|
] })
|
|
22642
23005
|
) : (
|
|
22643
23006
|
// All Categories - Messenger Style
|
|
22644
|
-
/* @__PURE__ */ (0,
|
|
23007
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "space-y-4", children: EMOJI_LIST.map((category) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
22645
23008
|
"div",
|
|
22646
23009
|
{
|
|
22647
23010
|
ref: (el) => {
|
|
22648
23011
|
categoryRefs.current[category.id] = el;
|
|
22649
23012
|
},
|
|
22650
23013
|
children: [
|
|
22651
|
-
/* @__PURE__ */ (0,
|
|
22652
|
-
/* @__PURE__ */ (0,
|
|
23014
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 sticky top-0 bg-card py-1 z-10", children: category.name }),
|
|
23015
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "grid grid-cols-9 gap-1", children: category.emojis.map((emoji) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
22653
23016
|
"button",
|
|
22654
23017
|
{
|
|
22655
23018
|
onClick: () => handleEmojiClick(emoji.emoji),
|
|
@@ -22670,9 +23033,9 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22670
23033
|
)
|
|
22671
23034
|
}
|
|
22672
23035
|
),
|
|
22673
|
-
!search && /* @__PURE__ */ (0,
|
|
22674
|
-
const IconComponent = CATEGORY_ICONS[category.id] ||
|
|
22675
|
-
return /* @__PURE__ */ (0,
|
|
23036
|
+
!search && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "flex items-center justify-around px-2 py-2 border-t bg-muted/30 shrink-0", children: EMOJI_LIST.map((category) => {
|
|
23037
|
+
const IconComponent = CATEGORY_ICONS[category.id] || import_lucide_react44.Smile;
|
|
23038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
22676
23039
|
"button",
|
|
22677
23040
|
{
|
|
22678
23041
|
onClick: () => handleCategoryClick(category.id),
|
|
@@ -22681,7 +23044,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22681
23044
|
activeCategory === category.id ? "text-primary bg-primary/10" : "text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
22682
23045
|
),
|
|
22683
23046
|
title: category.name,
|
|
22684
|
-
children: /* @__PURE__ */ (0,
|
|
23047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(IconComponent, { className: "w-5 h-5" })
|
|
22685
23048
|
},
|
|
22686
23049
|
category.id
|
|
22687
23050
|
);
|
|
@@ -22690,7 +23053,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
22690
23053
|
};
|
|
22691
23054
|
|
|
22692
23055
|
// ../../components/ui/UEditor/toolbar.tsx
|
|
22693
|
-
var
|
|
23056
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
22694
23057
|
function fileToDataUrl2(file) {
|
|
22695
23058
|
return new Promise((resolve, reject) => {
|
|
22696
23059
|
const reader = new FileReader();
|
|
@@ -22699,8 +23062,8 @@ function fileToDataUrl2(file) {
|
|
|
22699
23062
|
reader.readAsDataURL(file);
|
|
22700
23063
|
});
|
|
22701
23064
|
}
|
|
22702
|
-
var ToolbarButton =
|
|
22703
|
-
const button = /* @__PURE__ */ (0,
|
|
23065
|
+
var ToolbarButton = import_react49.default.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
23066
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22704
23067
|
"button",
|
|
22705
23068
|
{
|
|
22706
23069
|
ref,
|
|
@@ -22723,12 +23086,12 @@ var ToolbarButton = import_react48.default.forwardRef(({ onClick, onMouseDown, a
|
|
|
22723
23086
|
}
|
|
22724
23087
|
);
|
|
22725
23088
|
if (title) {
|
|
22726
|
-
return /* @__PURE__ */ (0,
|
|
23089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Tooltip, { content: title, placement: "top", delay: { open: 200, close: 0 }, children: button });
|
|
22727
23090
|
}
|
|
22728
23091
|
return button;
|
|
22729
23092
|
});
|
|
22730
23093
|
ToolbarButton.displayName = "ToolbarButton";
|
|
22731
|
-
var ToolbarDivider = () => /* @__PURE__ */ (0,
|
|
23094
|
+
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" });
|
|
22732
23095
|
var EditorToolbar = ({
|
|
22733
23096
|
editor,
|
|
22734
23097
|
variant,
|
|
@@ -22737,10 +23100,10 @@ var EditorToolbar = ({
|
|
|
22737
23100
|
}) => {
|
|
22738
23101
|
const t = (0, import_next_intl3.useTranslations)("UEditor");
|
|
22739
23102
|
const { textColors, highlightColors } = useEditorColors();
|
|
22740
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
22741
|
-
const fileInputRef = (0,
|
|
22742
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
22743
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
23103
|
+
const [showImageInput, setShowImageInput] = (0, import_react49.useState)(false);
|
|
23104
|
+
const fileInputRef = (0, import_react49.useRef)(null);
|
|
23105
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react49.useState)(false);
|
|
23106
|
+
const [imageUploadError, setImageUploadError] = (0, import_react49.useState)(null);
|
|
22744
23107
|
const insertImageFiles = async (files) => {
|
|
22745
23108
|
if (files.length === 0) return;
|
|
22746
23109
|
setIsUploadingImage(true);
|
|
@@ -22759,63 +23122,63 @@ var EditorToolbar = ({
|
|
|
22759
23122
|
setIsUploadingImage(false);
|
|
22760
23123
|
};
|
|
22761
23124
|
if (variant === "minimal") {
|
|
22762
|
-
return /* @__PURE__ */ (0,
|
|
22763
|
-
/* @__PURE__ */ (0,
|
|
22764
|
-
/* @__PURE__ */ (0,
|
|
22765
|
-
/* @__PURE__ */ (0,
|
|
23125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center gap-1 p-2 border-b bg-muted/30", children: [
|
|
23126
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Bold, { className: "w-4 h-4" }) }),
|
|
23127
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Italic, { className: "w-4 h-4" }) }),
|
|
23128
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22766
23129
|
ToolbarButton,
|
|
22767
23130
|
{
|
|
22768
23131
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
22769
23132
|
active: editor.isActive("bulletList"),
|
|
22770
23133
|
title: t("toolbar.bulletList"),
|
|
22771
|
-
children: /* @__PURE__ */ (0,
|
|
23134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.List, { className: "w-4 h-4" })
|
|
22772
23135
|
}
|
|
22773
23136
|
)
|
|
22774
23137
|
] });
|
|
22775
23138
|
}
|
|
22776
|
-
return /* @__PURE__ */ (0,
|
|
22777
|
-
/* @__PURE__ */ (0,
|
|
23139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-wrap items-center gap-1 p-2 border-b bg-linear-to-r from-muted/30 to-transparent", children: [
|
|
23140
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
22778
23141
|
DropdownMenu,
|
|
22779
23142
|
{
|
|
22780
|
-
trigger: /* @__PURE__ */ (0,
|
|
23143
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
22781
23144
|
}, title: t("toolbar.textStyle"), className: "px-2 w-auto gap-1", children: [
|
|
22782
|
-
/* @__PURE__ */ (0,
|
|
22783
|
-
/* @__PURE__ */ (0,
|
|
23145
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Type, { className: "w-4 h-4" }),
|
|
23146
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
22784
23147
|
] }),
|
|
22785
23148
|
children: [
|
|
22786
|
-
/* @__PURE__ */ (0,
|
|
23149
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22787
23150
|
DropdownMenuItem,
|
|
22788
23151
|
{
|
|
22789
|
-
icon:
|
|
23152
|
+
icon: import_lucide_react45.Type,
|
|
22790
23153
|
label: t("toolbar.normal"),
|
|
22791
23154
|
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
22792
23155
|
active: editor.isActive("paragraph")
|
|
22793
23156
|
}
|
|
22794
23157
|
),
|
|
22795
|
-
/* @__PURE__ */ (0,
|
|
23158
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22796
23159
|
DropdownMenuItem,
|
|
22797
23160
|
{
|
|
22798
|
-
icon:
|
|
23161
|
+
icon: import_lucide_react45.Heading1,
|
|
22799
23162
|
label: t("toolbar.heading1"),
|
|
22800
23163
|
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
22801
23164
|
active: editor.isActive("heading", { level: 1 }),
|
|
22802
23165
|
shortcut: "Ctrl+Alt+1"
|
|
22803
23166
|
}
|
|
22804
23167
|
),
|
|
22805
|
-
/* @__PURE__ */ (0,
|
|
23168
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22806
23169
|
DropdownMenuItem,
|
|
22807
23170
|
{
|
|
22808
|
-
icon:
|
|
23171
|
+
icon: import_lucide_react45.Heading2,
|
|
22809
23172
|
label: t("toolbar.heading2"),
|
|
22810
23173
|
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
22811
23174
|
active: editor.isActive("heading", { level: 2 }),
|
|
22812
23175
|
shortcut: "Ctrl+Alt+2"
|
|
22813
23176
|
}
|
|
22814
23177
|
),
|
|
22815
|
-
/* @__PURE__ */ (0,
|
|
23178
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22816
23179
|
DropdownMenuItem,
|
|
22817
23180
|
{
|
|
22818
|
-
icon:
|
|
23181
|
+
icon: import_lucide_react45.Heading3,
|
|
22819
23182
|
label: t("toolbar.heading3"),
|
|
22820
23183
|
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
22821
23184
|
active: editor.isActive("heading", { level: 3 }),
|
|
@@ -22825,30 +23188,30 @@ var EditorToolbar = ({
|
|
|
22825
23188
|
]
|
|
22826
23189
|
}
|
|
22827
23190
|
),
|
|
22828
|
-
/* @__PURE__ */ (0,
|
|
22829
|
-
/* @__PURE__ */ (0,
|
|
22830
|
-
/* @__PURE__ */ (0,
|
|
22831
|
-
/* @__PURE__ */ (0,
|
|
23191
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarDivider, {}),
|
|
23192
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Bold, { className: "w-4 h-4" }) }),
|
|
23193
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Italic, { className: "w-4 h-4" }) }),
|
|
23194
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22832
23195
|
ToolbarButton,
|
|
22833
23196
|
{
|
|
22834
23197
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
22835
23198
|
active: editor.isActive("underline"),
|
|
22836
23199
|
title: t("toolbar.underline"),
|
|
22837
|
-
children: /* @__PURE__ */ (0,
|
|
23200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Underline, { className: "w-4 h-4" })
|
|
22838
23201
|
}
|
|
22839
23202
|
),
|
|
22840
|
-
/* @__PURE__ */ (0,
|
|
22841
|
-
/* @__PURE__ */ (0,
|
|
22842
|
-
/* @__PURE__ */ (0,
|
|
22843
|
-
/* @__PURE__ */ (0,
|
|
23203
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Strikethrough, { className: "w-4 h-4" }) }),
|
|
23204
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Code, { className: "w-4 h-4" }) }),
|
|
23205
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarDivider, {}),
|
|
23206
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22844
23207
|
DropdownMenu,
|
|
22845
23208
|
{
|
|
22846
|
-
trigger: /* @__PURE__ */ (0,
|
|
23209
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
22847
23210
|
}, title: t("colors.textColor"), children: [
|
|
22848
|
-
/* @__PURE__ */ (0,
|
|
22849
|
-
/* @__PURE__ */ (0,
|
|
23211
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Palette, { className: "w-4 h-4" }),
|
|
23212
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
22850
23213
|
] }),
|
|
22851
|
-
children: /* @__PURE__ */ (0,
|
|
23214
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22852
23215
|
EditorColorPalette,
|
|
22853
23216
|
{
|
|
22854
23217
|
colors: textColors,
|
|
@@ -22865,15 +23228,15 @@ var EditorToolbar = ({
|
|
|
22865
23228
|
)
|
|
22866
23229
|
}
|
|
22867
23230
|
),
|
|
22868
|
-
/* @__PURE__ */ (0,
|
|
23231
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22869
23232
|
DropdownMenu,
|
|
22870
23233
|
{
|
|
22871
|
-
trigger: /* @__PURE__ */ (0,
|
|
23234
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
22872
23235
|
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
22873
|
-
/* @__PURE__ */ (0,
|
|
22874
|
-
/* @__PURE__ */ (0,
|
|
23236
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Highlighter, { className: "w-4 h-4" }),
|
|
23237
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
22875
23238
|
] }),
|
|
22876
|
-
children: /* @__PURE__ */ (0,
|
|
23239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22877
23240
|
EditorColorPalette,
|
|
22878
23241
|
{
|
|
22879
23242
|
colors: highlightColors,
|
|
@@ -22890,13 +23253,13 @@ var EditorToolbar = ({
|
|
|
22890
23253
|
)
|
|
22891
23254
|
}
|
|
22892
23255
|
),
|
|
22893
|
-
/* @__PURE__ */ (0,
|
|
22894
|
-
/* @__PURE__ */ (0,
|
|
23256
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarDivider, {}),
|
|
23257
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22895
23258
|
DropdownMenu,
|
|
22896
23259
|
{
|
|
22897
|
-
trigger: /* @__PURE__ */ (0,
|
|
22898
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0,
|
|
22899
|
-
children: /* @__PURE__ */ (0,
|
|
23260
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => {
|
|
23261
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Smile, { className: "w-4 h-4" }) }),
|
|
23262
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22900
23263
|
EmojiPicker,
|
|
22901
23264
|
{
|
|
22902
23265
|
onSelect: (emoji) => {
|
|
@@ -22906,47 +23269,47 @@ var EditorToolbar = ({
|
|
|
22906
23269
|
)
|
|
22907
23270
|
}
|
|
22908
23271
|
),
|
|
22909
|
-
/* @__PURE__ */ (0,
|
|
22910
|
-
/* @__PURE__ */ (0,
|
|
23272
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarDivider, {}),
|
|
23273
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
22911
23274
|
DropdownMenu,
|
|
22912
23275
|
{
|
|
22913
|
-
trigger: /* @__PURE__ */ (0,
|
|
23276
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
22914
23277
|
}, title: t("toolbar.alignment"), children: [
|
|
22915
|
-
/* @__PURE__ */ (0,
|
|
22916
|
-
/* @__PURE__ */ (0,
|
|
23278
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.AlignLeft, { className: "w-4 h-4" }),
|
|
23279
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
22917
23280
|
] }),
|
|
22918
23281
|
children: [
|
|
22919
|
-
/* @__PURE__ */ (0,
|
|
23282
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22920
23283
|
DropdownMenuItem,
|
|
22921
23284
|
{
|
|
22922
|
-
icon:
|
|
23285
|
+
icon: import_lucide_react45.AlignLeft,
|
|
22923
23286
|
label: t("toolbar.alignLeft"),
|
|
22924
23287
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
22925
23288
|
active: editor.isActive({ textAlign: "left" })
|
|
22926
23289
|
}
|
|
22927
23290
|
),
|
|
22928
|
-
/* @__PURE__ */ (0,
|
|
23291
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22929
23292
|
DropdownMenuItem,
|
|
22930
23293
|
{
|
|
22931
|
-
icon:
|
|
23294
|
+
icon: import_lucide_react45.AlignCenter,
|
|
22932
23295
|
label: t("toolbar.alignCenter"),
|
|
22933
23296
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
22934
23297
|
active: editor.isActive({ textAlign: "center" })
|
|
22935
23298
|
}
|
|
22936
23299
|
),
|
|
22937
|
-
/* @__PURE__ */ (0,
|
|
23300
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22938
23301
|
DropdownMenuItem,
|
|
22939
23302
|
{
|
|
22940
|
-
icon:
|
|
23303
|
+
icon: import_lucide_react45.AlignRight,
|
|
22941
23304
|
label: t("toolbar.alignRight"),
|
|
22942
23305
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
22943
23306
|
active: editor.isActive({ textAlign: "right" })
|
|
22944
23307
|
}
|
|
22945
23308
|
),
|
|
22946
|
-
/* @__PURE__ */ (0,
|
|
23309
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22947
23310
|
DropdownMenuItem,
|
|
22948
23311
|
{
|
|
22949
|
-
icon:
|
|
23312
|
+
icon: import_lucide_react45.AlignJustify,
|
|
22950
23313
|
label: t("toolbar.justify"),
|
|
22951
23314
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
22952
23315
|
active: editor.isActive({ textAlign: "justify" })
|
|
@@ -22955,40 +23318,40 @@ var EditorToolbar = ({
|
|
|
22955
23318
|
]
|
|
22956
23319
|
}
|
|
22957
23320
|
),
|
|
22958
|
-
/* @__PURE__ */ (0,
|
|
22959
|
-
/* @__PURE__ */ (0,
|
|
23321
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarDivider, {}),
|
|
23322
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
22960
23323
|
DropdownMenu,
|
|
22961
23324
|
{
|
|
22962
|
-
trigger: /* @__PURE__ */ (0,
|
|
23325
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
22963
23326
|
}, title: t("toolbar.bulletList"), children: [
|
|
22964
|
-
/* @__PURE__ */ (0,
|
|
22965
|
-
/* @__PURE__ */ (0,
|
|
23327
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.List, { className: "w-4 h-4" }),
|
|
23328
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
22966
23329
|
] }),
|
|
22967
23330
|
children: [
|
|
22968
|
-
/* @__PURE__ */ (0,
|
|
23331
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22969
23332
|
DropdownMenuItem,
|
|
22970
23333
|
{
|
|
22971
|
-
icon:
|
|
23334
|
+
icon: import_lucide_react45.List,
|
|
22972
23335
|
label: t("toolbar.bulletList"),
|
|
22973
23336
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
22974
23337
|
active: editor.isActive("bulletList"),
|
|
22975
23338
|
shortcut: "Ctrl+Shift+8"
|
|
22976
23339
|
}
|
|
22977
23340
|
),
|
|
22978
|
-
/* @__PURE__ */ (0,
|
|
23341
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22979
23342
|
DropdownMenuItem,
|
|
22980
23343
|
{
|
|
22981
|
-
icon:
|
|
23344
|
+
icon: import_lucide_react45.ListOrdered,
|
|
22982
23345
|
label: t("toolbar.orderedList"),
|
|
22983
23346
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
22984
23347
|
active: editor.isActive("orderedList"),
|
|
22985
23348
|
shortcut: "Ctrl+Shift+7"
|
|
22986
23349
|
}
|
|
22987
23350
|
),
|
|
22988
|
-
/* @__PURE__ */ (0,
|
|
23351
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
22989
23352
|
DropdownMenuItem,
|
|
22990
23353
|
{
|
|
22991
|
-
icon:
|
|
23354
|
+
icon: import_lucide_react45.ListTodo,
|
|
22992
23355
|
label: t("toolbar.taskList"),
|
|
22993
23356
|
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
22994
23357
|
active: editor.isActive("taskList"),
|
|
@@ -22998,29 +23361,29 @@ var EditorToolbar = ({
|
|
|
22998
23361
|
]
|
|
22999
23362
|
}
|
|
23000
23363
|
),
|
|
23001
|
-
/* @__PURE__ */ (0,
|
|
23364
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
23002
23365
|
DropdownMenu,
|
|
23003
23366
|
{
|
|
23004
|
-
trigger: /* @__PURE__ */ (0,
|
|
23367
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
23005
23368
|
}, title: t("toolbar.quote"), children: [
|
|
23006
|
-
/* @__PURE__ */ (0,
|
|
23007
|
-
/* @__PURE__ */ (0,
|
|
23369
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Quote, { className: "w-4 h-4" }),
|
|
23370
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
23008
23371
|
] }),
|
|
23009
23372
|
children: [
|
|
23010
|
-
/* @__PURE__ */ (0,
|
|
23373
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23011
23374
|
DropdownMenuItem,
|
|
23012
23375
|
{
|
|
23013
|
-
icon:
|
|
23376
|
+
icon: import_lucide_react45.Quote,
|
|
23014
23377
|
label: t("toolbar.quote"),
|
|
23015
23378
|
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
23016
23379
|
active: editor.isActive("blockquote"),
|
|
23017
23380
|
shortcut: "Ctrl+Shift+B"
|
|
23018
23381
|
}
|
|
23019
23382
|
),
|
|
23020
|
-
/* @__PURE__ */ (0,
|
|
23383
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23021
23384
|
DropdownMenuItem,
|
|
23022
23385
|
{
|
|
23023
|
-
icon:
|
|
23386
|
+
icon: import_lucide_react45.FileCode,
|
|
23024
23387
|
label: t("toolbar.codeBlock"),
|
|
23025
23388
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
23026
23389
|
active: editor.isActive("codeBlock"),
|
|
@@ -23030,15 +23393,15 @@ var EditorToolbar = ({
|
|
|
23030
23393
|
]
|
|
23031
23394
|
}
|
|
23032
23395
|
),
|
|
23033
|
-
/* @__PURE__ */ (0,
|
|
23396
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23034
23397
|
DropdownMenu,
|
|
23035
23398
|
{
|
|
23036
|
-
trigger: /* @__PURE__ */ (0,
|
|
23399
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
23037
23400
|
}, title: t("toolbar.image"), children: [
|
|
23038
|
-
/* @__PURE__ */ (0,
|
|
23039
|
-
/* @__PURE__ */ (0,
|
|
23401
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Image, { className: "w-4 h-4" }),
|
|
23402
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
23040
23403
|
] }),
|
|
23041
|
-
children: showImageInput ? /* @__PURE__ */ (0,
|
|
23404
|
+
children: showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23042
23405
|
ImageInput,
|
|
23043
23406
|
{
|
|
23044
23407
|
onSubmit: (url, alt) => {
|
|
@@ -23047,19 +23410,19 @@ var EditorToolbar = ({
|
|
|
23047
23410
|
},
|
|
23048
23411
|
onCancel: () => setShowImageInput(false)
|
|
23049
23412
|
}
|
|
23050
|
-
) : /* @__PURE__ */ (0,
|
|
23051
|
-
/* @__PURE__ */ (0,
|
|
23052
|
-
/* @__PURE__ */ (0,
|
|
23413
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
23414
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(DropdownMenuItem, { icon: import_lucide_react45.Link, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true) }),
|
|
23415
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23053
23416
|
DropdownMenuItem,
|
|
23054
23417
|
{
|
|
23055
|
-
icon:
|
|
23418
|
+
icon: import_lucide_react45.Upload,
|
|
23056
23419
|
label: isUploadingImage ? t("imageInput.uploading") : t("imageInput.uploadTab"),
|
|
23057
23420
|
disabled: isUploadingImage,
|
|
23058
23421
|
onClick: () => fileInputRef.current?.click()
|
|
23059
23422
|
}
|
|
23060
23423
|
),
|
|
23061
|
-
imageUploadError && /* @__PURE__ */ (0,
|
|
23062
|
-
/* @__PURE__ */ (0,
|
|
23424
|
+
imageUploadError && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
23425
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23063
23426
|
"input",
|
|
23064
23427
|
{
|
|
23065
23428
|
ref: fileInputRef,
|
|
@@ -23077,83 +23440,83 @@ var EditorToolbar = ({
|
|
|
23077
23440
|
] })
|
|
23078
23441
|
}
|
|
23079
23442
|
),
|
|
23080
|
-
/* @__PURE__ */ (0,
|
|
23443
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
23081
23444
|
DropdownMenu,
|
|
23082
23445
|
{
|
|
23083
|
-
trigger: /* @__PURE__ */ (0,
|
|
23446
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ToolbarButton, { onClick: () => {
|
|
23084
23447
|
}, title: t("toolbar.table"), children: [
|
|
23085
|
-
/* @__PURE__ */ (0,
|
|
23086
|
-
/* @__PURE__ */ (0,
|
|
23448
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Table, { className: "w-4 h-4" }),
|
|
23449
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.ChevronDown, { className: "w-3 h-3" })
|
|
23087
23450
|
] }),
|
|
23088
23451
|
children: [
|
|
23089
|
-
/* @__PURE__ */ (0,
|
|
23452
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23090
23453
|
DropdownMenuItem,
|
|
23091
23454
|
{
|
|
23092
|
-
icon:
|
|
23455
|
+
icon: import_lucide_react45.Table,
|
|
23093
23456
|
label: t("tableMenu.insert3x3"),
|
|
23094
23457
|
onClick: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run()
|
|
23095
23458
|
}
|
|
23096
23459
|
),
|
|
23097
|
-
/* @__PURE__ */ (0,
|
|
23098
|
-
/* @__PURE__ */ (0,
|
|
23460
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "my-1 border-t" }),
|
|
23461
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23099
23462
|
DropdownMenuItem,
|
|
23100
23463
|
{
|
|
23101
|
-
icon:
|
|
23464
|
+
icon: import_lucide_react45.ArrowDown,
|
|
23102
23465
|
label: t("tableMenu.addColumnBefore"),
|
|
23103
23466
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
23104
23467
|
disabled: !editor.can().addColumnBefore()
|
|
23105
23468
|
}
|
|
23106
23469
|
),
|
|
23107
|
-
/* @__PURE__ */ (0,
|
|
23470
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23108
23471
|
DropdownMenuItem,
|
|
23109
23472
|
{
|
|
23110
|
-
icon:
|
|
23473
|
+
icon: import_lucide_react45.ArrowDown,
|
|
23111
23474
|
label: t("tableMenu.addColumnAfter"),
|
|
23112
23475
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
23113
23476
|
disabled: !editor.can().addColumnAfter()
|
|
23114
23477
|
}
|
|
23115
23478
|
),
|
|
23116
|
-
/* @__PURE__ */ (0,
|
|
23479
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23117
23480
|
DropdownMenuItem,
|
|
23118
23481
|
{
|
|
23119
|
-
icon:
|
|
23482
|
+
icon: import_lucide_react45.ArrowRight,
|
|
23120
23483
|
label: t("tableMenu.addRowBefore"),
|
|
23121
23484
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
23122
23485
|
disabled: !editor.can().addRowBefore()
|
|
23123
23486
|
}
|
|
23124
23487
|
),
|
|
23125
|
-
/* @__PURE__ */ (0,
|
|
23488
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23126
23489
|
DropdownMenuItem,
|
|
23127
23490
|
{
|
|
23128
|
-
icon:
|
|
23491
|
+
icon: import_lucide_react45.ArrowRight,
|
|
23129
23492
|
label: t("tableMenu.addRowAfter"),
|
|
23130
23493
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
23131
23494
|
disabled: !editor.can().addRowAfter()
|
|
23132
23495
|
}
|
|
23133
23496
|
),
|
|
23134
|
-
/* @__PURE__ */ (0,
|
|
23135
|
-
/* @__PURE__ */ (0,
|
|
23497
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "my-1 border-t" }),
|
|
23498
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23136
23499
|
DropdownMenuItem,
|
|
23137
23500
|
{
|
|
23138
|
-
icon:
|
|
23501
|
+
icon: import_lucide_react45.Trash2,
|
|
23139
23502
|
label: t("tableMenu.deleteColumn"),
|
|
23140
23503
|
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
23141
23504
|
disabled: !editor.can().deleteColumn()
|
|
23142
23505
|
}
|
|
23143
23506
|
),
|
|
23144
|
-
/* @__PURE__ */ (0,
|
|
23507
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23145
23508
|
DropdownMenuItem,
|
|
23146
23509
|
{
|
|
23147
|
-
icon:
|
|
23510
|
+
icon: import_lucide_react45.Trash2,
|
|
23148
23511
|
label: t("tableMenu.deleteRow"),
|
|
23149
23512
|
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
23150
23513
|
disabled: !editor.can().deleteRow()
|
|
23151
23514
|
}
|
|
23152
23515
|
),
|
|
23153
|
-
/* @__PURE__ */ (0,
|
|
23516
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23154
23517
|
DropdownMenuItem,
|
|
23155
23518
|
{
|
|
23156
|
-
icon:
|
|
23519
|
+
icon: import_lucide_react45.Trash2,
|
|
23157
23520
|
label: t("tableMenu.deleteTable"),
|
|
23158
23521
|
onClick: () => editor.chain().focus().deleteTable().run(),
|
|
23159
23522
|
disabled: !editor.can().deleteTable()
|
|
@@ -23162,105 +23525,105 @@ var EditorToolbar = ({
|
|
|
23162
23525
|
]
|
|
23163
23526
|
}
|
|
23164
23527
|
),
|
|
23165
|
-
/* @__PURE__ */ (0,
|
|
23166
|
-
/* @__PURE__ */ (0,
|
|
23528
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarDivider, {}),
|
|
23529
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23167
23530
|
ToolbarButton,
|
|
23168
23531
|
{
|
|
23169
23532
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
23170
23533
|
active: editor.isActive("subscript"),
|
|
23171
23534
|
title: t("toolbar.subscript"),
|
|
23172
|
-
children: /* @__PURE__ */ (0,
|
|
23535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Subscript, { className: "w-4 h-4" })
|
|
23173
23536
|
}
|
|
23174
23537
|
),
|
|
23175
|
-
/* @__PURE__ */ (0,
|
|
23538
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
23176
23539
|
ToolbarButton,
|
|
23177
23540
|
{
|
|
23178
23541
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
23179
23542
|
active: editor.isActive("superscript"),
|
|
23180
23543
|
title: t("toolbar.superscript"),
|
|
23181
|
-
children: /* @__PURE__ */ (0,
|
|
23544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Superscript, { className: "w-4 h-4" })
|
|
23182
23545
|
}
|
|
23183
23546
|
),
|
|
23184
|
-
/* @__PURE__ */ (0,
|
|
23185
|
-
/* @__PURE__ */ (0,
|
|
23186
|
-
/* @__PURE__ */ (0,
|
|
23547
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarDivider, {}),
|
|
23548
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Undo, { className: "w-4 h-4" }) }),
|
|
23549
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react45.Redo, { className: "w-4 h-4" }) })
|
|
23187
23550
|
] });
|
|
23188
23551
|
};
|
|
23189
23552
|
|
|
23190
23553
|
// ../../components/ui/UEditor/menus.tsx
|
|
23191
|
-
var
|
|
23554
|
+
var import_react50 = require("react");
|
|
23192
23555
|
var import_react_dom9 = require("react-dom");
|
|
23193
23556
|
var import_next_intl4 = require("next-intl");
|
|
23194
|
-
var
|
|
23195
|
-
var
|
|
23557
|
+
var import_lucide_react46 = require("lucide-react");
|
|
23558
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
23196
23559
|
var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
23197
23560
|
const t = (0, import_next_intl4.useTranslations)("UEditor");
|
|
23198
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
23199
|
-
const menuRef = (0,
|
|
23200
|
-
const allCommands = (0,
|
|
23561
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react50.useState)(0);
|
|
23562
|
+
const menuRef = (0, import_react50.useRef)(null);
|
|
23563
|
+
const allCommands = (0, import_react50.useMemo)(
|
|
23201
23564
|
() => [
|
|
23202
23565
|
{
|
|
23203
|
-
icon:
|
|
23566
|
+
icon: import_lucide_react46.Type,
|
|
23204
23567
|
label: t("slashCommand.text"),
|
|
23205
23568
|
description: t("slashCommand.textDesc"),
|
|
23206
23569
|
action: () => editor.chain().focus().setParagraph().run()
|
|
23207
23570
|
},
|
|
23208
23571
|
{
|
|
23209
|
-
icon:
|
|
23572
|
+
icon: import_lucide_react46.Heading1,
|
|
23210
23573
|
label: t("slashCommand.heading1"),
|
|
23211
23574
|
description: t("slashCommand.heading1Desc"),
|
|
23212
23575
|
action: () => editor.chain().focus().toggleHeading({ level: 1 }).run()
|
|
23213
23576
|
},
|
|
23214
23577
|
{
|
|
23215
|
-
icon:
|
|
23578
|
+
icon: import_lucide_react46.Heading2,
|
|
23216
23579
|
label: t("slashCommand.heading2"),
|
|
23217
23580
|
description: t("slashCommand.heading2Desc"),
|
|
23218
23581
|
action: () => editor.chain().focus().toggleHeading({ level: 2 }).run()
|
|
23219
23582
|
},
|
|
23220
23583
|
{
|
|
23221
|
-
icon:
|
|
23584
|
+
icon: import_lucide_react46.Heading3,
|
|
23222
23585
|
label: t("slashCommand.heading3"),
|
|
23223
23586
|
description: t("slashCommand.heading3Desc"),
|
|
23224
23587
|
action: () => editor.chain().focus().toggleHeading({ level: 3 }).run()
|
|
23225
23588
|
},
|
|
23226
23589
|
{
|
|
23227
|
-
icon:
|
|
23590
|
+
icon: import_lucide_react46.List,
|
|
23228
23591
|
label: t("slashCommand.bulletList"),
|
|
23229
23592
|
description: t("slashCommand.bulletListDesc"),
|
|
23230
23593
|
action: () => editor.chain().focus().toggleBulletList().run()
|
|
23231
23594
|
},
|
|
23232
23595
|
{
|
|
23233
|
-
icon:
|
|
23596
|
+
icon: import_lucide_react46.ListOrdered,
|
|
23234
23597
|
label: t("slashCommand.orderedList"),
|
|
23235
23598
|
description: t("slashCommand.orderedListDesc"),
|
|
23236
23599
|
action: () => editor.chain().focus().toggleOrderedList().run()
|
|
23237
23600
|
},
|
|
23238
23601
|
{
|
|
23239
|
-
icon:
|
|
23602
|
+
icon: import_lucide_react46.ListTodo,
|
|
23240
23603
|
label: t("slashCommand.todoList"),
|
|
23241
23604
|
description: t("slashCommand.todoListDesc"),
|
|
23242
23605
|
action: () => editor.chain().focus().toggleTaskList().run()
|
|
23243
23606
|
},
|
|
23244
23607
|
{
|
|
23245
|
-
icon:
|
|
23608
|
+
icon: import_lucide_react46.Quote,
|
|
23246
23609
|
label: t("slashCommand.quote"),
|
|
23247
23610
|
description: t("slashCommand.quoteDesc"),
|
|
23248
23611
|
action: () => editor.chain().focus().toggleBlockquote().run()
|
|
23249
23612
|
},
|
|
23250
23613
|
{
|
|
23251
|
-
icon:
|
|
23614
|
+
icon: import_lucide_react46.FileCode,
|
|
23252
23615
|
label: t("slashCommand.codeBlock"),
|
|
23253
23616
|
description: t("slashCommand.codeBlockDesc"),
|
|
23254
23617
|
action: () => editor.chain().focus().toggleCodeBlock().run()
|
|
23255
23618
|
},
|
|
23256
23619
|
{
|
|
23257
|
-
icon:
|
|
23620
|
+
icon: import_lucide_react46.Minus,
|
|
23258
23621
|
label: t("slashCommand.divider"),
|
|
23259
23622
|
description: t("slashCommand.dividerDesc"),
|
|
23260
23623
|
action: () => editor.chain().focus().setHorizontalRule().run()
|
|
23261
23624
|
},
|
|
23262
23625
|
{
|
|
23263
|
-
icon:
|
|
23626
|
+
icon: import_lucide_react46.Table,
|
|
23264
23627
|
label: t("slashCommand.table"),
|
|
23265
23628
|
description: t("slashCommand.tableDesc"),
|
|
23266
23629
|
action: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run()
|
|
@@ -23268,19 +23631,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23268
23631
|
],
|
|
23269
23632
|
[editor, t]
|
|
23270
23633
|
);
|
|
23271
|
-
const commands = (0,
|
|
23634
|
+
const commands = (0, import_react50.useMemo)(() => {
|
|
23272
23635
|
if (!filterText) return allCommands;
|
|
23273
23636
|
const lowerFilter = filterText.toLowerCase();
|
|
23274
23637
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
23275
23638
|
}, [allCommands, filterText]);
|
|
23276
|
-
(0,
|
|
23639
|
+
(0, import_react50.useEffect)(() => {
|
|
23277
23640
|
setSelectedIndex(0);
|
|
23278
23641
|
}, [filterText]);
|
|
23279
|
-
(0,
|
|
23642
|
+
(0, import_react50.useEffect)(() => {
|
|
23280
23643
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
23281
23644
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
23282
23645
|
}, [selectedIndex]);
|
|
23283
|
-
const selectCommand = (0,
|
|
23646
|
+
const selectCommand = (0, import_react50.useCallback)(
|
|
23284
23647
|
(index) => {
|
|
23285
23648
|
const command = commands[index];
|
|
23286
23649
|
if (command) {
|
|
@@ -23290,7 +23653,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23290
23653
|
},
|
|
23291
23654
|
[commands, onClose]
|
|
23292
23655
|
);
|
|
23293
|
-
(0,
|
|
23656
|
+
(0, import_react50.useEffect)(() => {
|
|
23294
23657
|
const handleKeyDown = (e) => {
|
|
23295
23658
|
if (commands.length === 0) return;
|
|
23296
23659
|
if (e.key === "ArrowDown") {
|
|
@@ -23311,11 +23674,11 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23311
23674
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
23312
23675
|
}, [commands, selectedIndex, selectCommand, onClose]);
|
|
23313
23676
|
if (commands.length === 0) {
|
|
23314
|
-
return /* @__PURE__ */ (0,
|
|
23677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "w-72 p-4 text-center text-muted-foreground text-sm", children: t("slashCommand.noResults") });
|
|
23315
23678
|
}
|
|
23316
|
-
return /* @__PURE__ */ (0,
|
|
23317
|
-
/* @__PURE__ */ (0,
|
|
23318
|
-
/* @__PURE__ */ (0,
|
|
23679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { ref: menuRef, className: "w-72 max-h-80 overflow-y-auto", children: [
|
|
23680
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "px-3 py-2 border-b", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("slashCommand.basicBlocks") }) }),
|
|
23681
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "p-1", children: commands.map((cmd, index) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
23319
23682
|
"button",
|
|
23320
23683
|
{
|
|
23321
23684
|
type: "button",
|
|
@@ -23328,19 +23691,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23328
23691
|
selectedIndex === index ? "bg-accent" : "hover:bg-accent/50"
|
|
23329
23692
|
),
|
|
23330
23693
|
children: [
|
|
23331
|
-
/* @__PURE__ */ (0,
|
|
23694
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23332
23695
|
"div",
|
|
23333
23696
|
{
|
|
23334
23697
|
className: cn(
|
|
23335
23698
|
"flex items-center justify-center w-10 h-10 rounded-lg mr-3 transition-colors",
|
|
23336
23699
|
selectedIndex === index ? "bg-primary/10" : "bg-muted/50 group-hover:bg-muted"
|
|
23337
23700
|
),
|
|
23338
|
-
children: /* @__PURE__ */ (0,
|
|
23701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(cmd.icon, { className: cn("w-5 h-5", selectedIndex === index ? "text-primary" : "text-muted-foreground") })
|
|
23339
23702
|
}
|
|
23340
23703
|
),
|
|
23341
|
-
/* @__PURE__ */ (0,
|
|
23342
|
-
/* @__PURE__ */ (0,
|
|
23343
|
-
/* @__PURE__ */ (0,
|
|
23704
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "text-left", children: [
|
|
23705
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: cn("text-sm font-medium", selectedIndex === index && "text-primary"), children: cmd.label }),
|
|
23706
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "text-xs text-muted-foreground", children: cmd.description })
|
|
23344
23707
|
] })
|
|
23345
23708
|
]
|
|
23346
23709
|
},
|
|
@@ -23350,19 +23713,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
23350
23713
|
};
|
|
23351
23714
|
var FloatingMenuContent = ({ editor }) => {
|
|
23352
23715
|
const t = (0, import_next_intl4.useTranslations)("UEditor");
|
|
23353
|
-
const [showCommands, setShowCommands] = (0,
|
|
23716
|
+
const [showCommands, setShowCommands] = (0, import_react50.useState)(false);
|
|
23354
23717
|
if (showCommands) {
|
|
23355
|
-
return /* @__PURE__ */ (0,
|
|
23718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
23356
23719
|
}
|
|
23357
|
-
return /* @__PURE__ */ (0,
|
|
23720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
23358
23721
|
"button",
|
|
23359
23722
|
{
|
|
23360
23723
|
type: "button",
|
|
23361
23724
|
onClick: () => setShowCommands(true),
|
|
23362
23725
|
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-accent transition-all group",
|
|
23363
23726
|
children: [
|
|
23364
|
-
/* @__PURE__ */ (0,
|
|
23365
|
-
/* @__PURE__ */ (0,
|
|
23727
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Plus, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
23728
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
23366
23729
|
]
|
|
23367
23730
|
}
|
|
23368
23731
|
);
|
|
@@ -23373,12 +23736,12 @@ var BubbleMenuContent = ({
|
|
|
23373
23736
|
}) => {
|
|
23374
23737
|
const t = (0, import_next_intl4.useTranslations)("UEditor");
|
|
23375
23738
|
const { textColors, highlightColors } = useEditorColors();
|
|
23376
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
23377
|
-
const [showEditorColorPalette, setShowEditorColorPalette] = (0,
|
|
23378
|
-
(0,
|
|
23739
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react50.useState)(false);
|
|
23740
|
+
const [showEditorColorPalette, setShowEditorColorPalette] = (0, import_react50.useState)(false);
|
|
23741
|
+
(0, import_react50.useEffect)(() => {
|
|
23379
23742
|
onKeepOpenChange?.(showLinkInput);
|
|
23380
23743
|
}, [onKeepOpenChange, showLinkInput]);
|
|
23381
|
-
(0,
|
|
23744
|
+
(0, import_react50.useEffect)(() => {
|
|
23382
23745
|
if (!showLinkInput) return;
|
|
23383
23746
|
const close = () => setShowLinkInput(false);
|
|
23384
23747
|
editor.on("selectionUpdate", close);
|
|
@@ -23389,7 +23752,7 @@ var BubbleMenuContent = ({
|
|
|
23389
23752
|
};
|
|
23390
23753
|
}, [editor, showLinkInput]);
|
|
23391
23754
|
if (showLinkInput) {
|
|
23392
|
-
return /* @__PURE__ */ (0,
|
|
23755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23393
23756
|
LinkInput,
|
|
23394
23757
|
{
|
|
23395
23758
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -23406,8 +23769,8 @@ var BubbleMenuContent = ({
|
|
|
23406
23769
|
);
|
|
23407
23770
|
}
|
|
23408
23771
|
if (showEditorColorPalette) {
|
|
23409
|
-
return /* @__PURE__ */ (0,
|
|
23410
|
-
/* @__PURE__ */ (0,
|
|
23772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "w-48", children: [
|
|
23773
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23411
23774
|
EditorColorPalette,
|
|
23412
23775
|
{
|
|
23413
23776
|
colors: textColors,
|
|
@@ -23422,8 +23785,8 @@ var BubbleMenuContent = ({
|
|
|
23422
23785
|
label: t("colors.textColor")
|
|
23423
23786
|
}
|
|
23424
23787
|
),
|
|
23425
|
-
/* @__PURE__ */ (0,
|
|
23426
|
-
/* @__PURE__ */ (0,
|
|
23788
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "border-t my-1" }),
|
|
23789
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23427
23790
|
EditorColorPalette,
|
|
23428
23791
|
{
|
|
23429
23792
|
colors: highlightColors,
|
|
@@ -23438,7 +23801,7 @@ var BubbleMenuContent = ({
|
|
|
23438
23801
|
label: t("colors.highlight")
|
|
23439
23802
|
}
|
|
23440
23803
|
),
|
|
23441
|
-
/* @__PURE__ */ (0,
|
|
23804
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "p-2 border-t", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23442
23805
|
"button",
|
|
23443
23806
|
{
|
|
23444
23807
|
type: "button",
|
|
@@ -23449,22 +23812,22 @@ var BubbleMenuContent = ({
|
|
|
23449
23812
|
) })
|
|
23450
23813
|
] });
|
|
23451
23814
|
}
|
|
23452
|
-
return /* @__PURE__ */ (0,
|
|
23453
|
-
/* @__PURE__ */ (0,
|
|
23454
|
-
/* @__PURE__ */ (0,
|
|
23455
|
-
/* @__PURE__ */ (0,
|
|
23815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
23816
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Bold, { className: "w-4 h-4" }) }),
|
|
23817
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Italic, { className: "w-4 h-4" }) }),
|
|
23818
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23456
23819
|
ToolbarButton,
|
|
23457
23820
|
{
|
|
23458
23821
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
23459
23822
|
active: editor.isActive("underline"),
|
|
23460
23823
|
title: t("toolbar.underline"),
|
|
23461
|
-
children: /* @__PURE__ */ (0,
|
|
23824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Underline, { className: "w-4 h-4" })
|
|
23462
23825
|
}
|
|
23463
23826
|
),
|
|
23464
|
-
/* @__PURE__ */ (0,
|
|
23465
|
-
/* @__PURE__ */ (0,
|
|
23466
|
-
/* @__PURE__ */ (0,
|
|
23467
|
-
/* @__PURE__ */ (0,
|
|
23827
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Strikethrough, { className: "w-4 h-4" }) }),
|
|
23828
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Code, { className: "w-4 h-4" }) }),
|
|
23829
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
23830
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23468
23831
|
ToolbarButton,
|
|
23469
23832
|
{
|
|
23470
23833
|
onMouseDown: () => {
|
|
@@ -23475,41 +23838,41 @@ var BubbleMenuContent = ({
|
|
|
23475
23838
|
},
|
|
23476
23839
|
active: editor.isActive("link"),
|
|
23477
23840
|
title: t("toolbar.link"),
|
|
23478
|
-
children: /* @__PURE__ */ (0,
|
|
23841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Link, { className: "w-4 h-4" })
|
|
23479
23842
|
}
|
|
23480
23843
|
),
|
|
23481
|
-
/* @__PURE__ */ (0,
|
|
23482
|
-
/* @__PURE__ */ (0,
|
|
23483
|
-
/* @__PURE__ */ (0,
|
|
23844
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ToolbarButton, { onClick: () => setShowEditorColorPalette(true), title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Palette, { className: "w-4 h-4" }) }),
|
|
23845
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
23846
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23484
23847
|
ToolbarButton,
|
|
23485
23848
|
{
|
|
23486
23849
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
23487
23850
|
active: editor.isActive("subscript"),
|
|
23488
23851
|
title: t("toolbar.subscript"),
|
|
23489
|
-
children: /* @__PURE__ */ (0,
|
|
23852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Subscript, { className: "w-4 h-4" })
|
|
23490
23853
|
}
|
|
23491
23854
|
),
|
|
23492
|
-
/* @__PURE__ */ (0,
|
|
23855
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23493
23856
|
ToolbarButton,
|
|
23494
23857
|
{
|
|
23495
23858
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
23496
23859
|
active: editor.isActive("superscript"),
|
|
23497
23860
|
title: t("toolbar.superscript"),
|
|
23498
|
-
children: /* @__PURE__ */ (0,
|
|
23861
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react46.Superscript, { className: "w-4 h-4" })
|
|
23499
23862
|
}
|
|
23500
23863
|
)
|
|
23501
23864
|
] });
|
|
23502
23865
|
};
|
|
23503
23866
|
var CustomBubbleMenu = ({ editor }) => {
|
|
23504
|
-
const [isVisible, setIsVisible] = (0,
|
|
23505
|
-
const [position, setPosition] = (0,
|
|
23506
|
-
const menuRef = (0,
|
|
23507
|
-
const keepOpenRef = (0,
|
|
23508
|
-
const setKeepOpen = (0,
|
|
23867
|
+
const [isVisible, setIsVisible] = (0, import_react50.useState)(false);
|
|
23868
|
+
const [position, setPosition] = (0, import_react50.useState)({ top: 0, left: 0 });
|
|
23869
|
+
const menuRef = (0, import_react50.useRef)(null);
|
|
23870
|
+
const keepOpenRef = (0, import_react50.useRef)(false);
|
|
23871
|
+
const setKeepOpen = (0, import_react50.useCallback)((next) => {
|
|
23509
23872
|
keepOpenRef.current = next;
|
|
23510
23873
|
if (next) setIsVisible(true);
|
|
23511
23874
|
}, []);
|
|
23512
|
-
(0,
|
|
23875
|
+
(0, import_react50.useEffect)(() => {
|
|
23513
23876
|
const updatePosition = () => {
|
|
23514
23877
|
const { state, view } = editor;
|
|
23515
23878
|
const { from, to, empty } = state.selection;
|
|
@@ -23538,7 +23901,7 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
23538
23901
|
}, [editor]);
|
|
23539
23902
|
if (!isVisible) return null;
|
|
23540
23903
|
return (0, import_react_dom9.createPortal)(
|
|
23541
|
-
/* @__PURE__ */ (0,
|
|
23904
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23542
23905
|
"div",
|
|
23543
23906
|
{
|
|
23544
23907
|
ref: menuRef,
|
|
@@ -23549,7 +23912,7 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
23549
23912
|
transform: "translate(-50%, -100%)"
|
|
23550
23913
|
},
|
|
23551
23914
|
onMouseDown: (e) => e.preventDefault(),
|
|
23552
|
-
children: /* @__PURE__ */ (0,
|
|
23915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23553
23916
|
BubbleMenuContent,
|
|
23554
23917
|
{
|
|
23555
23918
|
editor,
|
|
@@ -23562,9 +23925,9 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
23562
23925
|
);
|
|
23563
23926
|
};
|
|
23564
23927
|
var CustomFloatingMenu = ({ editor }) => {
|
|
23565
|
-
const [isVisible, setIsVisible] = (0,
|
|
23566
|
-
const [position, setPosition] = (0,
|
|
23567
|
-
(0,
|
|
23928
|
+
const [isVisible, setIsVisible] = (0, import_react50.useState)(false);
|
|
23929
|
+
const [position, setPosition] = (0, import_react50.useState)({ top: 0, left: 0 });
|
|
23930
|
+
(0, import_react50.useEffect)(() => {
|
|
23568
23931
|
const updatePosition = () => {
|
|
23569
23932
|
const { state, view } = editor;
|
|
23570
23933
|
const { $from, empty } = state.selection;
|
|
@@ -23591,7 +23954,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
23591
23954
|
}, [editor]);
|
|
23592
23955
|
if (!isVisible) return null;
|
|
23593
23956
|
return (0, import_react_dom9.createPortal)(
|
|
23594
|
-
/* @__PURE__ */ (0,
|
|
23957
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
23595
23958
|
"div",
|
|
23596
23959
|
{
|
|
23597
23960
|
className: "fixed z-50 rounded-2xl border border-border bg-card text-card-foreground shadow-lg backdrop-blur-sm overflow-hidden animate-in fade-in-0 slide-in-from-bottom-2",
|
|
@@ -23601,7 +23964,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
23601
23964
|
transform: "translate(-50%, -100%)"
|
|
23602
23965
|
},
|
|
23603
23966
|
onMouseDown: (e) => e.preventDefault(),
|
|
23604
|
-
children: /* @__PURE__ */ (0,
|
|
23967
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(FloatingMenuContent, { editor })
|
|
23605
23968
|
}
|
|
23606
23969
|
),
|
|
23607
23970
|
document.body
|
|
@@ -23610,25 +23973,25 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
23610
23973
|
|
|
23611
23974
|
// ../../components/ui/UEditor/CharacterCount.tsx
|
|
23612
23975
|
var import_next_intl5 = require("next-intl");
|
|
23613
|
-
var
|
|
23976
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
23614
23977
|
var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
23615
23978
|
const t = (0, import_next_intl5.useTranslations)("UEditor");
|
|
23616
23979
|
const storage = editor.storage;
|
|
23617
23980
|
const characterCount = storage.characterCount?.characters?.() ?? 0;
|
|
23618
23981
|
const wordCount = storage.characterCount?.words?.() ?? 0;
|
|
23619
23982
|
const percentage = maxCharacters ? Math.round(characterCount / maxCharacters * 100) : 0;
|
|
23620
|
-
return /* @__PURE__ */ (0,
|
|
23621
|
-
/* @__PURE__ */ (0,
|
|
23983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground border-t bg-muted/20", children: [
|
|
23984
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { children: [
|
|
23622
23985
|
wordCount,
|
|
23623
23986
|
" ",
|
|
23624
23987
|
t("words")
|
|
23625
23988
|
] }),
|
|
23626
|
-
/* @__PURE__ */ (0,
|
|
23989
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { children: [
|
|
23627
23990
|
characterCount,
|
|
23628
23991
|
" ",
|
|
23629
23992
|
t("characters")
|
|
23630
23993
|
] }),
|
|
23631
|
-
maxCharacters && /* @__PURE__ */ (0,
|
|
23994
|
+
maxCharacters && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: cn(percentage > 90 && "text-destructive", percentage > 100 && "font-bold"), children: [
|
|
23632
23995
|
characterCount,
|
|
23633
23996
|
"/",
|
|
23634
23997
|
maxCharacters
|
|
@@ -23637,7 +24000,7 @@ var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
|
23637
24000
|
};
|
|
23638
24001
|
|
|
23639
24002
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
23640
|
-
var
|
|
24003
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
23641
24004
|
var UEditor = ({
|
|
23642
24005
|
content = "",
|
|
23643
24006
|
onChange,
|
|
@@ -23660,11 +24023,11 @@ var UEditor = ({
|
|
|
23660
24023
|
}) => {
|
|
23661
24024
|
const t = (0, import_next_intl6.useTranslations)("UEditor");
|
|
23662
24025
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
23663
|
-
const extensions = (0,
|
|
24026
|
+
const extensions = (0, import_react51.useMemo)(
|
|
23664
24027
|
() => buildUEditorExtensions({ placeholder: effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable }),
|
|
23665
24028
|
[effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable]
|
|
23666
24029
|
);
|
|
23667
|
-
const editor = (0,
|
|
24030
|
+
const editor = (0, import_react52.useEditor)({
|
|
23668
24031
|
immediatelyRender: false,
|
|
23669
24032
|
extensions,
|
|
23670
24033
|
content,
|
|
@@ -23769,7 +24132,7 @@ var UEditor = ({
|
|
|
23769
24132
|
onJsonChange?.(editor2.getJSON());
|
|
23770
24133
|
}
|
|
23771
24134
|
});
|
|
23772
|
-
(0,
|
|
24135
|
+
(0, import_react51.useEffect)(() => {
|
|
23773
24136
|
if (editor && content !== editor.getHTML()) {
|
|
23774
24137
|
if (editor.isEmpty && content) {
|
|
23775
24138
|
editor.commands.setContent(content);
|
|
@@ -23777,7 +24140,7 @@ var UEditor = ({
|
|
|
23777
24140
|
}
|
|
23778
24141
|
}, [content, editor]);
|
|
23779
24142
|
if (!editor) {
|
|
23780
|
-
return /* @__PURE__ */ (0,
|
|
24143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
23781
24144
|
"div",
|
|
23782
24145
|
{
|
|
23783
24146
|
className: cn("w-full rounded-lg border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -23786,7 +24149,7 @@ var UEditor = ({
|
|
|
23786
24149
|
}
|
|
23787
24150
|
);
|
|
23788
24151
|
}
|
|
23789
|
-
return /* @__PURE__ */ (0,
|
|
24152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
23790
24153
|
"div",
|
|
23791
24154
|
{
|
|
23792
24155
|
className: cn(
|
|
@@ -23798,11 +24161,11 @@ var UEditor = ({
|
|
|
23798
24161
|
className
|
|
23799
24162
|
),
|
|
23800
24163
|
children: [
|
|
23801
|
-
editable && showToolbar && /* @__PURE__ */ (0,
|
|
23802
|
-
editable && showBubbleMenu && /* @__PURE__ */ (0,
|
|
23803
|
-
editable && showFloatingMenu && /* @__PURE__ */ (0,
|
|
23804
|
-
/* @__PURE__ */ (0,
|
|
23805
|
-
|
|
24164
|
+
editable && showToolbar && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EditorToolbar, { editor, variant, uploadImage, imageInsertMode }),
|
|
24165
|
+
editable && showBubbleMenu && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CustomBubbleMenu, { editor }),
|
|
24166
|
+
editable && showFloatingMenu && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CustomFloatingMenu, { editor }),
|
|
24167
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
24168
|
+
import_react52.EditorContent,
|
|
23806
24169
|
{
|
|
23807
24170
|
editor,
|
|
23808
24171
|
className: "flex-1 overflow-y-auto",
|
|
@@ -23812,7 +24175,7 @@ var UEditor = ({
|
|
|
23812
24175
|
}
|
|
23813
24176
|
}
|
|
23814
24177
|
),
|
|
23815
|
-
showCharacterCount && /* @__PURE__ */ (0,
|
|
24178
|
+
showCharacterCount && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CharacterCountDisplay, { editor, maxCharacters })
|
|
23816
24179
|
]
|
|
23817
24180
|
}
|
|
23818
24181
|
);
|
|
@@ -23897,6 +24260,8 @@ function getUnderverseMessages(locale = "en") {
|
|
|
23897
24260
|
MonthYearPicker,
|
|
23898
24261
|
MonthYearPickerBase,
|
|
23899
24262
|
MultiCombobox,
|
|
24263
|
+
MusicPlayer,
|
|
24264
|
+
MusicPlayerDefault,
|
|
23900
24265
|
NotificationBadge,
|
|
23901
24266
|
NotificationModal,
|
|
23902
24267
|
NumberInput,
|