@hex-core/components 1.5.0 → 1.7.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/_tsup-dts-rollup.d.ts +487 -0
- package/dist/attachment.d.ts +4 -0
- package/dist/attachment.js +157 -0
- package/dist/attachment.js.map +1 -0
- package/dist/code-block.js +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/dropzone.js +46 -44
- package/dist/dropzone.js.map +1 -1
- package/dist/empty.d.ts +3 -0
- package/dist/empty.js +94 -0
- package/dist/empty.js.map +1 -0
- package/dist/error-state.d.ts +3 -0
- package/dist/error-state.js +67 -0
- package/dist/error-state.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +982 -46
- package/dist/index.js.map +1 -1
- package/dist/loading.d.ts +3 -0
- package/dist/loading.js +80 -0
- package/dist/loading.js.map +1 -0
- package/dist/schemas.d.ts +7 -0
- package/dist/schemas.js +804 -4
- package/dist/schemas.js.map +1 -1
- package/dist/speech-recognition.d.ts +2 -0
- package/dist/speech-recognition.js +152 -0
- package/dist/speech-recognition.js.map +1 -0
- package/dist/tag.d.ts +3 -0
- package/dist/tag.js +107 -0
- package/dist/tag.js.map +1 -0
- package/dist/toolbar.d.ts +8 -0
- package/dist/toolbar.js +120 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tree.d.ts +3 -0
- package/dist/tree.js +275 -0
- package/dist/tree.js.map +1 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ import { DayPicker } from 'react-day-picker';
|
|
|
39
39
|
import { format } from 'date-fns';
|
|
40
40
|
import { OTPInput, OTPInputContext } from 'input-otp';
|
|
41
41
|
import { Command as Command$1 } from 'cmdk';
|
|
42
|
+
import * as ToolbarPrimitive from '@radix-ui/react-toolbar';
|
|
42
43
|
import { Drawer as Drawer$1 } from 'vaul';
|
|
43
44
|
import { Panel, Group, Separator as Separator$1 } from 'react-resizable-panels';
|
|
44
45
|
import { Streamdown } from 'streamdown';
|
|
@@ -625,6 +626,288 @@ function Skeleton({ className, ...props }) {
|
|
|
625
626
|
}
|
|
626
627
|
);
|
|
627
628
|
}
|
|
629
|
+
var emptyVariants = cva(
|
|
630
|
+
[
|
|
631
|
+
"flex flex-col items-center justify-center text-center",
|
|
632
|
+
"rounded-md border border-dashed border-border bg-muted/30"
|
|
633
|
+
].join(" "),
|
|
634
|
+
{
|
|
635
|
+
variants: {
|
|
636
|
+
size: {
|
|
637
|
+
sm: "gap-[var(--space-2,0.5rem)] px-[var(--space-4,1rem)] py-[var(--space-6,1.5rem)] text-sm",
|
|
638
|
+
default: "gap-[var(--space-3,0.75rem)] px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)]",
|
|
639
|
+
lg: "gap-[var(--space-4,1rem)] px-[var(--space-8,2rem)] py-[var(--space-12,3rem)]"
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
defaultVariants: { size: "default" }
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
var emptyIconWrapperVariants = cva(
|
|
646
|
+
"flex shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground [&_svg]:size-5",
|
|
647
|
+
{
|
|
648
|
+
variants: {
|
|
649
|
+
size: {
|
|
650
|
+
sm: "h-9 w-9",
|
|
651
|
+
default: "h-12 w-12 [&_svg]:size-6",
|
|
652
|
+
lg: "h-16 w-16 [&_svg]:size-7"
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
defaultVariants: { size: "default" }
|
|
656
|
+
}
|
|
657
|
+
);
|
|
658
|
+
var emptyTitleVariants = cva("font-semibold text-foreground", {
|
|
659
|
+
variants: {
|
|
660
|
+
size: {
|
|
661
|
+
sm: "text-sm",
|
|
662
|
+
default: "text-base",
|
|
663
|
+
lg: "text-lg"
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
defaultVariants: { size: "default" }
|
|
667
|
+
});
|
|
668
|
+
var emptyDescriptionVariants = cva("max-w-md text-muted-foreground", {
|
|
669
|
+
variants: {
|
|
670
|
+
size: {
|
|
671
|
+
sm: "text-xs",
|
|
672
|
+
default: "text-sm",
|
|
673
|
+
lg: "text-base"
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
defaultVariants: { size: "default" }
|
|
677
|
+
});
|
|
678
|
+
function Empty({
|
|
679
|
+
className,
|
|
680
|
+
size,
|
|
681
|
+
icon,
|
|
682
|
+
title,
|
|
683
|
+
description,
|
|
684
|
+
action,
|
|
685
|
+
titleAs = "h3",
|
|
686
|
+
ref,
|
|
687
|
+
...props
|
|
688
|
+
}) {
|
|
689
|
+
const titleId = React44.useId();
|
|
690
|
+
const TitleComp = titleAs;
|
|
691
|
+
return /* @__PURE__ */ jsxs(
|
|
692
|
+
"div",
|
|
693
|
+
{
|
|
694
|
+
ref,
|
|
695
|
+
role: "region",
|
|
696
|
+
"aria-labelledby": titleId,
|
|
697
|
+
className: cn(emptyVariants({ size }), className),
|
|
698
|
+
...props,
|
|
699
|
+
children: [
|
|
700
|
+
icon ? /* @__PURE__ */ jsx("div", { className: emptyIconWrapperVariants({ size }), "aria-hidden": "true", children: icon }) : null,
|
|
701
|
+
/* @__PURE__ */ jsx(TitleComp, { id: titleId, className: emptyTitleVariants({ size }), children: title }),
|
|
702
|
+
description ? /* @__PURE__ */ jsx("div", { className: emptyDescriptionVariants({ size }), children: description }) : null,
|
|
703
|
+
action ? /* @__PURE__ */ jsx("div", { className: "mt-[var(--space-2,0.5rem)]", children: action }) : null
|
|
704
|
+
]
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
var loadingVariants = cva("flex w-full", {
|
|
709
|
+
variants: {
|
|
710
|
+
variant: {
|
|
711
|
+
list: "flex-col gap-[var(--space-3,0.75rem)]",
|
|
712
|
+
card: "flex-col gap-[var(--space-2,0.5rem)] rounded-md border border-border bg-card p-[var(--space-4,1rem)]",
|
|
713
|
+
stack: "flex-col gap-[var(--space-4,1rem)]"
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
defaultVariants: { variant: "list" }
|
|
717
|
+
});
|
|
718
|
+
function Loading({
|
|
719
|
+
className,
|
|
720
|
+
variant = "list",
|
|
721
|
+
rows = 3,
|
|
722
|
+
label = "Loading\u2026",
|
|
723
|
+
ref,
|
|
724
|
+
...props
|
|
725
|
+
}) {
|
|
726
|
+
return /* @__PURE__ */ jsxs(
|
|
727
|
+
"div",
|
|
728
|
+
{
|
|
729
|
+
ref,
|
|
730
|
+
role: "status",
|
|
731
|
+
"aria-live": "polite",
|
|
732
|
+
className: cn(loadingVariants({ variant }), className),
|
|
733
|
+
...props,
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: label }),
|
|
736
|
+
Array.from({ length: rows }, (_, i) => (
|
|
737
|
+
// `variant` can be `null` per CVA's VariantProps shape — the
|
|
738
|
+
// destructured default only catches undefined. The fallback
|
|
739
|
+
// here narrows to the LoadingRow's "list" | "card" | "stack"
|
|
740
|
+
// signature.
|
|
741
|
+
/* @__PURE__ */ jsx(LoadingRow, { variant: variant ?? "list" }, i)
|
|
742
|
+
))
|
|
743
|
+
]
|
|
744
|
+
}
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
function LoadingRow({ variant }) {
|
|
748
|
+
if (variant === "card") {
|
|
749
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
750
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/4" }),
|
|
751
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-full" }),
|
|
752
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-5/6" })
|
|
753
|
+
] });
|
|
754
|
+
}
|
|
755
|
+
if (variant === "stack") {
|
|
756
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[var(--space-3,0.75rem)]", children: [
|
|
757
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-10 shrink-0 rounded-full" }),
|
|
758
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-[var(--space-2,0.5rem)]", children: [
|
|
759
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/3" }),
|
|
760
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-2/3" })
|
|
761
|
+
] })
|
|
762
|
+
] });
|
|
763
|
+
}
|
|
764
|
+
return /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" });
|
|
765
|
+
}
|
|
766
|
+
var errorStateVariants = cva(
|
|
767
|
+
[
|
|
768
|
+
"flex flex-col items-center justify-center text-center",
|
|
769
|
+
"rounded-md border px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)] gap-[var(--space-3,0.75rem)]"
|
|
770
|
+
].join(" "),
|
|
771
|
+
{
|
|
772
|
+
variants: {
|
|
773
|
+
variant: {
|
|
774
|
+
default: "border-border bg-muted/30",
|
|
775
|
+
destructive: "border-destructive/30 bg-destructive/5"
|
|
776
|
+
}
|
|
777
|
+
},
|
|
778
|
+
defaultVariants: { variant: "default" }
|
|
779
|
+
}
|
|
780
|
+
);
|
|
781
|
+
var errorIconWrapperVariants = cva(
|
|
782
|
+
"flex h-12 w-12 shrink-0 items-center justify-center rounded-full [&_svg]:size-6",
|
|
783
|
+
{
|
|
784
|
+
variants: {
|
|
785
|
+
variant: {
|
|
786
|
+
default: "bg-muted text-muted-foreground",
|
|
787
|
+
destructive: "bg-destructive/10 text-destructive"
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
defaultVariants: { variant: "default" }
|
|
791
|
+
}
|
|
792
|
+
);
|
|
793
|
+
function ErrorState({
|
|
794
|
+
className,
|
|
795
|
+
variant,
|
|
796
|
+
icon,
|
|
797
|
+
title = "Something went wrong",
|
|
798
|
+
message,
|
|
799
|
+
action,
|
|
800
|
+
ref,
|
|
801
|
+
...props
|
|
802
|
+
}) {
|
|
803
|
+
return /* @__PURE__ */ jsxs(
|
|
804
|
+
"div",
|
|
805
|
+
{
|
|
806
|
+
ref,
|
|
807
|
+
role: "alert",
|
|
808
|
+
className: cn(errorStateVariants({ variant }), className),
|
|
809
|
+
...props,
|
|
810
|
+
children: [
|
|
811
|
+
icon ? /* @__PURE__ */ jsx("div", { className: errorIconWrapperVariants({ variant }), "aria-hidden": "true", children: icon }) : null,
|
|
812
|
+
/* @__PURE__ */ jsx("div", { className: "font-semibold text-foreground", children: title }),
|
|
813
|
+
/* @__PURE__ */ jsx("div", { className: "max-w-md text-sm text-muted-foreground", children: message }),
|
|
814
|
+
action ? /* @__PURE__ */ jsx("div", { className: "mt-[var(--space-2,0.5rem)]", children: action }) : null
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
var tagVariants = cva(
|
|
820
|
+
[
|
|
821
|
+
"inline-flex items-center gap-[var(--gap-xs,0.25rem)] rounded-full border px-2.5 py-0.5 text-xs font-medium",
|
|
822
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
823
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
824
|
+
].join(" "),
|
|
825
|
+
{
|
|
826
|
+
variants: {
|
|
827
|
+
variant: {
|
|
828
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
829
|
+
secondary: "border-foreground/15 bg-secondary text-secondary-foreground hover:border-foreground/20",
|
|
830
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
831
|
+
outline: "border-foreground/20 text-foreground hover:border-foreground/30"
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
defaultVariants: { variant: "default" }
|
|
835
|
+
}
|
|
836
|
+
);
|
|
837
|
+
function extractStringLabel(children) {
|
|
838
|
+
const parts = [];
|
|
839
|
+
const visit = (node) => {
|
|
840
|
+
if (node === null || node === void 0 || typeof node === "boolean") return;
|
|
841
|
+
if (typeof node === "string") {
|
|
842
|
+
parts.push(node);
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
if (typeof node === "number") {
|
|
846
|
+
parts.push(String(node));
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
if (Array.isArray(node)) {
|
|
850
|
+
for (const item of node) visit(item);
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
if (React44.isValidElement(node)) {
|
|
854
|
+
const props = node.props;
|
|
855
|
+
visit(props.children);
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
visit(children);
|
|
859
|
+
const joined = parts.join(" ").replace(/\s+/g, " ").trim();
|
|
860
|
+
return joined.length > 0 ? joined : null;
|
|
861
|
+
}
|
|
862
|
+
function Tag({
|
|
863
|
+
className,
|
|
864
|
+
variant,
|
|
865
|
+
icon,
|
|
866
|
+
onRemove,
|
|
867
|
+
removeLabel,
|
|
868
|
+
children,
|
|
869
|
+
ref,
|
|
870
|
+
...props
|
|
871
|
+
}) {
|
|
872
|
+
const labelText = extractStringLabel(children);
|
|
873
|
+
const ariaLabel = removeLabel ?? (labelText ? `Remove ${labelText}` : "Remove");
|
|
874
|
+
return /* @__PURE__ */ jsxs("span", { ref, className: cn(tagVariants({ variant }), className), ...props, children: [
|
|
875
|
+
icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "-ml-0.5 [&_svg]:size-3 [&_svg]:shrink-0", children: icon }) : null,
|
|
876
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
877
|
+
onRemove ? /* @__PURE__ */ jsx(
|
|
878
|
+
"button",
|
|
879
|
+
{
|
|
880
|
+
type: "button",
|
|
881
|
+
onClick: onRemove,
|
|
882
|
+
"aria-label": ariaLabel,
|
|
883
|
+
className: cn(
|
|
884
|
+
"-mr-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full",
|
|
885
|
+
"transition-colors duration-[var(--duration-normal,200ms)] ease-out",
|
|
886
|
+
"hover:bg-foreground/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
887
|
+
"active:scale-[0.92]"
|
|
888
|
+
),
|
|
889
|
+
children: /* @__PURE__ */ jsxs(
|
|
890
|
+
"svg",
|
|
891
|
+
{
|
|
892
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
893
|
+
viewBox: "0 0 24 24",
|
|
894
|
+
fill: "none",
|
|
895
|
+
stroke: "currentColor",
|
|
896
|
+
strokeWidth: "2.5",
|
|
897
|
+
strokeLinecap: "round",
|
|
898
|
+
strokeLinejoin: "round",
|
|
899
|
+
className: "size-3",
|
|
900
|
+
"aria-hidden": "true",
|
|
901
|
+
children: [
|
|
902
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
903
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
}
|
|
908
|
+
) : null
|
|
909
|
+
] });
|
|
910
|
+
}
|
|
628
911
|
var Progress = React44.forwardRef(({ className, value, max = 100, ...props }, ref) => {
|
|
629
912
|
const pct = Math.max(0, Math.min(100, (value ?? 0) / max * 100));
|
|
630
913
|
return /* @__PURE__ */ jsx(
|
|
@@ -3358,31 +3641,31 @@ function Dropzone({
|
|
|
3358
3641
|
isDisabled: disabled,
|
|
3359
3642
|
openFileDialog
|
|
3360
3643
|
};
|
|
3361
|
-
return /* @__PURE__ */ jsxs(
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
typeof children === "function" ? children(renderState) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3644
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3645
|
+
/* @__PURE__ */ jsx(
|
|
3646
|
+
"div",
|
|
3647
|
+
{
|
|
3648
|
+
role: "button",
|
|
3649
|
+
tabIndex: disabled ? -1 : 0,
|
|
3650
|
+
"aria-label": ariaLabel,
|
|
3651
|
+
"aria-disabled": disabled || void 0,
|
|
3652
|
+
"data-drag-over": isDragOver || void 0,
|
|
3653
|
+
onClick: openFileDialog,
|
|
3654
|
+
onKeyDown: handleKeyDown,
|
|
3655
|
+
onDragEnter: handleDragEnter,
|
|
3656
|
+
onDragOver: handleDragOver,
|
|
3657
|
+
onDragLeave: handleDragLeave,
|
|
3658
|
+
onDrop: handleDrop,
|
|
3659
|
+
className: cn(
|
|
3660
|
+
"flex w-full cursor-pointer select-none flex-col items-center justify-center gap-[var(--space-2,0.5rem)] rounded-md border-2 border-dashed border-input bg-background px-[var(--space-6,1.5rem)] py-[var(--space-8,2rem)] text-center text-sm transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
3661
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
3662
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
3663
|
+
isDragOver && "border-primary bg-accent text-accent-foreground",
|
|
3664
|
+
disabled && "pointer-events-none opacity-50",
|
|
3665
|
+
className
|
|
3666
|
+
),
|
|
3667
|
+
...rest,
|
|
3668
|
+
children: typeof children === "function" ? children(renderState) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3386
3669
|
/* @__PURE__ */ jsxs(
|
|
3387
3670
|
"svg",
|
|
3388
3671
|
{
|
|
@@ -3404,25 +3687,27 @@ function Dropzone({
|
|
|
3404
3687
|
),
|
|
3405
3688
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: isDragOver ? "Drop files to upload" : "Drag files here or click to browse" }),
|
|
3406
3689
|
accept ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: accept }) : null
|
|
3407
|
-
] })
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3690
|
+
] })
|
|
3691
|
+
}
|
|
3692
|
+
),
|
|
3693
|
+
/* @__PURE__ */ jsx(
|
|
3694
|
+
"input",
|
|
3695
|
+
{
|
|
3696
|
+
ref: inputRef,
|
|
3697
|
+
type: "file",
|
|
3698
|
+
accept,
|
|
3699
|
+
multiple,
|
|
3700
|
+
disabled,
|
|
3701
|
+
"aria-hidden": "true",
|
|
3702
|
+
tabIndex: -1,
|
|
3703
|
+
className: "sr-only",
|
|
3704
|
+
onChange: (e) => {
|
|
3705
|
+
emit(e.target.files);
|
|
3706
|
+
e.target.value = "";
|
|
3707
|
+
}
|
|
3708
|
+
}
|
|
3709
|
+
)
|
|
3710
|
+
] });
|
|
3426
3711
|
}
|
|
3427
3712
|
Dropzone.displayName = "Dropzone";
|
|
3428
3713
|
var TimePicker = React44.forwardRef(
|
|
@@ -3771,6 +4056,374 @@ function FileTree({
|
|
|
3771
4056
|
);
|
|
3772
4057
|
}
|
|
3773
4058
|
FileTree.displayName = "FileTree";
|
|
4059
|
+
function flattenVisible(nodes, expanded) {
|
|
4060
|
+
const out = [];
|
|
4061
|
+
function walk(items, depth, parentId) {
|
|
4062
|
+
for (const node of items) {
|
|
4063
|
+
out.push({ node, depth, parentId });
|
|
4064
|
+
if (node.children && expanded.has(node.id)) {
|
|
4065
|
+
walk(node.children, depth + 1, node.id);
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
walk(nodes, 0, null);
|
|
4070
|
+
return out;
|
|
4071
|
+
}
|
|
4072
|
+
function Tree({
|
|
4073
|
+
data,
|
|
4074
|
+
defaultExpanded,
|
|
4075
|
+
expanded: expandedProp,
|
|
4076
|
+
onExpandedChange,
|
|
4077
|
+
selected: selectedProp,
|
|
4078
|
+
onSelect,
|
|
4079
|
+
"aria-label": ariaLabel,
|
|
4080
|
+
className,
|
|
4081
|
+
ref
|
|
4082
|
+
}) {
|
|
4083
|
+
const [internalExpanded, setInternalExpanded] = React44.useState(
|
|
4084
|
+
() => new Set(defaultExpanded ?? [])
|
|
4085
|
+
);
|
|
4086
|
+
const expanded = React44.useMemo(
|
|
4087
|
+
() => expandedProp ? new Set(expandedProp) : internalExpanded,
|
|
4088
|
+
[expandedProp, internalExpanded]
|
|
4089
|
+
);
|
|
4090
|
+
const [internalSelected, setInternalSelected] = React44.useState(null);
|
|
4091
|
+
const selected = selectedProp ?? internalSelected;
|
|
4092
|
+
const visible = React44.useMemo(() => flattenVisible(data, expanded), [data, expanded]);
|
|
4093
|
+
const [focusedId, setFocusedId] = React44.useState(
|
|
4094
|
+
() => visible[0]?.node.id ?? null
|
|
4095
|
+
);
|
|
4096
|
+
React44.useEffect(() => {
|
|
4097
|
+
if (focusedId && !visible.some((row) => row.node.id === focusedId)) {
|
|
4098
|
+
setFocusedId(visible[0]?.node.id ?? null);
|
|
4099
|
+
}
|
|
4100
|
+
}, [visible, focusedId]);
|
|
4101
|
+
const setExpandedSet = React44.useCallback(
|
|
4102
|
+
(next) => {
|
|
4103
|
+
if (expandedProp) {
|
|
4104
|
+
onExpandedChange?.([...next]);
|
|
4105
|
+
} else {
|
|
4106
|
+
setInternalExpanded(next);
|
|
4107
|
+
onExpandedChange?.([...next]);
|
|
4108
|
+
}
|
|
4109
|
+
},
|
|
4110
|
+
[expandedProp, onExpandedChange]
|
|
4111
|
+
);
|
|
4112
|
+
const toggleExpand = React44.useCallback(
|
|
4113
|
+
(id) => {
|
|
4114
|
+
const next = new Set(expanded);
|
|
4115
|
+
if (next.has(id)) next.delete(id);
|
|
4116
|
+
else next.add(id);
|
|
4117
|
+
setExpandedSet(next);
|
|
4118
|
+
},
|
|
4119
|
+
[expanded, setExpandedSet]
|
|
4120
|
+
);
|
|
4121
|
+
const activate = React44.useCallback(
|
|
4122
|
+
(id) => {
|
|
4123
|
+
if (selectedProp === void 0) setInternalSelected(id);
|
|
4124
|
+
onSelect?.(id);
|
|
4125
|
+
},
|
|
4126
|
+
[selectedProp, onSelect]
|
|
4127
|
+
);
|
|
4128
|
+
const handleKeyDown = React44.useCallback(
|
|
4129
|
+
(e) => {
|
|
4130
|
+
if (!focusedId) return;
|
|
4131
|
+
const idx = visible.findIndex((row2) => row2.node.id === focusedId);
|
|
4132
|
+
if (idx < 0) return;
|
|
4133
|
+
const row = visible[idx];
|
|
4134
|
+
if (!row) return;
|
|
4135
|
+
const node = row.node;
|
|
4136
|
+
const isParent = !!node.children;
|
|
4137
|
+
const isExpanded = expanded.has(node.id);
|
|
4138
|
+
switch (e.key) {
|
|
4139
|
+
case "ArrowDown": {
|
|
4140
|
+
e.preventDefault();
|
|
4141
|
+
const next = visible[idx + 1];
|
|
4142
|
+
if (next) setFocusedId(next.node.id);
|
|
4143
|
+
break;
|
|
4144
|
+
}
|
|
4145
|
+
case "ArrowUp": {
|
|
4146
|
+
e.preventDefault();
|
|
4147
|
+
const prev = visible[idx - 1];
|
|
4148
|
+
if (prev) setFocusedId(prev.node.id);
|
|
4149
|
+
break;
|
|
4150
|
+
}
|
|
4151
|
+
case "ArrowRight": {
|
|
4152
|
+
e.preventDefault();
|
|
4153
|
+
if (isParent && !isExpanded) toggleExpand(node.id);
|
|
4154
|
+
else if (isParent && isExpanded) {
|
|
4155
|
+
const next = visible[idx + 1];
|
|
4156
|
+
if (next) setFocusedId(next.node.id);
|
|
4157
|
+
}
|
|
4158
|
+
break;
|
|
4159
|
+
}
|
|
4160
|
+
case "ArrowLeft": {
|
|
4161
|
+
e.preventDefault();
|
|
4162
|
+
if (isParent && isExpanded) toggleExpand(node.id);
|
|
4163
|
+
else if (row.parentId) {
|
|
4164
|
+
setFocusedId(row.parentId);
|
|
4165
|
+
}
|
|
4166
|
+
break;
|
|
4167
|
+
}
|
|
4168
|
+
case "Home": {
|
|
4169
|
+
e.preventDefault();
|
|
4170
|
+
if (visible[0]) setFocusedId(visible[0].node.id);
|
|
4171
|
+
break;
|
|
4172
|
+
}
|
|
4173
|
+
case "End": {
|
|
4174
|
+
e.preventDefault();
|
|
4175
|
+
const last = visible[visible.length - 1];
|
|
4176
|
+
if (last) setFocusedId(last.node.id);
|
|
4177
|
+
break;
|
|
4178
|
+
}
|
|
4179
|
+
case "Enter":
|
|
4180
|
+
case " ": {
|
|
4181
|
+
e.preventDefault();
|
|
4182
|
+
if (node.disabled) return;
|
|
4183
|
+
if (isParent) toggleExpand(node.id);
|
|
4184
|
+
activate(node.id);
|
|
4185
|
+
break;
|
|
4186
|
+
}
|
|
4187
|
+
default:
|
|
4188
|
+
return;
|
|
4189
|
+
}
|
|
4190
|
+
},
|
|
4191
|
+
[focusedId, visible, expanded, toggleExpand, activate]
|
|
4192
|
+
);
|
|
4193
|
+
const isSelectable = onSelect !== void 0 || selectedProp !== void 0;
|
|
4194
|
+
return /* @__PURE__ */ jsx(
|
|
4195
|
+
"ul",
|
|
4196
|
+
{
|
|
4197
|
+
ref,
|
|
4198
|
+
role: "tree",
|
|
4199
|
+
"aria-label": ariaLabel,
|
|
4200
|
+
className: cn("flex flex-col text-sm text-foreground", className),
|
|
4201
|
+
onKeyDown: handleKeyDown,
|
|
4202
|
+
children: data.map((node) => /* @__PURE__ */ jsx(
|
|
4203
|
+
TreeItem2,
|
|
4204
|
+
{
|
|
4205
|
+
node,
|
|
4206
|
+
depth: 0,
|
|
4207
|
+
expanded,
|
|
4208
|
+
selected,
|
|
4209
|
+
isSelectable,
|
|
4210
|
+
focusedId,
|
|
4211
|
+
onFocus: setFocusedId,
|
|
4212
|
+
onToggleExpand: toggleExpand,
|
|
4213
|
+
onActivate: activate
|
|
4214
|
+
},
|
|
4215
|
+
node.id
|
|
4216
|
+
))
|
|
4217
|
+
}
|
|
4218
|
+
);
|
|
4219
|
+
}
|
|
4220
|
+
function TreeItem2({
|
|
4221
|
+
node,
|
|
4222
|
+
depth,
|
|
4223
|
+
expanded,
|
|
4224
|
+
selected,
|
|
4225
|
+
isSelectable,
|
|
4226
|
+
focusedId,
|
|
4227
|
+
onFocus,
|
|
4228
|
+
onToggleExpand,
|
|
4229
|
+
onActivate
|
|
4230
|
+
}) {
|
|
4231
|
+
const children = node.children;
|
|
4232
|
+
const isParent = children !== void 0;
|
|
4233
|
+
const isExpanded = expanded.has(node.id);
|
|
4234
|
+
const isSelected = selected === node.id;
|
|
4235
|
+
const isFocused = focusedId === node.id;
|
|
4236
|
+
const handleClick = () => {
|
|
4237
|
+
if (node.disabled) return;
|
|
4238
|
+
onFocus(node.id);
|
|
4239
|
+
if (isParent) onToggleExpand(node.id);
|
|
4240
|
+
onActivate(node.id);
|
|
4241
|
+
};
|
|
4242
|
+
const labelId = React44.useId();
|
|
4243
|
+
return /* @__PURE__ */ jsxs(
|
|
4244
|
+
"li",
|
|
4245
|
+
{
|
|
4246
|
+
role: "treeitem",
|
|
4247
|
+
"aria-labelledby": labelId,
|
|
4248
|
+
"aria-level": depth + 1,
|
|
4249
|
+
"aria-expanded": isParent ? isExpanded : void 0,
|
|
4250
|
+
"aria-selected": isSelectable ? isSelected : void 0,
|
|
4251
|
+
"aria-disabled": node.disabled || void 0,
|
|
4252
|
+
tabIndex: isFocused ? 0 : -1,
|
|
4253
|
+
onClick: (e) => {
|
|
4254
|
+
e.stopPropagation();
|
|
4255
|
+
handleClick();
|
|
4256
|
+
},
|
|
4257
|
+
onFocus: (e) => {
|
|
4258
|
+
e.stopPropagation();
|
|
4259
|
+
if (!node.disabled) onFocus(node.id);
|
|
4260
|
+
},
|
|
4261
|
+
className: cn(
|
|
4262
|
+
"outline-none rounded-sm",
|
|
4263
|
+
// H1: focus-visible-driven ring (NOT state-driven) — the ring
|
|
4264
|
+
// only shows on keyboard focus, not on mouse clicks.
|
|
4265
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"
|
|
4266
|
+
),
|
|
4267
|
+
children: [
|
|
4268
|
+
/* @__PURE__ */ jsxs(
|
|
4269
|
+
"div",
|
|
4270
|
+
{
|
|
4271
|
+
className: cn(
|
|
4272
|
+
"flex cursor-pointer select-none items-center gap-[var(--gap-xs,0.25rem)] rounded-sm px-[var(--space-2,0.5rem)] py-[var(--space-1,0.25rem)]",
|
|
4273
|
+
"transition-colors duration-[var(--duration-normal,200ms)] ease-out",
|
|
4274
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
4275
|
+
isSelected && "bg-accent text-accent-foreground font-medium",
|
|
4276
|
+
node.disabled && "cursor-not-allowed opacity-50"
|
|
4277
|
+
),
|
|
4278
|
+
style: { paddingLeft: `calc(${depth} * var(--space-4, 1rem) + var(--space-2, 0.5rem))` },
|
|
4279
|
+
children: [
|
|
4280
|
+
isParent ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "inline-flex h-4 w-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
4281
|
+
"svg",
|
|
4282
|
+
{
|
|
4283
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4284
|
+
viewBox: "0 0 24 24",
|
|
4285
|
+
fill: "none",
|
|
4286
|
+
stroke: "currentColor",
|
|
4287
|
+
strokeWidth: "2",
|
|
4288
|
+
strokeLinecap: "round",
|
|
4289
|
+
strokeLinejoin: "round",
|
|
4290
|
+
className: cn(
|
|
4291
|
+
"h-3 w-3 transition-transform duration-[var(--duration-normal,200ms)] ease-out",
|
|
4292
|
+
isExpanded ? "rotate-90" : "rotate-0"
|
|
4293
|
+
),
|
|
4294
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" })
|
|
4295
|
+
}
|
|
4296
|
+
) }) : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "inline-block h-4 w-4 shrink-0" }),
|
|
4297
|
+
node.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "inline-flex h-4 w-4 shrink-0 items-center justify-center [&_svg]:size-4", children: node.icon }) : null,
|
|
4298
|
+
/* @__PURE__ */ jsx("span", { id: labelId, className: "truncate", children: node.label })
|
|
4299
|
+
]
|
|
4300
|
+
}
|
|
4301
|
+
),
|
|
4302
|
+
isParent && isExpanded && children ? /* @__PURE__ */ jsx("ul", { role: "group", "aria-labelledby": labelId, className: "flex flex-col", children: children.map((child) => /* @__PURE__ */ jsx(
|
|
4303
|
+
TreeItem2,
|
|
4304
|
+
{
|
|
4305
|
+
node: child,
|
|
4306
|
+
depth: depth + 1,
|
|
4307
|
+
expanded,
|
|
4308
|
+
selected,
|
|
4309
|
+
isSelectable,
|
|
4310
|
+
focusedId,
|
|
4311
|
+
onFocus,
|
|
4312
|
+
onToggleExpand,
|
|
4313
|
+
onActivate
|
|
4314
|
+
},
|
|
4315
|
+
child.id
|
|
4316
|
+
)) }) : null
|
|
4317
|
+
]
|
|
4318
|
+
}
|
|
4319
|
+
);
|
|
4320
|
+
}
|
|
4321
|
+
var toolbarVariants = cva("flex items-center gap-[var(--gap-xs,0.25rem)] rounded-md border border-border bg-card p-[var(--space-1,0.25rem)]", {
|
|
4322
|
+
variants: {
|
|
4323
|
+
orientation: {
|
|
4324
|
+
horizontal: "flex-row",
|
|
4325
|
+
vertical: "flex-col items-stretch"
|
|
4326
|
+
}
|
|
4327
|
+
},
|
|
4328
|
+
defaultVariants: { orientation: "horizontal" }
|
|
4329
|
+
});
|
|
4330
|
+
var toolbarItemBaseClasses = [
|
|
4331
|
+
"inline-flex items-center justify-center gap-[var(--gap-xs,0.25rem)] rounded-sm",
|
|
4332
|
+
"px-[var(--space-2,0.5rem)] h-[var(--control-height-sm,2.25rem)] text-sm font-medium",
|
|
4333
|
+
"text-foreground/80 hover:text-foreground hover:bg-accent",
|
|
4334
|
+
"transition-colors duration-[var(--duration-normal,200ms)] ease-out",
|
|
4335
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
4336
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
4337
|
+
"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
|
4338
|
+
"active:scale-[0.98]",
|
|
4339
|
+
"[&_svg]:size-4 [&_svg]:shrink-0"
|
|
4340
|
+
].join(" ");
|
|
4341
|
+
function Toolbar({ className, orientation = "horizontal", ref, ...props }) {
|
|
4342
|
+
return /* @__PURE__ */ jsx(
|
|
4343
|
+
ToolbarPrimitive.Root,
|
|
4344
|
+
{
|
|
4345
|
+
ref,
|
|
4346
|
+
orientation,
|
|
4347
|
+
className: cn(toolbarVariants({ orientation }), className),
|
|
4348
|
+
...props
|
|
4349
|
+
}
|
|
4350
|
+
);
|
|
4351
|
+
}
|
|
4352
|
+
function ToolbarButton({
|
|
4353
|
+
className,
|
|
4354
|
+
ref,
|
|
4355
|
+
...props
|
|
4356
|
+
}) {
|
|
4357
|
+
return /* @__PURE__ */ jsx(
|
|
4358
|
+
ToolbarPrimitive.Button,
|
|
4359
|
+
{
|
|
4360
|
+
ref,
|
|
4361
|
+
className: cn(toolbarItemBaseClasses, className),
|
|
4362
|
+
...props
|
|
4363
|
+
}
|
|
4364
|
+
);
|
|
4365
|
+
}
|
|
4366
|
+
function ToolbarLink({
|
|
4367
|
+
className,
|
|
4368
|
+
ref,
|
|
4369
|
+
...props
|
|
4370
|
+
}) {
|
|
4371
|
+
return /* @__PURE__ */ jsx(
|
|
4372
|
+
ToolbarPrimitive.Link,
|
|
4373
|
+
{
|
|
4374
|
+
ref,
|
|
4375
|
+
className: cn(toolbarItemBaseClasses, "underline-offset-4 hover:underline", className),
|
|
4376
|
+
...props
|
|
4377
|
+
}
|
|
4378
|
+
);
|
|
4379
|
+
}
|
|
4380
|
+
function ToolbarToggleGroup({
|
|
4381
|
+
className,
|
|
4382
|
+
ref,
|
|
4383
|
+
...props
|
|
4384
|
+
}) {
|
|
4385
|
+
return /* @__PURE__ */ jsx(
|
|
4386
|
+
ToolbarPrimitive.ToggleGroup,
|
|
4387
|
+
{
|
|
4388
|
+
ref,
|
|
4389
|
+
className: cn("flex items-center gap-[var(--gap-xs,0.25rem)]", className),
|
|
4390
|
+
...props
|
|
4391
|
+
}
|
|
4392
|
+
);
|
|
4393
|
+
}
|
|
4394
|
+
function ToolbarToggleItem({
|
|
4395
|
+
className,
|
|
4396
|
+
ref,
|
|
4397
|
+
...props
|
|
4398
|
+
}) {
|
|
4399
|
+
return /* @__PURE__ */ jsx(
|
|
4400
|
+
ToolbarPrimitive.ToggleItem,
|
|
4401
|
+
{
|
|
4402
|
+
ref,
|
|
4403
|
+
className: cn(toolbarItemBaseClasses, className),
|
|
4404
|
+
...props
|
|
4405
|
+
}
|
|
4406
|
+
);
|
|
4407
|
+
}
|
|
4408
|
+
function ToolbarSeparator({
|
|
4409
|
+
className,
|
|
4410
|
+
ref,
|
|
4411
|
+
...props
|
|
4412
|
+
}) {
|
|
4413
|
+
return /* @__PURE__ */ jsx(
|
|
4414
|
+
ToolbarPrimitive.Separator,
|
|
4415
|
+
{
|
|
4416
|
+
ref,
|
|
4417
|
+
className: cn(
|
|
4418
|
+
"shrink-0 bg-border",
|
|
4419
|
+
"data-[orientation=horizontal]:h-4 data-[orientation=horizontal]:w-px data-[orientation=horizontal]:mx-[var(--space-1,0.25rem)]",
|
|
4420
|
+
"data-[orientation=vertical]:w-4 data-[orientation=vertical]:h-px data-[orientation=vertical]:my-[var(--space-1,0.25rem)]",
|
|
4421
|
+
className
|
|
4422
|
+
),
|
|
4423
|
+
...props
|
|
4424
|
+
}
|
|
4425
|
+
);
|
|
4426
|
+
}
|
|
3774
4427
|
var Sheet = DialogPrimitive.Root;
|
|
3775
4428
|
var SheetTrigger = DialogPrimitive.Trigger;
|
|
3776
4429
|
var SheetClose = DialogPrimitive.Close;
|
|
@@ -4324,6 +4977,145 @@ function Composer({
|
|
|
4324
4977
|
}
|
|
4325
4978
|
);
|
|
4326
4979
|
}
|
|
4980
|
+
function getSpeechRecognitionCtor() {
|
|
4981
|
+
if (typeof window === "undefined") return null;
|
|
4982
|
+
const w = window;
|
|
4983
|
+
return w.SpeechRecognition ?? w.webkitSpeechRecognition ?? null;
|
|
4984
|
+
}
|
|
4985
|
+
function SpeechRecognition({
|
|
4986
|
+
isListening,
|
|
4987
|
+
onListeningChange,
|
|
4988
|
+
onTranscript,
|
|
4989
|
+
onError,
|
|
4990
|
+
lang = "en-US",
|
|
4991
|
+
continuous = true,
|
|
4992
|
+
interimResults = true,
|
|
4993
|
+
startLabel = "Start dictation",
|
|
4994
|
+
stopLabel = "Stop dictation",
|
|
4995
|
+
notSupportedLabel = "Speech recognition not supported in this browser",
|
|
4996
|
+
disabled,
|
|
4997
|
+
className,
|
|
4998
|
+
...rest
|
|
4999
|
+
}) {
|
|
5000
|
+
const recognitionRef = React44.useRef(null);
|
|
5001
|
+
const [isSupported, setIsSupported] = React44.useState(true);
|
|
5002
|
+
const onTranscriptRef = React44.useRef(onTranscript);
|
|
5003
|
+
const onListeningChangeRef = React44.useRef(onListeningChange);
|
|
5004
|
+
const onErrorRef = React44.useRef(onError);
|
|
5005
|
+
onTranscriptRef.current = onTranscript;
|
|
5006
|
+
onListeningChangeRef.current = onListeningChange;
|
|
5007
|
+
onErrorRef.current = onError;
|
|
5008
|
+
const mountedRef = React44.useRef(true);
|
|
5009
|
+
React44.useEffect(
|
|
5010
|
+
() => () => {
|
|
5011
|
+
mountedRef.current = false;
|
|
5012
|
+
},
|
|
5013
|
+
[]
|
|
5014
|
+
);
|
|
5015
|
+
const rebuildingRef = React44.useRef(false);
|
|
5016
|
+
const isListeningRef = React44.useRef(isListening);
|
|
5017
|
+
isListeningRef.current = isListening;
|
|
5018
|
+
React44.useEffect(() => {
|
|
5019
|
+
const Ctor = getSpeechRecognitionCtor();
|
|
5020
|
+
setIsSupported(Ctor !== null);
|
|
5021
|
+
}, []);
|
|
5022
|
+
React44.useEffect(() => {
|
|
5023
|
+
if (!isListening) return;
|
|
5024
|
+
const Ctor = getSpeechRecognitionCtor();
|
|
5025
|
+
if (!Ctor) return;
|
|
5026
|
+
const instance = new Ctor();
|
|
5027
|
+
instance.continuous = continuous;
|
|
5028
|
+
instance.interimResults = interimResults;
|
|
5029
|
+
instance.lang = lang;
|
|
5030
|
+
instance.onresult = (event) => {
|
|
5031
|
+
if (!mountedRef.current) return;
|
|
5032
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
5033
|
+
const result = event.results[i];
|
|
5034
|
+
const transcript = result[0]?.transcript ?? "";
|
|
5035
|
+
if (transcript) onTranscriptRef.current(transcript, result.isFinal);
|
|
5036
|
+
}
|
|
5037
|
+
};
|
|
5038
|
+
instance.onerror = (event) => {
|
|
5039
|
+
if (!mountedRef.current) return;
|
|
5040
|
+
onErrorRef.current?.(event.error, event.message);
|
|
5041
|
+
if (event.error !== "aborted") onListeningChangeRef.current(false);
|
|
5042
|
+
};
|
|
5043
|
+
instance.onend = () => {
|
|
5044
|
+
if (!mountedRef.current) return;
|
|
5045
|
+
if (rebuildingRef.current) return;
|
|
5046
|
+
onListeningChangeRef.current(false);
|
|
5047
|
+
};
|
|
5048
|
+
recognitionRef.current = instance;
|
|
5049
|
+
try {
|
|
5050
|
+
instance.start();
|
|
5051
|
+
} catch (err) {
|
|
5052
|
+
onErrorRef.current?.("start-failed", err instanceof Error ? err.message : String(err));
|
|
5053
|
+
onListeningChangeRef.current(false);
|
|
5054
|
+
}
|
|
5055
|
+
return () => {
|
|
5056
|
+
rebuildingRef.current = isListeningRef.current;
|
|
5057
|
+
instance.onresult = null;
|
|
5058
|
+
instance.onerror = null;
|
|
5059
|
+
instance.onend = null;
|
|
5060
|
+
try {
|
|
5061
|
+
instance.abort();
|
|
5062
|
+
} catch {
|
|
5063
|
+
}
|
|
5064
|
+
recognitionRef.current = null;
|
|
5065
|
+
queueMicrotask(() => {
|
|
5066
|
+
rebuildingRef.current = false;
|
|
5067
|
+
});
|
|
5068
|
+
};
|
|
5069
|
+
}, [isListening, continuous, interimResults, lang]);
|
|
5070
|
+
const tooltip = !isSupported ? notSupportedLabel : isListening ? stopLabel : startLabel;
|
|
5071
|
+
const accessibleName = isSupported ? startLabel : notSupportedLabel;
|
|
5072
|
+
const isDisabled = disabled || !isSupported;
|
|
5073
|
+
return /* @__PURE__ */ jsx(
|
|
5074
|
+
"button",
|
|
5075
|
+
{
|
|
5076
|
+
type: "button",
|
|
5077
|
+
...rest,
|
|
5078
|
+
disabled: isDisabled,
|
|
5079
|
+
"aria-label": accessibleName,
|
|
5080
|
+
"aria-pressed": isListening,
|
|
5081
|
+
title: tooltip,
|
|
5082
|
+
onClick: (event) => {
|
|
5083
|
+
rest.onClick?.(event);
|
|
5084
|
+
if (event.defaultPrevented || isDisabled) return;
|
|
5085
|
+
onListeningChange(!isListening);
|
|
5086
|
+
},
|
|
5087
|
+
className: cn(
|
|
5088
|
+
"inline-flex h-9 w-9 items-center justify-center rounded-md border bg-background",
|
|
5089
|
+
"text-foreground transition-colors duration-[var(--duration-normal,200ms)] ease-out",
|
|
5090
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
5091
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
5092
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
5093
|
+
isListening && "animate-pulse border-destructive text-destructive",
|
|
5094
|
+
className
|
|
5095
|
+
),
|
|
5096
|
+
children: /* @__PURE__ */ jsxs(
|
|
5097
|
+
"svg",
|
|
5098
|
+
{
|
|
5099
|
+
"aria-hidden": true,
|
|
5100
|
+
viewBox: "0 0 16 16",
|
|
5101
|
+
width: "14",
|
|
5102
|
+
height: "14",
|
|
5103
|
+
fill: "none",
|
|
5104
|
+
stroke: "currentColor",
|
|
5105
|
+
strokeWidth: "1.5",
|
|
5106
|
+
strokeLinecap: "round",
|
|
5107
|
+
strokeLinejoin: "round",
|
|
5108
|
+
children: [
|
|
5109
|
+
/* @__PURE__ */ jsx("rect", { x: "6", y: "2", width: "4", height: "8", rx: "2" }),
|
|
5110
|
+
/* @__PURE__ */ jsx("path", { d: "M3.5 7.5a4.5 4.5 0 0 0 9 0" }),
|
|
5111
|
+
/* @__PURE__ */ jsx("path", { d: "M8 12v2" }),
|
|
5112
|
+
/* @__PURE__ */ jsx("path", { d: "M5.5 14h5" })
|
|
5113
|
+
]
|
|
5114
|
+
}
|
|
5115
|
+
)
|
|
5116
|
+
}
|
|
5117
|
+
);
|
|
5118
|
+
}
|
|
4327
5119
|
var loadingIndicatorVariants = cva("inline-flex items-center gap-2 text-muted-foreground", {
|
|
4328
5120
|
variants: {
|
|
4329
5121
|
size: {
|
|
@@ -4728,7 +5520,7 @@ var LABEL_TO_LANG = {
|
|
|
4728
5520
|
prompt: "text",
|
|
4729
5521
|
plain: "text"
|
|
4730
5522
|
};
|
|
4731
|
-
var DEFAULT_THEMES = { light: "github-light", dark: "github-dark" };
|
|
5523
|
+
var DEFAULT_THEMES = { light: "github-light-high-contrast", dark: "github-dark" };
|
|
4732
5524
|
var cachedCodeToHtml = cache(
|
|
4733
5525
|
async (code, lang, themesKey, themes) => {
|
|
4734
5526
|
return codeToHtml(code, { lang, themes, defaultColor: false });
|
|
@@ -4872,7 +5664,151 @@ function ErrorGlyph() {
|
|
|
4872
5664
|
}
|
|
4873
5665
|
);
|
|
4874
5666
|
}
|
|
5667
|
+
var attachmentVariants = cva(
|
|
5668
|
+
[
|
|
5669
|
+
"group/attachment relative inline-flex items-center gap-[var(--gap-sm,0.5rem)] rounded-md border border-border bg-card",
|
|
5670
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out"
|
|
5671
|
+
].join(" "),
|
|
5672
|
+
{
|
|
5673
|
+
variants: {
|
|
5674
|
+
variant: {
|
|
5675
|
+
file: "px-[var(--space-3,0.75rem)] py-[var(--space-2,0.5rem)] max-w-xs",
|
|
5676
|
+
image: "p-0 overflow-hidden"
|
|
5677
|
+
}
|
|
5678
|
+
},
|
|
5679
|
+
defaultVariants: { variant: "file" }
|
|
5680
|
+
}
|
|
5681
|
+
);
|
|
5682
|
+
function formatSize(bytes) {
|
|
5683
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
5684
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
5685
|
+
if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
5686
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
5687
|
+
}
|
|
5688
|
+
function detectVariant(file) {
|
|
5689
|
+
const preview = "preview" in file ? file.preview : void 0;
|
|
5690
|
+
const isImage = file.type.startsWith("image/");
|
|
5691
|
+
return isImage && preview ? "image" : "file";
|
|
5692
|
+
}
|
|
5693
|
+
function resolvePreview(file) {
|
|
5694
|
+
return "preview" in file ? file.preview : void 0;
|
|
5695
|
+
}
|
|
5696
|
+
function Attachment({
|
|
5697
|
+
className,
|
|
5698
|
+
variant,
|
|
5699
|
+
file,
|
|
5700
|
+
onRemove,
|
|
5701
|
+
progress,
|
|
5702
|
+
ref,
|
|
5703
|
+
...props
|
|
5704
|
+
}) {
|
|
5705
|
+
const preview = resolvePreview(file);
|
|
5706
|
+
const detected = detectVariant(file);
|
|
5707
|
+
const resolvedVariant = variant === "image" && !preview ? "file" : variant ?? detected;
|
|
5708
|
+
const showProgress = typeof progress === "number" && progress >= 0 && progress < 1;
|
|
5709
|
+
const progressPercent = showProgress ? Math.round(progress * 100) : 0;
|
|
5710
|
+
return /* @__PURE__ */ jsxs(
|
|
5711
|
+
"div",
|
|
5712
|
+
{
|
|
5713
|
+
ref,
|
|
5714
|
+
className: cn(attachmentVariants({ variant: resolvedVariant }), className),
|
|
5715
|
+
...props,
|
|
5716
|
+
children: [
|
|
5717
|
+
resolvedVariant === "image" && preview ? (
|
|
5718
|
+
// Intentional plain <img> (not next/image) — Attachment is
|
|
5719
|
+
// framework-agnostic. Consumers can swap in next/image at the
|
|
5720
|
+
// callsite when they want optimization.
|
|
5721
|
+
/* @__PURE__ */ jsx(
|
|
5722
|
+
"img",
|
|
5723
|
+
{
|
|
5724
|
+
src: preview,
|
|
5725
|
+
alt: file.name,
|
|
5726
|
+
className: "block h-20 w-20 object-cover"
|
|
5727
|
+
}
|
|
5728
|
+
)
|
|
5729
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5730
|
+
/* @__PURE__ */ jsx(FileIcon2, { className: "h-5 w-5 shrink-0 text-muted-foreground" }),
|
|
5731
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
5732
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: file.name }),
|
|
5733
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: formatSize(file.size) })
|
|
5734
|
+
] })
|
|
5735
|
+
] }),
|
|
5736
|
+
showProgress ? /* @__PURE__ */ jsx(
|
|
5737
|
+
"div",
|
|
5738
|
+
{
|
|
5739
|
+
role: "progressbar",
|
|
5740
|
+
"aria-valuemin": 0,
|
|
5741
|
+
"aria-valuemax": 100,
|
|
5742
|
+
"aria-valuenow": progressPercent,
|
|
5743
|
+
"aria-label": `Uploading ${file.name}`,
|
|
5744
|
+
className: "absolute inset-x-0 bottom-0 h-1 overflow-hidden rounded-b-md bg-muted",
|
|
5745
|
+
children: /* @__PURE__ */ jsx(
|
|
5746
|
+
"div",
|
|
5747
|
+
{
|
|
5748
|
+
className: "h-full bg-primary transition-[width] duration-[var(--duration-normal,200ms)] ease-out",
|
|
5749
|
+
style: { width: `${progressPercent}%` }
|
|
5750
|
+
}
|
|
5751
|
+
)
|
|
5752
|
+
}
|
|
5753
|
+
) : null,
|
|
5754
|
+
onRemove ? /* @__PURE__ */ jsx(
|
|
5755
|
+
"button",
|
|
5756
|
+
{
|
|
5757
|
+
type: "button",
|
|
5758
|
+
onClick: onRemove,
|
|
5759
|
+
"aria-label": `Remove ${file.name}`,
|
|
5760
|
+
className: cn(
|
|
5761
|
+
"absolute -right-2 -top-2 inline-flex h-5 w-5 items-center justify-center rounded-full",
|
|
5762
|
+
"bg-card border border-border text-foreground shadow-sm",
|
|
5763
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
5764
|
+
"hover:bg-accent hover:scale-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
5765
|
+
"active:scale-90"
|
|
5766
|
+
),
|
|
5767
|
+
children: /* @__PURE__ */ jsxs(
|
|
5768
|
+
"svg",
|
|
5769
|
+
{
|
|
5770
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5771
|
+
viewBox: "0 0 24 24",
|
|
5772
|
+
fill: "none",
|
|
5773
|
+
stroke: "currentColor",
|
|
5774
|
+
strokeWidth: "2.5",
|
|
5775
|
+
strokeLinecap: "round",
|
|
5776
|
+
strokeLinejoin: "round",
|
|
5777
|
+
className: "size-3",
|
|
5778
|
+
"aria-hidden": "true",
|
|
5779
|
+
children: [
|
|
5780
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
5781
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
5782
|
+
]
|
|
5783
|
+
}
|
|
5784
|
+
)
|
|
5785
|
+
}
|
|
5786
|
+
) : null
|
|
5787
|
+
]
|
|
5788
|
+
}
|
|
5789
|
+
);
|
|
5790
|
+
}
|
|
5791
|
+
function FileIcon2(props) {
|
|
5792
|
+
return /* @__PURE__ */ jsxs(
|
|
5793
|
+
"svg",
|
|
5794
|
+
{
|
|
5795
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5796
|
+
viewBox: "0 0 24 24",
|
|
5797
|
+
fill: "none",
|
|
5798
|
+
stroke: "currentColor",
|
|
5799
|
+
strokeWidth: "2",
|
|
5800
|
+
strokeLinecap: "round",
|
|
5801
|
+
strokeLinejoin: "round",
|
|
5802
|
+
"aria-hidden": "true",
|
|
5803
|
+
...props,
|
|
5804
|
+
children: [
|
|
5805
|
+
/* @__PURE__ */ jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
5806
|
+
/* @__PURE__ */ jsx("polyline", { points: "14 2 14 8 20 8" })
|
|
5807
|
+
]
|
|
5808
|
+
}
|
|
5809
|
+
);
|
|
5810
|
+
}
|
|
4875
5811
|
|
|
4876
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Citation, Cluster, CodeBlock, CodeBlockCopy2 as CodeBlockCopy, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Composer, Container, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger, DataTable, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, Dropzone, FileTree, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Grid, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, LoadingIndicator, Markdown, Menubar, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarSeparator, MenubarShortcut, MenubarTrigger, Message, MessageActions, MessageList, MultiCombobox, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarProvider, SidebarTrigger, Skeleton, Slider, Spacer, Stack, Stepper, Suggestion, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TimePicker, Timeline, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToolCall, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, clusterVariants, cn, containerVariants, formatHslTriplet, gridVariants, hexToHslTriplet, hslToRgb, hslTripletToHex, loadingIndicatorVariants, messageVariants, navigationMenuTriggerStyle, parseHslTriplet, rgbToHsl, spacerVariants, stackVariants, toggleVariants, useFormField, useSidebar };
|
|
5812
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Attachment, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Citation, Cluster, CodeBlock, CodeBlockCopy2 as CodeBlockCopy, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Composer, Container, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger, DataTable, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, Dropzone, Empty, ErrorState, FileTree, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Grid, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, Loading, LoadingIndicator, Markdown, Menubar, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarSeparator, MenubarShortcut, MenubarTrigger, Message, MessageActions, MessageList, MultiCombobox, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarProvider, SidebarTrigger, Skeleton, Slider, Spacer, SpeechRecognition, Stack, Stepper, Suggestion, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, TimePicker, Timeline, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToolCall, Toolbar, ToolbarButton, ToolbarLink, ToolbarSeparator, ToolbarToggleGroup, ToolbarToggleItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tree, alertVariants, attachmentVariants, badgeVariants, buttonVariants, clusterVariants, cn, containerVariants, emptyVariants, errorStateVariants, formatHslTriplet, gridVariants, hexToHslTriplet, hslToRgb, hslTripletToHex, loadingIndicatorVariants, loadingVariants, messageVariants, navigationMenuTriggerStyle, parseHslTriplet, rgbToHsl, spacerVariants, stackVariants, tagVariants, toggleVariants, toolbarVariants, useFormField, useSidebar };
|
|
4877
5813
|
//# sourceMappingURL=index.js.map
|
|
4878
5814
|
//# sourceMappingURL=index.js.map
|