import{j as t}from"./assertThisInitialized-ClXgY4BW.js";import{r as l}from"./index-BP8_t0zE.js";import{u as c}from"./FormGroupsProvider-B1X-6k0S.js";import{a as f}from"./utils-CkyKHvS2.js";import{w as x,M as d}from"./defaultI18nProvider-C_r1y4tu.js";import{S as b,T as m,c as N,d as S}from"./SimpleForm-DxY-i_Qk.js";import{N as j}from"./Notification-DRBCrx1Z.js";import{B as F}from"./Button-C3j8Wgdd.js";import"./dataProvider-BSMCbdJg.js";import"./useResourceDefinitionContext-mEDLreK0.js";import"./index-BCKAMao3.js";import"./Clear-2k3OxyE6.js";import"./createSvgIcon-BeVLBbd8.js";import"./createSvgIcon-C1LdFc73.js";import"./TextField-z9WrHgJg.js";import"./useFormControl-D0zEVldg.js";import"./Modal-CloRq8hE.js";import"./Typography-E7d16C50.js";import"./getFieldLabelTranslationArgs-DwcCC9dO.js";import"./colorManipulator-DXmmM2jC.js";import"./useResourceContext-BI9mATY-.js";import"./useRecordContext-CmNI-aHo.js";import"./CircularProgress-CoZCnRya.js";import"./DeleteButton-BNKEwqMZ.js";import"./Confirm-BXDL5GEC.js";import"./useRemoveFromStore-DvPdj666.js";import"./useRedirect-BE8GZC2N.js";import"./useMutation-DBpLFNEy.js";import"./useLogout-DAYYFX4P.js";import"./useDataProvider-BTi1EEZL.js";import"./undoableEventEmitter-DTIdLI-s.js";import"./warning-3oRADCZr.js";import"./Toolbar-C8uTbHq-.js";import"./Stack-BmeOikgJ.js";import"./CardContent-C5u1opi3.js";import"./merge-2TaxnYbe.js";import"./_copyObject-Dr_k0OJK.js";import"./isArrayLikeObject-WBq23Ido.js";import"./identity-B2iMGpmP.js";import"./_isIterateeCall-D0xvKagp.js";import"./OptionalRecordContextProvider-ChL7EZ8k.js";const pt={title:"Pages/CustomForm",decorators:[o=>y(o)]},e={render:()=>{const o=x(),a=()=>{const{reset:r}=c(),u=l.useCallback(()=>{r()},[r]);return t.jsxs(N,{children:[t.jsx(S,{label:"Submit"}),t.jsx(F,{label:"Reset",size:"medium",variant:"outlined",onClick:u,sx:{marginLeft:"1em"}})]})};function p(r){o(r.firstName+" "+r.lastName,{type:"success"})}return t.jsxs(b,{record:{firstName:"John",lastName:"Doe"},toolbar:t.jsx(a,{}),onSubmit:p,children:[t.jsx(m,{source:"firstName"}),t.jsx(m,{source:"lastName"})]})}},y=o=>t.jsx(d,{initialEntries:["/"],children:t.jsxs(f,{children:[t.jsx(o,{}),t.jsx(j,{})]})});var s,i,n;e.parameters={...e.parameters,docs:{...(s=e.parameters)==null?void 0:s.docs,source:{originalSource:`{
  render: () => {
    const notify = useNotify();
    const FormToolbar = () => {
      const {
        reset
      } = useFormContext();
      const resetForm = useCallback(() => {
        reset();
      }, [reset]);
      return <Toolbar>
          <SaveButton label="Submit" />
          <Button label="Reset" size="medium" variant="outlined" onClick={resetForm} sx={{
          marginLeft: "1em"
        }} />
        </Toolbar>;
    };
    function onSubmit(values: Record<string, any>) {
      notify(values.firstName + " " + values.lastName, {
        type: "success"
      });
    }
    return <SimpleForm record={{
      firstName: "John",
      lastName: "Doe"
    }} toolbar={<FormToolbar />} onSubmit={onSubmit}>
        <TextInput source="firstName" />
        <TextInput source="lastName" />
      </SimpleForm>;
  }
}`,...(n=(i=e.parameters)==null?void 0:i.docs)==null?void 0:n.source}}};const ut=["Default"];export{e as Default,ut as __namedExportsOrder,pt as default};
