@underverse-ui/underverse 0.1.25 → 0.1.28
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 +770 -315
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -2
- package/dist/index.d.ts +34 -2
- package/dist/index.js +725 -271
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
NotificationBadge: () => NotificationBadge,
|
|
88
88
|
NotificationModal: () => NotificationModal_default,
|
|
89
89
|
NumberInput: () => NumberInput,
|
|
90
|
+
OverlayControls: () => OverlayControls,
|
|
90
91
|
PageLoading: () => PageLoading,
|
|
91
92
|
Pagination: () => Pagination,
|
|
92
93
|
PasswordInput: () => PasswordInput,
|
|
@@ -5901,6 +5902,8 @@ var Slider = React24.forwardRef(
|
|
|
5901
5902
|
step = 1,
|
|
5902
5903
|
onChange,
|
|
5903
5904
|
onValueChange,
|
|
5905
|
+
onMouseUp,
|
|
5906
|
+
onTouchEnd,
|
|
5904
5907
|
label,
|
|
5905
5908
|
labelClassName,
|
|
5906
5909
|
containerClassName,
|
|
@@ -5954,6 +5957,8 @@ var Slider = React24.forwardRef(
|
|
|
5954
5957
|
step,
|
|
5955
5958
|
value: currentValue,
|
|
5956
5959
|
onChange: handleChange,
|
|
5960
|
+
onMouseUp,
|
|
5961
|
+
onTouchEnd,
|
|
5957
5962
|
disabled,
|
|
5958
5963
|
className: cn(
|
|
5959
5964
|
// Base styles
|
|
@@ -6005,13 +6010,444 @@ var Slider = React24.forwardRef(
|
|
|
6005
6010
|
);
|
|
6006
6011
|
Slider.displayName = "Slider";
|
|
6007
6012
|
|
|
6008
|
-
// ../../components/ui/
|
|
6009
|
-
var import_react15 = require("react");
|
|
6013
|
+
// ../../components/ui/OverlayControls.tsx
|
|
6010
6014
|
var import_lucide_react16 = require("lucide-react");
|
|
6015
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
6011
6016
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6017
|
+
function OverlayControls({
|
|
6018
|
+
mode,
|
|
6019
|
+
value,
|
|
6020
|
+
max,
|
|
6021
|
+
step = 0.1,
|
|
6022
|
+
onChange,
|
|
6023
|
+
onCommit,
|
|
6024
|
+
playing = false,
|
|
6025
|
+
onTogglePlay,
|
|
6026
|
+
onGoLive,
|
|
6027
|
+
volume,
|
|
6028
|
+
muted,
|
|
6029
|
+
onVolumeChange,
|
|
6030
|
+
onToggleMute,
|
|
6031
|
+
rate = 1,
|
|
6032
|
+
onChangeRate,
|
|
6033
|
+
onToggleFullscreen,
|
|
6034
|
+
showOnHover = false,
|
|
6035
|
+
className,
|
|
6036
|
+
showTime,
|
|
6037
|
+
skipSeconds = 10,
|
|
6038
|
+
onSkip,
|
|
6039
|
+
onSeekPreview,
|
|
6040
|
+
autoHide = false,
|
|
6041
|
+
autoHideDelay = 3e3,
|
|
6042
|
+
enableKeyboardShortcuts = true
|
|
6043
|
+
}) {
|
|
6044
|
+
const hoverClasses = showOnHover ? "opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto" : "opacity-100 pointer-events-auto";
|
|
6045
|
+
const showControlsBar = mode === "review";
|
|
6046
|
+
const [rateOpen, setRateOpen] = import_react15.default.useState(false);
|
|
6047
|
+
const rateWrapRef = import_react15.default.useRef(null);
|
|
6048
|
+
const [controlsVisible, setControlsVisible] = import_react15.default.useState(true);
|
|
6049
|
+
const hideTimerRef = import_react15.default.useRef(null);
|
|
6050
|
+
const [previewData, setPreviewData] = import_react15.default.useState(null);
|
|
6051
|
+
const sliderRef = import_react15.default.useRef(null);
|
|
6052
|
+
const [isDragging, setIsDragging] = import_react15.default.useState(false);
|
|
6053
|
+
const [dragValue, setDragValue] = import_react15.default.useState(value);
|
|
6054
|
+
import_react15.default.useEffect(() => {
|
|
6055
|
+
if (!isDragging) {
|
|
6056
|
+
setDragValue(value);
|
|
6057
|
+
}
|
|
6058
|
+
}, [value, isDragging]);
|
|
6059
|
+
const [keyboardFeedback, setKeyboardFeedback] = import_react15.default.useState(null);
|
|
6060
|
+
const feedbackTimerRef = import_react15.default.useRef(null);
|
|
6061
|
+
const seekAccumulatorRef = import_react15.default.useRef(0);
|
|
6062
|
+
const seekAccumulatorTimerRef = import_react15.default.useRef(null);
|
|
6063
|
+
import_react15.default.useEffect(() => {
|
|
6064
|
+
const onDocDown = (e) => {
|
|
6065
|
+
if (!rateOpen) return;
|
|
6066
|
+
const wrap = rateWrapRef.current;
|
|
6067
|
+
if (wrap && !wrap.contains(e.target)) {
|
|
6068
|
+
setRateOpen(false);
|
|
6069
|
+
}
|
|
6070
|
+
};
|
|
6071
|
+
document.addEventListener("mousedown", onDocDown);
|
|
6072
|
+
return () => document.removeEventListener("mousedown", onDocDown);
|
|
6073
|
+
}, [rateOpen]);
|
|
6074
|
+
import_react15.default.useEffect(() => {
|
|
6075
|
+
if (!autoHide || showOnHover) return;
|
|
6076
|
+
const resetTimer = () => {
|
|
6077
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
6078
|
+
setControlsVisible(true);
|
|
6079
|
+
hideTimerRef.current = setTimeout(() => {
|
|
6080
|
+
setControlsVisible(false);
|
|
6081
|
+
}, autoHideDelay);
|
|
6082
|
+
};
|
|
6083
|
+
const handleMouseMove = () => resetTimer();
|
|
6084
|
+
const handleMouseLeave = () => {
|
|
6085
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
6086
|
+
hideTimerRef.current = setTimeout(() => {
|
|
6087
|
+
setControlsVisible(false);
|
|
6088
|
+
}, autoHideDelay);
|
|
6089
|
+
};
|
|
6090
|
+
resetTimer();
|
|
6091
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
6092
|
+
return () => {
|
|
6093
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
6094
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
6095
|
+
};
|
|
6096
|
+
}, [autoHide, autoHideDelay, showOnHover]);
|
|
6097
|
+
const showFeedback = (type, value2) => {
|
|
6098
|
+
if (feedbackTimerRef.current) clearTimeout(feedbackTimerRef.current);
|
|
6099
|
+
setKeyboardFeedback({ type, value: value2 });
|
|
6100
|
+
feedbackTimerRef.current = setTimeout(() => {
|
|
6101
|
+
setKeyboardFeedback(null);
|
|
6102
|
+
}, 800);
|
|
6103
|
+
};
|
|
6104
|
+
const accumulateSeek = (seconds) => {
|
|
6105
|
+
if (seekAccumulatorTimerRef.current) clearTimeout(seekAccumulatorTimerRef.current);
|
|
6106
|
+
seekAccumulatorRef.current += seconds;
|
|
6107
|
+
showFeedback("seek", seekAccumulatorRef.current);
|
|
6108
|
+
seekAccumulatorTimerRef.current = setTimeout(() => {
|
|
6109
|
+
seekAccumulatorRef.current = 0;
|
|
6110
|
+
}, 1e3);
|
|
6111
|
+
};
|
|
6112
|
+
import_react15.default.useEffect(() => {
|
|
6113
|
+
if (!enableKeyboardShortcuts) return;
|
|
6114
|
+
const handleKeyDown = (e) => {
|
|
6115
|
+
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
6116
|
+
switch (e.key) {
|
|
6117
|
+
case " ":
|
|
6118
|
+
case "k":
|
|
6119
|
+
e.preventDefault();
|
|
6120
|
+
onTogglePlay?.();
|
|
6121
|
+
showFeedback(playing ? "pause" : "play");
|
|
6122
|
+
break;
|
|
6123
|
+
case "ArrowLeft":
|
|
6124
|
+
e.preventDefault();
|
|
6125
|
+
if (e.shiftKey) {
|
|
6126
|
+
onSkip?.(-skipSeconds);
|
|
6127
|
+
accumulateSeek(-skipSeconds);
|
|
6128
|
+
} else {
|
|
6129
|
+
{
|
|
6130
|
+
const newTime = Math.max(0, value - 5);
|
|
6131
|
+
onChange(newTime);
|
|
6132
|
+
onCommit?.(newTime);
|
|
6133
|
+
}
|
|
6134
|
+
accumulateSeek(-5);
|
|
6135
|
+
}
|
|
6136
|
+
break;
|
|
6137
|
+
case "ArrowRight":
|
|
6138
|
+
e.preventDefault();
|
|
6139
|
+
if (e.shiftKey) {
|
|
6140
|
+
onSkip?.(skipSeconds);
|
|
6141
|
+
accumulateSeek(skipSeconds);
|
|
6142
|
+
} else {
|
|
6143
|
+
{
|
|
6144
|
+
const newTime = Math.min(max, value + 5);
|
|
6145
|
+
onChange(newTime);
|
|
6146
|
+
onCommit?.(newTime);
|
|
6147
|
+
}
|
|
6148
|
+
accumulateSeek(5);
|
|
6149
|
+
}
|
|
6150
|
+
break;
|
|
6151
|
+
case "ArrowUp":
|
|
6152
|
+
e.preventDefault();
|
|
6153
|
+
if (onVolumeChange && volume !== void 0) {
|
|
6154
|
+
const newVolume = Math.min(1, volume + 0.05);
|
|
6155
|
+
onVolumeChange(newVolume);
|
|
6156
|
+
showFeedback("volume", Math.round(newVolume * 100));
|
|
6157
|
+
}
|
|
6158
|
+
break;
|
|
6159
|
+
case "ArrowDown":
|
|
6160
|
+
e.preventDefault();
|
|
6161
|
+
if (onVolumeChange && volume !== void 0) {
|
|
6162
|
+
const newVolume = Math.max(0, volume - 0.05);
|
|
6163
|
+
onVolumeChange(newVolume);
|
|
6164
|
+
showFeedback("volume", Math.round(newVolume * 100));
|
|
6165
|
+
}
|
|
6166
|
+
break;
|
|
6167
|
+
case "f":
|
|
6168
|
+
case "F":
|
|
6169
|
+
e.preventDefault();
|
|
6170
|
+
onToggleFullscreen?.();
|
|
6171
|
+
break;
|
|
6172
|
+
case "m":
|
|
6173
|
+
case "M":
|
|
6174
|
+
e.preventDefault();
|
|
6175
|
+
onToggleMute?.();
|
|
6176
|
+
showFeedback(muted ? "unmute" : "mute");
|
|
6177
|
+
break;
|
|
6178
|
+
case "j":
|
|
6179
|
+
e.preventDefault();
|
|
6180
|
+
onSkip?.(-skipSeconds);
|
|
6181
|
+
accumulateSeek(-skipSeconds);
|
|
6182
|
+
break;
|
|
6183
|
+
case "l":
|
|
6184
|
+
e.preventDefault();
|
|
6185
|
+
onSkip?.(skipSeconds);
|
|
6186
|
+
accumulateSeek(skipSeconds);
|
|
6187
|
+
break;
|
|
6188
|
+
default:
|
|
6189
|
+
if (e.key >= "0" && e.key <= "9") {
|
|
6190
|
+
e.preventDefault();
|
|
6191
|
+
const percent = parseInt(e.key) * 10;
|
|
6192
|
+
const newTime = percent / 100 * max;
|
|
6193
|
+
onChange(newTime);
|
|
6194
|
+
onCommit?.(newTime);
|
|
6195
|
+
}
|
|
6196
|
+
break;
|
|
6197
|
+
}
|
|
6198
|
+
};
|
|
6199
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
6200
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
6201
|
+
}, [
|
|
6202
|
+
enableKeyboardShortcuts,
|
|
6203
|
+
mode,
|
|
6204
|
+
onTogglePlay,
|
|
6205
|
+
onSkip,
|
|
6206
|
+
skipSeconds,
|
|
6207
|
+
onChange,
|
|
6208
|
+
value,
|
|
6209
|
+
max,
|
|
6210
|
+
onVolumeChange,
|
|
6211
|
+
volume,
|
|
6212
|
+
onToggleFullscreen,
|
|
6213
|
+
onToggleMute,
|
|
6214
|
+
playing,
|
|
6215
|
+
muted
|
|
6216
|
+
]);
|
|
6217
|
+
const formatTime2 = (sec) => {
|
|
6218
|
+
if (!isFinite(sec) || sec < 0) return "0:00";
|
|
6219
|
+
const h = Math.floor(sec / 3600);
|
|
6220
|
+
const m = Math.floor(sec % 3600 / 60);
|
|
6221
|
+
const s = Math.floor(sec % 60);
|
|
6222
|
+
if (h > 0) return `${h}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
6223
|
+
return `${m}:${String(s).padStart(2, "0")}`;
|
|
6224
|
+
};
|
|
6225
|
+
const handleSliderMouseMove = (e) => {
|
|
6226
|
+
if (!sliderRef.current) return;
|
|
6227
|
+
const rect = sliderRef.current.getBoundingClientRect();
|
|
6228
|
+
const x = e.clientX - rect.left;
|
|
6229
|
+
const percent = Math.max(0, Math.min(1, x / rect.width));
|
|
6230
|
+
const time = percent * max;
|
|
6231
|
+
const thumbnailUrl = onSeekPreview ? onSeekPreview(time) : void 0;
|
|
6232
|
+
setPreviewData({ time, x: e.clientX - rect.left, url: thumbnailUrl });
|
|
6233
|
+
};
|
|
6234
|
+
const handleSliderMouseLeave = () => {
|
|
6235
|
+
setPreviewData(null);
|
|
6236
|
+
};
|
|
6237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
6238
|
+
keyboardFeedback && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6239
|
+
"div",
|
|
6240
|
+
{
|
|
6241
|
+
className: cn(
|
|
6242
|
+
"absolute inset-0 flex items-center pointer-events-none z-50",
|
|
6243
|
+
keyboardFeedback.type === "seek" && (keyboardFeedback.value ?? 0) > 0 ? "justify-end pr-32" : keyboardFeedback.type === "seek" && (keyboardFeedback.value ?? 0) < 0 ? "justify-start pl-32" : "justify-center"
|
|
6244
|
+
),
|
|
6245
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "bg-black/50 backdrop-blur-sm rounded-xl px-6 py-4 shadow-xl border border-white/10 animate-in fade-in zoom-in duration-200", children: [
|
|
6246
|
+
keyboardFeedback.type === "play" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Play, { className: "w-16 h-16 text-white", fill: "white" }),
|
|
6247
|
+
keyboardFeedback.type === "pause" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Pause, { className: "w-16 h-16 text-white", fill: "white" }),
|
|
6248
|
+
keyboardFeedback.type === "seek" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
6249
|
+
(keyboardFeedback.value ?? 0) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.RotateCw, { className: "w-12 h-12 text-white" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.RotateCcw, { className: "w-12 h-12 text-white" }),
|
|
6250
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "text-3xl font-bold text-white", children: [
|
|
6251
|
+
keyboardFeedback.value && keyboardFeedback.value > 0 ? "+" : "",
|
|
6252
|
+
keyboardFeedback.value,
|
|
6253
|
+
"s"
|
|
6254
|
+
] })
|
|
6255
|
+
] }),
|
|
6256
|
+
keyboardFeedback.type === "volume" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
6257
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Volume2, { className: "w-12 h-12 text-white" }),
|
|
6258
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
6259
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "text-2xl font-bold text-white", children: [
|
|
6260
|
+
keyboardFeedback.value,
|
|
6261
|
+
"%"
|
|
6262
|
+
] }),
|
|
6263
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-32 h-1.5 bg-white/30 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-full bg-white rounded-full transition-all", style: { width: `${keyboardFeedback.value}%` } }) })
|
|
6264
|
+
] })
|
|
6265
|
+
] }),
|
|
6266
|
+
keyboardFeedback.type === "mute" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.VolumeX, { className: "w-16 h-16 text-white" }),
|
|
6267
|
+
keyboardFeedback.type === "unmute" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Volume2, { className: "w-16 h-16 text-white" })
|
|
6268
|
+
] })
|
|
6269
|
+
}
|
|
6270
|
+
),
|
|
6271
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6272
|
+
"div",
|
|
6273
|
+
{
|
|
6274
|
+
className: cn(
|
|
6275
|
+
"absolute bottom-0 left-0 right-0 pb-2 pt-8 bg-gradient-to-t from-black/40 to-transparent z-20 transition-opacity duration-200",
|
|
6276
|
+
hoverClasses,
|
|
6277
|
+
autoHide && !controlsVisible && "opacity-0 pointer-events-none",
|
|
6278
|
+
className
|
|
6279
|
+
),
|
|
6280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "px-4", children: [
|
|
6281
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: sliderRef, onMouseMove: handleSliderMouseMove, onMouseLeave: handleSliderMouseLeave, className: "relative", children: [
|
|
6282
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6283
|
+
Slider,
|
|
6284
|
+
{
|
|
6285
|
+
min: 0,
|
|
6286
|
+
max: max || 0,
|
|
6287
|
+
step,
|
|
6288
|
+
value: dragValue,
|
|
6289
|
+
onValueChange: (v) => {
|
|
6290
|
+
setIsDragging(true);
|
|
6291
|
+
setDragValue(v);
|
|
6292
|
+
onChange(v);
|
|
6293
|
+
},
|
|
6294
|
+
onMouseUp: () => {
|
|
6295
|
+
onCommit?.(dragValue);
|
|
6296
|
+
setIsDragging(false);
|
|
6297
|
+
},
|
|
6298
|
+
onTouchEnd: () => {
|
|
6299
|
+
onCommit?.(dragValue);
|
|
6300
|
+
setIsDragging(false);
|
|
6301
|
+
},
|
|
6302
|
+
trackClassName: "bg-muted",
|
|
6303
|
+
size: "sm",
|
|
6304
|
+
noFocus: true
|
|
6305
|
+
}
|
|
6306
|
+
),
|
|
6307
|
+
previewData && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "absolute bottom-full mb-2 transform -translate-x-1/2 pointer-events-none z-30", style: { left: `${previewData.x}px` }, children: previewData.url ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "bg-background/95 backdrop-blur rounded-md border border-border shadow-lg overflow-hidden", children: [
|
|
6308
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: previewData.url, alt: "Preview", className: "w-40 h-24 object-cover" }),
|
|
6309
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "px-2 py-1 text-xs font-mono text-center bg-background/80", children: formatTime2(previewData.time) })
|
|
6310
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "px-3 py-1.5 rounded-md bg-background/90 backdrop-blur border border-border shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "text-xs font-mono text-center", children: formatTime2(previewData.time) }) }) })
|
|
6311
|
+
] }),
|
|
6312
|
+
showControlsBar && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mt-2 flex items-center justify-between gap-2", children: [
|
|
6313
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
6314
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6315
|
+
Button_default,
|
|
6316
|
+
{
|
|
6317
|
+
variant: "ghost",
|
|
6318
|
+
size: "icon",
|
|
6319
|
+
onClick: onTogglePlay,
|
|
6320
|
+
title: playing ? "T\u1EA1m d\u1EEBng" : "Ph\xE1t",
|
|
6321
|
+
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6322
|
+
children: playing ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Pause, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Play, { className: "w-4 h-4" })
|
|
6323
|
+
}
|
|
6324
|
+
),
|
|
6325
|
+
onSkip && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6326
|
+
Button_default,
|
|
6327
|
+
{
|
|
6328
|
+
variant: "ghost",
|
|
6329
|
+
size: "icon",
|
|
6330
|
+
onClick: () => onSkip(-skipSeconds),
|
|
6331
|
+
title: `L\xF9i ${skipSeconds}s`,
|
|
6332
|
+
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.RotateCcw, { className: "w-4 h-4" })
|
|
6334
|
+
}
|
|
6335
|
+
),
|
|
6336
|
+
onSkip && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6337
|
+
Button_default,
|
|
6338
|
+
{
|
|
6339
|
+
variant: "ghost",
|
|
6340
|
+
size: "icon",
|
|
6341
|
+
onClick: () => onSkip(skipSeconds),
|
|
6342
|
+
title: `Tua ${skipSeconds}s`,
|
|
6343
|
+
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6344
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.RotateCw, { className: "w-4 h-4" })
|
|
6345
|
+
}
|
|
6346
|
+
),
|
|
6347
|
+
(showTime ?? true) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "px-3 py-1 rounded-full text-xs font-mono bg-background/60 text-foreground shadow-sm border border-border whitespace-nowrap", children: [
|
|
6348
|
+
formatTime2(dragValue),
|
|
6349
|
+
" / ",
|
|
6350
|
+
formatTime2(max)
|
|
6351
|
+
] }),
|
|
6352
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
6353
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6354
|
+
Button_default,
|
|
6355
|
+
{
|
|
6356
|
+
variant: "ghost",
|
|
6357
|
+
size: "icon",
|
|
6358
|
+
onClick: onToggleMute,
|
|
6359
|
+
title: muted ? "B\u1EADt ti\u1EBFng" : "T\u1EAFt ti\u1EBFng",
|
|
6360
|
+
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6361
|
+
children: muted || (volume ?? 1) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.VolumeX, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Volume2, { className: "w-4 h-4" })
|
|
6362
|
+
}
|
|
6363
|
+
),
|
|
6364
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-24", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6365
|
+
Slider,
|
|
6366
|
+
{
|
|
6367
|
+
min: 0,
|
|
6368
|
+
max: 1,
|
|
6369
|
+
step: 0.05,
|
|
6370
|
+
value: Math.max(0, Math.min(volume ?? 1, 1)),
|
|
6371
|
+
onValueChange: (v) => onVolumeChange?.(v),
|
|
6372
|
+
trackClassName: "bg-muted",
|
|
6373
|
+
size: "sm",
|
|
6374
|
+
noFocus: true
|
|
6375
|
+
}
|
|
6376
|
+
) })
|
|
6377
|
+
] })
|
|
6378
|
+
] }),
|
|
6379
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 relative", children: [
|
|
6380
|
+
onGoLive && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6381
|
+
Button_default,
|
|
6382
|
+
{
|
|
6383
|
+
variant: "ghost",
|
|
6384
|
+
size: "sm",
|
|
6385
|
+
onClick: onGoLive,
|
|
6386
|
+
title: "Tr\u1EF1c ti\u1EBFp (v\u1EC1 Live)",
|
|
6387
|
+
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6388
|
+
children: [
|
|
6389
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Dot, { className: "w-10 h-10 text-destructive" }),
|
|
6390
|
+
"Tr\u1EF1c ti\u1EBFp"
|
|
6391
|
+
]
|
|
6392
|
+
}
|
|
6393
|
+
),
|
|
6394
|
+
onChangeRate && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative", ref: rateWrapRef, children: [
|
|
6395
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6396
|
+
Button_default,
|
|
6397
|
+
{
|
|
6398
|
+
variant: "ghost",
|
|
6399
|
+
size: "sm",
|
|
6400
|
+
onClick: () => setRateOpen((o) => !o),
|
|
6401
|
+
title: "T\u1ED1c \u0111\u1ED9 ph\xE1t",
|
|
6402
|
+
className: "bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6403
|
+
children: [
|
|
6404
|
+
rate,
|
|
6405
|
+
"x"
|
|
6406
|
+
]
|
|
6407
|
+
}
|
|
6408
|
+
),
|
|
6409
|
+
rateOpen && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "absolute bottom-9 right-0 bg-background/90 backdrop-blur rounded-md border border-border shadow-lg p-1 z-30", children: [0.5, 0.75, 1, 1.25, 1.5].map((r) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6410
|
+
"button",
|
|
6411
|
+
{
|
|
6412
|
+
onClick: () => {
|
|
6413
|
+
onChangeRate(r);
|
|
6414
|
+
setRateOpen(false);
|
|
6415
|
+
},
|
|
6416
|
+
className: cn("block w-full text-left px-3 py-1 text-sm rounded hover:bg-accent", rate === r && "bg-accent"),
|
|
6417
|
+
children: [
|
|
6418
|
+
r,
|
|
6419
|
+
"x"
|
|
6420
|
+
]
|
|
6421
|
+
},
|
|
6422
|
+
r
|
|
6423
|
+
)) })
|
|
6424
|
+
] }),
|
|
6425
|
+
onToggleFullscreen && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6426
|
+
Button_default,
|
|
6427
|
+
{
|
|
6428
|
+
variant: "ghost",
|
|
6429
|
+
size: "sm",
|
|
6430
|
+
onClick: onToggleFullscreen,
|
|
6431
|
+
title: "To\xE0n m\xE0n h\xECnh",
|
|
6432
|
+
className: "px-3 bg-background/60 hover:bg-background/80 border-transparent shadow-sm outline-none focus:outline-none focus:ring-0",
|
|
6433
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Maximize2, { className: "w-4 h-4" })
|
|
6434
|
+
}
|
|
6435
|
+
)
|
|
6436
|
+
] })
|
|
6437
|
+
] })
|
|
6438
|
+
] })
|
|
6439
|
+
}
|
|
6440
|
+
)
|
|
6441
|
+
] });
|
|
6442
|
+
}
|
|
6443
|
+
|
|
6444
|
+
// ../../components/ui/CategoryTreeSelect.tsx
|
|
6445
|
+
var import_react16 = require("react");
|
|
6446
|
+
var import_lucide_react17 = require("lucide-react");
|
|
6447
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6012
6448
|
function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1ECDn danh m\u1EE5c", disabled }) {
|
|
6013
|
-
const [isOpen, setIsOpen] = (0,
|
|
6014
|
-
const [expandedNodes, setExpandedNodes] = (0,
|
|
6449
|
+
const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
|
|
6450
|
+
const [expandedNodes, setExpandedNodes] = (0, import_react16.useState)(/* @__PURE__ */ new Set());
|
|
6015
6451
|
const parentCategories = categories.filter((c) => !c.parent_id);
|
|
6016
6452
|
const childrenMap = /* @__PURE__ */ new Map();
|
|
6017
6453
|
categories.forEach((cat) => {
|
|
@@ -6050,8 +6486,8 @@ function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1E
|
|
|
6050
6486
|
const hasChildren = children.length > 0;
|
|
6051
6487
|
const isExpanded = expandedNodes.has(category.id);
|
|
6052
6488
|
const isSelected = value.includes(category.id);
|
|
6053
|
-
return /* @__PURE__ */ (0,
|
|
6054
|
-
/* @__PURE__ */ (0,
|
|
6489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6490
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6055
6491
|
"div",
|
|
6056
6492
|
{
|
|
6057
6493
|
className: cn(
|
|
@@ -6061,7 +6497,7 @@ function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1E
|
|
|
6061
6497
|
),
|
|
6062
6498
|
style: { paddingLeft: `${level * 1.5 + 0.75}rem` },
|
|
6063
6499
|
children: [
|
|
6064
|
-
hasChildren ? /* @__PURE__ */ (0,
|
|
6500
|
+
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6065
6501
|
"button",
|
|
6066
6502
|
{
|
|
6067
6503
|
type: "button",
|
|
@@ -6070,39 +6506,39 @@ function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1E
|
|
|
6070
6506
|
toggleExpand(category.id);
|
|
6071
6507
|
},
|
|
6072
6508
|
className: "p-0.5 hover:bg-accent rounded",
|
|
6073
|
-
children: isExpanded ? /* @__PURE__ */ (0,
|
|
6509
|
+
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react17.ChevronDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react17.ChevronRight, { className: "w-4 h-4" })
|
|
6074
6510
|
}
|
|
6075
|
-
) : /* @__PURE__ */ (0,
|
|
6076
|
-
/* @__PURE__ */ (0,
|
|
6511
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-5" }),
|
|
6512
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6077
6513
|
"div",
|
|
6078
6514
|
{
|
|
6079
6515
|
onClick: () => handleSelect(category.id, category),
|
|
6080
6516
|
className: "flex items-center gap-2 flex-1",
|
|
6081
6517
|
children: [
|
|
6082
|
-
/* @__PURE__ */ (0,
|
|
6518
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6083
6519
|
"div",
|
|
6084
6520
|
{
|
|
6085
6521
|
className: cn(
|
|
6086
6522
|
"w-4 h-4 border-2 rounded flex items-center justify-center transition-colors",
|
|
6087
6523
|
isSelected ? "bg-primary border-primary" : "border-muted-foreground/30"
|
|
6088
6524
|
),
|
|
6089
|
-
children: isSelected && /* @__PURE__ */ (0,
|
|
6525
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react17.Check, { className: "w-3 h-3 text-primary-foreground" })
|
|
6090
6526
|
}
|
|
6091
6527
|
),
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6528
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: cn("text-sm", isSelected && "font-medium text-primary"), children: category.name })
|
|
6093
6529
|
]
|
|
6094
6530
|
}
|
|
6095
6531
|
)
|
|
6096
6532
|
]
|
|
6097
6533
|
}
|
|
6098
6534
|
),
|
|
6099
|
-
hasChildren && isExpanded && /* @__PURE__ */ (0,
|
|
6535
|
+
hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: children.map((child) => renderCategory(child, level + 1)) })
|
|
6100
6536
|
] }, category.id);
|
|
6101
6537
|
};
|
|
6102
6538
|
const selectedCount = value.length;
|
|
6103
6539
|
const displayText = selectedCount > 0 ? `\u0110\xE3 ch\u1ECDn ${selectedCount} danh m\u1EE5c` : placeholder;
|
|
6104
|
-
return /* @__PURE__ */ (0,
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative", children: [
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6106
6542
|
"button",
|
|
6107
6543
|
{
|
|
6108
6544
|
type: "button",
|
|
@@ -6115,22 +6551,22 @@ function CategoryTreeSelect({ categories, value, onChange, placeholder = "Ch\u1E
|
|
|
6115
6551
|
isOpen && "border-primary ring-1 ring-primary"
|
|
6116
6552
|
),
|
|
6117
6553
|
children: [
|
|
6118
|
-
/* @__PURE__ */ (0,
|
|
6119
|
-
/* @__PURE__ */ (0,
|
|
6554
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: cn("text-sm", selectedCount === 0 && "text-muted-foreground"), children: displayText }),
|
|
6555
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react17.ChevronDown, { className: cn("w-4 h-4 transition-transform", isOpen && "transform rotate-180") })
|
|
6120
6556
|
]
|
|
6121
6557
|
}
|
|
6122
6558
|
),
|
|
6123
|
-
isOpen && !disabled && /* @__PURE__ */ (0,
|
|
6124
|
-
/* @__PURE__ */ (0,
|
|
6125
|
-
/* @__PURE__ */ (0,
|
|
6559
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6560
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "fixed inset-0 z-10", onClick: () => setIsOpen(false) }),
|
|
6561
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "absolute z-20 mt-1 w-full max-h-80 overflow-auto bg-background border rounded-md shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "p-1", children: parentCategories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: "Kh\xF4ng c\xF3 danh m\u1EE5c n\xE0o" }) : parentCategories.map((cat) => renderCategory(cat)) }) })
|
|
6126
6562
|
] })
|
|
6127
6563
|
] });
|
|
6128
6564
|
}
|
|
6129
6565
|
|
|
6130
6566
|
// ../../components/ui/SmartImage.tsx
|
|
6131
6567
|
var import_image = __toESM(require("next/image"), 1);
|
|
6132
|
-
var
|
|
6133
|
-
var
|
|
6568
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
6569
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6134
6570
|
var DEFAULT_FALLBACK = "/images/products/hoa-hong-do.png";
|
|
6135
6571
|
function SmartImage({
|
|
6136
6572
|
src,
|
|
@@ -6154,7 +6590,7 @@ function SmartImage({
|
|
|
6154
6590
|
}
|
|
6155
6591
|
return input;
|
|
6156
6592
|
};
|
|
6157
|
-
const [resolvedSrc, setResolvedSrc] =
|
|
6593
|
+
const [resolvedSrc, setResolvedSrc] = import_react17.default.useState(() => normalize(src));
|
|
6158
6594
|
const handleError = () => {
|
|
6159
6595
|
if (resolvedSrc.endsWith(".jpg")) {
|
|
6160
6596
|
setResolvedSrc(resolvedSrc.replace(/\.jpg($|\?)/, ".png$1"));
|
|
@@ -6162,9 +6598,9 @@ function SmartImage({
|
|
|
6162
6598
|
setResolvedSrc(fallbackSrc);
|
|
6163
6599
|
}
|
|
6164
6600
|
};
|
|
6165
|
-
const Wrapper = ({ children }) => /* @__PURE__ */ (0,
|
|
6601
|
+
const Wrapper = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("relative overflow-hidden bg-muted/30", ratioClass, roundedClass, className), children });
|
|
6166
6602
|
if (fill) {
|
|
6167
|
-
return /* @__PURE__ */ (0,
|
|
6603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6168
6604
|
import_image.default,
|
|
6169
6605
|
{
|
|
6170
6606
|
src: resolvedSrc,
|
|
@@ -6178,7 +6614,7 @@ function SmartImage({
|
|
|
6178
6614
|
}
|
|
6179
6615
|
) });
|
|
6180
6616
|
}
|
|
6181
|
-
return /* @__PURE__ */ (0,
|
|
6617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("relative overflow-hidden bg-muted/30", roundedClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6182
6618
|
import_image.default,
|
|
6183
6619
|
{
|
|
6184
6620
|
src: resolvedSrc,
|
|
@@ -6195,10 +6631,10 @@ function SmartImage({
|
|
|
6195
6631
|
}
|
|
6196
6632
|
|
|
6197
6633
|
// ../../components/ui/ImageUpload.tsx
|
|
6198
|
-
var
|
|
6199
|
-
var
|
|
6634
|
+
var import_react18 = require("react");
|
|
6635
|
+
var import_lucide_react18 = require("lucide-react");
|
|
6200
6636
|
var import_next_intl6 = require("next-intl");
|
|
6201
|
-
var
|
|
6637
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6202
6638
|
function ImageUpload({
|
|
6203
6639
|
onUpload,
|
|
6204
6640
|
onRemove,
|
|
@@ -6214,10 +6650,10 @@ function ImageUpload({
|
|
|
6214
6650
|
browseText,
|
|
6215
6651
|
supportedFormatsText
|
|
6216
6652
|
}) {
|
|
6217
|
-
const [isDragging, setIsDragging] = (0,
|
|
6218
|
-
const [uploading, setUploading] = (0,
|
|
6219
|
-
const [uploadedImages, setUploadedImages] = (0,
|
|
6220
|
-
const fileInputRef = (0,
|
|
6653
|
+
const [isDragging, setIsDragging] = (0, import_react18.useState)(false);
|
|
6654
|
+
const [uploading, setUploading] = (0, import_react18.useState)(false);
|
|
6655
|
+
const [uploadedImages, setUploadedImages] = (0, import_react18.useState)([]);
|
|
6656
|
+
const fileInputRef = (0, import_react18.useRef)(null);
|
|
6221
6657
|
const { addToast } = useToast();
|
|
6222
6658
|
const t = (0, import_next_intl6.useTranslations)("OCR.imageUpload");
|
|
6223
6659
|
const previewSizes = {
|
|
@@ -6225,17 +6661,17 @@ function ImageUpload({
|
|
|
6225
6661
|
md: "w-24 h-24",
|
|
6226
6662
|
lg: "w-32 h-32"
|
|
6227
6663
|
};
|
|
6228
|
-
const handleDragOver = (0,
|
|
6664
|
+
const handleDragOver = (0, import_react18.useCallback)((e) => {
|
|
6229
6665
|
e.preventDefault();
|
|
6230
6666
|
if (!disabled) {
|
|
6231
6667
|
setIsDragging(true);
|
|
6232
6668
|
}
|
|
6233
6669
|
}, [disabled]);
|
|
6234
|
-
const handleDragLeave = (0,
|
|
6670
|
+
const handleDragLeave = (0, import_react18.useCallback)((e) => {
|
|
6235
6671
|
e.preventDefault();
|
|
6236
6672
|
setIsDragging(false);
|
|
6237
6673
|
}, []);
|
|
6238
|
-
const handleFiles = (0,
|
|
6674
|
+
const handleFiles = (0, import_react18.useCallback)(async (files) => {
|
|
6239
6675
|
if (files.length === 0) return;
|
|
6240
6676
|
const validFiles = files.filter((file) => {
|
|
6241
6677
|
if (file.size > maxSize * 1024 * 1024) {
|
|
@@ -6299,14 +6735,14 @@ function ImageUpload({
|
|
|
6299
6735
|
setUploading(false);
|
|
6300
6736
|
}
|
|
6301
6737
|
}, [maxSize, addToast, onUpload]);
|
|
6302
|
-
const handleDrop = (0,
|
|
6738
|
+
const handleDrop = (0, import_react18.useCallback)((e) => {
|
|
6303
6739
|
e.preventDefault();
|
|
6304
6740
|
setIsDragging(false);
|
|
6305
6741
|
if (disabled) return;
|
|
6306
6742
|
const files = Array.from(e.dataTransfer.files);
|
|
6307
6743
|
handleFiles(files);
|
|
6308
6744
|
}, [disabled, handleFiles]);
|
|
6309
|
-
const handleFileSelect = (0,
|
|
6745
|
+
const handleFileSelect = (0, import_react18.useCallback)((e) => {
|
|
6310
6746
|
const files = Array.from(e.target.files || []);
|
|
6311
6747
|
handleFiles(files);
|
|
6312
6748
|
if (fileInputRef.current) {
|
|
@@ -6320,8 +6756,8 @@ function ImageUpload({
|
|
|
6320
6756
|
const handleBrowseClick = () => {
|
|
6321
6757
|
fileInputRef.current?.click();
|
|
6322
6758
|
};
|
|
6323
|
-
return /* @__PURE__ */ (0,
|
|
6324
|
-
/* @__PURE__ */ (0,
|
|
6759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("space-y-4", className), children: [
|
|
6760
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6325
6761
|
"div",
|
|
6326
6762
|
{
|
|
6327
6763
|
className: cn(
|
|
@@ -6334,15 +6770,15 @@ function ImageUpload({
|
|
|
6334
6770
|
onDragLeave: handleDragLeave,
|
|
6335
6771
|
onDrop: handleDrop,
|
|
6336
6772
|
children: [
|
|
6337
|
-
uploading && /* @__PURE__ */ (0,
|
|
6338
|
-
/* @__PURE__ */ (0,
|
|
6339
|
-
/* @__PURE__ */ (0,
|
|
6773
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "absolute inset-0 bg-background/80 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
6774
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Loader2, { className: "w-6 h-6 animate-spin text-primary" }),
|
|
6775
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm font-medium", children: "Uploading..." })
|
|
6340
6776
|
] }) }),
|
|
6341
|
-
/* @__PURE__ */ (0,
|
|
6342
|
-
/* @__PURE__ */ (0,
|
|
6343
|
-
/* @__PURE__ */ (0,
|
|
6344
|
-
/* @__PURE__ */ (0,
|
|
6345
|
-
/* @__PURE__ */ (0,
|
|
6777
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-4", children: [
|
|
6778
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mx-auto w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Upload, { className: "w-6 h-6 text-primary" }) }),
|
|
6779
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-2", children: [
|
|
6780
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-muted-foreground", children: dragDropText || t("dragDropText") }),
|
|
6781
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6346
6782
|
Button_default,
|
|
6347
6783
|
{
|
|
6348
6784
|
type: "button",
|
|
@@ -6354,9 +6790,9 @@ function ImageUpload({
|
|
|
6354
6790
|
}
|
|
6355
6791
|
)
|
|
6356
6792
|
] }),
|
|
6357
|
-
/* @__PURE__ */ (0,
|
|
6793
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xs text-muted-foreground", children: supportedFormatsText || t("supportedFormats") })
|
|
6358
6794
|
] }),
|
|
6359
|
-
/* @__PURE__ */ (0,
|
|
6795
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6360
6796
|
"input",
|
|
6361
6797
|
{
|
|
6362
6798
|
ref: fileInputRef,
|
|
@@ -6371,25 +6807,25 @@ function ImageUpload({
|
|
|
6371
6807
|
]
|
|
6372
6808
|
}
|
|
6373
6809
|
),
|
|
6374
|
-
showPreview && uploadedImages.length > 0 && /* @__PURE__ */ (0,
|
|
6375
|
-
/* @__PURE__ */ (0,
|
|
6376
|
-
/* @__PURE__ */ (0,
|
|
6810
|
+
showPreview && uploadedImages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-3", children: [
|
|
6811
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h4", { className: "text-sm font-medium", children: "Uploaded Images" }),
|
|
6812
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4", children: uploadedImages.map((image) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6377
6813
|
"div",
|
|
6378
6814
|
{
|
|
6379
6815
|
className: "relative group bg-card border border-border rounded-lg p-3",
|
|
6380
6816
|
children: [
|
|
6381
|
-
/* @__PURE__ */ (0,
|
|
6817
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6382
6818
|
Button_default,
|
|
6383
6819
|
{
|
|
6384
6820
|
variant: "danger",
|
|
6385
6821
|
size: "icon",
|
|
6386
6822
|
className: "absolute -top-2 -right-2 w-6 h-6 opacity-0 group-hover:opacity-100 transition-opacity z-10",
|
|
6387
6823
|
onClick: () => handleRemoveImage(image.id),
|
|
6388
|
-
children: /* @__PURE__ */ (0,
|
|
6824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.X, { className: "w-3 h-3" })
|
|
6389
6825
|
}
|
|
6390
6826
|
),
|
|
6391
|
-
/* @__PURE__ */ (0,
|
|
6392
|
-
/* @__PURE__ */ (0,
|
|
6827
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("mx-auto mb-2 overflow-hidden rounded-md", previewSizes[previewSize]), children: [
|
|
6828
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6393
6829
|
"img",
|
|
6394
6830
|
{
|
|
6395
6831
|
src: image.url,
|
|
@@ -6402,18 +6838,18 @@ function ImageUpload({
|
|
|
6402
6838
|
}
|
|
6403
6839
|
}
|
|
6404
6840
|
),
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6841
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "hidden w-full h-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Image, { className: "w-8 h-8 text-muted-foreground" }) })
|
|
6406
6842
|
] }),
|
|
6407
|
-
/* @__PURE__ */ (0,
|
|
6408
|
-
/* @__PURE__ */ (0,
|
|
6409
|
-
/* @__PURE__ */ (0,
|
|
6410
|
-
image.width && image.height && /* @__PURE__ */ (0,
|
|
6843
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "space-y-1", children: [
|
|
6844
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xs font-medium truncate", title: image.originalName, children: image.originalName }),
|
|
6845
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xs text-muted-foreground", children: image.formattedSize }),
|
|
6846
|
+
image.width && image.height && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
6411
6847
|
image.width,
|
|
6412
6848
|
" \xD7 ",
|
|
6413
6849
|
image.height
|
|
6414
6850
|
] })
|
|
6415
6851
|
] }),
|
|
6416
|
-
/* @__PURE__ */ (0,
|
|
6852
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "absolute top-1 left-1 w-5 h-5 bg-success rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Check, { className: "w-3 h-3 text-success-foreground" }) })
|
|
6417
6853
|
]
|
|
6418
6854
|
},
|
|
6419
6855
|
image.id
|
|
@@ -6423,51 +6859,51 @@ function ImageUpload({
|
|
|
6423
6859
|
}
|
|
6424
6860
|
|
|
6425
6861
|
// ../../components/ui/Carousel.tsx
|
|
6426
|
-
var
|
|
6427
|
-
var
|
|
6428
|
-
var
|
|
6862
|
+
var React28 = __toESM(require("react"), 1);
|
|
6863
|
+
var import_lucide_react19 = require("lucide-react");
|
|
6864
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6429
6865
|
function Carousel({ children, autoScroll = true, autoScrollInterval = 5e3 }) {
|
|
6430
|
-
const [currentIndex, setCurrentIndex] =
|
|
6431
|
-
const totalSlides =
|
|
6432
|
-
const [isPaused, setIsPaused] =
|
|
6433
|
-
const scrollPrev =
|
|
6866
|
+
const [currentIndex, setCurrentIndex] = React28.useState(0);
|
|
6867
|
+
const totalSlides = React28.Children.count(children);
|
|
6868
|
+
const [isPaused, setIsPaused] = React28.useState(false);
|
|
6869
|
+
const scrollPrev = React28.useCallback(() => {
|
|
6434
6870
|
setCurrentIndex((prev) => prev > 0 ? prev - 1 : totalSlides - 1);
|
|
6435
6871
|
}, [totalSlides]);
|
|
6436
|
-
const scrollNext =
|
|
6872
|
+
const scrollNext = React28.useCallback(() => {
|
|
6437
6873
|
setCurrentIndex((prev) => prev < totalSlides - 1 ? prev + 1 : 0);
|
|
6438
6874
|
}, [totalSlides]);
|
|
6439
|
-
|
|
6875
|
+
React28.useEffect(() => {
|
|
6440
6876
|
if (!autoScroll || isPaused || totalSlides <= 1) return;
|
|
6441
6877
|
const interval = setInterval(() => {
|
|
6442
6878
|
scrollNext();
|
|
6443
6879
|
}, autoScrollInterval);
|
|
6444
6880
|
return () => clearInterval(interval);
|
|
6445
6881
|
}, [autoScroll, isPaused, totalSlides, autoScrollInterval, scrollNext]);
|
|
6446
|
-
return /* @__PURE__ */ (0,
|
|
6447
|
-
/* @__PURE__ */ (0,
|
|
6448
|
-
totalSlides > 1 && /* @__PURE__ */ (0,
|
|
6449
|
-
/* @__PURE__ */ (0,
|
|
6882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative w-full overflow-hidden", onMouseEnter: () => setIsPaused(true), onMouseLeave: () => setIsPaused(false), children: [
|
|
6883
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex transition-transform duration-500 ease-in-out", style: { transform: `translateX(-${currentIndex * 100}%)` }, children: React28.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex-shrink-0 w-full h-full", children: child }, idx)) }),
|
|
6884
|
+
totalSlides > 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
6885
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6450
6886
|
Button_default,
|
|
6451
6887
|
{
|
|
6452
6888
|
onClick: scrollPrev,
|
|
6453
6889
|
variant: "outline",
|
|
6454
6890
|
size: "icon",
|
|
6455
|
-
icon:
|
|
6891
|
+
icon: import_lucide_react19.ArrowLeft,
|
|
6456
6892
|
className: "absolute left-4 top-1/2 -translate-y-1/2 hover:-translate-y-1/2 z-10 rounded-full will-change-transform bg-background/80 hover:bg-background border-border/50 hover:border-border text-foreground"
|
|
6457
6893
|
}
|
|
6458
6894
|
),
|
|
6459
|
-
/* @__PURE__ */ (0,
|
|
6895
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6460
6896
|
Button_default,
|
|
6461
6897
|
{
|
|
6462
6898
|
onClick: scrollNext,
|
|
6463
6899
|
variant: "outline",
|
|
6464
6900
|
size: "icon",
|
|
6465
|
-
icon:
|
|
6901
|
+
icon: import_lucide_react19.ArrowRight,
|
|
6466
6902
|
className: "absolute right-4 top-1/2 -translate-y-1/2 hover:-translate-y-1/2 z-10 rounded-full will-change-transform bg-background/80 hover:bg-background border-border/50 hover:border-border text-foreground"
|
|
6467
6903
|
}
|
|
6468
6904
|
)
|
|
6469
6905
|
] }),
|
|
6470
|
-
totalSlides > 1 && /* @__PURE__ */ (0,
|
|
6906
|
+
totalSlides > 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2", children: Array.from({ length: totalSlides }, (_, idx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6471
6907
|
"button",
|
|
6472
6908
|
{
|
|
6473
6909
|
onClick: () => setCurrentIndex(idx),
|
|
@@ -6480,22 +6916,22 @@ function Carousel({ children, autoScroll = true, autoScrollInterval = 5e3 }) {
|
|
|
6480
6916
|
}
|
|
6481
6917
|
|
|
6482
6918
|
// ../../components/ui/ClientOnly.tsx
|
|
6483
|
-
var
|
|
6484
|
-
var
|
|
6919
|
+
var import_react19 = require("react");
|
|
6920
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6485
6921
|
function ClientOnly({ children, fallback = null }) {
|
|
6486
|
-
const [hasMounted, setHasMounted] = (0,
|
|
6487
|
-
(0,
|
|
6922
|
+
const [hasMounted, setHasMounted] = (0, import_react19.useState)(false);
|
|
6923
|
+
(0, import_react19.useEffect)(() => {
|
|
6488
6924
|
setHasMounted(true);
|
|
6489
6925
|
}, []);
|
|
6490
6926
|
if (!hasMounted) {
|
|
6491
|
-
return /* @__PURE__ */ (0,
|
|
6927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: fallback });
|
|
6492
6928
|
}
|
|
6493
|
-
return /* @__PURE__ */ (0,
|
|
6929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
|
6494
6930
|
}
|
|
6495
6931
|
|
|
6496
6932
|
// ../../components/ui/Loading.tsx
|
|
6497
|
-
var
|
|
6498
|
-
var
|
|
6933
|
+
var import_lucide_react20 = require("lucide-react");
|
|
6934
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6499
6935
|
var LoadingSpinner = ({
|
|
6500
6936
|
size = "md",
|
|
6501
6937
|
className,
|
|
@@ -6511,8 +6947,8 @@ var LoadingSpinner = ({
|
|
|
6511
6947
|
foreground: "text-foreground",
|
|
6512
6948
|
muted: "text-muted-foreground"
|
|
6513
6949
|
};
|
|
6514
|
-
return /* @__PURE__ */ (0,
|
|
6515
|
-
|
|
6950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6951
|
+
import_lucide_react20.Activity,
|
|
6516
6952
|
{
|
|
6517
6953
|
className: cn(
|
|
6518
6954
|
"animate-spin",
|
|
@@ -6532,7 +6968,7 @@ var LoadingDots = ({
|
|
|
6532
6968
|
foreground: "bg-foreground",
|
|
6533
6969
|
muted: "bg-muted-foreground"
|
|
6534
6970
|
};
|
|
6535
|
-
return /* @__PURE__ */ (0,
|
|
6971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: cn("flex items-center space-x-1", className), children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6536
6972
|
"div",
|
|
6537
6973
|
{
|
|
6538
6974
|
className: cn(
|
|
@@ -6554,7 +6990,7 @@ var LoadingBar = ({
|
|
|
6554
6990
|
label
|
|
6555
6991
|
}) => {
|
|
6556
6992
|
const pct = progress ? Math.min(Math.max(progress, 0), 100) : void 0;
|
|
6557
|
-
return /* @__PURE__ */ (0,
|
|
6993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6558
6994
|
"div",
|
|
6559
6995
|
{
|
|
6560
6996
|
className: cn("w-full bg-muted rounded-full h-2", className),
|
|
@@ -6563,7 +6999,7 @@ var LoadingBar = ({
|
|
|
6563
6999
|
"aria-valuemax": pct === void 0 ? void 0 : 100,
|
|
6564
7000
|
"aria-valuenow": pct === void 0 ? void 0 : Math.round(pct),
|
|
6565
7001
|
"aria-label": label || "Loading",
|
|
6566
|
-
children: /* @__PURE__ */ (0,
|
|
7002
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6567
7003
|
"div",
|
|
6568
7004
|
{
|
|
6569
7005
|
className: cn(
|
|
@@ -6580,10 +7016,10 @@ var LoadingBar = ({
|
|
|
6580
7016
|
};
|
|
6581
7017
|
|
|
6582
7018
|
// ../../components/ui/Table.tsx
|
|
6583
|
-
var
|
|
6584
|
-
var
|
|
6585
|
-
var Table =
|
|
6586
|
-
({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ (0,
|
|
7019
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
7020
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
7021
|
+
var Table = import_react20.default.forwardRef(
|
|
7022
|
+
({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6587
7023
|
"div",
|
|
6588
7024
|
{
|
|
6589
7025
|
className: cn(
|
|
@@ -6593,7 +7029,7 @@ var Table = import_react19.default.forwardRef(
|
|
|
6593
7029
|
"backdrop-blur-sm transition-all duration-300",
|
|
6594
7030
|
containerClassName
|
|
6595
7031
|
),
|
|
6596
|
-
children: /* @__PURE__ */ (0,
|
|
7032
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6597
7033
|
"table",
|
|
6598
7034
|
{
|
|
6599
7035
|
ref,
|
|
@@ -6605,8 +7041,8 @@ var Table = import_react19.default.forwardRef(
|
|
|
6605
7041
|
)
|
|
6606
7042
|
);
|
|
6607
7043
|
Table.displayName = "Table";
|
|
6608
|
-
var TableHeader =
|
|
6609
|
-
({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ (0,
|
|
7044
|
+
var TableHeader = import_react20.default.forwardRef(
|
|
7045
|
+
({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6610
7046
|
"thead",
|
|
6611
7047
|
{
|
|
6612
7048
|
ref,
|
|
@@ -6624,7 +7060,7 @@ var TableHeader = import_react19.default.forwardRef(
|
|
|
6624
7060
|
)
|
|
6625
7061
|
);
|
|
6626
7062
|
TableHeader.displayName = "TableHeader";
|
|
6627
|
-
var TableBody =
|
|
7063
|
+
var TableBody = import_react20.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6628
7064
|
"tbody",
|
|
6629
7065
|
{
|
|
6630
7066
|
ref,
|
|
@@ -6633,7 +7069,7 @@ var TableBody = import_react19.default.forwardRef(({ className, ...props }, ref)
|
|
|
6633
7069
|
}
|
|
6634
7070
|
));
|
|
6635
7071
|
TableBody.displayName = "TableBody";
|
|
6636
|
-
var TableFooter =
|
|
7072
|
+
var TableFooter = import_react20.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6637
7073
|
"tfoot",
|
|
6638
7074
|
{
|
|
6639
7075
|
ref,
|
|
@@ -6645,7 +7081,7 @@ var TableFooter = import_react19.default.forwardRef(({ className, ...props }, re
|
|
|
6645
7081
|
}
|
|
6646
7082
|
));
|
|
6647
7083
|
TableFooter.displayName = "TableFooter";
|
|
6648
|
-
var TableRow =
|
|
7084
|
+
var TableRow = import_react20.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6649
7085
|
"tr",
|
|
6650
7086
|
{
|
|
6651
7087
|
ref,
|
|
@@ -6659,7 +7095,7 @@ var TableRow = import_react19.default.forwardRef(({ className, ...props }, ref)
|
|
|
6659
7095
|
}
|
|
6660
7096
|
));
|
|
6661
7097
|
TableRow.displayName = "TableRow";
|
|
6662
|
-
var TableHead =
|
|
7098
|
+
var TableHead = import_react20.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6663
7099
|
"th",
|
|
6664
7100
|
{
|
|
6665
7101
|
ref,
|
|
@@ -6671,7 +7107,7 @@ var TableHead = import_react19.default.forwardRef(({ className, ...props }, ref)
|
|
|
6671
7107
|
}
|
|
6672
7108
|
));
|
|
6673
7109
|
TableHead.displayName = "TableHead";
|
|
6674
|
-
var TableCell =
|
|
7110
|
+
var TableCell = import_react20.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6675
7111
|
"td",
|
|
6676
7112
|
{
|
|
6677
7113
|
ref,
|
|
@@ -6680,7 +7116,7 @@ var TableCell = import_react19.default.forwardRef(({ className, ...props }, ref)
|
|
|
6680
7116
|
}
|
|
6681
7117
|
));
|
|
6682
7118
|
TableCell.displayName = "TableCell";
|
|
6683
|
-
var TableCaption =
|
|
7119
|
+
var TableCaption = import_react20.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6684
7120
|
"caption",
|
|
6685
7121
|
{
|
|
6686
7122
|
ref,
|
|
@@ -6691,13 +7127,13 @@ var TableCaption = import_react19.default.forwardRef(({ className, ...props }, r
|
|
|
6691
7127
|
TableCaption.displayName = "TableCaption";
|
|
6692
7128
|
|
|
6693
7129
|
// ../../components/ui/DataTable.tsx
|
|
6694
|
-
var
|
|
6695
|
-
var
|
|
7130
|
+
var import_lucide_react21 = require("lucide-react");
|
|
7131
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
6696
7132
|
var import_next_intl7 = require("next-intl");
|
|
6697
|
-
var
|
|
7133
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6698
7134
|
function useDebounced(value, delay = 300) {
|
|
6699
|
-
const [debounced, setDebounced] =
|
|
6700
|
-
|
|
7135
|
+
const [debounced, setDebounced] = import_react21.default.useState(value);
|
|
7136
|
+
import_react21.default.useEffect(() => {
|
|
6701
7137
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
6702
7138
|
return () => clearTimeout(id);
|
|
6703
7139
|
}, [value, delay]);
|
|
@@ -6711,6 +7147,7 @@ function DataTable({
|
|
|
6711
7147
|
total = 0,
|
|
6712
7148
|
page = 1,
|
|
6713
7149
|
pageSize = 20,
|
|
7150
|
+
pageSizeOptions,
|
|
6714
7151
|
onQueryChange,
|
|
6715
7152
|
caption,
|
|
6716
7153
|
toolbar,
|
|
@@ -6722,14 +7159,20 @@ function DataTable({
|
|
|
6722
7159
|
labels
|
|
6723
7160
|
}) {
|
|
6724
7161
|
const t = (0, import_next_intl7.useTranslations)("Common");
|
|
6725
|
-
const [visibleCols, setVisibleCols] =
|
|
6726
|
-
const [filters, setFilters] =
|
|
6727
|
-
const [sort, setSort] =
|
|
6728
|
-
const [density, setDensity] =
|
|
6729
|
-
const [curPage, setCurPage] =
|
|
6730
|
-
const [curPageSize, setCurPageSize] =
|
|
7162
|
+
const [visibleCols, setVisibleCols] = import_react21.default.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
7163
|
+
const [filters, setFilters] = import_react21.default.useState({});
|
|
7164
|
+
const [sort, setSort] = import_react21.default.useState(null);
|
|
7165
|
+
const [density, setDensity] = import_react21.default.useState("normal");
|
|
7166
|
+
const [curPage, setCurPage] = import_react21.default.useState(page);
|
|
7167
|
+
const [curPageSize, setCurPageSize] = import_react21.default.useState(pageSize);
|
|
6731
7168
|
const debouncedFilters = useDebounced(filters, 350);
|
|
6732
|
-
|
|
7169
|
+
import_react21.default.useEffect(() => {
|
|
7170
|
+
setCurPage(page);
|
|
7171
|
+
}, [page]);
|
|
7172
|
+
import_react21.default.useEffect(() => {
|
|
7173
|
+
setCurPageSize(pageSize);
|
|
7174
|
+
}, [pageSize]);
|
|
7175
|
+
import_react21.default.useEffect(() => {
|
|
6733
7176
|
if (!onQueryChange) return;
|
|
6734
7177
|
onQueryChange({ filters: debouncedFilters, sort, page: curPage, pageSize: curPageSize });
|
|
6735
7178
|
}, [debouncedFilters, sort, curPage, curPageSize]);
|
|
@@ -6748,7 +7191,7 @@ function DataTable({
|
|
|
6748
7191
|
className: "h-8 w-full text-sm"
|
|
6749
7192
|
};
|
|
6750
7193
|
if (col.filter.type === "text") {
|
|
6751
|
-
return /* @__PURE__ */ (0,
|
|
7194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6752
7195
|
Input_default,
|
|
6753
7196
|
{
|
|
6754
7197
|
...commonProps,
|
|
@@ -6763,7 +7206,7 @@ function DataTable({
|
|
|
6763
7206
|
}
|
|
6764
7207
|
if (col.filter.type === "select") {
|
|
6765
7208
|
const options = col.filter.options || [];
|
|
6766
|
-
return /* @__PURE__ */ (0,
|
|
7209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6767
7210
|
Combobox,
|
|
6768
7211
|
{
|
|
6769
7212
|
options: ["", ...options],
|
|
@@ -6779,7 +7222,7 @@ function DataTable({
|
|
|
6779
7222
|
);
|
|
6780
7223
|
}
|
|
6781
7224
|
if (col.filter.type === "date") {
|
|
6782
|
-
return /* @__PURE__ */ (0,
|
|
7225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6783
7226
|
DatePicker,
|
|
6784
7227
|
{
|
|
6785
7228
|
placeholder: col.filter.placeholder || `Select ${String(col.title)}`,
|
|
@@ -6793,15 +7236,15 @@ function DataTable({
|
|
|
6793
7236
|
}
|
|
6794
7237
|
return null;
|
|
6795
7238
|
};
|
|
6796
|
-
const renderHeader = /* @__PURE__ */ (0,
|
|
7239
|
+
const renderHeader = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: visibleColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6797
7240
|
TableHead,
|
|
6798
7241
|
{
|
|
6799
7242
|
style: { width: col.width },
|
|
6800
7243
|
className: cn(col.align === "right" && "text-right", col.align === "center" && "text-center"),
|
|
6801
|
-
children: /* @__PURE__ */ (0,
|
|
6802
|
-
/* @__PURE__ */ (0,
|
|
6803
|
-
/* @__PURE__ */ (0,
|
|
6804
|
-
col.sortable && /* @__PURE__ */ (0,
|
|
7244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-2 select-none min-h-[2.5rem]", children: [
|
|
7245
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-1 min-w-0 flex-1", children: [
|
|
7246
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "truncate font-medium text-sm", children: col.title }),
|
|
7247
|
+
col.sortable && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6805
7248
|
"button",
|
|
6806
7249
|
{
|
|
6807
7250
|
className: cn(
|
|
@@ -6818,8 +7261,8 @@ function DataTable({
|
|
|
6818
7261
|
},
|
|
6819
7262
|
"aria-label": "Sort",
|
|
6820
7263
|
title: `Sort by ${String(col.title)}`,
|
|
6821
|
-
children: /* @__PURE__ */ (0,
|
|
6822
|
-
/* @__PURE__ */ (0,
|
|
7264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", className: "inline-block", children: [
|
|
7265
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6823
7266
|
"path",
|
|
6824
7267
|
{
|
|
6825
7268
|
d: "M7 8l3-3 3 3",
|
|
@@ -6830,7 +7273,7 @@ function DataTable({
|
|
|
6830
7273
|
opacity: sort?.key === col.key && sort.order === "asc" ? 1 : 0.4
|
|
6831
7274
|
}
|
|
6832
7275
|
),
|
|
6833
|
-
/* @__PURE__ */ (0,
|
|
7276
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6834
7277
|
"path",
|
|
6835
7278
|
{
|
|
6836
7279
|
d: "M7 12l3 3 3-3",
|
|
@@ -6845,11 +7288,11 @@ function DataTable({
|
|
|
6845
7288
|
}
|
|
6846
7289
|
)
|
|
6847
7290
|
] }),
|
|
6848
|
-
col.filter && /* @__PURE__ */ (0,
|
|
7291
|
+
col.filter && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6849
7292
|
Popover,
|
|
6850
7293
|
{
|
|
6851
7294
|
placement: "bottom-start",
|
|
6852
|
-
trigger: /* @__PURE__ */ (0,
|
|
7295
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6853
7296
|
"button",
|
|
6854
7297
|
{
|
|
6855
7298
|
className: cn(
|
|
@@ -6859,16 +7302,16 @@ function DataTable({
|
|
|
6859
7302
|
),
|
|
6860
7303
|
"aria-label": "Filter",
|
|
6861
7304
|
title: "Filter",
|
|
6862
|
-
children: /* @__PURE__ */ (0,
|
|
7305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.Filter, { className: "h-4 w-4" })
|
|
6863
7306
|
}
|
|
6864
7307
|
),
|
|
6865
|
-
children: /* @__PURE__ */ (0,
|
|
6866
|
-
/* @__PURE__ */ (0,
|
|
7308
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "w-48 p-2 space-y-2", children: [
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "text-xs font-medium text-muted-foreground mb-2", children: [
|
|
6867
7310
|
"Filter ",
|
|
6868
7311
|
col.title
|
|
6869
7312
|
] }),
|
|
6870
7313
|
renderFilterControl(col),
|
|
6871
|
-
filters[col.key] && /* @__PURE__ */ (0,
|
|
7314
|
+
filters[col.key] && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6872
7315
|
"button",
|
|
6873
7316
|
{
|
|
6874
7317
|
onClick: () => {
|
|
@@ -6890,15 +7333,21 @@ function DataTable({
|
|
|
6890
7333
|
},
|
|
6891
7334
|
col.key
|
|
6892
7335
|
)) });
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
7336
|
+
const isServerMode = Boolean(onQueryChange);
|
|
7337
|
+
const displayedData = isServerMode ? data : import_react21.default.useMemo(() => {
|
|
7338
|
+
const start = (curPage - 1) * curPageSize;
|
|
7339
|
+
return data.slice(start, start + curPageSize);
|
|
7340
|
+
}, [data, curPage, curPageSize]);
|
|
7341
|
+
const totalItems = isServerMode ? total : data.length;
|
|
7342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cn("space-y-2", className), children: [
|
|
7343
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
7344
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "text-sm text-muted-foreground", children: caption }),
|
|
7345
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7346
|
+
enableDensityToggle && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6898
7347
|
DropdownMenu_default,
|
|
6899
7348
|
{
|
|
6900
|
-
trigger: /* @__PURE__ */ (0,
|
|
6901
|
-
/* @__PURE__ */ (0,
|
|
7349
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
7350
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) }),
|
|
6902
7351
|
labels?.density || t("density")
|
|
6903
7352
|
] }),
|
|
6904
7353
|
items: [
|
|
@@ -6908,11 +7357,11 @@ function DataTable({
|
|
|
6908
7357
|
]
|
|
6909
7358
|
}
|
|
6910
7359
|
),
|
|
6911
|
-
enableColumnVisibilityToggle && /* @__PURE__ */ (0,
|
|
7360
|
+
enableColumnVisibilityToggle && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6912
7361
|
DropdownMenu_default,
|
|
6913
7362
|
{
|
|
6914
|
-
trigger: /* @__PURE__ */ (0,
|
|
6915
|
-
/* @__PURE__ */ (0,
|
|
7363
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
7364
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6916
7365
|
"path",
|
|
6917
7366
|
{
|
|
6918
7367
|
strokeLinecap: "round",
|
|
@@ -6923,15 +7372,15 @@ function DataTable({
|
|
|
6923
7372
|
) }),
|
|
6924
7373
|
labels?.columns || t("columns")
|
|
6925
7374
|
] }),
|
|
6926
|
-
children: columns.map((c) => /* @__PURE__ */ (0,
|
|
7375
|
+
children: columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6927
7376
|
DropdownMenuItem,
|
|
6928
7377
|
{
|
|
6929
7378
|
onClick: () => {
|
|
6930
7379
|
setVisibleCols((prev) => prev.includes(c.key) ? prev.filter((k) => k !== c.key) : [...prev, c.key]);
|
|
6931
7380
|
},
|
|
6932
7381
|
children: [
|
|
6933
|
-
/* @__PURE__ */ (0,
|
|
6934
|
-
/* @__PURE__ */ (0,
|
|
7382
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "checkbox", className: "mr-2 rounded border-border", readOnly: true, checked: visibleCols.includes(c.key) }),
|
|
7383
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "truncate", children: c.title })
|
|
6935
7384
|
]
|
|
6936
7385
|
},
|
|
6937
7386
|
c.key
|
|
@@ -6941,17 +7390,17 @@ function DataTable({
|
|
|
6941
7390
|
toolbar
|
|
6942
7391
|
] })
|
|
6943
7392
|
] }),
|
|
6944
|
-
/* @__PURE__ */ (0,
|
|
7393
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: cn("relative rounded-lg border border-border/50 overflow-hidden", loading2 && "opacity-60 pointer-events-none"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6945
7394
|
Table,
|
|
6946
7395
|
{
|
|
6947
7396
|
containerClassName: "border-0 rounded-none shadow-none",
|
|
6948
7397
|
className: "[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-[5] [&_thead]:bg-background [&_thead]:backdrop-blur-sm",
|
|
6949
7398
|
children: [
|
|
6950
|
-
/* @__PURE__ */ (0,
|
|
6951
|
-
/* @__PURE__ */ (0,
|
|
6952
|
-
/* @__PURE__ */ (0,
|
|
6953
|
-
/* @__PURE__ */ (0,
|
|
6954
|
-
/* @__PURE__ */ (0,
|
|
7399
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableHeader, { children: renderHeader }),
|
|
7400
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableBody, { children: loading2 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableCell, { colSpan: visibleColumns.length, className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-center gap-2 text-muted-foreground", children: [
|
|
7401
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
7402
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
7403
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6955
7404
|
"path",
|
|
6956
7405
|
{
|
|
6957
7406
|
className: "opacity-75",
|
|
@@ -6960,10 +7409,10 @@ function DataTable({
|
|
|
6960
7409
|
}
|
|
6961
7410
|
)
|
|
6962
7411
|
] }),
|
|
6963
|
-
/* @__PURE__ */ (0,
|
|
6964
|
-
] }) }) }) : !
|
|
7412
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-sm", children: "Loading..." })
|
|
7413
|
+
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableCell, { colSpan: visibleColumns.length, className: "text-center py-6 text-muted-foreground", children: "No data" }) }) : displayedData.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TableRow, { className: cn(densityRowClass, striped && idx % 2 === 0 && "bg-muted/30"), children: visibleColumns.map((col) => {
|
|
6965
7414
|
const value = col.dataIndex ? row[col.dataIndex] : void 0;
|
|
6966
|
-
return /* @__PURE__ */ (0,
|
|
7415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6967
7416
|
TableCell,
|
|
6968
7417
|
{
|
|
6969
7418
|
className: cn(
|
|
@@ -6981,16 +7430,21 @@ function DataTable({
|
|
|
6981
7430
|
]
|
|
6982
7431
|
}
|
|
6983
7432
|
) }),
|
|
6984
|
-
|
|
7433
|
+
totalItems > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "border-t bg-muted/30 p-4 rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6985
7434
|
Pagination,
|
|
6986
7435
|
{
|
|
6987
7436
|
page: curPage,
|
|
6988
|
-
totalPages: Math.ceil(
|
|
7437
|
+
totalPages: Math.ceil(totalItems / curPageSize),
|
|
6989
7438
|
onChange: (p) => setCurPage(p),
|
|
6990
7439
|
className: "",
|
|
6991
7440
|
showInfo: true,
|
|
6992
|
-
totalItems
|
|
6993
|
-
pageSize: curPageSize
|
|
7441
|
+
totalItems,
|
|
7442
|
+
pageSize: curPageSize,
|
|
7443
|
+
pageSizeOptions,
|
|
7444
|
+
onPageSizeChange: (s) => {
|
|
7445
|
+
setCurPage(1);
|
|
7446
|
+
setCurPageSize(s);
|
|
7447
|
+
}
|
|
6994
7448
|
}
|
|
6995
7449
|
) })
|
|
6996
7450
|
] });
|
|
@@ -6998,10 +7452,10 @@ function DataTable({
|
|
|
6998
7452
|
var DataTable_default = DataTable;
|
|
6999
7453
|
|
|
7000
7454
|
// ../../components/ui/Form.tsx
|
|
7001
|
-
var
|
|
7455
|
+
var React32 = __toESM(require("react"), 1);
|
|
7002
7456
|
|
|
7003
7457
|
// ../../node_modules/react-hook-form/dist/index.esm.mjs
|
|
7004
|
-
var
|
|
7458
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
7005
7459
|
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
7006
7460
|
var isDateObject = (value) => value instanceof Date;
|
|
7007
7461
|
var isNullOrUndefined = (value) => value == null;
|
|
@@ -7089,12 +7543,12 @@ var INPUT_VALIDATION_RULES = {
|
|
|
7089
7543
|
required: "required",
|
|
7090
7544
|
validate: "validate"
|
|
7091
7545
|
};
|
|
7092
|
-
var HookFormContext =
|
|
7546
|
+
var HookFormContext = import_react22.default.createContext(null);
|
|
7093
7547
|
HookFormContext.displayName = "HookFormContext";
|
|
7094
|
-
var useFormContext = () =>
|
|
7548
|
+
var useFormContext = () => import_react22.default.useContext(HookFormContext);
|
|
7095
7549
|
var FormProvider = (props) => {
|
|
7096
7550
|
const { children, ...data } = props;
|
|
7097
|
-
return
|
|
7551
|
+
return import_react22.default.createElement(HookFormContext.Provider, { value: data }, children);
|
|
7098
7552
|
};
|
|
7099
7553
|
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
7100
7554
|
const result = {
|
|
@@ -7114,12 +7568,12 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
7114
7568
|
}
|
|
7115
7569
|
return result;
|
|
7116
7570
|
};
|
|
7117
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
7571
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react22.default.useLayoutEffect : import_react22.default.useEffect;
|
|
7118
7572
|
function useFormState(props) {
|
|
7119
7573
|
const methods = useFormContext();
|
|
7120
7574
|
const { control = methods.control, disabled, name, exact } = props || {};
|
|
7121
|
-
const [formState, updateFormState] =
|
|
7122
|
-
const _localProxyFormState =
|
|
7575
|
+
const [formState, updateFormState] = import_react22.default.useState(control._formState);
|
|
7576
|
+
const _localProxyFormState = import_react22.default.useRef({
|
|
7123
7577
|
isDirty: false,
|
|
7124
7578
|
isLoading: false,
|
|
7125
7579
|
dirtyFields: false,
|
|
@@ -7140,10 +7594,10 @@ function useFormState(props) {
|
|
|
7140
7594
|
});
|
|
7141
7595
|
}
|
|
7142
7596
|
}), [name, disabled, exact]);
|
|
7143
|
-
|
|
7597
|
+
import_react22.default.useEffect(() => {
|
|
7144
7598
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
7145
7599
|
}, [control]);
|
|
7146
|
-
return
|
|
7600
|
+
return import_react22.default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
|
|
7147
7601
|
}
|
|
7148
7602
|
var isString = (value) => typeof value === "string";
|
|
7149
7603
|
var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
|
|
@@ -7192,12 +7646,12 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
7192
7646
|
function useWatch(props) {
|
|
7193
7647
|
const methods = useFormContext();
|
|
7194
7648
|
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
7195
|
-
const _defaultValue =
|
|
7196
|
-
const _compute =
|
|
7197
|
-
const _computeFormValues =
|
|
7649
|
+
const _defaultValue = import_react22.default.useRef(defaultValue);
|
|
7650
|
+
const _compute = import_react22.default.useRef(compute);
|
|
7651
|
+
const _computeFormValues = import_react22.default.useRef(void 0);
|
|
7198
7652
|
_compute.current = compute;
|
|
7199
|
-
const defaultValueMemo =
|
|
7200
|
-
const [value, updateValue] =
|
|
7653
|
+
const defaultValueMemo = import_react22.default.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
7654
|
+
const [value, updateValue] = import_react22.default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
7201
7655
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
7202
7656
|
name,
|
|
7203
7657
|
formState: {
|
|
@@ -7219,14 +7673,14 @@ function useWatch(props) {
|
|
|
7219
7673
|
}
|
|
7220
7674
|
}
|
|
7221
7675
|
}), [control, disabled, name, exact]);
|
|
7222
|
-
|
|
7676
|
+
import_react22.default.useEffect(() => control._removeUnmounted());
|
|
7223
7677
|
return value;
|
|
7224
7678
|
}
|
|
7225
7679
|
function useController(props) {
|
|
7226
7680
|
const methods = useFormContext();
|
|
7227
7681
|
const { name, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
7228
7682
|
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
7229
|
-
const defaultValueMemo =
|
|
7683
|
+
const defaultValueMemo = import_react22.default.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
7230
7684
|
const value = useWatch({
|
|
7231
7685
|
control,
|
|
7232
7686
|
name,
|
|
@@ -7238,15 +7692,15 @@ function useController(props) {
|
|
|
7238
7692
|
name,
|
|
7239
7693
|
exact: true
|
|
7240
7694
|
});
|
|
7241
|
-
const _props =
|
|
7242
|
-
const _previousNameRef =
|
|
7243
|
-
const _registerProps =
|
|
7695
|
+
const _props = import_react22.default.useRef(props);
|
|
7696
|
+
const _previousNameRef = import_react22.default.useRef(void 0);
|
|
7697
|
+
const _registerProps = import_react22.default.useRef(control.register(name, {
|
|
7244
7698
|
...props.rules,
|
|
7245
7699
|
value,
|
|
7246
7700
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
7247
7701
|
}));
|
|
7248
7702
|
_props.current = props;
|
|
7249
|
-
const fieldState =
|
|
7703
|
+
const fieldState = import_react22.default.useMemo(() => Object.defineProperties({}, {
|
|
7250
7704
|
invalid: {
|
|
7251
7705
|
enumerable: true,
|
|
7252
7706
|
get: () => !!get(formState.errors, name)
|
|
@@ -7268,21 +7722,21 @@ function useController(props) {
|
|
|
7268
7722
|
get: () => get(formState.errors, name)
|
|
7269
7723
|
}
|
|
7270
7724
|
}), [formState, name]);
|
|
7271
|
-
const onChange =
|
|
7725
|
+
const onChange = import_react22.default.useCallback((event) => _registerProps.current.onChange({
|
|
7272
7726
|
target: {
|
|
7273
7727
|
value: getEventValue(event),
|
|
7274
7728
|
name
|
|
7275
7729
|
},
|
|
7276
7730
|
type: EVENTS.CHANGE
|
|
7277
7731
|
}), [name]);
|
|
7278
|
-
const onBlur =
|
|
7732
|
+
const onBlur = import_react22.default.useCallback(() => _registerProps.current.onBlur({
|
|
7279
7733
|
target: {
|
|
7280
7734
|
value: get(control._formValues, name),
|
|
7281
7735
|
name
|
|
7282
7736
|
},
|
|
7283
7737
|
type: EVENTS.BLUR
|
|
7284
7738
|
}), [name, control._formValues]);
|
|
7285
|
-
const ref =
|
|
7739
|
+
const ref = import_react22.default.useCallback((elm) => {
|
|
7286
7740
|
const field2 = get(control._fields, name);
|
|
7287
7741
|
if (field2 && elm) {
|
|
7288
7742
|
field2._f.ref = {
|
|
@@ -7293,7 +7747,7 @@ function useController(props) {
|
|
|
7293
7747
|
};
|
|
7294
7748
|
}
|
|
7295
7749
|
}, [control._fields, name]);
|
|
7296
|
-
const field =
|
|
7750
|
+
const field = import_react22.default.useMemo(() => ({
|
|
7297
7751
|
name,
|
|
7298
7752
|
value,
|
|
7299
7753
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
@@ -7301,7 +7755,7 @@ function useController(props) {
|
|
|
7301
7755
|
onBlur,
|
|
7302
7756
|
ref
|
|
7303
7757
|
}), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
|
|
7304
|
-
|
|
7758
|
+
import_react22.default.useEffect(() => {
|
|
7305
7759
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
7306
7760
|
const previousName = _previousNameRef.current;
|
|
7307
7761
|
if (previousName && previousName !== name && !isArrayField) {
|
|
@@ -7331,13 +7785,13 @@ function useController(props) {
|
|
|
7331
7785
|
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
7332
7786
|
};
|
|
7333
7787
|
}, [name, control, isArrayField, shouldUnregister]);
|
|
7334
|
-
|
|
7788
|
+
import_react22.default.useEffect(() => {
|
|
7335
7789
|
control._setDisabledField({
|
|
7336
7790
|
disabled,
|
|
7337
7791
|
name
|
|
7338
7792
|
});
|
|
7339
7793
|
}, [disabled, name, control]);
|
|
7340
|
-
return
|
|
7794
|
+
return import_react22.default.useMemo(() => ({
|
|
7341
7795
|
field,
|
|
7342
7796
|
formState,
|
|
7343
7797
|
fieldState
|
|
@@ -8656,9 +9110,9 @@ function createFormControl(props = {}) {
|
|
|
8656
9110
|
};
|
|
8657
9111
|
}
|
|
8658
9112
|
function useForm(props = {}) {
|
|
8659
|
-
const _formControl =
|
|
8660
|
-
const _values =
|
|
8661
|
-
const [formState, updateFormState] =
|
|
9113
|
+
const _formControl = import_react22.default.useRef(void 0);
|
|
9114
|
+
const _values = import_react22.default.useRef(void 0);
|
|
9115
|
+
const [formState, updateFormState] = import_react22.default.useState({
|
|
8662
9116
|
isDirty: false,
|
|
8663
9117
|
isValidating: false,
|
|
8664
9118
|
isLoading: isFunction(props.defaultValues),
|
|
@@ -8707,8 +9161,8 @@ function useForm(props = {}) {
|
|
|
8707
9161
|
control._formState.isReady = true;
|
|
8708
9162
|
return sub;
|
|
8709
9163
|
}, [control]);
|
|
8710
|
-
|
|
8711
|
-
|
|
9164
|
+
import_react22.default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
|
|
9165
|
+
import_react22.default.useEffect(() => {
|
|
8712
9166
|
if (props.mode) {
|
|
8713
9167
|
control._options.mode = props.mode;
|
|
8714
9168
|
}
|
|
@@ -8716,18 +9170,18 @@ function useForm(props = {}) {
|
|
|
8716
9170
|
control._options.reValidateMode = props.reValidateMode;
|
|
8717
9171
|
}
|
|
8718
9172
|
}, [control, props.mode, props.reValidateMode]);
|
|
8719
|
-
|
|
9173
|
+
import_react22.default.useEffect(() => {
|
|
8720
9174
|
if (props.errors) {
|
|
8721
9175
|
control._setErrors(props.errors);
|
|
8722
9176
|
control._focusError();
|
|
8723
9177
|
}
|
|
8724
9178
|
}, [control, props.errors]);
|
|
8725
|
-
|
|
9179
|
+
import_react22.default.useEffect(() => {
|
|
8726
9180
|
props.shouldUnregister && control._subjects.state.next({
|
|
8727
9181
|
values: control._getWatch()
|
|
8728
9182
|
});
|
|
8729
9183
|
}, [control, props.shouldUnregister]);
|
|
8730
|
-
|
|
9184
|
+
import_react22.default.useEffect(() => {
|
|
8731
9185
|
if (control._proxyFormState.isDirty) {
|
|
8732
9186
|
const isDirty = control._getDirty();
|
|
8733
9187
|
if (isDirty !== formState.isDirty) {
|
|
@@ -8737,7 +9191,7 @@ function useForm(props = {}) {
|
|
|
8737
9191
|
}
|
|
8738
9192
|
}
|
|
8739
9193
|
}, [control, formState.isDirty]);
|
|
8740
|
-
|
|
9194
|
+
import_react22.default.useEffect(() => {
|
|
8741
9195
|
if (props.values && !deepEqual(props.values, _values.current)) {
|
|
8742
9196
|
control._reset(props.values, {
|
|
8743
9197
|
keepFieldsRef: true,
|
|
@@ -8749,7 +9203,7 @@ function useForm(props = {}) {
|
|
|
8749
9203
|
control._resetDefaultValues();
|
|
8750
9204
|
}
|
|
8751
9205
|
}, [control, props.values]);
|
|
8752
|
-
|
|
9206
|
+
import_react22.default.useEffect(() => {
|
|
8753
9207
|
if (!control._state.mount) {
|
|
8754
9208
|
control._setValid();
|
|
8755
9209
|
control._state.mount = true;
|
|
@@ -8766,8 +9220,8 @@ function useForm(props = {}) {
|
|
|
8766
9220
|
|
|
8767
9221
|
// ../../components/ui/Form.tsx
|
|
8768
9222
|
var import_next_intl8 = require("next-intl");
|
|
8769
|
-
var
|
|
8770
|
-
var FormConfigContext =
|
|
9223
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
9224
|
+
var FormConfigContext = React32.createContext({ size: "md" });
|
|
8771
9225
|
var FormWrapper = ({
|
|
8772
9226
|
children,
|
|
8773
9227
|
onSubmit,
|
|
@@ -8780,24 +9234,24 @@ var FormWrapper = ({
|
|
|
8780
9234
|
const methods = useForm({
|
|
8781
9235
|
defaultValues: initialValues
|
|
8782
9236
|
});
|
|
8783
|
-
|
|
9237
|
+
React32.useEffect(() => {
|
|
8784
9238
|
if (initialValues) {
|
|
8785
9239
|
methods.reset(initialValues);
|
|
8786
9240
|
}
|
|
8787
9241
|
}, [JSON.stringify(initialValues)]);
|
|
8788
9242
|
const { validationSchema: _, ...formProps } = props;
|
|
8789
|
-
return /* @__PURE__ */ (0,
|
|
9243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
8790
9244
|
};
|
|
8791
9245
|
var Form = FormWrapper;
|
|
8792
|
-
var FormFieldContext =
|
|
9246
|
+
var FormFieldContext = React32.createContext({});
|
|
8793
9247
|
var FormField = ({
|
|
8794
9248
|
...props
|
|
8795
9249
|
}) => {
|
|
8796
|
-
return /* @__PURE__ */ (0,
|
|
9250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Controller, { ...props }) });
|
|
8797
9251
|
};
|
|
8798
9252
|
var useFormField = () => {
|
|
8799
|
-
const fieldContext =
|
|
8800
|
-
const itemContext =
|
|
9253
|
+
const fieldContext = React32.useContext(FormFieldContext);
|
|
9254
|
+
const itemContext = React32.useContext(FormItemContext);
|
|
8801
9255
|
const { getFieldState, formState } = useFormContext();
|
|
8802
9256
|
if (!fieldContext) {
|
|
8803
9257
|
try {
|
|
@@ -8818,22 +9272,22 @@ var useFormField = () => {
|
|
|
8818
9272
|
...fieldState
|
|
8819
9273
|
};
|
|
8820
9274
|
};
|
|
8821
|
-
var FormItemContext =
|
|
8822
|
-
var FormItem =
|
|
8823
|
-
const id =
|
|
8824
|
-
return /* @__PURE__ */ (0,
|
|
9275
|
+
var FormItemContext = React32.createContext({});
|
|
9276
|
+
var FormItem = React32.forwardRef(({ className, ...props }, ref) => {
|
|
9277
|
+
const id = React32.useId();
|
|
9278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
8825
9279
|
});
|
|
8826
9280
|
FormItem.displayName = "FormItem";
|
|
8827
|
-
var FormLabel =
|
|
9281
|
+
var FormLabel = React32.forwardRef(({ className, ...props }, ref) => {
|
|
8828
9282
|
const { error, formItemId } = useFormField();
|
|
8829
|
-
const config =
|
|
9283
|
+
const config = React32.useContext(FormConfigContext);
|
|
8830
9284
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
8831
|
-
return /* @__PURE__ */ (0,
|
|
9285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props });
|
|
8832
9286
|
});
|
|
8833
9287
|
FormLabel.displayName = "FormLabel";
|
|
8834
|
-
var FormControl =
|
|
9288
|
+
var FormControl = React32.forwardRef(({ ...props }, ref) => {
|
|
8835
9289
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
8836
|
-
return /* @__PURE__ */ (0,
|
|
9290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8837
9291
|
"div",
|
|
8838
9292
|
{
|
|
8839
9293
|
ref,
|
|
@@ -8845,37 +9299,37 @@ var FormControl = React31.forwardRef(({ ...props }, ref) => {
|
|
|
8845
9299
|
);
|
|
8846
9300
|
});
|
|
8847
9301
|
FormControl.displayName = "FormControl";
|
|
8848
|
-
var FormDescription =
|
|
9302
|
+
var FormDescription = React32.forwardRef(({ className, ...props }, ref) => {
|
|
8849
9303
|
const { formDescriptionId } = useFormField();
|
|
8850
|
-
return /* @__PURE__ */ (0,
|
|
9304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
8851
9305
|
});
|
|
8852
9306
|
FormDescription.displayName = "FormDescription";
|
|
8853
|
-
var FormMessage =
|
|
9307
|
+
var FormMessage = React32.forwardRef(({ className, children, ...props }, ref) => {
|
|
8854
9308
|
const { error, formMessageId } = useFormField();
|
|
8855
9309
|
const body = error ? String(error?.message) : children;
|
|
8856
9310
|
if (!body) {
|
|
8857
9311
|
return null;
|
|
8858
9312
|
}
|
|
8859
|
-
return /* @__PURE__ */ (0,
|
|
9313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
8860
9314
|
});
|
|
8861
9315
|
FormMessage.displayName = "FormMessage";
|
|
8862
|
-
var FormInput =
|
|
9316
|
+
var FormInput = React32.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8863
9317
|
FormField,
|
|
8864
9318
|
{
|
|
8865
9319
|
name,
|
|
8866
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
8867
|
-
/* @__PURE__ */ (0,
|
|
8868
|
-
/* @__PURE__ */ (0,
|
|
9320
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(FormItem, { children: [
|
|
9321
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Input_default, { size: props.size ?? size, ...field, ...props }) }),
|
|
9322
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormMessage, {})
|
|
8869
9323
|
] })
|
|
8870
9324
|
}
|
|
8871
9325
|
) }));
|
|
8872
9326
|
FormInput.displayName = "FormInput";
|
|
8873
|
-
var FormCheckbox =
|
|
9327
|
+
var FormCheckbox = React32.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8874
9328
|
FormField,
|
|
8875
9329
|
{
|
|
8876
9330
|
name,
|
|
8877
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
8878
|
-
/* @__PURE__ */ (0,
|
|
9331
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(FormItem, { children: [
|
|
9332
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8879
9333
|
Checkbox,
|
|
8880
9334
|
{
|
|
8881
9335
|
ref,
|
|
@@ -8889,20 +9343,20 @@ var FormCheckbox = React31.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
8889
9343
|
...props
|
|
8890
9344
|
}
|
|
8891
9345
|
) }),
|
|
8892
|
-
/* @__PURE__ */ (0,
|
|
9346
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormMessage, {})
|
|
8893
9347
|
] })
|
|
8894
9348
|
}
|
|
8895
9349
|
) }));
|
|
8896
9350
|
FormCheckbox.displayName = "FormCheckbox";
|
|
8897
|
-
var FormActions =
|
|
9351
|
+
var FormActions = React32.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
8898
9352
|
FormActions.displayName = "FormActions";
|
|
8899
|
-
var FormSubmitButton =
|
|
9353
|
+
var FormSubmitButton = React32.forwardRef(({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) }));
|
|
8900
9354
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
8901
9355
|
|
|
8902
9356
|
// ../../components/ui/NotificationModal.tsx
|
|
8903
|
-
var
|
|
9357
|
+
var import_lucide_react22 = require("lucide-react");
|
|
8904
9358
|
var import_next_intl9 = require("next-intl");
|
|
8905
|
-
var
|
|
9359
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8906
9360
|
function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }) {
|
|
8907
9361
|
const t = (0, import_next_intl9.useTranslations)("Common");
|
|
8908
9362
|
if (!notification) return null;
|
|
@@ -8923,26 +9377,26 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
8923
9377
|
onClose();
|
|
8924
9378
|
}
|
|
8925
9379
|
};
|
|
8926
|
-
return /* @__PURE__ */ (0,
|
|
9380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8927
9381
|
Modal_default,
|
|
8928
9382
|
{
|
|
8929
9383
|
isOpen,
|
|
8930
9384
|
onClose,
|
|
8931
9385
|
title: titleText || t("notifications"),
|
|
8932
9386
|
size: "md",
|
|
8933
|
-
children: /* @__PURE__ */ (0,
|
|
8934
|
-
/* @__PURE__ */ (0,
|
|
8935
|
-
/* @__PURE__ */ (0,
|
|
9387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "space-y-4", children: [
|
|
9388
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2 pb-2 border-b border-border", children: [
|
|
9389
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn(
|
|
8936
9390
|
"w-2 h-2 rounded-full",
|
|
8937
9391
|
!notification.is_read ? "bg-primary" : "bg-border"
|
|
8938
9392
|
) }),
|
|
8939
|
-
/* @__PURE__ */ (0,
|
|
9393
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-xs text-muted-foreground", children: !notification.is_read ? t("newNotification") : t("readStatus") })
|
|
8940
9394
|
] }),
|
|
8941
|
-
notification.title && /* @__PURE__ */ (0,
|
|
8942
|
-
notification.body && /* @__PURE__ */ (0,
|
|
8943
|
-
/* @__PURE__ */ (0,
|
|
8944
|
-
/* @__PURE__ */ (0,
|
|
8945
|
-
hasLink && /* @__PURE__ */ (0,
|
|
9395
|
+
notification.title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: notification.title }),
|
|
9396
|
+
notification.body && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-sm text-muted-foreground whitespace-pre-wrap leading-relaxed", children: notification.body }),
|
|
9397
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-xs text-muted-foreground border-t border-border pt-2", children: formatTime2(notification.created_at) }),
|
|
9398
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex gap-2 justify-end pt-2", children: [
|
|
9399
|
+
hasLink && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8946
9400
|
Button_default,
|
|
8947
9401
|
{
|
|
8948
9402
|
variant: "primary",
|
|
@@ -8950,12 +9404,12 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
8950
9404
|
onClick: handleLinkClick,
|
|
8951
9405
|
className: "gap-2",
|
|
8952
9406
|
children: [
|
|
8953
|
-
/* @__PURE__ */ (0,
|
|
9407
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react22.ExternalLink, { className: "w-4 h-4" }),
|
|
8954
9408
|
openLinkText || t("openLink")
|
|
8955
9409
|
]
|
|
8956
9410
|
}
|
|
8957
9411
|
),
|
|
8958
|
-
/* @__PURE__ */ (0,
|
|
9412
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8959
9413
|
Button_default,
|
|
8960
9414
|
{
|
|
8961
9415
|
variant: "ghost",
|
|
@@ -8974,13 +9428,13 @@ var NotificationModal_default = NotificationModal;
|
|
|
8974
9428
|
// ../../components/ui/FloatingContacts.tsx
|
|
8975
9429
|
var import_link2 = __toESM(require("next/link"), 1);
|
|
8976
9430
|
var import_navigation = require("next/navigation");
|
|
8977
|
-
var
|
|
9431
|
+
var import_lucide_react23 = require("lucide-react");
|
|
8978
9432
|
|
|
8979
9433
|
// ../../node_modules/react-icons/lib/iconBase.mjs
|
|
8980
|
-
var
|
|
9434
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
8981
9435
|
|
|
8982
9436
|
// ../../node_modules/react-icons/lib/iconContext.mjs
|
|
8983
|
-
var
|
|
9437
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
8984
9438
|
var DefaultContext = {
|
|
8985
9439
|
color: void 0,
|
|
8986
9440
|
size: void 0,
|
|
@@ -8988,7 +9442,7 @@ var DefaultContext = {
|
|
|
8988
9442
|
style: void 0,
|
|
8989
9443
|
attr: void 0
|
|
8990
9444
|
};
|
|
8991
|
-
var IconContext =
|
|
9445
|
+
var IconContext = import_react23.default.createContext && /* @__PURE__ */ import_react23.default.createContext(DefaultContext);
|
|
8992
9446
|
|
|
8993
9447
|
// ../../node_modules/react-icons/lib/iconBase.mjs
|
|
8994
9448
|
var _excluded = ["attr", "size", "title"];
|
|
@@ -9077,12 +9531,12 @@ function _toPrimitive(t, r) {
|
|
|
9077
9531
|
return ("string" === r ? String : Number)(t);
|
|
9078
9532
|
}
|
|
9079
9533
|
function Tree2Element(tree) {
|
|
9080
|
-
return tree && tree.map((node, i) => /* @__PURE__ */
|
|
9534
|
+
return tree && tree.map((node, i) => /* @__PURE__ */ import_react24.default.createElement(node.tag, _objectSpread({
|
|
9081
9535
|
key: i
|
|
9082
9536
|
}, node.attr), Tree2Element(node.child)));
|
|
9083
9537
|
}
|
|
9084
9538
|
function GenIcon(data) {
|
|
9085
|
-
return (props) => /* @__PURE__ */
|
|
9539
|
+
return (props) => /* @__PURE__ */ import_react24.default.createElement(IconBase, _extends({
|
|
9086
9540
|
attr: _objectSpread({}, data.attr)
|
|
9087
9541
|
}, props), Tree2Element(data.child));
|
|
9088
9542
|
}
|
|
@@ -9097,7 +9551,7 @@ function IconBase(props) {
|
|
|
9097
9551
|
var className;
|
|
9098
9552
|
if (conf.className) className = conf.className;
|
|
9099
9553
|
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
9100
|
-
return /* @__PURE__ */
|
|
9554
|
+
return /* @__PURE__ */ import_react24.default.createElement("svg", _extends({
|
|
9101
9555
|
stroke: "currentColor",
|
|
9102
9556
|
fill: "currentColor",
|
|
9103
9557
|
strokeWidth: "0"
|
|
@@ -9109,9 +9563,9 @@ function IconBase(props) {
|
|
|
9109
9563
|
height: computedSize,
|
|
9110
9564
|
width: computedSize,
|
|
9111
9565
|
xmlns: "http://www.w3.org/2000/svg"
|
|
9112
|
-
}), title && /* @__PURE__ */
|
|
9566
|
+
}), title && /* @__PURE__ */ import_react24.default.createElement("title", null, title), props.children);
|
|
9113
9567
|
};
|
|
9114
|
-
return IconContext !== void 0 ? /* @__PURE__ */
|
|
9568
|
+
return IconContext !== void 0 ? /* @__PURE__ */ import_react24.default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
|
|
9115
9569
|
}
|
|
9116
9570
|
|
|
9117
9571
|
// ../../node_modules/react-icons/fa/index.mjs
|
|
@@ -9125,9 +9579,9 @@ function SiZalo(props) {
|
|
|
9125
9579
|
}
|
|
9126
9580
|
|
|
9127
9581
|
// ../../components/ui/FloatingContacts.tsx
|
|
9128
|
-
var
|
|
9582
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
9129
9583
|
function MessengerIcon(props) {
|
|
9130
|
-
return /* @__PURE__ */ (0,
|
|
9584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("svg", { viewBox: "0 0 24 24", width: 24, height: 24, "aria-hidden": "true", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9131
9585
|
"path",
|
|
9132
9586
|
{
|
|
9133
9587
|
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",
|
|
@@ -9136,10 +9590,10 @@ function MessengerIcon(props) {
|
|
|
9136
9590
|
) });
|
|
9137
9591
|
}
|
|
9138
9592
|
function ZaloIcon(props) {
|
|
9139
|
-
return /* @__PURE__ */ (0,
|
|
9593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SiZalo, { size: 20, ...props });
|
|
9140
9594
|
}
|
|
9141
9595
|
function InstagramIcon(props) {
|
|
9142
|
-
return /* @__PURE__ */ (0,
|
|
9596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FaInstagram, { size: 20, ...props });
|
|
9143
9597
|
}
|
|
9144
9598
|
function FloatingContacts({ className }) {
|
|
9145
9599
|
const pathname = (0, import_navigation.usePathname)();
|
|
@@ -9174,8 +9628,8 @@ function FloatingContacts({ className }) {
|
|
|
9174
9628
|
external: true
|
|
9175
9629
|
}
|
|
9176
9630
|
];
|
|
9177
|
-
return /* @__PURE__ */ (0,
|
|
9178
|
-
/* @__PURE__ */ (0,
|
|
9631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: cn("fixed bottom-6 right-4 z-[100000]", "flex flex-col items-end gap-3", className), "aria-label": "Quick contacts", children: [
|
|
9632
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9179
9633
|
import_link2.default,
|
|
9180
9634
|
{
|
|
9181
9635
|
href: `tel:${hotline.replace(/\D/g, "")}`,
|
|
@@ -9186,10 +9640,10 @@ function FloatingContacts({ className }) {
|
|
|
9186
9640
|
"hover:scale-105 active:scale-95 transition-transform",
|
|
9187
9641
|
"bg-[#22c55e]"
|
|
9188
9642
|
),
|
|
9189
|
-
children: /* @__PURE__ */ (0,
|
|
9643
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react23.Phone, { className: "w-6 h-6" })
|
|
9190
9644
|
}
|
|
9191
9645
|
),
|
|
9192
|
-
moreItems.map(({ key, href, label, bg, Icon, external }) => /* @__PURE__ */ (0,
|
|
9646
|
+
moreItems.map(({ key, href, label, bg, Icon, external }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9193
9647
|
import_link2.default,
|
|
9194
9648
|
{
|
|
9195
9649
|
href,
|
|
@@ -9201,7 +9655,7 @@ function FloatingContacts({ className }) {
|
|
|
9201
9655
|
"hover:scale-105 active:scale-95 transition-transform",
|
|
9202
9656
|
bg
|
|
9203
9657
|
),
|
|
9204
|
-
children: /* @__PURE__ */ (0,
|
|
9658
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { className: "w-6 h-6" })
|
|
9205
9659
|
},
|
|
9206
9660
|
key
|
|
9207
9661
|
))
|
|
@@ -9209,17 +9663,17 @@ function FloatingContacts({ className }) {
|
|
|
9209
9663
|
}
|
|
9210
9664
|
|
|
9211
9665
|
// ../../components/ui/AccessDenied.tsx
|
|
9212
|
-
var
|
|
9213
|
-
var
|
|
9666
|
+
var import_lucide_react24 = require("lucide-react");
|
|
9667
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9214
9668
|
var VARIANT_STYLES = {
|
|
9215
9669
|
destructive: { bg: "bg-destructive/5", border: "border-destructive/20", text: "text-destructive" },
|
|
9216
9670
|
warning: { bg: "bg-warning/5", border: "border-warning/20", text: "text-warning" },
|
|
9217
9671
|
info: { bg: "bg-info/5", border: "border-info/20", text: "text-info" }
|
|
9218
9672
|
};
|
|
9219
9673
|
var DEFAULT_ICONS = {
|
|
9220
|
-
destructive:
|
|
9221
|
-
warning:
|
|
9222
|
-
info:
|
|
9674
|
+
destructive: import_lucide_react24.ShieldAlert,
|
|
9675
|
+
warning: import_lucide_react24.Ban,
|
|
9676
|
+
info: import_lucide_react24.Lock
|
|
9223
9677
|
};
|
|
9224
9678
|
function AccessDenied({
|
|
9225
9679
|
title = "Access Restricted",
|
|
@@ -9231,36 +9685,36 @@ function AccessDenied({
|
|
|
9231
9685
|
}) {
|
|
9232
9686
|
const styles = VARIANT_STYLES[variant];
|
|
9233
9687
|
const UsedIcon = Icon || DEFAULT_ICONS[variant];
|
|
9234
|
-
return /* @__PURE__ */ (0,
|
|
9235
|
-
/* @__PURE__ */ (0,
|
|
9236
|
-
/* @__PURE__ */ (0,
|
|
9237
|
-
/* @__PURE__ */ (0,
|
|
9238
|
-
/* @__PURE__ */ (0,
|
|
9688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Card_default, { className: cn("p-8 text-center shadow-sm", styles.bg, styles.border, className), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
9689
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: cn("p-3 rounded-lg", styles.bg.replace("/5", "/10")), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UsedIcon, { className: cn("w-8 h-8", styles.text) }) }),
|
|
9690
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
9691
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { className: cn("font-semibold mb-2", styles.text), children: title }),
|
|
9692
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: cn(styles.text.replace("text-", "text-") + "/80", "text-sm"), children: description })
|
|
9239
9693
|
] }),
|
|
9240
|
-
children && /* @__PURE__ */ (0,
|
|
9694
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "mt-2 flex flex-wrap gap-2 justify-center", children })
|
|
9241
9695
|
] }) });
|
|
9242
9696
|
}
|
|
9243
9697
|
|
|
9244
9698
|
// ../../components/ui/ThemeToggleHeadless.tsx
|
|
9245
|
-
var
|
|
9246
|
-
var
|
|
9699
|
+
var import_lucide_react25 = require("lucide-react");
|
|
9700
|
+
var import_react25 = require("react");
|
|
9247
9701
|
var import_react_dom9 = require("react-dom");
|
|
9248
|
-
var
|
|
9702
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9249
9703
|
function ThemeToggleHeadless({
|
|
9250
9704
|
theme,
|
|
9251
9705
|
onChange,
|
|
9252
9706
|
labels,
|
|
9253
9707
|
className
|
|
9254
9708
|
}) {
|
|
9255
|
-
const [isOpen, setIsOpen] = (0,
|
|
9256
|
-
const [mounted, setMounted] = (0,
|
|
9257
|
-
const triggerRef = (0,
|
|
9258
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
9259
|
-
(0,
|
|
9709
|
+
const [isOpen, setIsOpen] = (0, import_react25.useState)(false);
|
|
9710
|
+
const [mounted, setMounted] = (0, import_react25.useState)(false);
|
|
9711
|
+
const triggerRef = (0, import_react25.useRef)(null);
|
|
9712
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react25.useState)(null);
|
|
9713
|
+
(0, import_react25.useEffect)(() => setMounted(true), []);
|
|
9260
9714
|
const themes = [
|
|
9261
|
-
{ value: "light", label: labels?.light ?? "Light", icon:
|
|
9262
|
-
{ value: "dark", label: labels?.dark ?? "Dark", icon:
|
|
9263
|
-
{ value: "system", label: labels?.system ?? "System", icon:
|
|
9715
|
+
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react25.Sun },
|
|
9716
|
+
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react25.Moon },
|
|
9717
|
+
{ value: "system", label: labels?.system ?? "System", icon: import_lucide_react25.Monitor }
|
|
9264
9718
|
];
|
|
9265
9719
|
const current = mounted ? themes.find((t) => t.value === theme) || themes[2] : themes[2];
|
|
9266
9720
|
const CurrentIcon = current.icon;
|
|
@@ -9274,8 +9728,8 @@ function ThemeToggleHeadless({
|
|
|
9274
9728
|
const top = rect.bottom + scrollTop + 8;
|
|
9275
9729
|
return { top, left, width };
|
|
9276
9730
|
};
|
|
9277
|
-
return /* @__PURE__ */ (0,
|
|
9278
|
-
/* @__PURE__ */ (0,
|
|
9731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: cn("relative", className), children: [
|
|
9732
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
9279
9733
|
Button_default,
|
|
9280
9734
|
{
|
|
9281
9735
|
variant: "ghost",
|
|
@@ -9293,25 +9747,25 @@ function ThemeToggleHeadless({
|
|
|
9293
9747
|
"aria-haspopup": "menu",
|
|
9294
9748
|
"aria-expanded": isOpen,
|
|
9295
9749
|
"aria-label": labels?.heading ?? "Theme",
|
|
9296
|
-
children: /* @__PURE__ */ (0,
|
|
9750
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CurrentIcon, { className: "h-5 w-5" })
|
|
9297
9751
|
}
|
|
9298
9752
|
),
|
|
9299
|
-
isOpen && /* @__PURE__ */ (0,
|
|
9300
|
-
typeof window !== "undefined" && (0, import_react_dom9.createPortal)(/* @__PURE__ */ (0,
|
|
9753
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
9754
|
+
typeof window !== "undefined" && (0, import_react_dom9.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
9301
9755
|
typeof window !== "undefined" && dropdownPosition && (0, import_react_dom9.createPortal)(
|
|
9302
|
-
/* @__PURE__ */ (0,
|
|
9756
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
9303
9757
|
"div",
|
|
9304
9758
|
{
|
|
9305
9759
|
className: "z-[9999] bg-card border border-border rounded-lg shadow-lg overflow-hidden",
|
|
9306
9760
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
9307
9761
|
onMouseDown: (e) => e.stopPropagation(),
|
|
9308
9762
|
role: "menu",
|
|
9309
|
-
children: /* @__PURE__ */ (0,
|
|
9310
|
-
/* @__PURE__ */ (0,
|
|
9763
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "p-2", children: [
|
|
9764
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border mb-2", children: labels?.heading ?? "Theme" }),
|
|
9311
9765
|
themes.map((opt) => {
|
|
9312
9766
|
const Icon = opt.icon;
|
|
9313
9767
|
const active = theme === opt.value;
|
|
9314
|
-
return /* @__PURE__ */ (0,
|
|
9768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
9315
9769
|
Button_default,
|
|
9316
9770
|
{
|
|
9317
9771
|
variant: "ghost",
|
|
@@ -9327,9 +9781,9 @@ function ThemeToggleHeadless({
|
|
|
9327
9781
|
role: "menuitemradio",
|
|
9328
9782
|
"aria-checked": active,
|
|
9329
9783
|
children: [
|
|
9330
|
-
/* @__PURE__ */ (0,
|
|
9331
|
-
/* @__PURE__ */ (0,
|
|
9332
|
-
active && /* @__PURE__ */ (0,
|
|
9784
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { className: "h-4 w-4" }),
|
|
9785
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "flex-1 text-left", children: opt.label }),
|
|
9786
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
9333
9787
|
]
|
|
9334
9788
|
},
|
|
9335
9789
|
opt.value
|
|
@@ -9345,10 +9799,10 @@ function ThemeToggleHeadless({
|
|
|
9345
9799
|
}
|
|
9346
9800
|
|
|
9347
9801
|
// ../../components/ui/LanguageSwitcherHeadless.tsx
|
|
9348
|
-
var
|
|
9802
|
+
var import_react26 = require("react");
|
|
9349
9803
|
var import_react_dom10 = require("react-dom");
|
|
9350
|
-
var
|
|
9351
|
-
var
|
|
9804
|
+
var import_lucide_react26 = require("lucide-react");
|
|
9805
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
9352
9806
|
function LanguageSwitcherHeadless({
|
|
9353
9807
|
locales,
|
|
9354
9808
|
currentLocale,
|
|
@@ -9356,9 +9810,9 @@ function LanguageSwitcherHeadless({
|
|
|
9356
9810
|
labels,
|
|
9357
9811
|
className
|
|
9358
9812
|
}) {
|
|
9359
|
-
const [isOpen, setIsOpen] = (0,
|
|
9360
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
9361
|
-
const triggerButtonRef = (0,
|
|
9813
|
+
const [isOpen, setIsOpen] = (0, import_react26.useState)(false);
|
|
9814
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react26.useState)(null);
|
|
9815
|
+
const triggerButtonRef = (0, import_react26.useRef)(null);
|
|
9362
9816
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
9363
9817
|
const calculatePosition = () => {
|
|
9364
9818
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -9370,8 +9824,8 @@ function LanguageSwitcherHeadless({
|
|
|
9370
9824
|
const top = rect.bottom + scrollTop + 8;
|
|
9371
9825
|
return { top, left, width };
|
|
9372
9826
|
};
|
|
9373
|
-
return /* @__PURE__ */ (0,
|
|
9374
|
-
/* @__PURE__ */ (0,
|
|
9827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cn("relative", className), children: [
|
|
9828
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9375
9829
|
Button_default,
|
|
9376
9830
|
{
|
|
9377
9831
|
variant: "ghost",
|
|
@@ -9390,22 +9844,22 @@ function LanguageSwitcherHeadless({
|
|
|
9390
9844
|
"aria-expanded": isOpen,
|
|
9391
9845
|
"aria-label": labels?.heading ?? "Language",
|
|
9392
9846
|
title: labels?.heading ?? "Language",
|
|
9393
|
-
children: /* @__PURE__ */ (0,
|
|
9847
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react26.Globe, { className: "h-5 w-5" })
|
|
9394
9848
|
}
|
|
9395
9849
|
),
|
|
9396
|
-
isOpen && /* @__PURE__ */ (0,
|
|
9397
|
-
typeof window !== "undefined" && (0, import_react_dom10.createPortal)(/* @__PURE__ */ (0,
|
|
9850
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
9851
|
+
typeof window !== "undefined" && (0, import_react_dom10.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
9398
9852
|
typeof window !== "undefined" && dropdownPosition && (0, import_react_dom10.createPortal)(
|
|
9399
|
-
/* @__PURE__ */ (0,
|
|
9853
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9400
9854
|
"div",
|
|
9401
9855
|
{
|
|
9402
9856
|
className: "z-[9999] bg-card border border-border rounded-lg shadow-lg overflow-hidden",
|
|
9403
9857
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
9404
9858
|
onMouseDown: (e) => e.stopPropagation(),
|
|
9405
9859
|
role: "menu",
|
|
9406
|
-
children: /* @__PURE__ */ (0,
|
|
9407
|
-
/* @__PURE__ */ (0,
|
|
9408
|
-
locales.map((language) => /* @__PURE__ */ (0,
|
|
9860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "p-2", children: [
|
|
9861
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border mb-2", children: labels?.heading ?? "Language" }),
|
|
9862
|
+
locales.map((language) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
9409
9863
|
Button_default,
|
|
9410
9864
|
{
|
|
9411
9865
|
variant: "ghost",
|
|
@@ -9418,9 +9872,9 @@ function LanguageSwitcherHeadless({
|
|
|
9418
9872
|
role: "menuitemradio",
|
|
9419
9873
|
"aria-checked": currentLocale === language.code,
|
|
9420
9874
|
children: [
|
|
9421
|
-
language.flag && /* @__PURE__ */ (0,
|
|
9422
|
-
/* @__PURE__ */ (0,
|
|
9423
|
-
currentLocale === language.code && /* @__PURE__ */ (0,
|
|
9875
|
+
language.flag && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "text-lg", children: language.flag }),
|
|
9876
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "flex-1 text-left", children: language.name }),
|
|
9877
|
+
currentLocale === language.code && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
9424
9878
|
]
|
|
9425
9879
|
},
|
|
9426
9880
|
language.code
|
|
@@ -9624,6 +10078,7 @@ function getUnderverseMessages(locale = "en") {
|
|
|
9624
10078
|
NotificationBadge,
|
|
9625
10079
|
NotificationModal,
|
|
9626
10080
|
NumberInput,
|
|
10081
|
+
OverlayControls,
|
|
9627
10082
|
PageLoading,
|
|
9628
10083
|
Pagination,
|
|
9629
10084
|
PasswordInput,
|