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/pisellHierarchicalSummaryList/PisellHierarchicalSummaryList.stories.tsx
var PisellHierarchicalSummaryList_stories_exports = {};
__export(PisellHierarchicalSummaryList_stories_exports, {
  Accordion: () => Accordion,
  AggregateSum: () => AggregateSum,
  Default: () => Default,
  FullFeatured: () => FullFeatured,
  MaxExpandLevel: () => MaxExpandLevel,
  default: () => PisellHierarchicalSummaryList_stories_default
});
module.exports = __toCommonJS(PisellHierarchicalSummaryList_stories_exports);
var import_react = __toESM(require("react"));
var import_PisellHierarchicalSummaryList = require("./PisellHierarchicalSummaryList");
var demoItems = [
  {
    key: "l1",
    label: "Label",
    value: /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#1570EF" } }, "Value"),
    children: [
      {
        key: "l2",
        label: "Label",
        value: "Value",
        children: [
          { key: "l3-1", label: "Label", itemsCount: "N items", value: "Value" },
          { key: "l3-2", label: "Label", infoTooltip: "Tooltip", value: "Value" },
          { key: "l3-3", label: "Label", value: "Value" },
          {
            key: "l3-4",
            label: "Label",
            itemsCount: "2 items",
            value: "Value",
            children: [
              { key: "l4-1", label: /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#667085" } }, "• Label"), value: /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#667085" } }, "Value") },
              { key: "l4-2", label: /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#667085" } }, "• Label"), value: /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#667085" } }, "Value") }
            ]
          }
        ]
      }
    ]
  }
];
var meta = {
  title: "Data Display/PisellHierarchicalSummaryList",
  component: import_PisellHierarchicalSummaryList.PisellHierarchicalSummaryList,
  tags: ["autodocs"],
  argTypes: {
    defaultExpandedLevel: { control: "number", description: "默认展开层级（非受控初始化）" },
    accordion: { control: "boolean", description: "手风琴模式（同级仅一个展开）" },
    maxRenderLevel: { control: "number", description: "最大渲染层级" },
    maxExpandLevel: { control: "number", description: "最大可展开层级" },
    indent: { control: "number", description: "缩进（px）" },
    rowGap: { control: "number", description: "行间距（px）" }
  }
};
var PisellHierarchicalSummaryList_stories_default = meta;
var Default = {
  args: {
    items: demoItems,
    defaultExpandedLevel: 2
  }
};
var Accordion = {
  args: {
    items: demoItems,
    defaultExpandedLevel: 3,
    accordion: true
  }
};
var MaxExpandLevel = {
  args: {
    items: demoItems,
    defaultExpandedLevel: 5,
    maxExpandLevel: 2
  }
};
var AggregateSum = {
  args: {
    items: [
      {
        key: "sum-root",
        label: "Total",
        children: [
          { key: "a", label: "A", value: 10 },
          { key: "b", label: "B", value: 20 },
          { key: "c", label: "C", value: 5, children: [{ key: "c-1", label: "C-1", value: 2 }] }
        ]
      }
    ],
    defaultExpandedLevel: 2,
    aggregate: {
      mode: "sum",
      format: (sum) => `$${sum}`
    }
  }
};
var FullFeatured = {
  args: {
    items: demoItems,
    defaultExpandedLevel: 3,
    accordion: false,
    maxRenderLevel: 4,
    maxExpandLevel: 3,
    indent: 16,
    rowGap: 8,
    levelConfig: {
      1: {
        rowStyle: { background: "#F5F5F5", padding: "8px 12px", borderRadius: 8 },
        labelTextStyle: { fontWeight: 700 },
        valueTextStyle: { color: "#1570EF", fontWeight: 700 }
      },
      2: {
        rowStyle: { padding: "4px 8px" },
        labelTextStyle: { fontWeight: 600 },
        showDotSeparator: true
      },
      3: {
        rowStyle: { padding: "2px 8px" },
        labelTextStyle: { color: "#1B1B1B", fontWeight: 500 },
        valueTextStyle: { color: "#1B1B1B", fontWeight: 500 }
      },
      4: {
        rowStyle: { paddingLeft: 0 },
        labelTextStyle: { color: "#667085", fontWeight: 400 },
        valueTextStyle: { color: "#667085", fontWeight: 400 }
      }
    },
    aggregate: {
      mode: "sum",
      getNumberValue: (item) => {
        if (typeof item.value === "number") return item.value;
        return null;
      },
      format: (sum, { level }) => level === 1 ? `Total $${sum}` : `$${sum}`
    },
    renderLabel: (item, ctx) => {
      if (ctx.level === 1) {
        return /* @__PURE__ */ import_react.default.createElement("span", null, item.label, " ", item.itemsCount ? /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#667085", marginLeft: 4 } }, item.itemsCount) : null);
      }
      return item.label;
    },
    renderValue: (item, ctx) => {
      if (ctx.aggregatedValue !== void 0) {
        return ctx.aggregatedValue;
      }
      return item.value ?? "—";
    }
  }
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Accordion,
  AggregateSum,
  Default,
  FullFeatured,
  MaxExpandLevel
});
