"use client";
'use strict';

var jsxRuntime = require('react/jsx-runtime');
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.jsx(search.Search, { ...props, ref: ref, onChange: handleSearch, value: tableQuery?.search, onClear: handleClear }));
});

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