@epicbagel/saas-kit 1.0.0 → 1.2.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.
Files changed (120) hide show
  1. package/README.md +72 -3
  2. package/THIRD_PARTY_NOTICES.md +230 -7
  3. package/dist/chunk-2AU7ZRGX.cjs +96 -0
  4. package/dist/chunk-2BTDBZYN.cjs +154 -0
  5. package/dist/chunk-2HV2KKOE.cjs +38 -0
  6. package/dist/chunk-2KFZQJH5.cjs +29 -0
  7. package/dist/chunk-32Q4XOTU.cjs +204 -0
  8. package/dist/chunk-42RTTHND.js +29 -0
  9. package/dist/chunk-6FC65AZQ.js +38 -0
  10. package/dist/chunk-B765DSRG.cjs +66 -0
  11. package/dist/chunk-ELPV44S6.cjs +44 -0
  12. package/dist/chunk-EOUO3ORO.cjs +244 -0
  13. package/dist/chunk-EZCKWTH7.js +204 -0
  14. package/dist/chunk-F366BHWH.js +116 -0
  15. package/dist/chunk-GFG2R5BZ.js +132 -0
  16. package/dist/chunk-HAC32ALJ.js +244 -0
  17. package/dist/chunk-INNGGLMZ.js +44 -0
  18. package/dist/chunk-IW4ZIXXG.js +66 -0
  19. package/dist/chunk-JZOBIPFC.js +96 -0
  20. package/dist/chunk-KADJ56AH.cjs +416 -0
  21. package/dist/chunk-KENBU3NV.cjs +27 -0
  22. package/dist/chunk-M7FYGAGO.js +416 -0
  23. package/dist/chunk-MHYAVXOE.js +159 -0
  24. package/dist/chunk-RIWLAMME.cjs +159 -0
  25. package/dist/chunk-SUB4BAYE.cjs +73 -0
  26. package/dist/chunk-THWIJG5C.js +73 -0
  27. package/dist/chunk-V4YWTRLD.cjs +116 -0
  28. package/dist/chunk-VY5U4VGV.js +27 -0
  29. package/dist/chunk-XABXUP6L.cjs +132 -0
  30. package/dist/chunk-Z45YKVAM.js +154 -0
  31. package/dist/primitives/action-dock.cjs +8 -0
  32. package/dist/primitives/action-dock.d.cts +10 -0
  33. package/dist/primitives/action-dock.d.ts +10 -0
  34. package/dist/primitives/action-dock.js +8 -0
  35. package/dist/primitives/attachment.cjs +25 -203
  36. package/dist/primitives/attachment.d.cts +1 -1
  37. package/dist/primitives/attachment.d.ts +1 -1
  38. package/dist/primitives/attachment.js +12 -190
  39. package/dist/primitives/badge.d.cts +1 -1
  40. package/dist/primitives/badge.d.ts +1 -1
  41. package/dist/primitives/board-view.cjs +3 -3
  42. package/dist/primitives/board-view.js +2 -2
  43. package/dist/primitives/bubble.cjs +14 -0
  44. package/dist/primitives/bubble.d.cts +21 -0
  45. package/dist/primitives/bubble.d.ts +21 -0
  46. package/dist/primitives/bubble.js +14 -0
  47. package/dist/primitives/button.d.cts +3 -3
  48. package/dist/primitives/button.d.ts +3 -3
  49. package/dist/primitives/chat.cjs +881 -0
  50. package/dist/primitives/chat.d.cts +345 -0
  51. package/dist/primitives/chat.d.ts +345 -0
  52. package/dist/primitives/chat.js +881 -0
  53. package/dist/primitives/connection.cjs +6 -6
  54. package/dist/primitives/connection.js +7 -7
  55. package/dist/primitives/file-dropzone.cjs +7 -107
  56. package/dist/primitives/file-dropzone.d.cts +66 -3
  57. package/dist/primitives/file-dropzone.d.ts +66 -3
  58. package/dist/primitives/file-dropzone.js +13 -113
  59. package/dist/primitives/input-group.cjs +21 -0
  60. package/dist/primitives/input-group.d.cts +20 -0
  61. package/dist/primitives/input-group.d.ts +20 -0
  62. package/dist/primitives/input-group.js +21 -0
  63. package/dist/primitives/item.cjs +197 -0
  64. package/dist/primitives/item.d.cts +28 -0
  65. package/dist/primitives/item.d.ts +28 -0
  66. package/dist/primitives/item.js +197 -0
  67. package/dist/primitives/lazy-markdown.cjs +10 -0
  68. package/dist/primitives/lazy-markdown.d.cts +20 -0
  69. package/dist/primitives/lazy-markdown.d.ts +20 -0
  70. package/dist/primitives/lazy-markdown.js +10 -0
  71. package/dist/primitives/markdown.cjs +17 -0
  72. package/dist/primitives/markdown.d.cts +32 -0
  73. package/dist/primitives/markdown.d.ts +32 -0
  74. package/dist/primitives/markdown.js +17 -0
  75. package/dist/primitives/marker.cjs +14 -0
  76. package/dist/primitives/marker.d.cts +15 -0
  77. package/dist/primitives/marker.d.ts +15 -0
  78. package/dist/primitives/marker.js +14 -0
  79. package/dist/primitives/message-scroller.cjs +26 -0
  80. package/dist/primitives/message-scroller.d.cts +16 -0
  81. package/dist/primitives/message-scroller.d.ts +16 -0
  82. package/dist/primitives/message-scroller.js +26 -0
  83. package/dist/primitives/message.cjs +7 -84
  84. package/dist/primitives/message.js +8 -85
  85. package/dist/primitives/resource-list.cjs +3 -3
  86. package/dist/primitives/resource-list.js +2 -2
  87. package/dist/primitives/rich-text.cjs +3 -38
  88. package/dist/primitives/rich-text.js +3 -38
  89. package/dist/primitives/section-header.d.cts +1 -1
  90. package/dist/primitives/section-header.d.ts +1 -1
  91. package/dist/primitives/spinner.cjs +23 -0
  92. package/dist/primitives/spinner.d.cts +6 -0
  93. package/dist/primitives/spinner.d.ts +6 -0
  94. package/dist/primitives/spinner.js +23 -0
  95. package/dist/primitives/suggestion.cjs +11 -0
  96. package/dist/primitives/suggestion.d.cts +19 -0
  97. package/dist/primitives/suggestion.d.ts +19 -0
  98. package/dist/primitives/suggestion.js +11 -0
  99. package/dist/primitives/switch-field.cjs +2 -2
  100. package/dist/primitives/switch-field.js +3 -3
  101. package/dist/primitives/textarea.cjs +4 -33
  102. package/dist/primitives/textarea.js +3 -32
  103. package/dist/primitives/toggle-group.d.cts +2 -2
  104. package/dist/primitives/toggle-group.d.ts +2 -2
  105. package/dist/primitives/toggle.d.cts +2 -2
  106. package/dist/primitives/toggle.d.ts +2 -2
  107. package/dist/primitives/trace.cjs +23 -0
  108. package/dist/primitives/trace.d.cts +22 -0
  109. package/dist/primitives/trace.d.ts +22 -0
  110. package/dist/primitives/trace.js +23 -0
  111. package/dist/primitives/voice-dictation-button.cjs +5 -239
  112. package/dist/primitives/voice-dictation-button.js +4 -238
  113. package/package.json +125 -2
  114. package/src/styles/components/bubble.css +81 -0
  115. package/src/styles/components/marker.css +27 -0
  116. package/src/styles/components/message-scroller.css +11 -0
  117. package/src/styles/components.css +3 -0
  118. package/src/styles/utilities.css +3 -2
  119. package/dist/{chunk-UGF2K6NR.js → chunk-HRLP4BHJ.js} +6 -6
  120. package/dist/{chunk-RWWOFWLP.cjs → chunk-IH3COANJ.cjs} +3 -3
@@ -1,37 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
4
+ var _chunk2HV2KKOEcjs = require('../chunk-2HV2KKOE.cjs');
5
+ require('../chunk-KWLSBTB2.cjs');
5
6
 
6
- // src/primitives/textarea.tsx
7
- var _react = require('react'); var React = _interopRequireWildcard(_react);
8
- var _jsxruntime = require('react/jsx-runtime');
9
- var Textarea = React.forwardRef(
10
- ({ className, textSize = "sm", resize = "vertical", grow = false, font = "sans", height = "auto", ...props }, ref) => {
11
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
12
- "textarea",
13
- {
14
- "data-slot": "textarea",
15
- className: _chunkKWLSBTB2cjs.cn.call(void 0,
16
- "flex min-h-[80px] w-full rounded-md border bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
17
- // Entered text keeps the iOS-safe floor. The shared stylesheet sizes
18
- // placeholder copy independently at the compact 14px base scale.
19
- textSize === "sm" ? "text-[16px] md:text-sm" : "text-[16px] md:text-xs",
20
- resize === "none" && "resize-none",
21
- grow && "flex-1",
22
- font === "mono" && "font-mono",
23
- height === "panel" && "h-32",
24
- height === "editor" && "h-72",
25
- height === "editor-lg" && "h-80",
26
- className
27
- ),
28
- ref,
29
- ...props
30
- }
31
- );
32
- }
33
- );
34
- Textarea.displayName = "Textarea";
35
7
 
36
-
37
- exports.Textarea = Textarea;
8
+ exports.Textarea = _chunk2HV2KKOEcjs.Textarea;
@@ -1,37 +1,8 @@
1
1
  "use client";
2
2
  import {
3
- cn
4
- } from "../chunk-G6SRSWXB.js";
5
-
6
- // src/primitives/textarea.tsx
7
- import * as React from "react";
8
- import { jsx } from "react/jsx-runtime";
9
- var Textarea = React.forwardRef(
10
- ({ className, textSize = "sm", resize = "vertical", grow = false, font = "sans", height = "auto", ...props }, ref) => {
11
- return /* @__PURE__ */ jsx(
12
- "textarea",
13
- {
14
- "data-slot": "textarea",
15
- className: cn(
16
- "flex min-h-[80px] w-full rounded-md border bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
17
- // Entered text keeps the iOS-safe floor. The shared stylesheet sizes
18
- // placeholder copy independently at the compact 14px base scale.
19
- textSize === "sm" ? "text-[16px] md:text-sm" : "text-[16px] md:text-xs",
20
- resize === "none" && "resize-none",
21
- grow && "flex-1",
22
- font === "mono" && "font-mono",
23
- height === "panel" && "h-32",
24
- height === "editor" && "h-72",
25
- height === "editor-lg" && "h-80",
26
- className
27
- ),
28
- ref,
29
- ...props
30
- }
31
- );
32
- }
33
- );
34
- Textarea.displayName = "Textarea";
3
+ Textarea
4
+ } from "../chunk-6FC65AZQ.js";
5
+ import "../chunk-G6SRSWXB.js";
35
6
  export {
36
7
  Textarea
37
8
  };
@@ -5,11 +5,11 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const ToggleGroup: React.ForwardRefExoticComponent<((Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & VariantProps<(props?: ({
7
7
  variant?: "default" | "outline" | null | undefined;
8
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
8
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string>) & React.RefAttributes<HTMLDivElement>>;
10
10
  declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
11
11
  variant?: "default" | "outline" | null | undefined;
12
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
12
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
13
13
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
14
14
  grow?: boolean;
15
15
  textSize?: "inherit" | "xs";
@@ -5,11 +5,11 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  declare const ToggleGroup: React.ForwardRefExoticComponent<((Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & VariantProps<(props?: ({
7
7
  variant?: "default" | "outline" | null | undefined;
8
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
8
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string>) & React.RefAttributes<HTMLDivElement>>;
10
10
  declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
11
11
  variant?: "default" | "outline" | null | undefined;
12
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
12
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
13
13
  } & class_variance_authority_types.ClassProp) | undefined) => string> & {
14
14
  grow?: boolean;
15
15
  textSize?: "inherit" | "xs";
@@ -5,11 +5,11 @@ import * as React from 'react';
5
5
 
6
6
  declare const toggleVariants: (props?: ({
7
7
  variant?: "default" | "outline" | null | undefined;
8
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
8
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
11
11
  variant?: "default" | "outline" | null | undefined;
12
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
12
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
13
13
  } & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
14
14
 
15
15
  export { Toggle, toggleVariants };
@@ -5,11 +5,11 @@ import * as React from 'react';
5
5
 
6
6
  declare const toggleVariants: (props?: ({
7
7
  variant?: "default" | "outline" | null | undefined;
8
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
8
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
9
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10
10
  declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
11
11
  variant?: "default" | "outline" | null | undefined;
12
- size?: "icon" | "sm" | "lg" | "default" | "icon-lg" | "avatar" | "chip" | null | undefined;
12
+ size?: "sm" | "lg" | "default" | "icon" | "icon-lg" | "avatar" | "chip" | null | undefined;
13
13
  } & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
14
14
 
15
15
  export { Toggle, toggleVariants };
@@ -0,0 +1,23 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ var _chunk2BTDBZYNcjs = require('../chunk-2BTDBZYN.cjs');
12
+ require('../chunk-W5HPHEE7.cjs');
13
+ require('../chunk-KWLSBTB2.cjs');
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+ exports.Trace = _chunk2BTDBZYNcjs.Trace; exports.TraceCollapsible = _chunk2BTDBZYNcjs.TraceCollapsible; exports.TraceCollapsibleContent = _chunk2BTDBZYNcjs.TraceCollapsibleContent; exports.TraceCollapsibleTrigger = _chunk2BTDBZYNcjs.TraceCollapsibleTrigger; exports.TraceDescription = _chunk2BTDBZYNcjs.TraceDescription; exports.TraceIcon = _chunk2BTDBZYNcjs.TraceIcon; exports.TraceLine = _chunk2BTDBZYNcjs.TraceLine; exports.TraceTitle = _chunk2BTDBZYNcjs.TraceTitle;
@@ -0,0 +1,22 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './collapsible.cjs';
4
+ import '@radix-ui/react-collapsible';
5
+
6
+ declare function Trace({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
7
+ declare function TraceLine({ className, status, ...props }: React.ComponentProps<"span"> & {
8
+ status?: "running" | "error" | "pending";
9
+ }): react_jsx_runtime.JSX.Element;
10
+ declare function TraceIcon({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
11
+ declare function TraceTitle({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
12
+ declare function TraceDescription({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
13
+ declare function TraceCollapsible({ className, ...props }: Omit<React.ComponentProps<typeof Collapsible>, "asChild" | "open"> & ({
14
+ open?: undefined;
15
+ } | {
16
+ open: boolean;
17
+ onOpenChange: NonNullable<React.ComponentProps<typeof Collapsible>["onOpenChange"]>;
18
+ })): react_jsx_runtime.JSX.Element;
19
+ declare function TraceCollapsibleTrigger({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsibleTrigger>, "asChild" | "appearance">): react_jsx_runtime.JSX.Element;
20
+ declare function TraceCollapsibleContent({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsibleContent>, "asChild" | "padding">): react_jsx_runtime.JSX.Element;
21
+
22
+ export { Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle };
@@ -0,0 +1,22 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './collapsible.js';
4
+ import '@radix-ui/react-collapsible';
5
+
6
+ declare function Trace({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
7
+ declare function TraceLine({ className, status, ...props }: React.ComponentProps<"span"> & {
8
+ status?: "running" | "error" | "pending";
9
+ }): react_jsx_runtime.JSX.Element;
10
+ declare function TraceIcon({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
11
+ declare function TraceTitle({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
12
+ declare function TraceDescription({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
13
+ declare function TraceCollapsible({ className, ...props }: Omit<React.ComponentProps<typeof Collapsible>, "asChild" | "open"> & ({
14
+ open?: undefined;
15
+ } | {
16
+ open: boolean;
17
+ onOpenChange: NonNullable<React.ComponentProps<typeof Collapsible>["onOpenChange"]>;
18
+ })): react_jsx_runtime.JSX.Element;
19
+ declare function TraceCollapsibleTrigger({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsibleTrigger>, "asChild" | "appearance">): react_jsx_runtime.JSX.Element;
20
+ declare function TraceCollapsibleContent({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsibleContent>, "asChild" | "padding">): react_jsx_runtime.JSX.Element;
21
+
22
+ export { Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import {
3
+ Trace,
4
+ TraceCollapsible,
5
+ TraceCollapsibleContent,
6
+ TraceCollapsibleTrigger,
7
+ TraceDescription,
8
+ TraceIcon,
9
+ TraceLine,
10
+ TraceTitle
11
+ } from "../chunk-Z45YKVAM.js";
12
+ import "../chunk-NBUWGRQO.js";
13
+ import "../chunk-G6SRSWXB.js";
14
+ export {
15
+ Trace,
16
+ TraceCollapsible,
17
+ TraceCollapsibleContent,
18
+ TraceCollapsibleTrigger,
19
+ TraceDescription,
20
+ TraceIcon,
21
+ TraceLine,
22
+ TraceTitle
23
+ };
@@ -1,244 +1,10 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
  "use client";
3
3
 
4
4
 
5
- var _chunkL4DH72UFcjs = require('../chunk-L4DH72UF.cjs');
5
+ var _chunkEOUO3OROcjs = require('../chunk-EOUO3ORO.cjs');
6
+ require('../chunk-L4DH72UF.cjs');
7
+ require('../chunk-KWLSBTB2.cjs');
6
8
 
7
9
 
8
- var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
9
-
10
- // src/primitives/voice-dictation-button.tsx
11
-
12
-
13
-
14
-
15
-
16
- var _react = require('react');
17
- var _reactdialog = require('@radix-ui/react-dialog'); var DialogPrimitive = _interopRequireWildcard(_reactdialog);
18
- var _lucidereact = require('lucide-react');
19
- var _jsxruntime = require('react/jsx-runtime');
20
- function VoiceDictationButton({
21
- onCommit,
22
- onCancel,
23
- title = "Dictate your message",
24
- caption = "listening",
25
- lang = "en-US",
26
- continuous = true,
27
- className,
28
- size = "sm",
29
- showLabel = false,
30
- children,
31
- disabled = false,
32
- visibility = "visible",
33
- shrink = true
34
- }) {
35
- const [supported, setSupported] = _react.useState.call(void 0, false);
36
- const [open, setOpen] = _react.useState.call(void 0, false);
37
- const [transcript, setTranscript] = _react.useState.call(void 0, "");
38
- const [interim, setInterim] = _react.useState.call(void 0, "");
39
- const [errored, setErrored] = _react.useState.call(void 0, false);
40
- const recognitionRef = _react.useRef.call(void 0, null);
41
- _react.useEffect.call(void 0, () => {
42
- const w = window;
43
- const Ctor = _nullishCoalesce(w.SpeechRecognition, () => ( w.webkitSpeechRecognition));
44
- setSupported(typeof Ctor === "function");
45
- }, []);
46
- const stop = _react.useCallback.call(void 0, () => {
47
- _optionalChain([recognitionRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.stop, 'call', _3 => _3()]);
48
- recognitionRef.current = null;
49
- }, []);
50
- const startRecognition = _react.useCallback.call(void 0, () => {
51
- const w = window;
52
- const Ctor = _nullishCoalesce(w.SpeechRecognition, () => ( w.webkitSpeechRecognition));
53
- if (!Ctor) return;
54
- const rec = new Ctor();
55
- rec.continuous = continuous;
56
- rec.interimResults = true;
57
- rec.lang = lang;
58
- rec.onresult = (event) => {
59
- let finalChunk = "";
60
- let interimChunk = "";
61
- for (let i = event.resultIndex; i < event.results.length; i++) {
62
- const r = event.results[i];
63
- if (!r) continue;
64
- if (r.isFinal) finalChunk += r[0].transcript;
65
- else interimChunk += r[0].transcript;
66
- }
67
- if (finalChunk) {
68
- setTranscript((prev) => prev ? prev + " " + finalChunk : finalChunk);
69
- setInterim("");
70
- } else if (interimChunk) {
71
- setInterim(interimChunk);
72
- }
73
- };
74
- rec.onerror = () => {
75
- setErrored(true);
76
- };
77
- rec.onend = () => {
78
- recognitionRef.current = null;
79
- };
80
- recognitionRef.current = rec;
81
- setErrored(false);
82
- rec.start();
83
- }, [continuous, lang]);
84
- const openOverlay = _react.useCallback.call(void 0, () => {
85
- setTranscript("");
86
- setInterim("");
87
- setOpen(true);
88
- startRecognition();
89
- }, [startRecognition]);
90
- const closeOverlay = _react.useCallback.call(void 0, () => {
91
- stop();
92
- setOpen(false);
93
- setInterim("");
94
- }, [stop]);
95
- const handleDone = _react.useCallback.call(void 0, () => {
96
- const final = `${transcript} ${interim}`.trim();
97
- closeOverlay();
98
- if (final) onCommit(final);
99
- else _optionalChain([onCancel, 'optionalCall', _4 => _4()]);
100
- }, [transcript, interim, onCommit, onCancel, closeOverlay]);
101
- const handleCancel = _react.useCallback.call(void 0, () => {
102
- closeOverlay();
103
- _optionalChain([onCancel, 'optionalCall', _5 => _5()]);
104
- }, [closeOverlay, onCancel]);
105
- _react.useEffect.call(void 0, () => {
106
- if (!open) return;
107
- const onKey = (e) => {
108
- if (e.key === "Enter" && !e.shiftKey) handleDone();
109
- };
110
- document.addEventListener("keydown", onKey);
111
- return () => document.removeEventListener("keydown", onKey);
112
- }, [open, handleDone]);
113
- _react.useEffect.call(void 0, () => {
114
- return () => {
115
- _optionalChain([recognitionRef, 'access', _6 => _6.current, 'optionalAccess', _7 => _7.abort, 'call', _8 => _8()]);
116
- };
117
- }, []);
118
- if (!supported) return null;
119
- const displayTranscript = `${transcript}${interim ? (transcript ? " " : "") + interim : ""}`;
120
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
121
- children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
122
- "button",
123
- {
124
- type: "button",
125
- onClick: openOverlay,
126
- disabled,
127
- "aria-label": "Start dictation",
128
- className: _chunkKWLSBTB2cjs.cn.call(void 0, visibility === "hidden" && "hidden", className),
129
- children
130
- }
131
- ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
132
- _chunkL4DH72UFcjs.Button,
133
- {
134
- type: "button",
135
- onClick: openOverlay,
136
- disabled,
137
- variant: "outline",
138
- size,
139
- "aria-label": "Start dictation",
140
- className: _chunkKWLSBTB2cjs.cn.call(void 0, "transition-colors", visibility === "hidden" && "hidden", !shrink && "shrink-0", className),
141
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center justify-center gap-2", children: [
142
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Mic, { className: "h-4 w-4" }),
143
- showLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Speak" })
144
- ] })
145
- }
146
- ),
147
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
148
- DialogPrimitive.Root,
149
- {
150
- open,
151
- onOpenChange: (next) => {
152
- if (!next) closeOverlay();
153
- },
154
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogPrimitive.Portal, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
155
- DialogPrimitive.Content,
156
- {
157
- "aria-label": "Voice dictation",
158
- onOpenAutoFocus: (e) => e.preventDefault(),
159
- onMouseDown: (e) => {
160
- if (e.target === e.currentTarget) handleCancel();
161
- },
162
- className: "fixed inset-0 z-[200] flex flex-col bg-background outline-hidden md:items-center md:justify-center md:bg-black/40 md:backdrop-blur-sm",
163
- children: [
164
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogPrimitive.Title, { className: "sr-only", children: "Voice dictation" }),
165
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 md:flex-initial w-full md:max-w-lg md:rounded-xl bg-background flex flex-col md:max-h-[80vh] md:shadow-2xl md:border md:border-border", children: [
166
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between px-4 py-3 border-b border-border md:rounded-t-xl", children: [
167
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-xs uppercase tracking-wider text-muted-foreground", children: caption }),
168
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
169
- "button",
170
- {
171
- type: "button",
172
- onClick: handleCancel,
173
- "aria-label": "Cancel",
174
- className: "p-1 -m-1 rounded-sm hover:bg-muted/60 transition-colors",
175
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { className: "h-4 w-4" })
176
- }
177
- )
178
- ] }),
179
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex flex-col items-center justify-center px-6 text-center", children: [
180
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative w-24 h-24 mb-10 flex items-center justify-center", children: [
181
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
182
- "span",
183
- {
184
- "aria-hidden": true,
185
- className: _chunkKWLSBTB2cjs.cn.call(void 0,
186
- "absolute inset-0 rounded-full",
187
- errored ? "bg-destructive/20" : "bg-destructive/20 animate-ping"
188
- )
189
- }
190
- ),
191
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
192
- "span",
193
- {
194
- "aria-hidden": true,
195
- className: _chunkKWLSBTB2cjs.cn.call(void 0,
196
- "absolute inset-2 rounded-full",
197
- errored ? "bg-destructive/40" : "bg-destructive/40"
198
- )
199
- }
200
- ),
201
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Mic, { className: "relative h-9 w-9 text-destructive-foreground" })
202
- ] }),
203
- title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-base font-medium text-muted-foreground mb-3", children: title }),
204
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl md:text-2xl leading-relaxed min-h-[5rem] max-w-xl text-foreground", children: displayTranscript ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
205
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: transcript }),
206
- interim && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground", children: [
207
- transcript ? " " : "",
208
- interim
209
- ] })
210
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground italic text-base", children: "Start speaking \u2014 I'm listening." }) }),
211
- errored && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive mt-4", children: "Couldn't access the microphone. Check permissions." })
212
- ] }),
213
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border-t border-border px-4 py-4 pb-[calc(1rem+env(safe-area-inset-bottom))] md:pb-4 md:rounded-b-xl flex flex-col items-stretch gap-2", children: [
214
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
215
- _chunkL4DH72UFcjs.Button,
216
- {
217
- size: "lg",
218
- className: "h-12 w-full",
219
- onClick: handleDone,
220
- disabled: !displayTranscript.trim(),
221
- children: "Done"
222
- }
223
- ),
224
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
225
- "button",
226
- {
227
- type: "button",
228
- onClick: handleCancel,
229
- className: "text-sm text-muted-foreground hover:text-foreground py-1",
230
- children: "Cancel"
231
- }
232
- )
233
- ] })
234
- ] })
235
- ]
236
- }
237
- ) })
238
- }
239
- )
240
- ] });
241
- }
242
-
243
-
244
- exports.VoiceDictationButton = VoiceDictationButton;
10
+ exports.VoiceDictationButton = _chunkEOUO3OROcjs.VoiceDictationButton;