function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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), !0).forEach(function (r) { _defineProperty(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; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { UserOutlined, EditOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons';
import { PisellEntityCard } from "./PisellEntityCard";
var meta = {
  title: 'Data Display/PisellEntityCard',
  component: PisellEntityCard,
  tags: ['autodocs'],
  decorators: [function (Story) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        width: 340
      }
    }, /*#__PURE__*/React.createElement(Story, null));
  }],
  argTypes: {
    density: {
      description: '信息密度',
      control: 'select',
      options: ['B1', 'B2', 'B5', 'B9']
    },
    layout: {
      description: '布局方向',
      control: 'radio',
      options: ['horizontal', 'vertical']
    },
    width: {
      description: '卡片宽度',
      control: 'select',
      options: ['content', 'full', 300, 340, 400]
    },
    showMedia: {
      description: '显示媒体区',
      control: 'boolean'
    },
    showPrimaryText: {
      description: '显示主文案',
      control: 'boolean'
    },
    showSecondaryText: {
      description: '显示次级文案',
      control: 'boolean'
    },
    showTags: {
      description: '显示标签',
      control: 'boolean'
    },
    showActions: {
      description: '显示底部操作',
      control: 'boolean'
    },
    swipeToDelete: {
      description: '开启左滑删除',
      control: 'boolean'
    }
  },
  args: {
    width: 340
  }
};
export default meta;
var defaultPrimary = '张三';
var defaultSecondary = [{
  text: '产品经理 · 杭州'
}, {
  text: '钉钉事业部'
}];
var defaultTags = [{
  text: '在职'
}, {
  text: '正式'
}];
/** 头像：使用带色块背景的占位图，便于在 Storybook 中看清尺寸 */
var defaultMedia = {
  type: 'avatar',
  src: 'https://ui-avatars.com/api/?name=Zhang+San&background=4a90d9&color=fff&size=48',
  alt: '头像',
  size: 48
};

/** 默认：横向 B2，主文案 + 次级 + 头像 */
export var Default = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    density: 'B2',
    layout: 'horizontal'
  }
};

/** 仅主文案（最小） */
export var PrimaryOnly = {
  args: {
    primaryText: '实体名称',
    showMedia: false,
    showSecondaryText: false,
    showTags: false,
    density: 'B1'
  }
};

/** 主文案 + 头像 一行 */
export var B1Line = {
  args: {
    primaryText: defaultPrimary,
    media: _objectSpread(_objectSpread({}, defaultMedia), {}, {
      src: 'https://ui-avatars.com/api/?name=Zhang+San&background=4a90d9&color=fff&size=24',
      size: 24
    }),
    density: 'B1',
    layout: 'horizontal',
    showSecondaryText: false,
    showTags: false
  }
};

/** B2 横向：头像 + 主 + 次级两行 */
export var B2Horizontal = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    density: 'B2',
    layout: 'horizontal'
  }
};

/** B2 竖向 */
export var B2Vertical = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: _objectSpread(_objectSpread({}, defaultMedia), {}, {
      src: 'https://ui-avatars.com/api/?name=Zhang+San&background=4a90d9&color=fff&size=64',
      size: 64
    }),
    density: 'B2',
    layout: 'vertical'
  }
};

/** B5：次级最多 5 行 */
export var B5Standard = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: [{
      text: '产品经理 · 杭州'
    }, {
      text: '钉钉事业部'
    }, {
      text: '第三行描述'
    }, {
      text: '第四行'
    }, {
      text: '第五行'
    }],
    tags: defaultTags,
    media: defaultMedia,
    density: 'B5',
    layout: 'horizontal'
  }
};

/** B9 全部展示 */
export var B9Extended = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: [].concat(defaultSecondary, [{
      text: '带提示的说明',
      showTooltip: true
    }]),
    tags: defaultTags,
    media: defaultMedia,
    density: 'B9',
    layout: 'horizontal'
  }
};

/** Action 区域默认关闭（不传 showActions 或 showActions: false） */
export var ActionDefaultOff = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    showActions: false,
    actions: [{
      type: 'text',
      label: '查看详情',
      onClick: function onClick() {}
    }]
  }
};

/** Action 仅文本 */
export var ActionTextOnly = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    showActions: true,
    actions: [{
      type: 'text',
      label: '查看详情',
      onClick: function onClick() {
        return console.log('查看详情');
      }
    }, {
      type: 'text',
      label: 'Add Contact',
      onClick: function onClick() {
        return console.log('Add Contact');
      }
    }]
  }
};

/** Action 仅按钮 */
export var ActionButtonOnly = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    showActions: true,
    actions: [{
      type: 'button',
      label: '选择',
      onClick: function onClick() {
        return console.log('选择');
      }
    }, {
      type: 'button',
      label: '编辑',
      onClick: function onClick() {
        return console.log('编辑');
      }
    }]
  }
};

/** Action 仅图标（Figma 支持右侧按钮 - 编辑图标） */
export var ActionIconOnly = {
  args: {
    primaryText: 'Bill Camp',
    secondaryTexts: [{
      text: 'Billcamp@pisell.com'
    }],
    media: defaultMedia,
    showActions: true,
    actions: [{
      type: 'icon',
      icon: /*#__PURE__*/React.createElement(EditOutlined, null),
      onClick: function onClick() {
        return console.log('编辑');
      }
    }]
  }
};

/** Action 混合：文本 + 按钮 + 图标，并各自自定义样式 */
export var ActionMixedWithCustomStyle = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    showActions: true,
    actions: [{
      type: 'text',
      label: 'Add Contact',
      icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
      onClick: function onClick() {
        return console.log('Add Contact');
      },
      style: {
        color: '#1677ff'
      }
    }, {
      type: 'button',
      label: '选择',
      onClick: function onClick() {
        return console.log('选择');
      },
      style: {
        borderColor: '#52c41a',
        color: '#52c41a'
      }
    }, {
      type: 'icon',
      icon: /*#__PURE__*/React.createElement(EditOutlined, null),
      onClick: function onClick() {
        return console.log('编辑');
      },
      style: {
        color: '#475467'
      }
    }, {
      type: 'icon',
      icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
      onClick: function onClick() {
        return console.log('删除');
      },
      className: 'pisell-entity-card-action-icon',
      style: {
        color: '#ff4d4f'
      }
    }]
  }
};

/** 带底部操作（兼容旧名） */
export var WithActions = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    showActions: true,
    actions: [{
      type: 'text',
      label: '查看详情',
      onClick: function onClick() {
        return console.log('查看');
      }
    }, {
      type: 'button',
      label: '选择',
      onClick: function onClick() {
        return console.log('选择');
      }
    }]
  }
};

/** 左滑删除（需在真机或模拟 touch 下左滑验证） */
export var SwipeToDelete = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    swipeToDelete: true,
    onDelete: function onDelete() {
      return console.log('onDelete');
    }
  }
};

/** 标签 inline */
export var TagPositionInline = {
  args: {
    primaryText: defaultPrimary,
    tags: defaultTags,
    tagPosition: 'inline',
    showMedia: false,
    showSecondaryText: false
  }
};

/** 宽度撑满父容器 */
export var WidthFull = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    width: 'full'
  },
  decorators: [function (Story) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        width: 340
      }
    }, /*#__PURE__*/React.createElement(Story, null));
  }]
};

/** 自定义主文案插槽 */
export var SlotPrimary = {
  args: {
    primaryText: '不应显示',
    renderPrimary: function renderPrimary() {
      return /*#__PURE__*/React.createElement("span", {
        style: {
          fontWeight: 700,
          color: '#1677ff'
        }
      }, "\u81EA\u5B9A\u4E49\u4E3B\u6587\u6848");
    }
  }
};

/** 缩略图类型媒体 */
export var MediaThumbnail = {
  args: {
    primaryText: '商品名称',
    secondaryTexts: [{
      text: '¥99.00'
    }],
    media: {
      type: 'thumbnail',
      src: 'https://picsum.photos/seed/product/128/128',
      alt: '商品图',
      size: 64,
      shape: 'square'
    },
    density: 'B2'
  }
};

/** 图标类型媒体 */
export var MediaIcon = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: {
      type: 'icon',
      icon: /*#__PURE__*/React.createElement(UserOutlined, {
        style: {
          fontSize: 24
        }
      }),
      size: 40,
      color: '#1677ff'
    },
    density: 'B2'
  }
};

/** 可点击卡片 */
export var Clickable = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    onClick: function onClick() {
      return alert('卡片被点击');
    }
  }
};

/** 禁用态 */
export var Disabled = {
  args: {
    primaryText: defaultPrimary,
    secondaryTexts: defaultSecondary,
    media: defaultMedia,
    disabled: true
  }
};