@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 2.26 kB
Source Map (JSON)
{"version":3,"file":"InputClearButton.cjs","names":["factory","useProps","InputContext","useResolvedStylesApi","CloseButton"],"sources":["../../../../src/components/Input/InputClearButton/InputClearButton.tsx"],"sourcesContent":["import { use } from 'react';\nimport {\n BoxProps,\n ElementProps,\n factory,\n Factory,\n MantineSize,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n} from '../../../core';\nimport { CloseButton, CloseButtonStylesNames } from '../../CloseButton';\nimport { InputContext } from '../Input.context';\n\nexport interface InputClearButtonProps\n extends BoxProps, StylesApiProps<InputClearButtonFactory>, ElementProps<'button'> {\n /** Size of the button, by default value is based on input context */\n size?: MantineSize | (string & {});\n}\n\nexport type InputClearButtonFactory = Factory<{\n props: InputClearButtonProps;\n ref: HTMLButtonElement;\n stylesNames: CloseButtonStylesNames;\n}>;\n\nexport const InputClearButton = factory<InputClearButtonFactory>((_props) => {\n const props = useProps('InputClearButton', null, _props);\n const { size, variant, vars, classNames, styles, ...others } = props;\n const ctx = use(InputContext);\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<InputClearButtonFactory>({\n classNames,\n styles,\n props,\n });\n\n return (\n <CloseButton\n variant={variant || 'transparent'}\n size={size || ctx?.size || 'sm'}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n __staticSelector=\"InputClearButton\"\n style={{ pointerEvents: 'all', background: 'var(--input-bg)', ...others.style }}\n {...others}\n />\n );\n});\n\nInputClearButton.displayName = '@mantine/core/InputClearButton';\n"],"mappings":";;;;;;;;;;AA0BA,MAAa,mBAAmBA,gBAAAA,SAAkC,WAAW;CAC3E,MAAM,QAAQC,kBAAAA,SAAS,oBAAoB,MAAM,OAAO;CACxD,MAAM,EAAE,MAAM,SAAS,MAAM,YAAY,QAAQ,GAAG,WAAW;CAC/D,MAAM,OAAA,GAAA,MAAA,KAAUC,sBAAAA,aAAa;CAE7B,MAAM,EAAE,oBAAoB,mBAAmBC,gCAAAA,qBAA8C;EAC3F;EACA;EACA;EACD,CAAC;AAEF,QACE,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,aAAD;EACE,SAAS,WAAW;EACpB,MAAM,QAAQ,KAAK,QAAQ;EAC3B,YAAY;EACZ,QAAQ;EACR,kBAAiB;EACjB,OAAO;GAAE,eAAe;GAAO,YAAY;GAAmB,GAAG,OAAO;GAAO;EAC/E,GAAI;EACJ,CAAA;EAEJ;AAEF,iBAAiB,cAAc"}