UNPKG

@snowball-tech/fractal

Version:

Fractal's (Snowball's design system) React component library based on RadixUI and TailwindCSS

2 lines 1.47 kB
"use client";import{a as e}from"../constants-CW2-utNH.js";import{r as t}from"../helpers-DBEwVIlX.js";import{DEFAULT_VARIANT as n}from"../Toggle/Toggle.constants.js";import{GROUP_NAME as r}from"./ToggleGroup.constants.js";import{ToggleGroupContext as i}from"./ToggleGroupContext.js";import a from"lodash/fp/isFunction.js";import o from"lodash/fp/omit.js";import{jsx as s}from"react/jsx-runtime";import*as c from"@radix-ui/react-toggle-group";const l=({children:l,defaultValue:u,disabled:d=!1,fullWidth:f=!1,grouped:p=!1,label:m,multiple:h=!1,onValueChange:g,orientation:_=`vertical`,value:v,variant:y=n,...b})=>s(c.Root,{"aria-label":m,className:t(`${e}-${r}`,`${e}-${r}--${y}`,p?`${e}-${r}--grouped`:``,p?_===`horizontal`?`[&>button:first-child]:rounded-l-full [&>button:last-child]:rounded-r-full`:`justify-stretch [&>button:first-child]:rounded-t-full [&>button:last-child]:rounded-b-full`:`gap-3`,`flex max-w-full flex-col`,`data-horizontal:flex-row data-horizontal:flex-wrap sm:data-horizontal:flex-nowrap`,d?`${e}-${r}--disabled`:``,f?`${e}-${r}--full-width w-full`:`w-fit`,b.className),title:m,...u===void 0?{}:{defaultValue:u},disabled:d,..._===void 0?{}:{orientation:_},type:h?`multiple`:`single`,value:v,...a(g)?{onValueChange:e=>g(e)}:{},...o([`className`],b),children:s(i.Provider,{value:{disabled:d,grouped:p,orientation:_,variant:y},children:l})});l.displayName=`ToggleGroup`;export{l as ToggleGroup,l as default}; //# sourceMappingURL=ToggleGroup.js.map