"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 IconsLegacy_stories_exports = {};
__export(IconsLegacy_stories_exports, {
  List: () => List,
  SingleIcon: () => SingleIcon,
  default: () => IconsLegacy_stories_default
});
module.exports = __toCommonJS(IconsLegacy_stories_exports);
var import_react = __toESM(require("react"));
var import_styled_components = __toESM(require("styled-components"));
var import_Icon = __toESM(require("./Icon"));
var import_styled_components2 = require("styled-components");
var import__ = require("../../..");
const ScrollArea = (0, import_styled_components.default)(import__.Grid)`
  flex: 1;
  height: auto;
  ${(p) => p.theme.overflow.y};
`;
const Container = (0, import_styled_components.default)(import__.Flex).attrs({
  flex: 1,
  flexDirection: "column",
  p: 4
})`
  overflow: hidden;
  height: calc(100vh - 4em);
`;
const IconContainer = (0, import_styled_components.default)(import__.Flex).attrs({
  flexDirection: "column",
  justifyContent: "flex-end",
  alignItems: "center",
  p: 4
})`
  ${(p) => p.active ? `background-color: ${p.theme.colors.neutral.c20};` : ``}
  border-radius: 4px;
  height: 100px;
`;
const Bold = import_styled_components.default.b`
  color: ${(p) => p.theme.colors.primary.c80};
`;
const Story = {
  title: "Asorted/Icons/Icons(legacy)",
  argTypes: {
    weight: {
      type: "enum",
      description: "Weight (Deprecated)",
      options: ["Medium"],
      control: { type: "select" },
      table: {
        type: { summary: "enum" },
        defaultValue: { summary: "Medium" }
      }
    },
    size: {
      type: "number",
      description: "Icon size for preview",
      table: {
        type: { summary: "number" },
        defaultValue: { summary: "32" }
      }
    },
    color: {
      type: "string",
      description: "Icon color",
      table: {
        type: { summary: "string" },
        defaultValue: { summary: "theme.colors.neutral.c100" }
      }
    },
    name: {
      type: "enum",
      description: "Icon name",
      options: import_Icon.iconNames,
      control: { type: "select" },
      table: {
        type: { summary: "enum" }
      }
    }
  },
  args: {
    weight: "Medium",
    size: 32,
    name: "Activity"
  }
};
var IconsLegacy_stories_default = Story;
const ListTemplate = (args) => {
  const theme = (0, import_styled_components2.useTheme)();
  const color = args.color || theme.colors.neutral.c100;
  const [search, setSearch] = (0, import_react.useState)("");
  const s = search.toLowerCase();
  const regexp = new RegExp(s, "i");
  return /* @__PURE__ */ import_react.default.createElement(Container, null, /* @__PURE__ */ import_react.default.createElement(import__.SearchInput, { value: search, onChange: setSearch }), /* @__PURE__ */ import_react.default.createElement(
    ScrollArea,
    {
      gridTemplateColumns: "repeat(auto-fill, 100px);",
      gridTemplateRows: "repeat(auto-fill, 100px);",
      gridGap: 4,
      mt: 4
    },
    import_Icon.iconNames.sort((a, b) => {
      return s ? b.toLowerCase().indexOf(s) - a.toLowerCase().indexOf(s) : a.localeCompare(b);
    }).map((name) => {
      const match = name.match(regexp);
      const active = s && match;
      const index = (match == null ? void 0 : match.index) ?? 0;
      return /* @__PURE__ */ import_react.default.createElement(IconContainer, { active: !!active }, /* @__PURE__ */ import_react.default.createElement(import__.Flex, { flex: 1, justifyContent: "center", alignItems: "center" }, /* @__PURE__ */ import_react.default.createElement(
        import_Icon.default,
        {
          key: name,
          name,
          weight: args.weight,
          size: args.size,
          color
        }
      )), /* @__PURE__ */ import_react.default.createElement(import__.Text, { variant: "extraSmall" }, active ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, name.substr(0, index), /* @__PURE__ */ import_react.default.createElement(Bold, null, name.substr(index, s.length)), name.substr(index + s.length)) : name));
    })
  ));
};
const IconTemplate = (args) => {
  const theme = (0, import_styled_components2.useTheme)();
  const color = args.color || theme.colors.neutral.c100;
  return /* @__PURE__ */ import_react.default.createElement(import_Icon.default, { ...args, color });
};
const SingleIcon = IconTemplate.bind({});
const List = ListTemplate.bind({});
//# sourceMappingURL=IconsLegacy.stories.js.map
