laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
64 lines (63 loc) • 1.52 kB
JavaScript
"use client";
import { jsx as i } from "react/jsx-runtime";
import * as d from "react";
import { Root as u, Item as m } from "../../node_modules/@radix-ui/react-toggle-group/dist/index.js";
import { cn as s } from "../../lib/utils.js";
import { toggleVariants as g } from "./toggle.js";
const l = d.createContext({
size: "default",
variant: "default"
});
function x({
className: a,
variant: o,
size: t,
children: e,
...n
}) {
return /* @__PURE__ */ i(
u,
{
"data-slot": "toggle-group",
"data-variant": o,
"data-size": t,
className: s(
"group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",
a
),
...n,
children: /* @__PURE__ */ i(l.Provider, { value: { variant: o, size: t }, children: e })
}
);
}
function z({
className: a,
children: o,
variant: t,
size: e,
...n
}) {
const r = d.useContext(l);
return /* @__PURE__ */ i(
m,
{
"data-slot": "toggle-group-item",
"data-variant": r.variant || t,
"data-size": r.size || e,
className: s(
g({
variant: r.variant || t,
size: r.size || e
}),
"border-d-border min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
a
),
...n,
children: o
}
);
}
export {
x as ToggleGroup,
z as ToggleGroupItem
};