import{n as e,o as t,r as n}from"./rolldown-runtime-C0FnF6B9.js";import{t as r}from"./react-C21x__mS.js";import{i,n as a,r as o}from"./iframe-DaN-XFub.js";import{a as s,i as c}from"./utils-DUM89eIj.js";import{n as l,t as u}from"./ui.module-DoMIk8Oc.js";import{n as d,r as f}from"./uiClasses-CO3Cdv1E.js";import{n as p,t as m}from"./CheckBox.module-BBzuj5He.js";var h,g;function _(){return(_=e((()=>{i(),h=[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],g=o(`circle`,h)})))()}var v,y;function b(){return(b=e((()=>{v=`gu8UMB`,y={radioInput:v}})))()}var x,S,C;function w(){return(w=e((()=>{x=t(r(),1),c(),_(),p(),u(),f(),b(),S=a(),C=({label:e,description:t,placeholder:n,disabled:r,size:i,className:a,onChange:o,value:c,id:u,tone:f=`neutral`,...p})=>{let h=(0,x.useId)(),_=u??h,v=t?`${_}-description`:void 0,b=e??n,C=c??!1;return(0,S.jsxs)(`div`,{className:s(l.uiElement,i&&l.uiSizable,i&&l[i],r&&l.disabled,a),children:[(0,S.jsxs)(`div`,{className:m.row,children:[(0,S.jsxs)(`div`,{className:s(m.wrapper,d(f)),children:[(0,S.jsx)(`input`,{...p,id:_,type:`checkbox`,role:`radio`,checked:C,disabled:r,"aria-disabled":r,"aria-checked":C,"aria-describedby":v,className:s(l.uiSelectionControl,m.input,y.radioInput),onChange:()=>o?.(!C)}),(0,S.jsx)(`div`,{className:s(l.uiSelectionIcon,m.icon),"aria-hidden":`true`,children:(0,S.jsx)(g,{})})]}),b&&(0,S.jsx)(`label`,{htmlFor:_,className:l.uiLabel,children:b})]}),t&&(0,S.jsx)(`p`,{id:v,className:l.uiDescription,children:t})]})},C.__docgenInfo={description:`Компонент радиокнопки для выбора одного варианта.
Поддерживает tone + appearance и использует общие selection utility-классы из ui.module.scss.`,methods:[],displayName:`RadioButton`,props:{label:{required:!1,tsType:{name:`ReactNode`},description:``},description:{required:!1,tsType:{name:`string`},description:``},placeholder:{required:!1,tsType:{name:`string`},description:``},disabled:{required:!1,tsType:{name:`boolean`},description:``},size:{required:!1,tsType:{name:`union`,raw:`"xs" | "sm" | "md" | "lg" | "xl"`,elements:[{name:`literal`,value:`"xs"`},{name:`literal`,value:`"sm"`},{name:`literal`,value:`"md"`},{name:`literal`,value:`"lg"`},{name:`literal`,value:`"xl"`}]},description:``},value:{required:!0,tsType:{name:`V`},description:"Если начальное состояние может быть `null | undefined`\nзначит `onChange` тоже должен ументь сбрасывать.\nПоэтому такой контрол явно должен передавать `UiBaseProps<AnyType | undefined>`"},onChange:{required:!0,tsType:{name:`signature`,type:`function`,raw:`(value: T) => void`,signature:{arguments:[{type:{name:`C`},name:`value`}],return:{name:`void`}}},description:``},tone:{required:!1,tsType:{name:`union`,raw:`"neutral" | "error" | "warning" | "success" | "info"`,elements:[{name:`literal`,value:`"neutral"`},{name:`literal`,value:`"error"`},{name:`literal`,value:`"warning"`},{name:`literal`,value:`"success"`},{name:`literal`,value:`"info"`}]},description:``,defaultValue:{value:`"neutral"`,computed:!1}}},composes:[`Omit`]}})))()}var T=n({Controlled:()=>k,Disabled:()=>j,Group:()=>A,__namedExportsOrder:()=>M,default:()=>O}),E,D,O,k,A,j,M;function N(){return(N=e((()=>{E=r(),w(),D=a(),O={title:`Shared/UI/RadioButton`,component:C,args:{value:!1,onChange:()=>{}},parameters:{atomicCanvas:!0,layout:`padded`},argTypes:{label:{description:`Текст подписи радиокнопки.`,control:`text`},description:{description:`Дополнительное описание под элементом.`,control:`text`},placeholder:{description:"Резервная подпись, если `label` не задан.",control:`text`},value:{description:`Признак выбранного состояния.`,control:`boolean`},onChange:{description:`Вызывается при изменении выбранности.`,control:!1},disabled:{description:`Блокирует взаимодействие.`,control:`boolean`},size:{description:`Размер визуального контрола и подписи.`,control:`select`,options:[`xs`,`sm`,`md`,`lg`,`xl`]},tone:{description:`Семантический тон радиокнопки.`,control:`inline-radio`,options:[`neutral`,`error`,`warning`,`success`,`info`]},name:{description:"HTML `name` для группировки кнопок.",control:`text`}}},k={render:e=>{let[t,n]=(0,E.useState)(e.value??!1);return(0,D.jsx)(C,{...e,value:t,onChange:n})},args:{label:`Выбрать опцию`,description:`Одиночная радиокнопка в controlled-режиме.`,value:!1,name:`single-radio`,tone:`neutral`}},A={render:()=>{let[e,t]=(0,E.useState)(`email`);return(0,D.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Канал уведомлений`,style:{display:`grid`,gap:12},children:[(0,D.jsx)(C,{name:`notify-channel`,label:`Email`,value:e===`email`,onChange:e=>e&&t(`email`),tone:`info`}),(0,D.jsx)(C,{name:`notify-channel`,label:`SMS`,value:e===`sms`,onChange:e=>e&&t(`sms`),tone:`info`})]})},args:{value:void 0}},j={args:{label:`Недоступная опция`,description:`Заблокировано политикой конфигурации.`,value:!0,disabled:!0,tone:`neutral`}},k.parameters={...k.parameters,docs:{...k.parameters?.docs,source:{originalSource:`{
  render: args => {
    const [value, setValue] = useState(args.value ?? false);
    return <RadioButton {...args} value={value} onChange={setValue} />;
  },
  args: {
    label: "Выбрать опцию",
    description: "Одиночная радиокнопка в controlled-режиме.",
    value: false,
    name: "single-radio",
    tone: "neutral"
  }
}`,...k.parameters?.docs?.source}}},A.parameters={...A.parameters,docs:{...A.parameters?.docs,source:{originalSource:`{
  render: () => {
    const [selected, setSelected] = useState<"email" | "sms">("email");
    return <div role="radiogroup" aria-label="Канал уведомлений" style={{
      display: "grid",
      gap: 12
    }}>
                <RadioButton name="notify-channel" label="Email" value={selected === "email"} onChange={checked => checked && setSelected("email")} tone="info" />
                <RadioButton name="notify-channel" label="SMS" value={selected === "sms"} onChange={checked => checked && setSelected("sms")} tone="info" />
            </div>;
  },
  args: {
    value: undefined
  }
}`,...A.parameters?.docs?.source}}},j.parameters={...j.parameters,docs:{...j.parameters?.docs,source:{originalSource:`{
  args: {
    label: "Недоступная опция",
    description: "Заблокировано политикой конфигурации.",
    value: true,
    disabled: true,
    tone: "neutral"
  }
}`,...j.parameters?.docs?.source}}},M=[`Controlled`,`Group`,`Disabled`]})))()}export{N as a,T as i,j as n,A as r,k as t};