import { Meta } from "@storybook/react";
import { NumericTextBoxProps } from "./NumericTextBoxProps";
import NumericTextBox from "./NumericTextBox";

export default {
  title: "Design System/Inputs/NumericTextBox",
  component: NumericTextBox,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The KendoReact NumericTextBox lets the user edit and submit specific numeric values by typing or by using the spin buttons. \n\n```javascript\nimport { NumericTextBox } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    accessKey: {
      control: { type: "text" },
      description: "Specifies the accessKey of the NumericTextBox.",
    },
    ariaDescribedBy: {
      control: { type: "text" },
      description:
        "Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.",
    },
    ariaLabel: {
      control: { type: "text" },
      description: "The accessible label of the component.",
    },
    ariaLabelledBy: {
      control: { type: "text" },
      description: "Identifies the element(s) which will label the component.",
    },
    className: {
      control: { type: "text" },
      description: "Sets a class of the NumericTextBox DOM element.",
    },
    defaultValue: {
      control: { type: "number" },
      description:
        "Specifies the initial value. Leaves the subsequent updates uncontrolled.",
    },
    dir: {
      control: { type: "text" },
      description: "Represents the dir HTML attribute.",
    },
    disabled: {
      control: { type: "boolean" },
      description: "Determines whether the NumericTextBox is disabled.",
    },
    fillMode: {
      control: { type: "select" },
      description: "Configures the fillMode of the NumericTextBox.",
    },
    format: {
      control: { type: "text" },
      description:
        "Specifies the number format which is used for formatting the value.",
    },
    id: {
      control: { type: "text" },
      description: "Sets the id of the input DOM element.",
    },
    inputStyle: {
      control: { type: "object" },
      description: "Represents the input element style HTML attribute.",
    },
    inputType: {
      control: { type: "select" },
      description: "Sets the type of the input DOM element.",
    },
    label: {
      control: { type: "text" },
      description: "Renders a floating label for the NumericTextBox.",
    },
    max: {
      control: { type: "number" },
      description: "Specifies the greatest value that can be entered.",
    },
    min: {
      control: { type: "number" },
      description: "Specifies the smallest value that can be entered.",
    },
    name: {
      control: { type: "text" },
      description: "Specifies the name of the input DOM element.",
    },
    placeholder: {
      control: { type: "text" },
      description: "Specifies the input placeholder.",
    },
    prefix: {
      control: { type: "text" },
      description: "Sets a custom prefix to the NumericTextBox component.",
    },
    rangeOnEnter: {
      control: { type: "boolean" },
      description:
        "If enabled, the NumericTextBox will handle the enter key to range the current invalid value between min and max props.",
    },
    readOnly: {
      control: { type: "boolean" },
      description:
        "Determines whether the NumericTextBox is in its read-only state.",
    },
    required: {
      control: { type: "boolean" },
      description: "Specifies if null is a valid value for the component.",
    },
    rounded: {
      control: { type: "select" },
      description: "Configures the roundness of the NumericTextBox.",
    },
    size: {
      control: { type: "select" },
      description: "Configures the size of the NumericTextBox.",
    },
    spinners: {
      control: { type: "boolean" },
      description:
        "Specifies whether the Up and Down spin buttons will be rendered.",
    },
    step: {
      control: { type: "number" },
      description:
        "Specifies the value that is used to increment or decrement the value of the NumericTextBox.",
    },
    style: {
      control: { type: "object" },
      description: "Represents the style HTML attribute.",
    },
    suffix: {
      control: { type: "text" },
      description: "Sets a custom suffix to the NumericTextBox component.",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Sets the tabIndex property of the NumericTextBox.",
    },
    title: {
      control: { type: "text" },
      description: "Sets the title of the input element of the NumericTextBox.",
    },
    valid: {
      control: { type: "boolean" },
      description: "Overrides the validity state of the component.",
    },
    validationMessage: {
      control: { type: "text" },
      description: "Controls the form error message of the component.",
    },
    validityStyles: {
      control: { type: "boolean" },
      description:
        "If set to false, no visual representation of the invalid state of the component will be applied.",
    },
    value: {
      control: { type: "number" },
      description: "Specifies the value of the NumericTextBox.",
    },
    width: {
      control: { type: "text" },
      description: "Specifies the width of the NumericTextBox.",
    },
  },
} as Meta;

export const Default = (args: NumericTextBoxProps): JSX.Element => (
  <NumericTextBox {...args} />
);

Default.args = {
  dataTestId: "numericTextBox-data-testid",
  accessKey: "someKey",
  ariaDescribedBy: "someElement",
  ariaLabel: "NumericTextBox",
  ariaLabelledBy: "labelId",
  className: "custom-class",
  defaultValue: 0,
  dir: "ltr",
  disabled: false,
  fillMode: "solid",
  format: "n2",
  id: "numericTextBoxId",
  inputStyle: { color: "red" },
  inputType: "tel",
  label: "Numeric Value",
  max: 100,
  min: 0,
  name: "numericTextBox",
  placeholder: "Enter value",
  rangeOnEnter: false,
  readOnly: false,
  required: false,
  rounded: "medium",
  size: "medium",
  spinners: true,
  step: 1,
  style: { width: "100%" },
  tabIndex: 0,
  title: "NumericTextBox",
  valid: true,
  validationMessage: "Invalid value",
  validityStyles: true,
  value: null,
  width: "100%",
};
