import { _ as __rest } from './tslib.es6-es.js';
import React__default from 'react';
import classnames from 'classnames';
import { I as Icon } from './Icon-es.js';
import { O as OverlaySeparator } from './OverlaySeparator-es.js';
import { S as SelectRoot, a as SelectPortal, b as SelectTrigger, c as SelectValue, d as SelectPositioner, e as SelectPopup, f as SelectList, g as SelectItem, h as SelectItemText, i as SelectItemIndicator, j as SelectGroup, k as SelectGroupLabel } from './SelectGroupLabel-es.js';

var styles = {"trigger":"WQiJQH4jadQ-","value":"P2HhjOjxY34-","iconWrapper":"cxgFUCKcXcw-","iconRotate":"_3BEK4Z1gGis-","positioner":"g221yZJtRrU-","popup":"vifRnCQ18ss-","list":"WsOmdkQ0SWU-","item":"wQ2wXu1YH-k-","itemText":"_--Vi-17OUiU-","itemIndicator":"CfjooR3I8Jc-","separator":"lI5-MyBERFY-","group":"_21z9KBWR06w-","groupLabel":"ZhtKkgZiSQI-","spinning":"sIXiKKpdSj8-"};

function mergeClassName(baseClassName, className) {
    if (typeof className === "function") {
        return (state) => classnames(baseClassName, className(state));
    }
    return classnames(baseClassName, className);
}

/**
 * The offset (px) between the trigger bottom edge and the popup top edge,
 * matching the Menu dropdown spacing.
 */
const SELECT_OFFSET = 6;
// ─── Trigger ─────────────────────────────────────────────────────────────────
function SelectPrimitiveTrigger(_a) {
    var { className, children } = _a, props = __rest(_a, ["className", "children"]);
    return (React__default.createElement(SelectTrigger, Object.assign({ className: mergeClassName(styles.trigger, className) }, props),
        children,
        React__default.createElement("span", { "aria-hidden": "true", className: styles.iconWrapper },
            React__default.createElement("span", { className: styles.iconRotate },
                React__default.createElement(Icon, { color: "greyBlue", name: "arrowDown", size: "base" })))));
}
// ─── Value ───────────────────────────────────────────────────────────────────
function SelectPrimitiveValue(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(SelectValue, Object.assign({ className: mergeClassName(styles.value, className) }, props)));
}
// ─── Positioner ───────────────────────────────────────────────────────────────
function SelectPrimitivePositioner(_a) {
    var { className, sideOffset = SELECT_OFFSET, alignItemWithTrigger = false } = _a, props = __rest(_a, ["className", "sideOffset", "alignItemWithTrigger"]);
    return (React__default.createElement(SelectPositioner, Object.assign({ className: mergeClassName(styles.positioner, className), sideOffset: sideOffset, alignItemWithTrigger: alignItemWithTrigger }, props)));
}
// ─── Popup ────────────────────────────────────────────────────────────────────
function SelectPrimitivePopup(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(SelectPopup, Object.assign({ className: mergeClassName(styles.popup, className) }, props)));
}
// ─── List ─────────────────────────────────────────────────────────────────────
function SelectPrimitiveList(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(SelectList, Object.assign({ className: mergeClassName(styles.list, className) }, props)));
}
// ─── Item ─────────────────────────────────────────────────────────────────────
function SelectPrimitiveItem(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(SelectItem, Object.assign({ className: mergeClassName(styles.item, className) }, props)));
}
// ─── ItemText ─────────────────────────────────────────────────────────────────
function SelectPrimitiveItemText(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(SelectItemText, Object.assign({ className: mergeClassName(styles.itemText, className) }, props)));
}
// ─── ItemIndicator ────────────────────────────────────────────────────────────
function SelectPrimitiveItemIndicator(_a) {
    var { className, children } = _a, props = __rest(_a, ["className", "children"]);
    return (React__default.createElement(SelectItemIndicator, Object.assign({ keepMounted: true, className: mergeClassName(styles.itemIndicator, className) }, props), children !== null && children !== void 0 ? children : React__default.createElement(Icon, { color: "icon", name: "checkmark", size: "base" })));
}
// ─── Group ────────────────────────────────────────────────────────────────────
function SelectPrimitiveGroup(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(SelectGroup, Object.assign({ className: mergeClassName(styles.group, className) }, props)));
}
// ─── GroupLabel ───────────────────────────────────────────────────────────────
function SelectPrimitiveGroupLabel(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(SelectGroupLabel, Object.assign({ className: mergeClassName(styles.groupLabel, className) }, props)));
}
// ─── Separator ────────────────────────────────────────────────────────────────
function SelectPrimitiveSeparator(_a) {
    var { className } = _a, props = __rest(_a, ["className"]);
    return (React__default.createElement(OverlaySeparator, Object.assign({ className: classnames(styles.separator, className), "data-testid": "ATL-SelectPrimitive-Separator" }, props)));
}
// ─── Display names ───────────────────────────────────────────────────────────
SelectPrimitiveTrigger.displayName = "SelectPrimitive.Trigger";
SelectPrimitiveValue.displayName = "SelectPrimitive.Value";
SelectPrimitivePositioner.displayName = "SelectPrimitive.Positioner";
SelectPrimitivePopup.displayName = "SelectPrimitive.Popup";
SelectPrimitiveList.displayName = "SelectPrimitive.List";
SelectPrimitiveItem.displayName = "SelectPrimitive.Item";
SelectPrimitiveItemText.displayName = "SelectPrimitive.ItemText";
SelectPrimitiveItemIndicator.displayName = "SelectPrimitive.ItemIndicator";
SelectPrimitiveGroup.displayName = "SelectPrimitive.Group";
SelectPrimitiveGroupLabel.displayName = "SelectPrimitive.GroupLabel";
SelectPrimitiveSeparator.displayName = "SelectPrimitive.Separator";
// ─── Compound export ─────────────────────────────────────────────────────────
const SelectPrimitive = {
    Root: SelectRoot,
    Trigger: SelectPrimitiveTrigger,
    Value: SelectPrimitiveValue,
    Portal: SelectPortal,
    Positioner: SelectPrimitivePositioner,
    Popup: SelectPrimitivePopup,
    List: SelectPrimitiveList,
    Item: SelectPrimitiveItem,
    ItemText: SelectPrimitiveItemText,
    ItemIndicator: SelectPrimitiveItemIndicator,
    Group: SelectPrimitiveGroup,
    GroupLabel: SelectPrimitiveGroupLabel,
    Separator: SelectPrimitiveSeparator,
};

export { SelectPrimitive as S };
