UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

18 lines (17 loc) 1.5 kB
import { __assign } from "tslib"; import React, { useCallback } from 'react'; import InternalInput from '../../input/internal'; import styles from './styles.css.js'; var Filter = function (_a) { var filteringType = _a.filteringType, filteringPlaceholder = _a.filteringPlaceholder, filteringAriaLabel = _a.filteringAriaLabel, ariaRequired = _a.ariaRequired, filterProps = _a.filterProps, _b = _a.filteringValue, filteringValue = _b === void 0 ? '' : _b, setFilteringValue = _a.setFilteringValue, resetHighlight = _a.resetHighlight, fireDelayedInput = _a.fireDelayedInput; var onChange = useCallback(function (event) { setFilteringValue && setFilteringValue(event.detail.value); fireDelayedInput && fireDelayedInput(event); resetHighlight(); }, [setFilteringValue, fireDelayedInput, resetHighlight]); if (filteringType === 'none') { return null; } return (React.createElement(InternalInput, __assign({ type: "search", className: styles.filter, value: filteringValue !== null && filteringValue !== void 0 ? filteringValue : '', ariaRequired: ariaRequired, autoComplete: false, disableBrowserAutocorrect: true, invalid: false, placeholder: filteringPlaceholder, ariaLabel: filteringAriaLabel, onChange: onChange, noBorderRadius: true }, filterProps, { nativeAttributes: __assign({ 'aria-expanded': true, 'aria-haspopup': true, role: 'combobox', autoCorrect: 'off', autoCapitalize: 'off' }, filterProps.nativeAttributes) }))); }; export default Filter;