/*
 * Copyright 2026 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 { Button } from "@base-ui/react/button";
import { Popover } from "@base-ui/react/popover";
import classnames from "classnames";
import React from "react";
import { OverflowItem } from "./OverflowItem.js";
import styles from "./OverflowButton.module.css.js";
export function OverflowButton({
  overflowMarkings,
  hasActiveOverflow,
  onMarkingToggle
}) {
  const [open, setOpen] = React.useState(false);
  return /*#__PURE__*/React.createElement(Popover.Root, {
    open: open,
    onOpenChange: setOpen
  }, /*#__PURE__*/React.createElement(Popover.Trigger, {
    render: /*#__PURE__*/React.createElement(Button, {
      className: classnames(styles.moreButton, hasActiveOverflow && styles.moreButtonActive)
    }, "+", overflowMarkings.length, " more")
  }), /*#__PURE__*/React.createElement(Popover.Portal, null, /*#__PURE__*/React.createElement(Popover.Positioner, {
    side: "bottom",
    align: "start"
  }, /*#__PURE__*/React.createElement(Popover.Popup, {
    className: styles.overflowList
  }, overflowMarkings.map(marking => /*#__PURE__*/React.createElement(OverflowItem, {
    key: marking.id,
    id: marking.id,
    label: marking.label,
    description: marking.description,
    selectionState: marking.selectionState,
    disabled: marking.disabled,
    onToggle: onMarkingToggle
  }))))));
}
//# sourceMappingURL=OverflowButton.js.map