var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/workSpaceList/components/CardList/index.tsx
var CardList_exports = {};
__export(CardList_exports, {
  default: () => CardList_default
});
module.exports = __toCommonJS(CardList_exports);
var import_Card = __toESM(require("./../Card"));
var import_CreateBaseModal = __toESM(require("./../CreateBaseModal"));
var import_materials = require("@pisell/materials");
var import_classnames = __toESM(require("classnames"));
var import_react = __toESM(require("react"));
var import_index = require("./index.less");
var Empty = (props) => {
  const { onAddBase } = props;
  const [open, setOpen] = (0, import_react.useState)(false);
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "styles-empty" }, /* @__PURE__ */ import_react.default.createElement("div", null, "This workspace is empty"), /* @__PURE__ */ import_react.default.createElement("div", null, "Get started by creating a new base"), /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { type: "primary", onClick: () => setOpen(true) }, "Create a base"), /* @__PURE__ */ import_react.default.createElement(
    import_CreateBaseModal.default,
    {
      onAddBase,
      open,
      onCancel: () => setOpen(false)
    }
  ));
};
var CardList = (props) => {
  const {
    data,
    onAddBase,
    onRefresh,
    onDeleteBase,
    onUpdateBase,
    scrollRef,
    isDetail
  } = props;
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)({
        "card-list-wrap": !!data.length,
        "card-list-in-workspace": !isDetail
      }),
      ref: scrollRef
    },
    !data.length ? /* @__PURE__ */ import_react.default.createElement(Empty, { onAddBase }) : data.map((item) => /* @__PURE__ */ import_react.default.createElement(
      import_Card.default,
      {
        id: item.id,
        key: item.name,
        icon: item.icon,
        color: item.color,
        describe: item.describe,
        name: item.name,
        created_at: item.created_at,
        onRefresh,
        onDeleteBase,
        onUpdateBase
      }
    ))
  );
};
var CardList_default = CardList;
