{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "number-input",
  "type": "registry:item",
  "title": "Number Input",
  "description": "A number input component with various features and customization options.",
  "dependencies": [
    "@mui/material",
    "@emotion/react",
    "@emotion/styled"
  ],
  "registryDependencies": [
    "https://www.mui-treasury.com/r/use-number-input.json"
  ],
  "files": [
    {
      "path": "components/number-input/number-input.tsx",
      "target": "src/mui-treasury/components/number-input/number-input.tsx",
      "content": "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React from 'react';\n\nimport Box from '@mui/material/Box';\nimport ButtonBase from '@mui/material/ButtonBase';\nimport FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport InputLabel from '@mui/material/InputLabel';\nimport OutlinedInput, { OutlinedInputProps } from '@mui/material/OutlinedInput';\nimport SvgIcon from '@mui/material/SvgIcon';\nimport { unstable_useId as useId } from '@mui/material/utils';\n\nimport {\n  UseNumberInputOptions,\n  useNumberInput,\n} from '@/registry/hooks/use-number-input';\n\nexport type {\n  NumberInputError,\n  NumberInputEventType,\n} from '@/registry/hooks/use-number-input';\n\nexport type NumberInputProps = UseNumberInputOptions & {\n  inputElement?: React.ReactElement;\n  incrementIcon?: React.ReactNode;\n  decrementIcon?: React.ReactNode;\n} & Omit<OutlinedInputProps, 'onChange'>;\n\nexport const NumberInput = React.forwardRef<HTMLDivElement, NumberInputProps>(\n  function NumberInput(props, ref) {\n    const {\n      endAdornment = null,\n      defaultValue,\n      allowMouseWheel,\n      keepWithinRange,\n      clampValueOnBlur,\n      focusInputOnChange,\n      formatter,\n      parser,\n      onChange,\n      ...other\n    } = props;\n\n    const { inputRef, getInputProps, getIncrementProps, getDecrementProps } =\n      useNumberInput(props);\n\n    return (\n      <OutlinedInput\n        ref={ref}\n        {...other}\n        inputRef={inputRef}\n        inputProps={getInputProps()}\n        endAdornment={\n          <>\n            {endAdornment}\n            <Box\n              sx={(theme) => ({\n                display: 'flex',\n                flexDirection: 'column',\n                alignSelf: 'stretch',\n                marginRight: '-14px',\n                marginLeft: '0.5rem',\n                borderLeft: `1px solid ${\n                  (theme.vars || theme).palette.divider\n                }`,\n                '& > button': {\n                  display: 'flex',\n                  justifyContent: 'center',\n                  alignItems: 'center',\n                  position: 'relative',\n                  flex: 1,\n                  width: 28,\n                  '&:hover': {\n                    color: theme.palette.text.primary,\n                    backgroundColor: (theme.vars || theme).palette.action.hover,\n                  },\n                  '&.Mui-disabled': {\n                    opacity: 0.5,\n                    cursor: 'not-allowed',\n                  },\n                  '&:first-child': {\n                    borderTopRightRadius: (theme.vars || theme).shape\n                      .borderRadius,\n                  },\n                  '&:last-child': {\n                    borderBottomRightRadius: (theme.vars || theme).shape\n                      .borderRadius,\n                  },\n                  '& svg': {\n                    fontSize: '1rem',\n                    mr: '2px',\n                  },\n                },\n              })}\n            >\n              <ButtonBase {...getIncrementProps()}>\n                <SvgIcon sx={{ bottom: '-4px' }}>\n                  <svg\n                    xmlns=\"http://www.w3.org/2000/svg\"\n                    width=\"24\"\n                    height=\"24\"\n                    viewBox=\"0 0 24 24\"\n                    fill=\"none\"\n                    stroke=\"currentColor\"\n                    strokeWidth=\"2\"\n                    strokeLinecap=\"round\"\n                    strokeLinejoin=\"round\"\n                  >\n                    <path d=\"m18 15-6-6-6 6\" />\n                  </svg>\n                </SvgIcon>\n              </ButtonBase>\n              <Box sx={{ width: '100%', height: '1px', bgcolor: 'divider' }} />\n              <ButtonBase {...getDecrementProps()}>\n                <SvgIcon sx={{ top: '-4px' }}>\n                  <svg\n                    xmlns=\"http://www.w3.org/2000/svg\"\n                    width=\"24\"\n                    height=\"24\"\n                    viewBox=\"0 0 24 24\"\n                    fill=\"none\"\n                    stroke=\"currentColor\"\n                    strokeWidth=\"2\"\n                    strokeLinecap=\"round\"\n                    strokeLinejoin=\"round\"\n                  >\n                    <path d=\"m6 9 6 6 6-6\" />\n                  </svg>\n                </SvgIcon>\n              </ButtonBase>\n            </Box>\n          </>\n        }\n      />\n    );\n  },\n);\n\nexport const NumberInputField = React.forwardRef<\n  HTMLDivElement,\n  NumberInputProps & {\n    label?: React.ReactNode;\n    helperText?: React.ReactNode;\n  }\n>(function NumberInputField(\n  { id: idOverride, helperText, label, error, fullWidth, ...props },\n  ref,\n) {\n  const id = useId(idOverride);\n  const helperTextId = helperText && id ? `${id}-helper-text` : undefined;\n  const inputLabelId = label && id ? `${id}-label` : undefined;\n  return (\n    <FormControl error={error} ref={ref} fullWidth={fullWidth}>\n      <InputLabel id={inputLabelId} htmlFor={id}>\n        {label}\n      </InputLabel>\n      <NumberInput id={id} {...props} />\n      {helperText && (\n        <FormHelperText id={helperTextId}>{helperText}</FormHelperText>\n      )}\n    </FormControl>\n  );\n});\n",
      "type": "registry:item"
    },
    {
      "path": "components/number-input/index.ts",
      "target": "src/mui-treasury/components/number-input/index.ts",
      "content": "export * from './number-input';\n",
      "type": "registry:item"
    }
  ],
  "meta": {
    "screenshot": "/og/number-input.png",
    "category": "primitive",
    "subcategory": "text-field"
  }
}