Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../chunk-BN4qSVkS.cjs");
const require_components_Button = require("../Button.cjs");
const require_components_TextInput = require("../TextInput.cjs");
const require_components_DataManagerTable_Filter = require("./Filter.cjs");
require("./filters.cjs");
const require_components_DataManagerTable_AppliedButtonsContainer = require("./AppliedButtonsContainer.cjs");
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
//#region src/components/DataManagerTable/StringFilter.tsx
const isStringFilterState = (state) => state.type === "string";
const getDefaultStringFilterState = () => ({
	type: "string",
	value: "",
	isApplied: false
});
const StringFilter = ({ updateFilterState, state, placeholder, label }) => {
	const handleChange = (value) => {
		updateFilterState({
			...state,
			value,
			isApplied: !!value
		});
	};
	const appliedValueButtons = state.appliedValues?.map((value) => {
		return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_Button.Button, {
			kind: "primary",
			size: "ExtraSmall",
			text: value,
			icon: { name: "Close" },
			iconSide: "right",
			onClick: () => {
				updateFilterState({
					...state,
					appliedValues: state.appliedValues?.filter((appliedValue) => appliedValue !== value)
				});
			}
		}, value);
	});
	return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(_emotion_react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_DataManagerTable_Filter.Filter, {
		label,
		children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_TextInput.TextInput, {
			placeholder: placeholder || "",
			onChange: handleChange,
			value: state.value
		})
	}), !!appliedValueButtons?.length ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_DataManagerTable_AppliedButtonsContainer.AppliedButtonsContainer, { children: appliedValueButtons }) : null] });
};
//#endregion
exports.StringFilter = StringFilter;
exports.getDefaultStringFilterState = getDefaultStringFilterState;
exports.isStringFilterState = isStringFilterState;
