import * as React from "react";
import {
IconBold,
IconCheck,
IconChevronDown,
IconItalic,
IconLink,
IconList,
IconSearch,
IconStrikethrough,
} from "@tabler/icons-react";
import { cn, Kbd, motion } from "@colineapp/ui";
import { LENS_GEOMETRY } from "@colineapp/liquid-glass";
import { LiquidGlass, useLiquidGlassTabs, type LiquidGlassHandle } from "@colineapp/liquid-glass/react";
import { useDraggable } from "./stage";
/* The package's surfaces, built the way its README says to. Every glass
surface here is a positioned, rounded element with first
and nothing painted over it. */
const EASE = [0.22, 1, 0.36, 1] as const;
/**
* Grows a floating surface's shadow in and out with its glass. 0.1.0's
* materialize() and dematerialize() leave the shadow as it is, so a closing
* menu kept a dark outline until it unmounted; the next release does this
* itself.
*/
function growShadow(glass: LiquidGlassHandle | null, direction: "in" | "out", duration: number) {
const surface = glass?.element.parentElement;
if (!surface) return;
const shadow = getComputedStyle(surface).boxShadow;
if (!shadow || shadow === "none") return;
const keyframes = [{ boxShadow: "none" }, { boxShadow: shadow }];
surface.animate(direction === "in" ? keyframes : keyframes.reverse(), {
duration,
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
fill: direction === "in" ? "backwards" : "forwards",
});
}
// ── Pill tabs ───────────────────────────────────────────
export function GlassTabs({
options,
value,
onChange,
className,
label,
}: {
options: string[];
value: string;
onChange: (value: string) => void;
className?: string;
label: string;
}) {
const track = React.useRef(null);
useLiquidGlassTabs(track, { appearance: "class" });
const index = options.indexOf(value);
return (