@epicbagel/saas-kit 1.21.0 → 1.23.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.
@@ -1,140 +0,0 @@
1
- "use client";
2
- import {
3
- AgentAudioVisualizerBar
4
- } from "./chunk-5OF6D3GH.js";
5
- import {
6
- Button
7
- } from "./chunk-W326GKML.js";
8
- import {
9
- cn
10
- } from "./chunk-G6SRSWXB.js";
11
-
12
- // src/primitives/voice-session-controls.tsx
13
- import { useSyncExternalStore } from "react";
14
- import { Mic, MicOff, Square, AudioLines } from "lucide-react";
15
- import { jsx, jsxs } from "react/jsx-runtime";
16
- var SILENCE = [];
17
- var silence = () => SILENCE;
18
- var noSubscription = () => () => {
19
- };
20
- var DEFAULT_LABELS = {
21
- disconnected: "Voice chat",
22
- connecting: "Connecting\u2026",
23
- listening: "Listening\u2026",
24
- thinking: "Thinking\u2026",
25
- speaking: "Speaking",
26
- reconnecting: "Reconnecting\u2026",
27
- error: "Voice chat unavailable",
28
- start: "Start voice chat",
29
- end: "End voice chat",
30
- mute: "Mute microphone",
31
- unmute: "Unmute microphone",
32
- muted: "Microphone muted",
33
- retry: "Retry voice chat",
34
- endShort: "End voice",
35
- muteShort: "Mute",
36
- unmuteShort: "Unmute"
37
- };
38
- function VoiceSessionControls({
39
- state,
40
- onStart,
41
- onEnd,
42
- muted = false,
43
- onMutedChange,
44
- disabled = false,
45
- error,
46
- volumeBands,
47
- audioLevels,
48
- labels,
49
- size = "icon",
50
- className
51
- }) {
52
- const liveBands = useSyncExternalStore(audioLevels?.subscribe ?? noSubscription, audioLevels?.getSnapshot ?? silence, silence);
53
- const copy = { ...DEFAULT_LABELS, ...labels };
54
- const active = state !== "disconnected" && state !== "error";
55
- const waiting = state === "connecting" || state === "reconnecting";
56
- return /* @__PURE__ */ jsxs(
57
- "div",
58
- {
59
- "data-slot": "voice-session-controls",
60
- "data-state": state,
61
- className: cn("min-w-0", active ? "@container/voice w-full" : "flex flex-wrap items-center gap-2", className),
62
- children: [
63
- active ? /* @__PURE__ */ jsxs("div", { "data-slot": "voice-session-strip", className: "flex w-full flex-wrap items-center gap-4 bg-primary/5 p-4 @2xl/voice:flex-nowrap @2xl/voice:px-5", children: [
64
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 basis-full items-center gap-3 @2xl/voice:basis-auto @2xl/voice:gap-4", children: [
65
- /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: cn(
66
- "flex size-12 shrink-0 items-center justify-center rounded-full ring-8 ring-primary/5 @sm/voice:size-14",
67
- muted ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground"
68
- ), children: muted ? /* @__PURE__ */ jsx(MicOff, { className: "size-5" }) : /* @__PURE__ */ jsx(Mic, { className: "size-5" }) }),
69
- /* @__PURE__ */ jsx(
70
- AgentAudioVisualizerBar,
71
- {
72
- "aria-hidden": "true",
73
- size: "sm",
74
- barCount: 5,
75
- className: "shrink-0 text-primary [&>div]:w-1",
76
- state: muted && state === "listening" ? "disconnected" : state === "reconnecting" ? "connecting" : state,
77
- volumeBands: muted && state === "listening" ? SILENCE : volumeBands ?? liveBands
78
- }
79
- ),
80
- /* @__PURE__ */ jsx("span", { role: "status", className: "min-w-0 flex-1 text-sm font-medium text-primary", children: muted && state === "listening" ? copy.muted : copy[state] })
81
- ] }),
82
- /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
83
- /* @__PURE__ */ jsxs(
84
- Button,
85
- {
86
- type: "button",
87
- variant: "outline",
88
- size: "sm",
89
- className: "min-h-[44px] shrink-0 rounded-xl bg-background px-3 text-foreground",
90
- "aria-label": muted ? copy.unmute : copy.mute,
91
- title: muted ? copy.unmute : copy.mute,
92
- "aria-pressed": muted,
93
- disabled: waiting,
94
- onClick: () => onMutedChange(!muted),
95
- children: [
96
- muted ? /* @__PURE__ */ jsx(Mic, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(MicOff, { "aria-hidden": "true" }),
97
- muted ? copy.unmuteShort : copy.muteShort
98
- ]
99
- }
100
- ),
101
- /* @__PURE__ */ jsxs(
102
- Button,
103
- {
104
- type: "button",
105
- variant: "outline",
106
- size: "sm",
107
- className: "min-h-[44px] shrink-0 rounded-xl bg-background px-3 text-foreground",
108
- "aria-label": copy.end,
109
- title: copy.end,
110
- onClick: onEnd,
111
- children: [
112
- /* @__PURE__ */ jsx(Square, { "aria-hidden": "true", className: "fill-current" }),
113
- copy.endShort
114
- ]
115
- }
116
- )
117
- ] })
118
- ] }) : /* @__PURE__ */ jsx(
119
- Button,
120
- {
121
- type: "button",
122
- size: "icon",
123
- shape: "circle",
124
- disabled,
125
- onClick: onStart,
126
- "aria-label": state === "error" ? copy.retry : copy.start,
127
- title: state === "error" ? copy.retry : copy.start,
128
- className: cn("min-h-[44px] min-w-[44px] shrink-0 rounded-full", size === "hero" && "size-24 [&_svg]:size-7"),
129
- children: /* @__PURE__ */ jsx(AudioLines, { "aria-hidden": "true" })
130
- }
131
- ),
132
- state === "error" && /* @__PURE__ */ jsx("span", { role: "alert", className: "basis-full text-xs text-destructive", children: error || copy.error })
133
- ]
134
- }
135
- );
136
- }
137
-
138
- export {
139
- VoiceSessionControls
140
- };
@@ -1,140 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
-
3
-
4
- var _chunkNKWHDI4Ccjs = require('./chunk-NKWHDI4C.cjs');
5
-
6
-
7
- var _chunkJDEXZGIYcjs = require('./chunk-JDEXZGIY.cjs');
8
-
9
-
10
- var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
11
-
12
- // src/primitives/voice-session-controls.tsx
13
- var _react = require('react');
14
- var _lucidereact = require('lucide-react');
15
- var _jsxruntime = require('react/jsx-runtime');
16
- var SILENCE = [];
17
- var silence = () => SILENCE;
18
- var noSubscription = () => () => {
19
- };
20
- var DEFAULT_LABELS = {
21
- disconnected: "Voice chat",
22
- connecting: "Connecting\u2026",
23
- listening: "Listening\u2026",
24
- thinking: "Thinking\u2026",
25
- speaking: "Speaking",
26
- reconnecting: "Reconnecting\u2026",
27
- error: "Voice chat unavailable",
28
- start: "Start voice chat",
29
- end: "End voice chat",
30
- mute: "Mute microphone",
31
- unmute: "Unmute microphone",
32
- muted: "Microphone muted",
33
- retry: "Retry voice chat",
34
- endShort: "End voice",
35
- muteShort: "Mute",
36
- unmuteShort: "Unmute"
37
- };
38
- function VoiceSessionControls({
39
- state,
40
- onStart,
41
- onEnd,
42
- muted = false,
43
- onMutedChange,
44
- disabled = false,
45
- error,
46
- volumeBands,
47
- audioLevels,
48
- labels,
49
- size = "icon",
50
- className
51
- }) {
52
- const liveBands = _react.useSyncExternalStore.call(void 0, _nullishCoalesce(_optionalChain([audioLevels, 'optionalAccess', _ => _.subscribe]), () => ( noSubscription)), _nullishCoalesce(_optionalChain([audioLevels, 'optionalAccess', _2 => _2.getSnapshot]), () => ( silence)), silence);
53
- const copy = { ...DEFAULT_LABELS, ...labels };
54
- const active = state !== "disconnected" && state !== "error";
55
- const waiting = state === "connecting" || state === "reconnecting";
56
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
57
- "div",
58
- {
59
- "data-slot": "voice-session-controls",
60
- "data-state": state,
61
- className: _chunkKWLSBTB2cjs.cn.call(void 0, "min-w-0", active ? "@container/voice w-full" : "flex flex-wrap items-center gap-2", className),
62
- children: [
63
- active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { "data-slot": "voice-session-strip", className: "flex w-full flex-wrap items-center gap-4 bg-primary/5 p-4 @2xl/voice:flex-nowrap @2xl/voice:px-5", children: [
64
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-w-0 flex-1 basis-full items-center gap-3 @2xl/voice:basis-auto @2xl/voice:gap-4", children: [
65
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "aria-hidden": "true", className: _chunkKWLSBTB2cjs.cn.call(void 0,
66
- "flex size-12 shrink-0 items-center justify-center rounded-full ring-8 ring-primary/5 @sm/voice:size-14",
67
- muted ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground"
68
- ), children: muted ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MicOff, { className: "size-5" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Mic, { className: "size-5" }) }),
69
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
70
- _chunkNKWHDI4Ccjs.AgentAudioVisualizerBar,
71
- {
72
- "aria-hidden": "true",
73
- size: "sm",
74
- barCount: 5,
75
- className: "shrink-0 text-primary [&>div]:w-1",
76
- state: muted && state === "listening" ? "disconnected" : state === "reconnecting" ? "connecting" : state,
77
- volumeBands: muted && state === "listening" ? SILENCE : _nullishCoalesce(volumeBands, () => ( liveBands))
78
- }
79
- ),
80
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { role: "status", className: "min-w-0 flex-1 text-sm font-medium text-primary", children: muted && state === "listening" ? copy.muted : copy[state] })
81
- ] }),
82
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
83
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
84
- _chunkJDEXZGIYcjs.Button,
85
- {
86
- type: "button",
87
- variant: "outline",
88
- size: "sm",
89
- className: "min-h-[44px] shrink-0 rounded-xl bg-background px-3 text-foreground",
90
- "aria-label": muted ? copy.unmute : copy.mute,
91
- title: muted ? copy.unmute : copy.mute,
92
- "aria-pressed": muted,
93
- disabled: waiting,
94
- onClick: () => onMutedChange(!muted),
95
- children: [
96
- muted ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Mic, { "aria-hidden": "true" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MicOff, { "aria-hidden": "true" }),
97
- muted ? copy.unmuteShort : copy.muteShort
98
- ]
99
- }
100
- ),
101
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
102
- _chunkJDEXZGIYcjs.Button,
103
- {
104
- type: "button",
105
- variant: "outline",
106
- size: "sm",
107
- className: "min-h-[44px] shrink-0 rounded-xl bg-background px-3 text-foreground",
108
- "aria-label": copy.end,
109
- title: copy.end,
110
- onClick: onEnd,
111
- children: [
112
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Square, { "aria-hidden": "true", className: "fill-current" }),
113
- copy.endShort
114
- ]
115
- }
116
- )
117
- ] })
118
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
119
- _chunkJDEXZGIYcjs.Button,
120
- {
121
- type: "button",
122
- size: "icon",
123
- shape: "circle",
124
- disabled,
125
- onClick: onStart,
126
- "aria-label": state === "error" ? copy.retry : copy.start,
127
- title: state === "error" ? copy.retry : copy.start,
128
- className: _chunkKWLSBTB2cjs.cn.call(void 0, "min-h-[44px] min-w-[44px] shrink-0 rounded-full", size === "hero" && "size-24 [&_svg]:size-7"),
129
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AudioLines, { "aria-hidden": "true" })
130
- }
131
- ),
132
- state === "error" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { role: "alert", className: "basis-full text-xs text-destructive", children: error || copy.error })
133
- ]
134
- }
135
- );
136
- }
137
-
138
-
139
-
140
- exports.VoiceSessionControls = VoiceSessionControls;