'use strict';

var jsxRuntime = require('../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var React = require('react');
var search = require('../../search/search.cjs');
var useDataTable = require('../hooks/useDataTable.cjs');

const TableSearch = React.forwardRef(({ ...props }, ref) => {
    const { updateTableQuery, tableQuery } = useDataTable.useDataTable();
    const handleSearch = (e) => {
        const value = e.target.value;
        updateTableQuery((query) => {
            return {
                ...query,
                search: value,
            };
        });
    };
    const handleClear = () => {
        updateTableQuery((query) => {
            return {
                ...query,
                search: "",
            };
        });
    };
    return (jsxRuntime.jsxRuntimeExports.jsx(search.Search, { ...props, ref: ref, onChange: handleSearch, value: tableQuery?.search, onClear: handleClear }));
});

exports.TableSearch = TableSearch;
//# sourceMappingURL=search.cjs.map
