| 20 | }); |
| 21 | |
| 22 | function ToggleGroup({ |
| 23 | className, |
| 24 | variant = "default", |
| 25 | size = "default", |
| 26 | orientation = "horizontal", |
| 27 | children, |
| 28 | ...props |
| 29 | }: ToggleGroupPrimitive.Props & VariantProps<typeof toggleVariants>) { |
| 30 | return ( |
| 31 | <ToggleGroupPrimitive |
| 32 | className={cn( |
| 33 | "flex w-fit *:focus-visible:z-10", |
| 34 | orientation === "horizontal" |
| 35 | ? "*:pointer-coarse:after:min-w-auto" |
| 36 | : "*:pointer-coarse:after:min-h-auto", |
| 37 | variant === "default" |
| 38 | ? "gap-0.5" |
| 39 | : orientation === "horizontal" |
| 40 | ? "*:not-first:before:-start-[0.5px] *:not-last:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none" |
| 41 | : "*:not-first:before:-top-[0.5px] *:not-last:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-last:before:hidden *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none dark:*:last:before:hidden dark:*:first:before:block", |
| 42 | className, |
| 43 | )} |
| 44 | data-size={size} |
| 45 | data-slot="toggle-group" |
| 46 | data-variant={variant} |
| 47 | orientation={orientation} |
| 48 | {...props} |
| 49 | > |
| 50 | <ToggleGroupContext.Provider value={{ size, variant }}> |
| 51 | {children} |
| 52 | </ToggleGroupContext.Provider> |
| 53 | </ToggleGroupPrimitive> |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | function Toggle({ |
| 58 | className, |