{"version":3,"file":"Form.mjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Form.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAAwB;AAiBtD,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,mBAAmB,CAAyB,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n * @category Component Props\n */\nexport type FormProps = {\n  children: SnapsChildren<GenericSnapElement>;\n  name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n * <Form name=\"my-form\">\n *   <Field label=\"Username\">\n *     <Input name=\"username\" type=\"text\" />\n *   </Field>\n *   <Button type=\"submit\">Submit</Button>\n * </Form>\n * @category Components\n */\nexport const Form = createSnapComponent<FormProps, typeof TYPE>(TYPE);\n\n/**\n * A form element.\n *\n * @see {@link Form}\n * @category Elements\n */\nexport type FormElement = ReturnType<typeof Form>;\n"]}