'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var neetoAtoms = require('@bigbinary/neeto-atoms');
var lucideReact = require('lucide-react');
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);

var CHECK_ICON_SIZE = 20;

var _excluded$3 = ["active", "memberName", "imageUrl"];
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var MembersListItem = function MembersListItem(_ref) {
  var active = _ref.active,
    memberName = _ref.memberName,
    imageUrl = _ref.imageUrl,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded$3);
  return /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread$3(_objectSpread$3({
    "data-testid": "inbox-member-list-item",
    className: neetoAtoms.cn("relative mb-2 flex w-full transform cursor-pointer select-none items-center gap-2 neeto-ui-rounded-md px-2 py-1 pe-7 text-start transition-colors", active ? "bg-primary text-primary-foreground" : "hover:bg-muted focus:bg-muted")
  }, otherProps), {}, {
    children: [memberName && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Avatar, {
      className: "size-6 shrink-0",
      user: {
        name: memberName,
        imageUrl: imageUrl
      }
    }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
      className: "min-w-0 break-words",
      variant: "body3",
      children: memberName
    }), active && /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "absolute end-0 top-0 flex h-full items-center pe-2",
      children: /*#__PURE__*/jsxRuntime.jsx(lucideReact.Check, {
        size: CHECK_ICON_SIZE
      })
    })]
  }));
};

var _excluded$2 = ["placeholder", "searchTerm", "handleClearSearchTerm"];
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Search = function Search(_ref) {
  var placeholder = _ref.placeholder,
    searchTerm = _ref.searchTerm,
    handleClearSearchTerm = _ref.handleClearSearchTerm,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded$2);
  var inputRef = React.useRef(null);
  return /*#__PURE__*/jsxRuntime.jsx("div", {
    className: "sticky top-0 z-10 w-full bg-background p-3",
    onClick: function onClick(e) {
      return e.stopPropagation();
    },
    children: /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: "relative",
      children: [/*#__PURE__*/jsxRuntime.jsx(lucideReact.Search, {
        className: "absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"
      }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, _objectSpread$2({
        placeholder: placeholder,
        autoFocus: true,
        className: "pe-8 ps-8",
        ref: inputRef,
        value: searchTerm
      }, otherProps)), /*#__PURE__*/jsxRuntime.jsx(lucideReact.X, {
        className: neetoAtoms.cn("absolute right-2.5 top-1/2 size-4 -translate-y-1/2 cursor-pointer text-muted-foreground hover:text-foreground", !searchTerm && "hidden"),
        onClick: function onClick() {
          var _inputRef$current;
          (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
          handleClearSearchTerm();
        }
      })]
    })
  });
};

var _excluded$1 = ["active", "teamName"];
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var TeamsListItem = function TeamsListItem(_ref) {
  var active = _ref.active,
    teamName = _ref.teamName,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded$1);
  return /*#__PURE__*/jsxRuntime.jsxs("button", _objectSpread$1(_objectSpread$1({
    "data-testid": "inbox-group-list-item",
    className: neetoAtoms.cn("relative mb-2 flex w-full transform cursor-pointer select-none items-center gap-2 neeto-ui-rounded-md p-2 pe-8 text-start transition-colors", active ? "bg-primary text-primary-foreground" : "hover:bg-muted focus:bg-muted")
  }, otherProps), {}, {
    children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
      className: "flex min-w-0 grow flex-wrap items-center break-words",
      variant: "body3",
      children: teamName
    }), active && /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "absolute end-0 top-0 flex h-full items-center pe-2",
      children: /*#__PURE__*/jsxRuntime.jsx(lucideReact.Check, {
        size: CHECK_ICON_SIZE
      })
    })]
  }));
};

var _excluded = ["children"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var AssignList = function AssignList(_ref) {
  var children = _ref.children,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded);
  return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
    className: "w-64 pb-3"
  }, otherProps), {}, {
    children: /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "flex w-full flex-col",
      children: children
    })
  }));
};
AssignList.Search = Search;
AssignList.MembersListItem = MembersListItem;
AssignList.TeamsListItem = TeamsListItem;

exports.AssignList = AssignList;
//# sourceMappingURL=index-BRgcqXVL.js.map
