{"version":3,"sources":["../src/create-icon.tsx"],"sourcesContent":["import { forwardRef } from \"@chakra-ui/system\"\nimport { Children } from \"react\"\nimport { Icon, IconProps } from \"./icon\"\n\ninterface CreateIconOptions {\n  /**\n   * The icon `svg` viewBox\n   * @default \"0 0 24 24\"\n   */\n  viewBox?: string\n  /**\n   * The `svg` path or group element\n   * @type React.ReactElement | React.ReactElement[]\n   */\n  path?: React.ReactElement | React.ReactElement[]\n  /**\n   * If the `svg` has a single path, simply copy the path's `d` attribute\n   */\n  d?: string\n  /**\n   * The display name useful in the dev tools\n   */\n  displayName?: string\n  /**\n   * Default props automatically passed to the component; overwritable\n   */\n  defaultProps?: IconProps\n}\n\nexport function createIcon(options: CreateIconOptions) {\n  const {\n    viewBox = \"0 0 24 24\",\n    d: pathDefinition,\n    displayName,\n    defaultProps = {},\n  } = options\n  const path = Children.toArray(options.path)\n\n  const Comp = forwardRef<IconProps, \"svg\">((props, ref) => (\n    <Icon ref={ref} viewBox={viewBox} {...defaultProps} {...props}>\n      {path.length ? path : <path fill=\"currentColor\" d={pathDefinition} />}\n    </Icon>\n  ))\n\n  Comp.displayName = displayName\n\n  return Comp\n}\n"],"mappings":";;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AAuCG;AAXrB,SAAS,WAAW,SAA4B;AACrD,QAAM;AAAA,IACJ,UAAU;AAAA,IACV,GAAG;AAAA,IACH;AAAA,IACA,eAAe,CAAC;AAAA,EAClB,IAAI;AACJ,QAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;AAE1C,QAAM,OAAO,WAA6B,CAAC,OAAO,QAChD,oBAAC,QAAK,KAAU,SAAmB,GAAG,cAAe,GAAG,OACrD,eAAK,SAAS,OAAO,oBAAC,UAAK,MAAK,gBAAe,GAAG,gBAAgB,GACrE,CACD;AAED,OAAK,cAAc;AAEnB,SAAO;AACT;","names":[]}