import{a as e,c as t,i as n}from"./preload-helper-B45gAKPr.js";import{pn as r,t as i}from"./iframe-NOj5DEP4.js";import{i as a,t as o}from"./text-CvgXrEkI.js";import{o as s}from"./Flex-CeJxM4Iy.js";import{t as c}from"./flex-BHSItP0G.js";import{t as l}from"./DateInput-CEdRCXUW.js";import{c as u}from"./preset-select-Ciy7yJO1.js";import{a as d,c as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./DateRangePresetSelect-Cf-UuC1x.js";var y=n((()=>{m(),p()}));function b(e){return e??`__empty__`}function x({value:e,onChange:t,presetId:n,onPresetIdChange:r,referenceDate:i,presetIds:a,presetOptions:o,presetLabel:c,presetDescription:u,presetPlaceholder:p=`Выберите пресет диапазона`,presetDisabled:m,...y}){let[x]=(0,S.useState)(()=>new Date),w=i??x,T=(0,S.useMemo)(()=>o??_(d(a,g)),[a,o]),E=e??null,D=(0,S.useMemo)(()=>h(E,w,T),[E,T,w]),O=n??D??void 0,k=(0,S.useRef)(``),A=(0,S.useCallback)(e=>{if(!r)return;let t=b(e);t!==k.current&&(k.current=t,r(e))},[r]),j=e=>{let n=f(e,w,T);if(!n){A(null);return}A(n.id),t(n.range)},M=e=>{t(e),A(h(e,w,T))};return(0,C.jsxs)(s,{gap:`sm`,align:`end`,children:[(0,C.jsx)(v,{size:`md`,label:c,description:u,placeholder:p,disabled:m??y.disabled,value:O,onChange:j,options:T,referenceDate:w}),(0,C.jsx)(l,{...y,size:`md`,value:E,onChange:M})]})}var S,C,w=n((()=>{S=t(r(),1),u(),y(),c(),C=i(),x.__docgenInfo={description:`Составной компонент выбора диапазона дат через пресет или ручной ввод.`,methods:[],displayName:`PresetRangeDateInput`,props:{presetId:{required:!1,tsType:{name:`union`,raw:`DateRangePresetOption["id"] | null`,elements:[{name:`DateRangePresetOption["id"]`,raw:`DateRangePresetOption["id"]`},{name:`null`}]},description:``},onPresetIdChange:{required:!1,tsType:{name:`signature`,type:`function`,raw:`(presetId: DateRangePresetOption["id"] | null) => void`,signature:{arguments:[{type:{name:`union`,raw:`DateRangePresetOption["id"] | null`,elements:[{name:`DateRangePresetOption["id"]`,raw:`DateRangePresetOption["id"]`},{name:`null`}]},name:`presetId`}],return:{name:`void`}}},description:``},referenceDate:{required:!1,tsType:{name:`Date`},description:``},presetIds:{required:!1,tsType:{name:`unknown`},description:``},presetOptions:{required:!1,tsType:{name:`unknown`},description:``},presetLabel:{required:!1,tsType:{name:`ReactNode`},description:``},presetDescription:{required:!1,tsType:{name:`string`},description:``},presetPlaceholder:{required:!1,tsType:{name:`string`},description:``,defaultValue:{value:`"Выберите пресет диапазона"`,computed:!1}},presetDisabled:{required:!1,tsType:{name:`boolean`},description:``}},composes:[`Omit`]}})),T=e({Default:()=>k,__namedExportsOrder:()=>A,default:()=>O}),E,D,O,k,A,j=n((()=>{E=t(r(),1),c(),o(),w(),D=i(),O={title:`Shared/UI/PresetRangeDateInput`,component:x,args:{value:null,onChange:()=>{}},parameters:{atomicCanvas:!0,layout:`padded`}},k={render:()=>{let[e,t]=(0,E.useState)([new Date(2026,2,10,0,0,0),new Date(2026,2,10,23,59,59)]),[n,r]=(0,E.useState)(`today`);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(s,{gap:`sm`,align:`end`,children:(0,D.jsx)(x,{value:e,onChange:t,presetId:n,onPresetIdChange:r,referenceDate:new Date(2026,2,10,12,0,0),presetLabel:`Быстрый диапазон`,size:`md`})}),(0,D.jsxs)(a,{as:`p`,className:`marginBlockSm`,children:[`Активный presetId: `,(0,D.jsx)(a,{as:`code`,children:n??`null`})]})]})}},k.parameters={...k.parameters,docs:{...k.parameters?.docs,source:{originalSource:`{
  render: () => {
    const [value, setValue] = useState<NullableDateRange | null>([new Date(2026, 2, 10, 0, 0, 0), new Date(2026, 2, 10, 23, 59, 59)]);
    const [presetId, setPresetId] = useState<string | null>("today");
    return <>
                <FlexContainer gap="sm" align="end">
                    <PresetRangeDateInput value={value} onChange={setValue} presetId={presetId} onPresetIdChange={setPresetId} referenceDate={new Date(2026, 2, 10, 12, 0, 0)} presetLabel="Быстрый диапазон" size="md" />
                </FlexContainer>

                <Text as="p" className="marginBlockSm">
                    Активный presetId: <Text as="code">{presetId ?? "null"}</Text>
                </Text>
            </>;
  }
}`,...k.parameters?.docs?.source},description:{story:`Демонстрирует совместную работу пресета и ручного диапазона.`,...k.parameters?.docs?.description}}},A=[`Default`]}));j();export{k as Default,A as __namedExportsOrder,O as default,j as n,T as t};