"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "SortItem", {
    enumerable: true,
    get: function() {
        return SortItem;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _css = require("../../../utils/css");
const _icon = require("../../../icon");
const _classvarianceauthority = require("class-variance-authority");
const _types = require("../shared/types");
const SortItem = (props)=>{
    const onClick = (0, _react.useCallback)(()=>{
        props.onClick?.(props.value);
    }, [
        props.value,
        props.currentValue
    ]);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
        className: (0, _css.cn)("orderly-flex orderly-items-center orderly-gap-1 orderly-cursor-pointer", {
            "orderly-text-base-contrast": props.currentValue?.key === props.value && props.currentValue.direction !== _types.SortDirection.NONE
        }),
        onClick: onClick,
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                children: props.label
            }),
            props.currentValue?.key === props.value && props.currentValue.direction !== _types.SortDirection.NONE && /*#__PURE__*/ (0, _jsxruntime.jsx)(_icon.ArrowIcon, {
                size: 8,
                className: (0, _classvarianceauthority.cx)("orderly-transition-transform", props.currentValue?.direction === _types.SortDirection.ASC ? "orderly-rotate-180" : "orderly-rotate-0")
            })
        ]
    });
};

//# sourceMappingURL=sortItem.js.map