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/pisellNumber/PisellNumber.stories.tsx
var PisellNumber_stories_exports = {};
__export(PisellNumber_stories_exports, {
  Basic: () => Basic,
  Disabled: () => Disabled,
  EmptyValue: () => EmptyValue,
  InForm: () => InForm,
  ReadOnly: () => ReadOnly,
  ReadOnlyStyles: () => ReadOnlyStyles,
  Sizes: () => Sizes,
  WithAddon: () => WithAddon,
  WithCustomValidation: () => WithCustomValidation,
  WithGrouping: () => WithGrouping,
  WithPrecision: () => WithPrecision,
  WithRange: () => WithRange,
  WithValidationRange: () => WithValidationRange,
  WithValidationRequired: () => WithValidationRequired,
  default: () => PisellNumber_stories_default
});
module.exports = __toCommonJS(PisellNumber_stories_exports);
var import_PisellNumber = require("./PisellNumber");
var import_react = require("react");
var import_antd = require("antd");
var import_react2 = __toESM(require("react"));
var meta = {
  title: "表单/表单组件/PisellNumber",
  component: import_PisellNumber.PisellNumber,
  tags: ["autodocs"],
  argTypes: {
    mode: {
      control: "radio",
      options: ["read", "edit"],
      description: "显示模式"
    },
    disabled: {
      control: "boolean",
      description: "是否禁用"
    },
    value: {
      control: "number",
      description: "当前值"
    },
    min: {
      control: "number",
      description: "最小值"
    },
    max: {
      control: "number",
      description: "最大值"
    },
    step: {
      control: "number",
      description: "步进值"
    },
    precision: {
      control: "number",
      description: "小数精度"
    },
    useGrouping: {
      control: "boolean",
      description: "是否使用千分位分隔符"
    }
  }
};
var PisellNumber_stories_default = meta;
var Basic = {
  args: {
    value: 10,
    placeholder: "请输入数字"
  },
  render: (args) => {
    const [value, setValue] = (0, import_react.useState)(args.value);
    return /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        ...args,
        value,
        onChange: setValue
      }
    );
  }
};
var ReadOnly = {
  args: {
    mode: "read",
    value: 1234.567,
    precision: 2
  }
};
var Disabled = {
  args: {
    disabled: true,
    value: 100
  }
};
var WithRange = {
  args: {
    value: 50,
    min: 0,
    max: 100,
    step: 10
  },
  render: (args) => {
    const [value, setValue] = (0, import_react.useState)(args.value);
    return /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        ...args,
        value,
        onChange: setValue
      }
    );
  }
};
var WithPrecision = {
  args: {
    value: 3.1415926,
    precision: 2,
    step: 0.01
  },
  render: (args) => {
    const [value, setValue] = (0, import_react.useState)(args.value);
    return /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        ...args,
        value,
        onChange: setValue
      }
    );
  }
};
var WithGrouping = {
  args: {
    mode: "read",
    value: 123456789e-2,
    precision: 2,
    useGrouping: true
  }
};
var WithAddon = {
  args: {
    value: 100,
    addonBefore: "￥",
    addonAfter: "元"
  },
  render: (args) => {
    const [value, setValue] = (0, import_react.useState)(args.value);
    return /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        ...args,
        value,
        onChange: setValue
      }
    );
  }
};
var WithValidationRequired = {
  render: () => {
    const [value, setValue] = (0, import_react.useState)(null);
    return /* @__PURE__ */ import_react2.default.createElement(import_antd.Form, null, /* @__PURE__ */ import_react2.default.createElement(import_antd.Form.Item, { label: "数量（必填）" }, /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        value,
        onChange: setValue,
        required: true,
        validateTrigger: "both",
        onValidate: (isValid, errors) => {
          console.log("校验结果:", isValid, errors);
        }
      }
    )));
  }
};
var WithValidationRange = {
  render: () => {
    const [value, setValue] = (0, import_react.useState)(50);
    return /* @__PURE__ */ import_react2.default.createElement(import_antd.Form, null, /* @__PURE__ */ import_react2.default.createElement(import_antd.Form.Item, { label: "年龄（0-150）" }, /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        value,
        onChange: setValue,
        min: 0,
        max: 150,
        required: true,
        validateTrigger: "both"
      }
    )));
  }
};
var WithCustomValidation = {
  render: () => {
    const [value, setValue] = (0, import_react.useState)(null);
    return /* @__PURE__ */ import_react2.default.createElement(import_antd.Form, null, /* @__PURE__ */ import_react2.default.createElement(import_antd.Form.Item, { label: "偶数校验" }, /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        value,
        onChange: setValue,
        validator: (v) => {
          if (v === null) return true;
          return v % 2 === 0 || "请输入偶数";
        },
        validateTrigger: "both"
      }
    )));
  }
};
var Sizes = {
  render: () => {
    return /* @__PURE__ */ import_react2.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 16 } }, /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "Large:"), /* @__PURE__ */ import_react2.default.createElement(import_PisellNumber.PisellNumber, { value: 100, size: "large" })), /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "Middle:"), /* @__PURE__ */ import_react2.default.createElement(import_PisellNumber.PisellNumber, { value: 100, size: "middle" })), /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "Small:"), /* @__PURE__ */ import_react2.default.createElement(import_PisellNumber.PisellNumber, { value: 100, size: "small" })));
  }
};
var ReadOnlyStyles = {
  render: () => {
    return /* @__PURE__ */ import_react2.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 16 } }, /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "默认:"), /* @__PURE__ */ import_react2.default.createElement(import_PisellNumber.PisellNumber, { mode: "read", value: 1234.56, precision: 2 })), /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "加粗:"), /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        mode: "read",
        value: 1234.56,
        precision: 2,
        fontWeight: "bold"
      }
    )), /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "红色:"), /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        mode: "read",
        value: 1234.56,
        precision: 2,
        color: "#ff4d4f"
      }
    )), /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "大字号:"), /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        mode: "read",
        value: 1234.56,
        precision: 2,
        fontSize: 20
      }
    )), /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "居中对齐:"), /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        mode: "read",
        value: 1234.56,
        precision: 2,
        textAlign: "center",
        style: { width: 200, border: "1px solid #d9d9d9", padding: 8 }
      }
    )));
  }
};
var InForm = {
  render: () => {
    const [quantity, setQuantity] = (0, import_react.useState)(1);
    const [price, setPrice] = (0, import_react.useState)(0);
    const [weight, setWeight] = (0, import_react.useState)(0);
    return /* @__PURE__ */ import_react2.default.createElement(import_antd.Form, { layout: "vertical", style: { maxWidth: 400 } }, /* @__PURE__ */ import_react2.default.createElement(import_antd.Form.Item, { label: "购买数量" }, /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        value: quantity,
        onChange: setQuantity,
        min: 1,
        max: 100,
        step: 1,
        precision: 0,
        required: true,
        validateTrigger: "both"
      }
    )), /* @__PURE__ */ import_react2.default.createElement(import_antd.Form.Item, { label: "商品价格" }, /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        value: price,
        onChange: setPrice,
        min: 0,
        precision: 2,
        addonBefore: "￥",
        required: true,
        validateTrigger: "both"
      }
    )), /* @__PURE__ */ import_react2.default.createElement(import_antd.Form.Item, { label: "商品重量" }, /* @__PURE__ */ import_react2.default.createElement(
      import_PisellNumber.PisellNumber,
      {
        value: weight,
        onChange: setWeight,
        min: 0,
        precision: 3,
        addonAfter: "kg"
      }
    )));
  }
};
var EmptyValue = {
  render: () => {
    return /* @__PURE__ */ import_react2.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 16 } }, /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "默认空值显示:"), /* @__PURE__ */ import_react2.default.createElement(import_PisellNumber.PisellNumber, { mode: "read", value: null })), /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("span", { style: { marginRight: 8 } }, "自定义空值文本:"), /* @__PURE__ */ import_react2.default.createElement(import_PisellNumber.PisellNumber, { mode: "read", value: null, emptyText: "暂无数据" })));
  }
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Basic,
  Disabled,
  EmptyValue,
  InForm,
  ReadOnly,
  ReadOnlyStyles,
  Sizes,
  WithAddon,
  WithCustomValidation,
  WithGrouping,
  WithPrecision,
  WithRange,
  WithValidationRange,
  WithValidationRequired
});
