"use strict";
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);
var VerticalTimeline_stories_exports = {};
__export(VerticalTimeline_stories_exports, {
  Default: () => Default,
  default: () => VerticalTimeline_stories_default
});
module.exports = __toCommonJS(VerticalTimeline_stories_exports);
var import_react = __toESM(require("react"));
var import_Flex = __toESM(require("../../Flex"));
var import_form = require("../../../form");
var import_asorted = require("../../../asorted");
var import_Button = __toESM(require("../../../cta/Button"));
var import_ContinueOnDevice = __toESM(require("../../../message/ContinueOnDevice"));
var import__ = __toESM(require("."));
const description = `
### A Vertical Timeline

This components accepts an Array of object like this:
## Usage

\`\`\`js

const steps = [
    {
      /**
       * status is an ItemStatus which can be inactive, active or completed
       */
      status: ItemStatus;
      /**
       * title is the title of the step
       */
      title: string;
      /**
       * renderBody is an optional prop which is a ReactNode to be rendered next to the title
       */
      renderBody?: (isDisplayed?: boolean) => ReactNode;
      /**
       * estimatedTime is an optional prop that take the estimated time to complete the time in second and display it in a tag in minute
       */
       estimatedTime?: number;
    },
    {
      status: ItemStatus;
      title: string;
      renderBody?: (isDisplayed?: boolean) => ReactNode;
      estimatedTime?: number;
    }
  ];

<VerticalTimeline steps={steps as any} />
\`\`\`
`;
var VerticalTimeline_stories_default = {
  title: "Layout/List/VerticalTimeline",
  argTypes: {
    steps: {
      control: "disabled"
    }
  },
  parameters: {
    docs: {
      description: {
        component: description
      }
    }
  }
};
const { BodyText, SubtitleText } = import__.default;
const defaultItems = [
  {
    status: "active",
    title: "step's {title} prop",
    renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column", flex: 1, border: "1px solid", borderColor: "neutral.c100", p: 3 }, /* @__PURE__ */ import_react.default.createElement(BodyText, null, `This box is the React node returned by the step's {renderBody} prop`), /* @__PURE__ */ import_react.default.createElement(import_asorted.Divider, { my: 6, text: "`Divider` component" }), /* @__PURE__ */ import_react.default.createElement(SubtitleText, null, "This subtitle text component is `VerticalTimeline.SubtitleText`"), /* @__PURE__ */ import_react.default.createElement(BodyText, null, "This body text component is `VerticalTimeline.BodyText`"), /* @__PURE__ */ import_react.default.createElement(
      import_ContinueOnDevice.default,
      {
        Icon: ({ size }) => /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { height: size, width: size, borderRadius: size, bg: "neutral.c40" }),
        text: "This component is `ContinueOnDevice`."
      }
    ))
  },
  {
    status: "inactive",
    title: "Set your PIN",
    estimatedTime: 120,
    renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column" }, /* @__PURE__ */ import_react.default.createElement(BodyText, null, `Your PIN can be 4 to 8 digits long. Anyone with access to your Nano and to your PIN can also access all your crypto and NFT assets.`), /* @__PURE__ */ import_react.default.createElement(
      import_ContinueOnDevice.default,
      {
        Icon: ({ size }) => /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { height: size, width: size, borderRadius: size, bg: "neutral.c40" }),
        text: "Set PIN on your Ledger Stax."
      }
    ))
  },
  {
    status: "inactive",
    title: "Recovery phrase",
    estimatedTime: 300,
    renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column" }, /* @__PURE__ */ import_react.default.createElement(SubtitleText, null, `Generate a new phrase`), /* @__PURE__ */ import_react.default.createElement(BodyText, null, `Your device will generate a new secret recovery phrase. For your eyes only.`), /* @__PURE__ */ import_react.default.createElement(import_asorted.Divider, { text: "OR", my: 6 }), /* @__PURE__ */ import_react.default.createElement(SubtitleText, null, `Restore using Secret Recovery Phrase`), /* @__PURE__ */ import_react.default.createElement(BodyText, null, `Make sure to use a Phrase generated by a Ledger for the guaranteed security of your assets. `))
  },
  {
    status: "inactive",
    title: "Software check",
    renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column" }, /* @__PURE__ */ import_react.default.createElement(BodyText, null, `We'll verify whether your Nano is genuine. This should be quick and easy!`))
  },
  {
    status: "inactive",
    title: "Install apps",
    renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column" }, /* @__PURE__ */ import_react.default.createElement(BodyText, null, `Installing apps`))
  },
  {
    status: "inactive",
    title: "Nano is ready",
    // @ts-expect-error children props issue
    renderBody: () => /* @__PURE__ */ import_react.default.createElement(BodyText, null, "Almost there ...")
  }
];
const Template = () => {
  const [autoAnimate, setAutoAnimate] = (0, import_react.useState)(false);
  const [currentIndex, setCurrentIndex] = (0, import_react.useState)(1);
  (0, import_react.useEffect)(() => {
    let timeout = null;
    if (autoAnimate) {
      timeout = setTimeout(() => {
        if (currentIndex === defaultItems.length) {
          setCurrentIndex(0);
          return;
        }
        setCurrentIndex(currentIndex + 1);
      }, 1e3);
    }
    return () => {
      timeout && clearTimeout(timeout);
    };
  }, [autoAnimate, currentIndex]);
  const items = (0, import_react.useMemo)(
    () => defaultItems.map((item, index) => ({
      ...item,
      status: index < currentIndex ? "completed" : index > currentIndex ? "inactive" : "active"
    })),
    [currentIndex]
  );
  return /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column", flex: 1, alignItems: "center" }, /* @__PURE__ */ import_react.default.createElement(
    import_Flex.default,
    {
      flexDirection: "column",
      p: 6,
      rowGap: 3,
      alignSelf: "stretch",
      alignItems: "flex-start",
      flex: 1,
      borderColor: "neutral.c100",
      border: "1px solid"
    },
    /* @__PURE__ */ import_react.default.createElement(import_asorted.Text, { variant: "h5Inter" }, "Controls:"),
    /* @__PURE__ */ import_react.default.createElement(
      import_form.Switch,
      {
        name: "Auto animate",
        label: "Auto animate steps",
        checked: autoAnimate,
        onChange: () => setAutoAnimate(!autoAnimate)
      }
    ),
    /* @__PURE__ */ import_react.default.createElement(import_Button.default, { my: 3, variant: "main", outline: true, onClick: () => setCurrentIndex(items.length) }, "Set last step complete"),
    /* @__PURE__ */ import_react.default.createElement(import_asorted.Text, { variant: "body" }, "Click on a step to make it the active one (this is only for the storybook, not a native feature of this component, although you can implement `onClickIndex` to do that)")
  ), /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { width: 432, mt: 10 }, /* @__PURE__ */ import_react.default.createElement(import__.default, { steps: items, onClickIndex: (index) => setCurrentIndex(index) })));
};
const Default = Template.bind({});
//# sourceMappingURL=VerticalTimeline.stories.js.map
