@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 2.17 kB
Source Map (JSON)
{"version":3,"file":"InputBase.cjs","names":["polymorphicFactory","useInputProps","Input"],"sources":["../../../src/components/InputBase/InputBase.tsx"],"sourcesContent":["import {\n BoxProps,\n DataAttributes,\n polymorphicFactory,\n PolymorphicFactory,\n StylesApiProps,\n} from '../../core';\nimport { __BaseInputProps, __InputStylesNames, Input, InputVariant, useInputProps } from '../Input';\n\nexport interface InputBaseProps\n extends BoxProps, __BaseInputProps, StylesApiProps<InputBaseFactory> {\n __staticSelector?: string;\n __stylesApiProps?: Record<string, any>;\n\n /** Props passed down to the root element (`Input.Wrapper` component) */\n wrapperProps?: React.ComponentProps<'div'> & DataAttributes;\n\n /** If set, the input can have multiple lines, for example when `component=\"textarea\"` @default false */\n multiline?: boolean;\n\n /** If set, `aria-` and other accessibility attributes are added to the input @default true */\n withAria?: boolean;\n}\n\nexport type InputBaseFactory = PolymorphicFactory<{\n props: InputBaseProps;\n defaultRef: HTMLInputElement;\n defaultComponent: 'input';\n stylesNames: __InputStylesNames;\n variant: InputVariant;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'InputBase',\n withAria: true,\n size: 'sm',\n} satisfies Partial<InputBaseProps>;\n\nexport const InputBase = polymorphicFactory<InputBaseFactory>((props) => {\n const { inputProps, wrapperProps, ...others } = useInputProps('InputBase', defaultProps, props);\n return (\n <Input.Wrapper {...wrapperProps}>\n <Input {...inputProps} {...others} />\n </Input.Wrapper>\n );\n});\n\nInputBase.classes = { ...Input.classes, ...Input.Wrapper.classes };\nInputBase.displayName = '@mantine/core/InputBase';\n"],"mappings":";;;;;;;AAgCA,MAAM,eAAe;CACnB,kBAAkB;CAClB,UAAU;CACV,MAAM;CACP;AAED,MAAa,YAAYA,4BAAAA,oBAAsC,UAAU;CACvE,MAAM,EAAE,YAAY,cAAc,GAAG,WAAWC,wBAAAA,cAAc,aAAa,cAAc,MAAM;AAC/F,QACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,MAAM,SAAP;EAAe,GAAI;YACjB,iBAAA,GAAA,kBAAA,KAACA,cAAAA,OAAD;GAAO,GAAI;GAAY,GAAI;GAAU,CAAA;EACvB,CAAA;EAElB;AAEF,UAAU,UAAU;CAAE,GAAGA,cAAAA,MAAM;CAAS,GAAGA,cAAAA,MAAM,QAAQ;CAAS;AAClE,UAAU,cAAc"}