{"version":3,"file":"Button.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/Button.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AAiCtD,MAAM,IAAI,GAAG,QAAQ,CAAC;AAEtB;;;;;;;;;;GAUG;AACU,QAAA,MAAM,GAAG,IAAA,+BAAmB,EAA2B,IAAI,CAAC,CAAC","sourcesContent":["import type { SnapsChildren, StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { IconElement } from '../Icon';\nimport type { ImageElement } from '../Image';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property size - The size of the button. Defaults to `md`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n * @property loading - Whether the button is loading. Defaults to `false`.\n * @property form - The name of the form component to associate the button with.\n * @category Component Props\n */\nexport type ButtonProps = {\n  children: SnapsChildren<StringElement | IconElement | ImageElement>;\n  name?: string | undefined;\n  type?: 'button' | 'submit' | undefined;\n  variant?: 'primary' | 'destructive' | undefined;\n  size?: 'sm' | 'md' | undefined;\n  disabled?: boolean | undefined;\n  loading?: boolean | undefined;\n  form?: string | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * <Button name=\"my-button\">Click me</Button>\n * @category Components\n */\nexport const Button = createSnapComponent<ButtonProps, typeof TYPE>(TYPE);\n\n/**\n * A button element.\n *\n * @see {@link Button}\n * @category Elements\n */\nexport type ButtonElement = ReturnType<typeof Button>;\n"]}