'use strict';
import { jsx, jsxs } from 'react/jsx-runtime';
import { Select, SelectTrigger, SelectContent, SelectGroup, SelectItem } from '../../../../../fd-component-toolbox/select/Select.js';
import { capitalizeString } from '../../../../../../fd-toolbox/strings/case-converters.js';
import { getFilterRightHandValue, booleanFilterSelectOptions, onBooleanFilterValueChange } from './BooleanFilter.funcs.js';
import { elementPrefixes } from '../../../../constants/element-prefixes.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function BooleanFilter({
  rightHandResult,
  onRightHandChange,
  displayName,
  state,
  filterOperatorType,
  inputId,
  onOpenChangeCallback,
  buttonRef
}) {
  return /* @__PURE__ */jsx("div", {
    className: "relative",
    children: /* @__PURE__ */jsxs(Select, {
      value: rightHandResult,
      onValueChange: value => {
        onBooleanFilterValueChange(onRightHandChange, buttonRef, value ?? void 0);
      },
      onOpenChange: onOpenChangeCallback,
      children: [/* @__PURE__ */jsx(SelectTrigger, {
        ref: buttonRef,
        id: inputId,
        label: displayName,
        shouldAnimate: !!rightHandResult && rightHandResult !== "none",
        variant: "float",
        children: capitalizeString(getFilterRightHandValue(state, filterOperatorType))
      }), /* @__PURE__ */jsx(SelectContent, {
        children: /* @__PURE__ */jsx(SelectGroup, {
          children: booleanFilterSelectOptions.map(option => /* @__PURE__ */jsx(SelectItem, {
            id: elementPrefixes.selectItem + option.label,
            value: option.value,
            children: option.label
          }, option.value))
        })
      })]
    })
  });
}
__name(BooleanFilter, "BooleanFilter");

export { BooleanFilter };
