{"version":3,"file":"Button.cjs","sources":["../../node_modules/@mui/base/Button/buttonClasses.js","../../node_modules/@mui/base/Button/Button.js","../src/Button/Button.tsx"],"sourcesContent":["import { generateUtilityClass } from '../generateUtilityClass';\nimport { generateUtilityClasses } from '../generateUtilityClasses';\nconst COMPONENT_NAME = 'Button';\nexport function getButtonUtilityClass(slot) {\n  return generateUtilityClass(COMPONENT_NAME, slot);\n}\nexport const buttonClasses = generateUtilityClasses(COMPONENT_NAME, ['root', 'active', 'disabled', 'focusVisible']);","'use client';\n\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nconst _excluded = [\"action\", \"children\", \"disabled\", \"focusableWhenDisabled\", \"onFocusVisible\", \"slotProps\", \"slots\"];\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { unstable_composeClasses as composeClasses } from '../composeClasses';\nimport { getButtonUtilityClass } from './buttonClasses';\nimport { useButton } from '../useButton';\nimport { useSlotProps } from '../utils';\nimport { useClassNamesOverride } from '../utils/ClassNameConfigurator';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n  const {\n    active,\n    disabled,\n    focusVisible\n  } = ownerState;\n  const slots = {\n    root: ['root', disabled && 'disabled', focusVisible && 'focusVisible', active && 'active']\n  };\n  return composeClasses(slots, useClassNamesOverride(getButtonUtilityClass));\n};\n/**\n * The foundation for building custom-styled buttons.\n *\n * Demos:\n *\n * - [Button](https://mui.com/base-ui/react-button/)\n *\n * API:\n *\n * - [Button API](https://mui.com/base-ui/react-button/components-api/#button)\n */\nconst Button = /*#__PURE__*/React.forwardRef(function Button(props, forwardedRef) {\n  var _slots$root;\n  const {\n      action,\n      children,\n      focusableWhenDisabled = false,\n      slotProps = {},\n      slots = {}\n    } = props,\n    other = _objectWithoutPropertiesLoose(props, _excluded);\n  const buttonRef = React.useRef();\n  const {\n    active,\n    focusVisible,\n    setFocusVisible,\n    getRootProps\n  } = useButton(_extends({}, props, {\n    focusableWhenDisabled\n  }));\n  React.useImperativeHandle(action, () => ({\n    focusVisible: () => {\n      setFocusVisible(true);\n      buttonRef.current.focus();\n    }\n  }), [setFocusVisible]);\n  const ownerState = _extends({}, props, {\n    active,\n    focusableWhenDisabled,\n    focusVisible\n  });\n  const classes = useUtilityClasses(ownerState);\n  const defaultElement = other.href || other.to ? 'a' : 'button';\n  const Root = (_slots$root = slots.root) != null ? _slots$root : defaultElement;\n  const rootProps = useSlotProps({\n    elementType: Root,\n    getSlotProps: getRootProps,\n    externalForwardedProps: other,\n    externalSlotProps: slotProps.root,\n    additionalProps: {\n      ref: forwardedRef\n    },\n    ownerState,\n    className: classes.root\n  });\n  return /*#__PURE__*/_jsx(Root, _extends({}, rootProps, {\n    children: children\n  }));\n});\nprocess.env.NODE_ENV !== \"production\" ? Button.propTypes /* remove-proptypes */ = {\n  // ┌────────────────────────────── Warning ──────────────────────────────┐\n  // │ These PropTypes are generated from the TypeScript type definitions. │\n  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │\n  // └─────────────────────────────────────────────────────────────────────┘\n  /**\n   * A ref for imperative actions. It currently only supports `focusVisible()` action.\n   */\n  action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({\n    current: PropTypes.shape({\n      focusVisible: PropTypes.func.isRequired\n    })\n  })]),\n  /**\n   * @ignore\n   */\n  children: PropTypes.node,\n  /**\n   * @ignore\n   */\n  className: PropTypes.string,\n  /**\n   * If `true`, the component is disabled.\n   * @default false\n   */\n  disabled: PropTypes.bool,\n  /**\n   * If `true`, allows a disabled button to receive focus.\n   * @default false\n   */\n  focusableWhenDisabled: PropTypes.bool,\n  /**\n   * @ignore\n   */\n  href: PropTypes.string,\n  /**\n   * @ignore\n   */\n  onFocusVisible: PropTypes.func,\n  /**\n   * The props used for each slot inside the Button.\n   * @default {}\n   */\n  slotProps: PropTypes.shape({\n    root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])\n  }),\n  /**\n   * The components used for each slot inside the Button.\n   * Either a string to use a HTML element or a component.\n   * @default {}\n   */\n  slots: PropTypes.shape({\n    root: PropTypes.elementType\n  }),\n  /**\n   * @ignore\n   */\n  to: PropTypes.string\n} : void 0;\nexport { Button };","import {\n  Button as ButtonUnstyled,\n  type ButtonOwnerState,\n  type ButtonOwnProps,\n} from '@mui/base/Button';\nimport clsx from 'clsx';\nimport type { MouseEvent } from 'react';\n\nimport {\n  type ComponentProps,\n  type SlotComponentPropsWithoutOverride,\n} from '../components.ts';\nimport { assocDefaultStyle } from '../utils/assign-default-style.ts';\nimport { mergeRootSlotPropsToComponentProps } from '../utils/merge-root-slot-props-to-component-prop.ts';\n\ninterface SlotProps {\n  root?: SlotComponentPropsWithoutOverride<'button', ButtonOwnerState>;\n}\n\nexport type ButtonProps = ComponentProps<\n  SlotProps,\n  ButtonOwnProps & {\n    onClick?: (e?: MouseEvent<HTMLElement>) => void;\n  }\n>;\n\nexport function Button({\n  children,\n  'data-testid': testId,\n  disableDefaultClasses,\n  slotProps: givenSlotProps,\n  ...rest\n}: ButtonProps) {\n  let slotProps = givenSlotProps;\n\n  if (!disableDefaultClasses) {\n    slotProps = assocDefaultStyle<SlotProps>({\n      slotWithDefaultClasses: {\n        root: clsx(\n          'tw-border',\n          'tw-p-0.5',\n          'tw-rounded-md',\n          'tw-bg-primary',\n          'tw-text-primary-contrast',\n          'tw-border-primary',\n          'hover:tw-border-primary-user-action',\n          'hover:tw-bg-primary-user-action',\n          'hover:tw-text-primary-user-action',\n          'focus:tw-outline-primary',\n        ),\n      },\n    })(givenSlotProps);\n  }\n  const rootProps = mergeRootSlotPropsToComponentProps()(slotProps, rest);\n\n  return (\n    <ButtonUnstyled\n      data-testid={testId ?? 'busybox-button'}\n      slotProps={slotProps}\n      {...rootProps}\n    >\n      {children}\n    </ButtonUnstyled>\n  );\n}\n"],"names":["COMPONENT_NAME","getButtonUtilityClass","slot","generateUtilityClass","generateUtilityClasses","_excluded","useUtilityClasses","ownerState","active","disabled","focusVisible","slots","composeClasses","useClassNamesOverride","Button","React","props","forwardedRef","_slots$root","action","children","focusableWhenDisabled","slotProps","other","_objectWithoutPropertiesLoose","buttonRef","setFocusVisible","getRootProps","useButton","_extends","classes","defaultElement","Root","rootProps","useSlotProps","_jsx","PropTypes","testId","disableDefaultClasses","givenSlotProps","rest","assocDefaultStyle","clsx","mergeRootSlotPropsToComponentProps","jsx","ButtonUnstyled"],"mappings":"u4BAEMA,EAAiB,SAChB,SAASC,EAAsBC,EAAM,CAC1C,OAAOC,EAAoB,qBAACH,EAAgBE,CAAI,CAClD,CAC6BE,EAAsB,uBAACJ,EAAgB,CAAC,OAAQ,SAAU,WAAY,cAAc,CAAC,ECFlH,MAAMK,EAAY,CAAC,SAAU,WAAY,WAAY,wBAAyB,iBAAkB,YAAa,OAAO,EAS9GC,EAAoBC,GAAc,CACtC,KAAM,CACJ,OAAAC,EACA,SAAAC,EACA,aAAAC,CACD,EAAGH,EACEI,EAAQ,CACZ,KAAM,CAAC,OAAQF,GAAY,WAAYC,GAAgB,eAAgBF,GAAU,QAAQ,CAC7F,EACE,OAAOI,EAAc,eAACD,EAAOE,wBAAsBZ,CAAqB,CAAC,CAC3E,EAYMa,EAAsBC,EAAM,WAAW,SAAgBC,EAAOC,EAAc,CAChF,IAAIC,EACJ,KAAM,CACF,OAAAC,EACA,SAAAC,EACA,sBAAAC,EAAwB,GACxB,UAAAC,EAAY,CAAE,EACd,MAAAX,EAAQ,CAAE,CAChB,EAAQK,EACJO,EAAQC,EAA6B,8BAACR,EAAOX,CAAS,EAClDoB,EAAYV,EAAM,SAClB,CACJ,OAAAP,EACA,aAAAE,EACA,gBAAAgB,EACA,aAAAC,CACD,EAAGC,YAAUC,EAAAA,SAAS,CAAE,EAAEb,EAAO,CAChC,sBAAAK,CACD,CAAA,CAAC,EACFN,EAAM,oBAAoBI,EAAQ,KAAO,CACvC,aAAc,IAAM,CAClBO,EAAgB,EAAI,EACpBD,EAAU,Q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