import React__default from 'react';
import { C as Chip } from './Chip-es.js';
import './tslib.es6-es.js';
import { I as Icon } from './Icon-es.js';
import { a as ComboboxContext } from './ComboboxProvider-es.js';

function ComboboxTrigger({ label = "Select", selected, activatorRef, }) {
    const { handleOpen } = React__default.useContext(ComboboxContext);
    const hasSelection = selected.length;
    const selectedLabel = selected.map(option => option.label).join(", ");
    return (React__default.createElement(Chip, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox", ref: activatorRef }, !hasSelection && (React__default.createElement(Chip.Suffix, null,
        React__default.createElement(Icon, { name: "add", size: "small" })))));
}

export { ComboboxTrigger as C };
