UNPKG

@talend/react-faceted-search

Version:
56 lines (55 loc) 1.6 kB
import { useMemo } from 'react'; import PropTypes from 'prop-types'; import { ButtonPrimary, Form } from '@talend/design-system'; import { getDataAttrFromProps } from '@talend/utils'; import { getApplyDataFeature } from '../../../helpers/usage.helpers'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; const BadgeNumberForm = ({ id, onChange, onSubmit, value, feature, t, ...rest }) => { const applyDataFeature = useMemo(() => getApplyDataFeature(feature), [feature]); const onChangeText = event => onChange(event, event.target.value); return /*#__PURE__*/_jsxs(Form, { id: `${id}-number`, onSubmit: onSubmit, children: [/*#__PURE__*/_jsx(Form.Number, { id: `${id}-input`, placeholder: t('TYPE_HERE', { defaultValue: 'Type here' }), onChange: onChangeText, value: value }), /*#__PURE__*/_jsx(Form.Buttons, { padding: { x: 0, bottom: 0, top: 'M' }, children: /*#__PURE__*/_jsx(ButtonPrimary, { type: "submit", "data-feature": applyDataFeature, ...getDataAttrFromProps(rest), children: t('APPLY', { defaultValue: 'Apply' }) }) })] }); }; BadgeNumberForm.propTypes = { id: PropTypes.string.isRequired, onChange: PropTypes.func, onSubmit: PropTypes.func.isRequired, value: PropTypes.string, feature: PropTypes.string.isRequired, t: PropTypes.func.isRequired }; // eslint-disable-next-line import/prefer-default-export export { BadgeNumberForm }; //# sourceMappingURL=BadgeNumberForm.component.js.map