@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
50 lines (49 loc) • 2.01 kB
JavaScript
"use client";
import { jsx } from "react/jsx-runtime";
import { mergeProps } from "@base-ui/react/merge-props";
import { ToggleGroup } from "@base-ui/react/toggle-group";
import { useRender } from "@base-ui/react/use-render";
import { cn } from "../../lib/utilities.js";
import { Toggle, toggleVariants } from "./toggle.js";
import toggle_group_module from "./toggle-group.module.js";
import * as __rspack_external_react from "react";
const ToggleGroupContext = /*#__PURE__*/ __rspack_external_react.createContext({});
const toggle_group_ToggleGroup = /*#__PURE__*/ __rspack_external_react.forwardRef((props, forwardedRef)=>{
const { className, children, render, size, variant, ...otherProps } = props;
return /*#__PURE__*/ jsx(ToggleGroup, {
...otherProps,
ref: forwardedRef,
render: useRender({
defaultTagName: "div",
render: render,
props: mergeProps({
className: cn(toggle_group_module.root, className)
}, {})
}),
children: /*#__PURE__*/ jsx(ToggleGroupContext.Provider, {
value: {
variant,
size
},
children: children
})
});
});
const ToggleGroupItem = /*#__PURE__*/ __rspack_external_react.forwardRef((props, forwardedRef)=>{
const { className, size, variant, ...otherProps } = props;
const context = __rspack_external_react.useContext(ToggleGroupContext);
return /*#__PURE__*/ jsx(Toggle, {
ref: forwardedRef,
className: cn(toggleVariants({
variant: variant ?? context.variant,
size: size ?? context.size
}), className),
size: size ?? context.size,
variant: variant ?? context.variant,
...otherProps
});
});
toggle_group_ToggleGroup.displayName = "ToggleGroup";
ToggleGroupItem.displayName = "ToggleGroupItem";
export { ToggleGroupItem, toggle_group_ToggleGroup as ToggleGroup };
//# sourceMappingURL=toggle-group.js.map