UNPKG

@arolariu/components

Version:

A collection of reusable components for React applications, built as ESM & CJS modules with tree shake, minify and bundler optimizations enabled, for the lowest bundle size (import cost)!

43 lines (42 loc) 2.44 kB
"use client"; import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime"; import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react"; import * as __WEBPACK_EXTERNAL_MODULE__radix_ui_react_toggle_group_4f42c91c__ from "@radix-ui/react-toggle-group"; import * as __WEBPACK_EXTERNAL_MODULE__toggle_js_10734c63__ from "./toggle.js"; import * as __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__ from "../../lib/utils.js"; const ToggleGroupContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__.createContext({ size: "default", variant: "default" }); function ToggleGroup({ className, variant, size, children, ...props }) { return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__radix_ui_react_toggle_group_4f42c91c__.Root, { "data-slot": "toggle-group", "data-variant": variant, "data-size": size, className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-2xs", className), ...props, children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ToggleGroupContext.Provider, { value: { variant, size }, children: children }) }); } function ToggleGroupItem({ className, children, variant, size, ...props }) { const context = __WEBPACK_EXTERNAL_MODULE_react__.useContext(ToggleGroupContext); return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__radix_ui_react_toggle_group_4f42c91c__.Item, { "data-slot": "toggle-group-item", "data-variant": context.variant || variant, "data-size": context.size || size, className: (0, __WEBPACK_EXTERNAL_MODULE__lib_utils_js_c09d30d7__.cn)((0, __WEBPACK_EXTERNAL_MODULE__toggle_js_10734c63__.toggleVariants)({ variant: context.variant || variant, size: context.size || size }), "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", className), ...props, children: children }); } export { ToggleGroup, ToggleGroupItem }; //# sourceMappingURL=toggle-group.js.map