import{a as e,c as t,i as n}from"./preload-helper-B45gAKPr.js";import{n as r,pn as i,rt as a,t as o}from"./iframe-GmIo3IOR.js";import{a as s,i as c}from"./utils-B73_kE2n.js";import{n as l,t as u}from"./ui.module-wFHXkJzp.js";import{n as d,r as f}from"./uiClasses-CaHp0EWd.js";import{n as p,t as m}from"./CheckBox.module-ezWPE2pa.js";var h,g,_=n((()=>{h=`gu8UMB`,g={radioInput:h}})),v,y,b,x=n((()=>{v=t(i(),1),c(),r(),p(),u(),f(),_(),y=o(),b=({label:e,description:t,placeholder:n,disabled:r,size:i,className:o,onChange:c,value:u,id:f,tone:p=`neutral`,...h})=>{let _=(0,v.useId)(),b=f??_,x=t?`${b}-description`:void 0,S=e??n,C=u??!1;return(0,y.jsxs)(`div`,{className:s(l.uiElement,i&&l.uiSizable,i&&l[i],r&&l.disabled,o),children:[(0,y.jsxs)(`div`,{className:m.row,children:[(0,y.jsxs)(`div`,{className:s(m.wrapper,d(p)),children:[(0,y.jsx)(`input`,{...h,id:b,type:`checkbox`,role:`radio`,checked:C,disabled:r,"aria-disabled":r,"aria-checked":C,"aria-describedby":x,className:s(l.uiSelectionControl,m.input,g.radioInput),onChange:()=>c?.(!C)}),(0,y.jsx)(`div`,{className:s(l.uiSelectionIcon,m.icon),"aria-hidden":`true`,children:(0,y.jsx)(a,{})})]}),S&&(0,y.jsx)(`label`,{htmlFor:b,className:l.uiLabel,children:S})]}),t&&(0,y.jsx)(`p`,{id:x,className:l.uiDescription,children:t})]})},b.__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`]}})),S=e({Controlled:()=>E,Disabled:()=>O,Group:()=>D,__namedExportsOrder:()=>k,default:()=>T}),C,w,T,E,D,O,k,A=n((()=>{C=t(i(),1),x(),w=o(),T={title:`Shared/UI/RadioButton`,component:b,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`}}},E={render:e=>{let[t,n]=(0,C.useState)(e.value??!1);return(0,w.jsx)(b,{...e,value:t,onChange:n})},args:{label:`Выбрать опцию`,description:`Одиночная радиокнопка в controlled-режиме.`,value:!1,name:`single-radio`,tone:`neutral`}},D={render:()=>{let[e,t]=(0,C.useState)(`email`);return(0,w.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Канал уведомлений`,style:{display:`grid`,gap:12},children:[(0,w.jsx)(b,{name:`notify-channel`,label:`Email`,value:e===`email`,onChange:e=>e&&t(`email`),tone:`info`}),(0,w.jsx)(b,{name:`notify-channel`,label:`SMS`,value:e===`sms`,onChange:e=>e&&t(`sms`),tone:`info`})]})},args:{value:void 0}},O={args:{label:`Недоступная опция`,description:`Заблокировано политикой конфигурации.`,value:!0,disabled:!0,tone:`neutral`}},E.parameters={...E.parameters,docs:{...E.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"
  }
}`,...E.parameters?.docs?.source}}},D.parameters={...D.parameters,docs:{...D.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
  }
}`,...D.parameters?.docs?.source}}},O.parameters={...O.parameters,docs:{...O.parameters?.docs,source:{originalSource:`{
  args: {
    label: "Недоступная опция",
    description: "Заблокировано политикой конфигурации.",
    value: true,
    disabled: true,
    tone: "neutral"
  }
}`,...O.parameters?.docs?.source}}},k=[`Controlled`,`Group`,`Disabled`]}));A();export{E as Controlled,O as Disabled,D as Group,k as __namedExportsOrder,T as default,A as n,S as t};