'use client';
"use strict";var e=require("tslib"),t=require("react"),r=require("tailwind-merge"),l=require("../../../contexts/BaseColorContext.cjs");require("../../../contexts/HoveredValueContext.cjs"),require("../../../contexts/RootStylesContext.cjs");var s=require("../../../contexts/SelectedValueContext.cjs"),a=require("../../../lib/shape.cjs"),o=require("../../../lib/sizing.cjs"),i=require("../../../lib/spacing.cjs"),n=require("../../../lib/font.cjs"),c=require("../../../lib/theme.cjs"),u=require("../../../lib/utils.cjs");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=g(t);const m=u.makeClassName("ToggleItem"),d=C.default.forwardRef(((g,d)=>{const{value:x,text:p,icon:b,className:f,onClick:h}=g,N=e.__rest(g,["value","text","icon","className","onClick"]),{selectedValue:q,handleValueChange:j}=t.useContext(s),w=t.useContext(l),v=q===x,O=r.twMerge(u.getColorClassNames("white").bgColor,u.getColorClassNames(w,c.colorPalette.text).textColor,u.getColorClassNames(c.DEFAULT_COLOR,c.colorPalette.lightBorder).ringColor,a.boxShadow.sm),R=r.twMerge(u.getColorClassNames("transparent").bgColor,u.getColorClassNames(c.DEFAULT_COLOR,c.colorPalette.darkText).hoverTextColor,u.getColorClassNames(c.DEFAULT_COLOR,c.colorPalette.text).textColor,u.getColorClassNames("transparent").ringColor),T=b;return C.default.createElement("button",Object.assign({ref:d,type:"button",className:r.twMerge(m("root"),"flex items-center ring-1",i.spacing.lg.paddingX,i.spacing.xs.paddingY,n.fontSize.sm,a.borderRadius.md.all,v?O:R,f),onClick:e=>{null==j||j(x),null==h||h(e)}},N),T?C.default.createElement(T,{className:r.twMerge(m("icon"),"opacity-70",p?i.spacing.xs.marginRight:"",o.sizing.lg.height,o.sizing.lg.width),"aria-hidden":"true"}):null,p?C.default.createElement("span",{className:r.twMerge(m(p),"text-sm whitespace-nowrap")},p):null)}));d.displayName="ToggleItem",module.exports=d;
