@sesionario/blocks 1.10.0 → 1.11.0
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 +350 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +216 -100
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as React7 from 'react';
|
|
3
3
|
import { createContext, useContext, useState, useRef, useEffect, useLayoutEffect, useCallback, useId, useMemo } from 'react';
|
|
4
4
|
import { ChevronsUpDown, CheckIcon, Smile, SearchIcon, Search, Clock, Flag, Hash, Lightbulb, Trophy, Plane, Apple, Leaf, Hand, Loader2, AlertTriangle, Inbox, X, ChevronLeft, ChevronRight, Monitor, Sun, Moon, Building2, Check, Plus, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, User, Pencil, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, Settings, PictureInPicture2, Minimize, Maximize, BadgeCheck, ArrowDownIcon, MessageCircleDashedIcon, MessageCircle, XIcon } from 'lucide-react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
@@ -1574,7 +1574,7 @@ function Slider({
|
|
|
1574
1574
|
max = 100,
|
|
1575
1575
|
...props
|
|
1576
1576
|
}) {
|
|
1577
|
-
const _values =
|
|
1577
|
+
const _values = React7.useMemo(
|
|
1578
1578
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
1579
1579
|
[value, defaultValue, min, max]
|
|
1580
1580
|
);
|
|
@@ -2703,22 +2703,22 @@ function EmojiPicker({
|
|
|
2703
2703
|
recentLimit = 24,
|
|
2704
2704
|
storageKey = "blocks-emoji"
|
|
2705
2705
|
}) {
|
|
2706
|
-
const strings =
|
|
2706
|
+
const strings = React7.useMemo(
|
|
2707
2707
|
() => ({ ...DEFAULT_LABELS[locale], ...labels }),
|
|
2708
2708
|
[locale, labels]
|
|
2709
2709
|
);
|
|
2710
|
-
const titles =
|
|
2710
|
+
const titles = React7.useMemo(
|
|
2711
2711
|
() => ({ ...DEFAULT_TITLES[locale], ...labels?.categoryTitles }),
|
|
2712
2712
|
[locale, labels]
|
|
2713
2713
|
);
|
|
2714
|
-
const [query, setQuery] =
|
|
2715
|
-
const [skinTone, setSkinTone] =
|
|
2714
|
+
const [query, setQuery] = React7.useState("");
|
|
2715
|
+
const [skinTone, setSkinTone] = React7.useState(() => {
|
|
2716
2716
|
const raw = readStored(storageKey, "tone");
|
|
2717
2717
|
const parsed = raw != null ? Number.parseInt(raw, 10) : 0;
|
|
2718
2718
|
return parsed >= 0 && parsed <= 5 ? parsed : 0;
|
|
2719
2719
|
});
|
|
2720
|
-
const [toneOpen, setToneOpen] =
|
|
2721
|
-
const [recents, setRecents] =
|
|
2720
|
+
const [toneOpen, setToneOpen] = React7.useState(false);
|
|
2721
|
+
const [recents, setRecents] = React7.useState(() => {
|
|
2722
2722
|
const raw = readStored(storageKey, "recent");
|
|
2723
2723
|
if (!raw) return [];
|
|
2724
2724
|
try {
|
|
@@ -2728,13 +2728,13 @@ function EmojiPicker({
|
|
|
2728
2728
|
return [];
|
|
2729
2729
|
}
|
|
2730
2730
|
});
|
|
2731
|
-
const [focusIndex, setFocusIndex] =
|
|
2732
|
-
const scrollRef =
|
|
2733
|
-
const sectionRefs =
|
|
2731
|
+
const [focusIndex, setFocusIndex] = React7.useState(-1);
|
|
2732
|
+
const scrollRef = React7.useRef(null);
|
|
2733
|
+
const sectionRefs = React7.useRef(
|
|
2734
2734
|
/* @__PURE__ */ new Map()
|
|
2735
2735
|
);
|
|
2736
2736
|
const normalizedQuery = normalizeEmojiQuery(query);
|
|
2737
|
-
const sections =
|
|
2737
|
+
const sections = React7.useMemo(() => {
|
|
2738
2738
|
if (normalizedQuery) return [];
|
|
2739
2739
|
const result = [];
|
|
2740
2740
|
if (recents.length > 0) {
|
|
@@ -2753,7 +2753,7 @@ function EmojiPicker({
|
|
|
2753
2753
|
}
|
|
2754
2754
|
return result;
|
|
2755
2755
|
}, [normalizedQuery, recents, titles]);
|
|
2756
|
-
const searchResults =
|
|
2756
|
+
const searchResults = React7.useMemo(() => {
|
|
2757
2757
|
if (!normalizedQuery) return [];
|
|
2758
2758
|
const out = [];
|
|
2759
2759
|
for (const category of EMOJI_CATEGORIES) {
|
|
@@ -2763,21 +2763,21 @@ function EmojiPicker({
|
|
|
2763
2763
|
}
|
|
2764
2764
|
return out;
|
|
2765
2765
|
}, [normalizedQuery]);
|
|
2766
|
-
const flatList =
|
|
2766
|
+
const flatList = React7.useMemo(() => {
|
|
2767
2767
|
if (normalizedQuery) return searchResults;
|
|
2768
2768
|
return sections.flatMap((s) => s.emojis);
|
|
2769
2769
|
}, [normalizedQuery, searchResults, sections]);
|
|
2770
|
-
|
|
2770
|
+
React7.useEffect(() => {
|
|
2771
2771
|
setFocusIndex(-1);
|
|
2772
2772
|
}, [normalizedQuery]);
|
|
2773
|
-
|
|
2773
|
+
React7.useEffect(() => {
|
|
2774
2774
|
if (focusIndex < 0) return;
|
|
2775
2775
|
const el = scrollRef.current?.querySelector(
|
|
2776
2776
|
`[data-emoji-index="${focusIndex}"]`
|
|
2777
2777
|
);
|
|
2778
2778
|
el?.focus();
|
|
2779
2779
|
}, [focusIndex]);
|
|
2780
|
-
const commitRecent =
|
|
2780
|
+
const commitRecent = React7.useCallback(
|
|
2781
2781
|
(glyph) => {
|
|
2782
2782
|
setRecents((prev) => {
|
|
2783
2783
|
const next = [glyph, ...prev.filter((e) => e !== glyph)].slice(
|
|
@@ -2790,14 +2790,14 @@ function EmojiPicker({
|
|
|
2790
2790
|
},
|
|
2791
2791
|
[recentLimit, storageKey]
|
|
2792
2792
|
);
|
|
2793
|
-
const handleSelect =
|
|
2793
|
+
const handleSelect = React7.useCallback(
|
|
2794
2794
|
(glyph) => {
|
|
2795
2795
|
commitRecent(glyph);
|
|
2796
2796
|
onSelect(glyph);
|
|
2797
2797
|
},
|
|
2798
2798
|
[commitRecent, onSelect]
|
|
2799
2799
|
);
|
|
2800
|
-
const chooseTone =
|
|
2800
|
+
const chooseTone = React7.useCallback(
|
|
2801
2801
|
(tone) => {
|
|
2802
2802
|
setSkinTone(tone);
|
|
2803
2803
|
setToneOpen(false);
|
|
@@ -3103,17 +3103,17 @@ function EmojiPickerPopover({
|
|
|
3103
3103
|
locale = "en",
|
|
3104
3104
|
...pickerProps
|
|
3105
3105
|
}) {
|
|
3106
|
-
const [internalOpen, setInternalOpen] =
|
|
3106
|
+
const [internalOpen, setInternalOpen] = React7.useState(false);
|
|
3107
3107
|
const isControlled = open !== void 0;
|
|
3108
3108
|
const isOpen = isControlled ? open : internalOpen;
|
|
3109
|
-
const setOpen =
|
|
3109
|
+
const setOpen = React7.useCallback(
|
|
3110
3110
|
(next) => {
|
|
3111
3111
|
if (!isControlled) setInternalOpen(next);
|
|
3112
3112
|
onOpenChange?.(next);
|
|
3113
3113
|
},
|
|
3114
3114
|
[isControlled, onOpenChange]
|
|
3115
3115
|
);
|
|
3116
|
-
const handleSelect =
|
|
3116
|
+
const handleSelect = React7.useCallback(
|
|
3117
3117
|
(emoji) => {
|
|
3118
3118
|
onSelect(emoji);
|
|
3119
3119
|
if (!keepOpenOnSelect) setOpen(false);
|
|
@@ -3146,8 +3146,10 @@ function insertAtCaret(element, value, text) {
|
|
|
3146
3146
|
caret: start + text.length
|
|
3147
3147
|
};
|
|
3148
3148
|
}
|
|
3149
|
-
|
|
3150
|
-
|
|
3149
|
+
|
|
3150
|
+
// src/components/emoji/emoji-field-shared.ts
|
|
3151
|
+
var emojiFieldWrapperClassName = "relative w-full rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-destructive/20 has-[:disabled]:opacity-50 dark:bg-input/30 dark:has-[[aria-invalid=true]]:ring-destructive/40";
|
|
3152
|
+
var emojiFieldResetClassName = "border-0 bg-transparent shadow-none focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent";
|
|
3151
3153
|
function mergeRefs(...refs) {
|
|
3152
3154
|
return (node) => {
|
|
3153
3155
|
for (const ref of refs) {
|
|
@@ -3171,7 +3173,7 @@ function emitChange(element, nextValue, onChange) {
|
|
|
3171
3173
|
});
|
|
3172
3174
|
}
|
|
3173
3175
|
function useEmojiInsert(fieldRef, value, onChange) {
|
|
3174
|
-
return
|
|
3176
|
+
return React7.useCallback(
|
|
3175
3177
|
(emoji) => {
|
|
3176
3178
|
const el = fieldRef.current;
|
|
3177
3179
|
const current = value !== void 0 && value !== null ? String(value) : el?.value ?? "";
|
|
@@ -3192,7 +3194,7 @@ function useEmojiInsert(fieldRef, value, onChange) {
|
|
|
3192
3194
|
[fieldRef, value, onChange]
|
|
3193
3195
|
);
|
|
3194
3196
|
}
|
|
3195
|
-
var EmojiTextarea =
|
|
3197
|
+
var EmojiTextarea = React7.forwardRef(
|
|
3196
3198
|
function EmojiTextarea2({
|
|
3197
3199
|
className,
|
|
3198
3200
|
locale = "en",
|
|
@@ -3212,10 +3214,10 @@ var EmojiTextarea = React6.forwardRef(
|
|
|
3212
3214
|
emojiTriggerClassName,
|
|
3213
3215
|
...props
|
|
3214
3216
|
}, ref) {
|
|
3215
|
-
const fieldRef =
|
|
3217
|
+
const fieldRef = React7.useRef(null);
|
|
3216
3218
|
const handleEmojiSelect = useEmojiInsert(fieldRef, value, onChange);
|
|
3217
3219
|
const pickerDisabled = Boolean(disabled || readOnly);
|
|
3218
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(
|
|
3220
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(emojiFieldWrapperClassName, className), children: [
|
|
3219
3221
|
/* @__PURE__ */ jsx(
|
|
3220
3222
|
"textarea",
|
|
3221
3223
|
{
|
|
@@ -3227,7 +3229,7 @@ var EmojiTextarea = React6.forwardRef(
|
|
|
3227
3229
|
onChange,
|
|
3228
3230
|
className: cn(
|
|
3229
3231
|
"placeholder:text-muted-foreground flex min-h-20 w-full rounded-md px-3 py-2 pb-9 pr-10 text-base outline-none transition-[color,box-shadow] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
3230
|
-
|
|
3232
|
+
emojiFieldResetClassName,
|
|
3231
3233
|
className
|
|
3232
3234
|
),
|
|
3233
3235
|
...props
|
|
@@ -3258,7 +3260,7 @@ var EmojiTextarea = React6.forwardRef(
|
|
|
3258
3260
|
}
|
|
3259
3261
|
);
|
|
3260
3262
|
EmojiTextarea.displayName = "EmojiTextarea";
|
|
3261
|
-
var EmojiInput =
|
|
3263
|
+
var EmojiInput = React7.forwardRef(
|
|
3262
3264
|
function EmojiInput2({
|
|
3263
3265
|
className,
|
|
3264
3266
|
locale = "en",
|
|
@@ -3279,10 +3281,10 @@ var EmojiInput = React6.forwardRef(
|
|
|
3279
3281
|
emojiTriggerClassName,
|
|
3280
3282
|
...props
|
|
3281
3283
|
}, ref) {
|
|
3282
|
-
const fieldRef =
|
|
3284
|
+
const fieldRef = React7.useRef(null);
|
|
3283
3285
|
const handleEmojiSelect = useEmojiInsert(fieldRef, value, onChange);
|
|
3284
3286
|
const pickerDisabled = Boolean(disabled || readOnly);
|
|
3285
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(
|
|
3287
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(emojiFieldWrapperClassName, className), children: [
|
|
3286
3288
|
/* @__PURE__ */ jsx(
|
|
3287
3289
|
"input",
|
|
3288
3290
|
{
|
|
@@ -3295,7 +3297,7 @@ var EmojiInput = React6.forwardRef(
|
|
|
3295
3297
|
onChange,
|
|
3296
3298
|
className: cn(
|
|
3297
3299
|
"placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md px-3 py-1 pr-10 text-base outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
3298
|
-
|
|
3300
|
+
emojiFieldResetClassName,
|
|
3299
3301
|
className
|
|
3300
3302
|
),
|
|
3301
3303
|
...props
|
|
@@ -3487,27 +3489,27 @@ function useHlsPlayback({
|
|
|
3487
3489
|
onError,
|
|
3488
3490
|
onPlayingChange
|
|
3489
3491
|
}) {
|
|
3490
|
-
const videoRef =
|
|
3491
|
-
const hlsRef =
|
|
3492
|
-
const [state, setState] =
|
|
3493
|
-
const [qualities, setQualities] =
|
|
3494
|
-
const [activeLevel, setActiveLevel] =
|
|
3495
|
-
const [autoplayState, setAutoplayState] =
|
|
3496
|
-
const [error, setError] =
|
|
3497
|
-
const [reloadKey, setReloadKey] =
|
|
3498
|
-
const onErrorRef =
|
|
3499
|
-
const onPlayingChangeRef =
|
|
3500
|
-
|
|
3492
|
+
const videoRef = React7.useRef(null);
|
|
3493
|
+
const hlsRef = React7.useRef(null);
|
|
3494
|
+
const [state, setState] = React7.useState("idle");
|
|
3495
|
+
const [qualities, setQualities] = React7.useState([]);
|
|
3496
|
+
const [activeLevel, setActiveLevel] = React7.useState(-1);
|
|
3497
|
+
const [autoplayState, setAutoplayState] = React7.useState("none");
|
|
3498
|
+
const [error, setError] = React7.useState(null);
|
|
3499
|
+
const [reloadKey, setReloadKey] = React7.useState(0);
|
|
3500
|
+
const onErrorRef = React7.useRef(onError);
|
|
3501
|
+
const onPlayingChangeRef = React7.useRef(onPlayingChange);
|
|
3502
|
+
React7.useEffect(() => {
|
|
3501
3503
|
onErrorRef.current = onError;
|
|
3502
3504
|
onPlayingChangeRef.current = onPlayingChange;
|
|
3503
3505
|
}, [onError, onPlayingChange]);
|
|
3504
|
-
const retry =
|
|
3506
|
+
const retry = React7.useCallback(() => {
|
|
3505
3507
|
setError(null);
|
|
3506
3508
|
setState("loading");
|
|
3507
3509
|
setAutoplayState("none");
|
|
3508
3510
|
setReloadKey((k) => k + 1);
|
|
3509
3511
|
}, []);
|
|
3510
|
-
|
|
3512
|
+
React7.useEffect(() => {
|
|
3511
3513
|
const media = videoRef.current;
|
|
3512
3514
|
if (!media || !src || !active) {
|
|
3513
3515
|
setState("idle");
|
|
@@ -3719,7 +3721,7 @@ function useHlsPlayback({
|
|
|
3719
3721
|
destroyHls();
|
|
3720
3722
|
};
|
|
3721
3723
|
}, [src, mode, active, autoPlay, muted, reloadKey]);
|
|
3722
|
-
const setLevel =
|
|
3724
|
+
const setLevel = React7.useCallback((index) => {
|
|
3723
3725
|
const hls = hlsRef.current;
|
|
3724
3726
|
if (!hls) return;
|
|
3725
3727
|
hls.nextLevel = index;
|
|
@@ -3802,12 +3804,12 @@ function VideoPlayer({
|
|
|
3802
3804
|
className
|
|
3803
3805
|
}) {
|
|
3804
3806
|
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
3805
|
-
const containerRef =
|
|
3806
|
-
const firstPlayFiredRef =
|
|
3807
|
-
const [userStarted, setUserStarted] =
|
|
3807
|
+
const containerRef = React7.useRef(null);
|
|
3808
|
+
const firstPlayFiredRef = React7.useRef(false);
|
|
3809
|
+
const [userStarted, setUserStarted] = React7.useState(false);
|
|
3808
3810
|
const active = autoPlay || !poster || userStarted;
|
|
3809
3811
|
const autoplayActive = autoPlay || userStarted;
|
|
3810
|
-
const handlePlayingChange =
|
|
3812
|
+
const handlePlayingChange = React7.useCallback(
|
|
3811
3813
|
(playing) => {
|
|
3812
3814
|
setIsPlaying(playing);
|
|
3813
3815
|
if (playing && !firstPlayFiredRef.current) {
|
|
@@ -3836,25 +3838,25 @@ function VideoPlayer({
|
|
|
3836
3838
|
onError,
|
|
3837
3839
|
onPlayingChange: handlePlayingChange
|
|
3838
3840
|
});
|
|
3839
|
-
const [isPlaying, setIsPlaying] =
|
|
3840
|
-
const [isMuted, setIsMuted] =
|
|
3841
|
-
const [volume, setVolume] =
|
|
3842
|
-
const [currentTime, setCurrentTime] =
|
|
3843
|
-
const [duration, setDuration] =
|
|
3844
|
-
const [buffered, setBuffered] =
|
|
3845
|
-
const [isFullscreen, setIsFullscreen] =
|
|
3846
|
-
const [pipActive, setPipActive] =
|
|
3847
|
-
const [controlsVisible, setControlsVisible] =
|
|
3848
|
-
const [playbackRate, setPlaybackRate] =
|
|
3849
|
-
const [openMenu, setOpenMenu] =
|
|
3841
|
+
const [isPlaying, setIsPlaying] = React7.useState(false);
|
|
3842
|
+
const [isMuted, setIsMuted] = React7.useState(muted);
|
|
3843
|
+
const [volume, setVolume] = React7.useState(1);
|
|
3844
|
+
const [currentTime, setCurrentTime] = React7.useState(0);
|
|
3845
|
+
const [duration, setDuration] = React7.useState(0);
|
|
3846
|
+
const [buffered, setBuffered] = React7.useState(0);
|
|
3847
|
+
const [isFullscreen, setIsFullscreen] = React7.useState(false);
|
|
3848
|
+
const [pipActive, setPipActive] = React7.useState(false);
|
|
3849
|
+
const [controlsVisible, setControlsVisible] = React7.useState(true);
|
|
3850
|
+
const [playbackRate, setPlaybackRate] = React7.useState(1);
|
|
3851
|
+
const [openMenu, setOpenMenu] = React7.useState(
|
|
3850
3852
|
null
|
|
3851
3853
|
);
|
|
3852
|
-
const [behindLive, setBehindLive] =
|
|
3853
|
-
const [webkitFullscreenSupported, setWebkitFullscreenSupported] =
|
|
3854
|
-
const hideTimerRef =
|
|
3854
|
+
const [behindLive, setBehindLive] = React7.useState(false);
|
|
3855
|
+
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React7.useState(false);
|
|
3856
|
+
const hideTimerRef = React7.useRef(null);
|
|
3855
3857
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
3856
3858
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
|
|
3857
|
-
|
|
3859
|
+
React7.useEffect(() => {
|
|
3858
3860
|
const video = videoRef.current;
|
|
3859
3861
|
if (!video || !active) return;
|
|
3860
3862
|
const onTimeUpdate = () => {
|
|
@@ -3887,15 +3889,15 @@ function VideoPlayer({
|
|
|
3887
3889
|
video.removeEventListener("ratechange", onRate);
|
|
3888
3890
|
};
|
|
3889
3891
|
}, [videoRef, active, mode]);
|
|
3890
|
-
|
|
3892
|
+
React7.useEffect(() => {
|
|
3891
3893
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
3892
3894
|
}, [videoRef, active]);
|
|
3893
|
-
|
|
3895
|
+
React7.useEffect(() => {
|
|
3894
3896
|
const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
3895
3897
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
3896
3898
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
3897
3899
|
}, []);
|
|
3898
|
-
|
|
3900
|
+
React7.useEffect(() => {
|
|
3899
3901
|
const video = asWebkitVideo(videoRef.current);
|
|
3900
3902
|
if (!video) return;
|
|
3901
3903
|
const onBegin = () => setIsFullscreen(true);
|
|
@@ -3907,7 +3909,7 @@ function VideoPlayer({
|
|
|
3907
3909
|
video.removeEventListener("webkitendfullscreen", onEnd);
|
|
3908
3910
|
};
|
|
3909
3911
|
}, [videoRef, active]);
|
|
3910
|
-
|
|
3912
|
+
React7.useEffect(() => {
|
|
3911
3913
|
const video = videoRef.current;
|
|
3912
3914
|
if (!video) return;
|
|
3913
3915
|
const onEnter = () => setPipActive(true);
|
|
@@ -3919,18 +3921,18 @@ function VideoPlayer({
|
|
|
3919
3921
|
video.removeEventListener("leavepictureinpicture", onLeave);
|
|
3920
3922
|
};
|
|
3921
3923
|
}, [videoRef]);
|
|
3922
|
-
const scheduleHide =
|
|
3924
|
+
const scheduleHide = React7.useCallback(() => {
|
|
3923
3925
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3924
3926
|
hideTimerRef.current = setTimeout(() => {
|
|
3925
3927
|
setControlsVisible(false);
|
|
3926
3928
|
setOpenMenu(null);
|
|
3927
3929
|
}, CONTROLS_HIDE_MS);
|
|
3928
3930
|
}, []);
|
|
3929
|
-
const revealControls =
|
|
3931
|
+
const revealControls = React7.useCallback(() => {
|
|
3930
3932
|
setControlsVisible(true);
|
|
3931
3933
|
scheduleHide();
|
|
3932
3934
|
}, [scheduleHide]);
|
|
3933
|
-
|
|
3935
|
+
React7.useEffect(() => {
|
|
3934
3936
|
return () => {
|
|
3935
3937
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3936
3938
|
};
|
|
@@ -4393,8 +4395,8 @@ function MenuItem({
|
|
|
4393
4395
|
);
|
|
4394
4396
|
}
|
|
4395
4397
|
function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
|
|
4396
|
-
const [stats, setStats] =
|
|
4397
|
-
|
|
4398
|
+
const [stats, setStats] = React7.useState({});
|
|
4399
|
+
React7.useEffect(() => {
|
|
4398
4400
|
if (!statsUrl || !enabled) return;
|
|
4399
4401
|
let cancelled = false;
|
|
4400
4402
|
const controller = new AbortController();
|
|
@@ -5419,7 +5421,7 @@ function ScrollBar({
|
|
|
5419
5421
|
);
|
|
5420
5422
|
}
|
|
5421
5423
|
var phoneInputGroupClass = "flex h-9 w-full gap-0 overflow-hidden rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] [--PhoneInputCountrySelect-marginRight:0] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 dark:bg-input/30 [&_.PhoneInputCountry]:mr-0";
|
|
5422
|
-
var PhoneInput =
|
|
5424
|
+
var PhoneInput = React7.forwardRef(
|
|
5423
5425
|
({ className, onChange, value, defaultCountry = "MX", ...props }, ref) => {
|
|
5424
5426
|
return /* @__PURE__ */ jsx(
|
|
5425
5427
|
RPNInput.default,
|
|
@@ -5439,7 +5441,7 @@ var PhoneInput = React6.forwardRef(
|
|
|
5439
5441
|
}
|
|
5440
5442
|
);
|
|
5441
5443
|
PhoneInput.displayName = "PhoneInput";
|
|
5442
|
-
var InputComponent =
|
|
5444
|
+
var InputComponent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5443
5445
|
Input,
|
|
5444
5446
|
{
|
|
5445
5447
|
className: cn(
|
|
@@ -5457,9 +5459,9 @@ var CountrySelect = ({
|
|
|
5457
5459
|
options: countryList,
|
|
5458
5460
|
onChange
|
|
5459
5461
|
}) => {
|
|
5460
|
-
const scrollAreaRef =
|
|
5461
|
-
const [searchValue, setSearchValue] =
|
|
5462
|
-
const [isOpen, setIsOpen] =
|
|
5462
|
+
const scrollAreaRef = React7.useRef(null);
|
|
5463
|
+
const [searchValue, setSearchValue] = React7.useState("");
|
|
5464
|
+
const [isOpen, setIsOpen] = React7.useState(false);
|
|
5463
5465
|
return /* @__PURE__ */ jsxs(
|
|
5464
5466
|
Popover,
|
|
5465
5467
|
{
|
|
@@ -5640,8 +5642,8 @@ var MEXICO_STATE_PATHS = {
|
|
|
5640
5642
|
};
|
|
5641
5643
|
function MexicoMap({ selected, onToggle, className }) {
|
|
5642
5644
|
const isInteractive = typeof onToggle === "function";
|
|
5643
|
-
const selectedSet =
|
|
5644
|
-
const handleKeyDown =
|
|
5645
|
+
const selectedSet = React7.useMemo(() => new Set(selected), [selected]);
|
|
5646
|
+
const handleKeyDown = React7.useCallback(
|
|
5645
5647
|
(event, id) => {
|
|
5646
5648
|
if (!onToggle) return;
|
|
5647
5649
|
if (event.key === "Enter" || event.key === " ") {
|
|
@@ -6123,6 +6125,121 @@ function ChatMessageList({
|
|
|
6123
6125
|
/* @__PURE__ */ jsx(MessageScrollerButton, {})
|
|
6124
6126
|
] }) });
|
|
6125
6127
|
}
|
|
6128
|
+
var MessageComposer = React7.forwardRef(function MessageComposer2({
|
|
6129
|
+
className,
|
|
6130
|
+
locale = "en",
|
|
6131
|
+
disabled,
|
|
6132
|
+
readOnly,
|
|
6133
|
+
value,
|
|
6134
|
+
onChange,
|
|
6135
|
+
onSubmit,
|
|
6136
|
+
onKeyDown,
|
|
6137
|
+
sendLabel,
|
|
6138
|
+
sendDisabled = false,
|
|
6139
|
+
sendButtonClassName,
|
|
6140
|
+
sendButtonSize = "sm",
|
|
6141
|
+
triggerLabel,
|
|
6142
|
+
keepOpenOnSelect,
|
|
6143
|
+
open,
|
|
6144
|
+
onOpenChange,
|
|
6145
|
+
side = "top",
|
|
6146
|
+
align = "end",
|
|
6147
|
+
labels,
|
|
6148
|
+
recentLimit,
|
|
6149
|
+
storageKey,
|
|
6150
|
+
emojiTriggerClassName,
|
|
6151
|
+
rows = 2,
|
|
6152
|
+
...props
|
|
6153
|
+
}, ref) {
|
|
6154
|
+
const formRef = React7.useRef(null);
|
|
6155
|
+
const fieldRef = React7.useRef(null);
|
|
6156
|
+
const handleEmojiSelect = useEmojiInsert(fieldRef, value, onChange);
|
|
6157
|
+
const pickerDisabled = Boolean(disabled || readOnly);
|
|
6158
|
+
const draft = value !== void 0 && value !== null ? String(value) : "";
|
|
6159
|
+
const canSubmit = Boolean(draft.trim()) && !sendDisabled && !disabled && !readOnly;
|
|
6160
|
+
const handleSubmit = React7.useCallback(
|
|
6161
|
+
(event) => {
|
|
6162
|
+
event.preventDefault();
|
|
6163
|
+
if (!canSubmit) return;
|
|
6164
|
+
onSubmit(event);
|
|
6165
|
+
},
|
|
6166
|
+
[canSubmit, onSubmit]
|
|
6167
|
+
);
|
|
6168
|
+
const handleKeyDown = React7.useCallback(
|
|
6169
|
+
(event) => {
|
|
6170
|
+
onKeyDown?.(event);
|
|
6171
|
+
if (event.defaultPrevented) return;
|
|
6172
|
+
if (event.key !== "Enter" || event.shiftKey) return;
|
|
6173
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229) return;
|
|
6174
|
+
event.preventDefault();
|
|
6175
|
+
if (!canSubmit) return;
|
|
6176
|
+
formRef.current?.requestSubmit();
|
|
6177
|
+
},
|
|
6178
|
+
[canSubmit, onKeyDown]
|
|
6179
|
+
);
|
|
6180
|
+
return /* @__PURE__ */ jsxs(
|
|
6181
|
+
"form",
|
|
6182
|
+
{
|
|
6183
|
+
ref: formRef,
|
|
6184
|
+
className: cn(emojiFieldWrapperClassName, "flex flex-col", className),
|
|
6185
|
+
onSubmit: handleSubmit,
|
|
6186
|
+
children: [
|
|
6187
|
+
/* @__PURE__ */ jsx(
|
|
6188
|
+
"textarea",
|
|
6189
|
+
{
|
|
6190
|
+
"data-slot": "textarea",
|
|
6191
|
+
ref: mergeRefs(fieldRef, ref),
|
|
6192
|
+
disabled,
|
|
6193
|
+
readOnly,
|
|
6194
|
+
value,
|
|
6195
|
+
onChange,
|
|
6196
|
+
onKeyDown: handleKeyDown,
|
|
6197
|
+
rows,
|
|
6198
|
+
className: cn(
|
|
6199
|
+
"placeholder:text-muted-foreground flex min-h-10 w-full resize-none rounded-md px-3 pt-2 pb-1 text-base outline-none transition-[color,box-shadow] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
6200
|
+
emojiFieldResetClassName
|
|
6201
|
+
),
|
|
6202
|
+
...props
|
|
6203
|
+
}
|
|
6204
|
+
),
|
|
6205
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-1.5 pb-1.5", children: [
|
|
6206
|
+
/* @__PURE__ */ jsx(
|
|
6207
|
+
EmojiPickerPopover,
|
|
6208
|
+
{
|
|
6209
|
+
locale,
|
|
6210
|
+
onSelect: handleEmojiSelect,
|
|
6211
|
+
disabled: pickerDisabled,
|
|
6212
|
+
triggerLabel,
|
|
6213
|
+
keepOpenOnSelect,
|
|
6214
|
+
open,
|
|
6215
|
+
onOpenChange,
|
|
6216
|
+
side,
|
|
6217
|
+
align,
|
|
6218
|
+
labels,
|
|
6219
|
+
recentLimit,
|
|
6220
|
+
storageKey,
|
|
6221
|
+
triggerClassName: cn(
|
|
6222
|
+
"size-7 text-muted-foreground",
|
|
6223
|
+
emojiTriggerClassName
|
|
6224
|
+
)
|
|
6225
|
+
}
|
|
6226
|
+
),
|
|
6227
|
+
/* @__PURE__ */ jsx(
|
|
6228
|
+
Button,
|
|
6229
|
+
{
|
|
6230
|
+
type: "submit",
|
|
6231
|
+
size: sendButtonSize,
|
|
6232
|
+
disabled: !canSubmit,
|
|
6233
|
+
className: sendButtonClassName,
|
|
6234
|
+
children: sendLabel
|
|
6235
|
+
}
|
|
6236
|
+
)
|
|
6237
|
+
] })
|
|
6238
|
+
]
|
|
6239
|
+
}
|
|
6240
|
+
);
|
|
6241
|
+
});
|
|
6242
|
+
MessageComposer.displayName = "MessageComposer";
|
|
6126
6243
|
var RECONNECT_DELAY_MS = 2e3;
|
|
6127
6244
|
function useSupportConversation({
|
|
6128
6245
|
client,
|
|
@@ -6343,23 +6460,22 @@ function ThreadPanel({
|
|
|
6343
6460
|
emptyDescription: labels.emptyThread
|
|
6344
6461
|
}
|
|
6345
6462
|
) }),
|
|
6346
|
-
/* @__PURE__ */
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
] })
|
|
6463
|
+
/* @__PURE__ */ jsx("div", { className: "border-t p-3", children: /* @__PURE__ */ jsx(
|
|
6464
|
+
MessageComposer,
|
|
6465
|
+
{
|
|
6466
|
+
locale: emojiLocale,
|
|
6467
|
+
value: draft,
|
|
6468
|
+
onChange: (e) => setDraft(e.target.value.slice(0, 2e3)),
|
|
6469
|
+
onSubmit,
|
|
6470
|
+
sendLabel: labels.send,
|
|
6471
|
+
placeholder: labels.placeholder,
|
|
6472
|
+
"aria-label": labels.placeholder,
|
|
6473
|
+
disabled: loading || sending,
|
|
6474
|
+
sendDisabled: loading || sending,
|
|
6475
|
+
maxLength: 2e3,
|
|
6476
|
+
rows: 2
|
|
6477
|
+
}
|
|
6478
|
+
) })
|
|
6363
6479
|
]
|
|
6364
6480
|
}
|
|
6365
6481
|
);
|
|
@@ -6741,6 +6857,6 @@ function createSupportChatClient(basePath = "/api/chat-svc") {
|
|
|
6741
6857
|
};
|
|
6742
6858
|
}
|
|
6743
6859
|
|
|
6744
|
-
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, ExpandableText, ImageLightbox, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, SearchablePicker, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
6860
|
+
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, ExpandableText, ImageLightbox, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageComposer, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, SearchablePicker, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
6745
6861
|
//# sourceMappingURL=index.js.map
|
|
6746
6862
|
//# sourceMappingURL=index.js.map
|