/*
 * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import classnames from "classnames";
import React, { memo, useMemo } from "react";
import { FilterListItem } from "./FilterListItem.js";
import styles from "./FilterListItem.module.css.js";
function SortableFilterListItemInner({
  id,
  definition,
  filterKey,
  label,
  filterState,
  onFilterStateChanged,
  onFilterRemoved,
  renderInput,
  searchField
}) {
  const {
    attributes,
    listeners,
    setNodeRef,
    transform,
    transition,
    isDragging
  } = useSortable({
    id
  });
  const style = useMemo(() => ({
    transform: CSS.Transform.toString(transform),
    transition: transition ?? undefined
  }), [transform, transition]);
  return /*#__PURE__*/React.createElement("div", {
    ref: setNodeRef,
    style: style,
    className: classnames(isDragging && styles.dragging)
  }, /*#__PURE__*/React.createElement(FilterListItem, {
    definition: definition,
    filterKey: filterKey,
    label: label,
    filterState: filterState,
    onFilterStateChanged: onFilterStateChanged,
    onFilterRemoved: onFilterRemoved,
    renderInput: renderInput,
    searchField: searchField,
    dragHandleAttributes: attributes,
    dragHandleListeners: listeners
  }));
}
export const SortableFilterListItem = /*#__PURE__*/memo(SortableFilterListItemInner);
//# sourceMappingURL=SortableFilterListItem.js.map