File size: 1,295 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "type": "composition",
  "npmDependencies": [],
  "fileDependencies": [
    "compositions/ui/tooltip"
  ],
  "id": "scrubber-input",
  "file": {
    "name": "scrubber-input.tsx",
    "content": "import { Group, Icon, InputElement, NumberInput } from \"@chakra-ui/react\"\nimport { Tooltip } from \"./tooltip\"\nimport { forwardRef } from \"react\"\n\nexport interface ScrubberInputProps extends NumberInput.InputProps {\n  label: React.ReactNode\n  icon: React.ReactNode\n  rootProps?: NumberInput.RootProps\n}\n\nexport const ScrubberInput = forwardRef<HTMLInputElement, ScrubberInputProps>(\n  function ScrubberInput(props, ref) {\n    const { label, icon, rootProps, ...rest } = props\n    return (\n      <NumberInput.Root variant=\"outline\" maxW=\"120px\" {...rootProps}>\n        <Tooltip content={label}>\n          <Group width=\"full\">\n            <InputElement>\n              <NumberInput.Scrubber>\n                <Icon asChild color=\"fg.subtle\">\n                  {icon}\n                </Icon>\n              </NumberInput.Scrubber>\n            </InputElement>\n            <NumberInput.Input cursor=\"default\" ps=\"10\" ref={ref} {...rest} />\n          </Group>\n        </Tooltip>\n      </NumberInput.Root>\n    )\n  },\n)\n"
  },
  "component": "ScrubberInput"
}