import { ReactElement, SVGProps, forwardRef, useMemo } from 'react';

import { useTestIdAttribute } from '../../hooks/useTestIdAttribute';
import { CommonProps, TestIdProps } from '../../types';
import { assertEmptyObject } from '../../utils/assertEmptyObject';

import { ReactComponent as Close } from './assets/actions/close.svg';
import { ReactComponent as CloseCircle } from './assets/actions/close_circle.svg';
import { ReactComponent as Copy } from './assets/actions/copy.svg';
import { ReactComponent as Delete } from './assets/actions/delete.svg';
import { ReactComponent as Edit } from './assets/actions/edit.svg';
import { ReactComponent as Exit } from './assets/actions/exit.svg';
import { ReactComponent as Filter } from './assets/actions/filter.svg';
import { ReactComponent as Minus } from './assets/actions/minus.svg';
import { ReactComponent as MinusCircle } from './assets/actions/minus_circle.svg';
import { ReactComponent as Pause } from './assets/actions/pause.svg';
import { ReactComponent as PauseCircle } from './assets/actions/pause_circle.svg';
import { ReactComponent as Play } from './assets/actions/play.svg';
import { ReactComponent as PlayCircle } from './assets/actions/play_circle.svg';
import { ReactComponent as Plus } from './assets/actions/plus.svg';
import { ReactComponent as PlusCircle } from './assets/actions/plus_circle.svg';
import { ReactComponent as Search } from './assets/actions/search.svg';
import { ReactComponent as Share } from './assets/actions/share.svg';
import { ReactComponent as Sort } from './assets/actions/sort.svg';
import { ReactComponent as Sort19 } from './assets/actions/sort_19.svg';
import { ReactComponent as Sort91 } from './assets/actions/sort_91.svg';
import { ReactComponent as SortAz } from './assets/actions/sort_az.svg';
import { ReactComponent as SortDown } from './assets/actions/sort_down.svg';
import { ReactComponent as SortUp } from './assets/actions/sort_up.svg';
import { ReactComponent as SortZa } from './assets/actions/sort_za.svg';
import { ReactComponent as ArrowCircleDown } from './assets/arrows/arrow_circle_down.svg';
import { ReactComponent as ArrowCircleLeft } from './assets/arrows/arrow_circle_left.svg';
import { ReactComponent as ArrowCircleRight } from './assets/arrows/arrow_circle_right.svg';
import { ReactComponent as ArrowCircleUp } from './assets/arrows/arrow_circle_up.svg';
import { ReactComponent as ArrowDown } from './assets/arrows/arrow_down.svg';
import { ReactComponent as ArrowLeft } from './assets/arrows/arrow_left.svg';
import { ReactComponent as ArrowRight } from './assets/arrows/arrow_right.svg';
import { ReactComponent as ArrowUp } from './assets/arrows/arrow_up.svg';
import { ReactComponent as ChevronDown } from './assets/arrows/chevron_down.svg';
import { ReactComponent as ChevronFilledDown } from './assets/arrows/chevron_filled_down.svg';
import { ReactComponent as ChevronFilledLeft } from './assets/arrows/chevron_filled_left.svg';
import { ReactComponent as ChevronFilledRight } from './assets/arrows/chevron_filled_right.svg';
import { ReactComponent as ChevronFilledUp } from './assets/arrows/chevron_filled_up.svg';
import { ReactComponent as ChevronLeft } from './assets/arrows/chevron_left.svg';
import { ReactComponent as ChevronRight } from './assets/arrows/chevron_right.svg';
import { ReactComponent as ChevronUp } from './assets/arrows/chevron_up.svg';
import { ReactComponent as Expand } from './assets/arrows/expand.svg';
import { ReactComponent as ExpandHorizontal } from './assets/arrows/expand_horizontal.svg';
import { ReactComponent as ExpandVertical } from './assets/arrows/expand_vertical.svg';
import { ReactComponent as Fork } from './assets/arrows/fork.svg';
import { ReactComponent as Merge } from './assets/arrows/merge.svg';
import { ReactComponent as Redo } from './assets/arrows/redo.svg';
import { ReactComponent as Refresh } from './assets/arrows/refresh.svg';
import { ReactComponent as Return } from './assets/arrows/return.svg';
import { ReactComponent as Shrink } from './assets/arrows/shrink.svg';
import { ReactComponent as ShrinkHorizontal } from './assets/arrows/shrink_horizontal.svg';
import { ReactComponent as ShrinkVertical } from './assets/arrows/shrink_vertical.svg';
import { ReactComponent as Sync } from './assets/arrows/sync.svg';
import { ReactComponent as Undo } from './assets/arrows/undo.svg';
import { ReactComponent as Amex } from './assets/billing/amex.svg';
import { ReactComponent as Cheque } from './assets/billing/cheque.svg';
import { ReactComponent as CreditCard } from './assets/billing/credit_card.svg';
import { ReactComponent as Discover } from './assets/billing/discover.svg';
import { ReactComponent as Mastercard } from './assets/billing/mastercard.svg';
import { ReactComponent as Paypal } from './assets/billing/paypal.svg';
import { ReactComponent as Receipt } from './assets/billing/receipt.svg';
import { ReactComponent as Visa } from './assets/billing/visa.svg';
import { ReactComponent as Wallet } from './assets/billing/wallet.svg';
import { ReactComponent as Apple } from './assets/brands/apple.svg';
import { ReactComponent as Facebook } from './assets/brands/facebook.svg';
import { ReactComponent as Google } from './assets/brands/google.svg';
import { ReactComponent as IntercomOutlined } from './assets/brands/intercom_outlined.svg';
import { ReactComponent as Mailchimp } from './assets/brands/mailchimp.svg';
import { ReactComponent as Twitter } from './assets/brands/twitter.svg';
import { ReactComponent as Attachment } from './assets/files/attachment.svg';
import { ReactComponent as Camera } from './assets/files/camera.svg';
import { ReactComponent as File } from './assets/files/file.svg';
import { ReactComponent as FileExcel } from './assets/files/file_excel.svg';
import { ReactComponent as FileSpreadsheet } from './assets/files/file_spreadsheet.svg';
import { ReactComponent as FileUpload } from './assets/files/file_upload.svg';
import { ReactComponent as Folder } from './assets/files/folder.svg';
import { ReactComponent as Image } from './assets/files/image.svg';
import { ReactComponent as Archive } from './assets/messaging/archive.svg';
import { ReactComponent as Autoresponder } from './assets/messaging/autoresponder.svg';
import { ReactComponent as Campaign } from './assets/messaging/campaign.svg';
import { ReactComponent as Email } from './assets/messaging/email.svg';
import { ReactComponent as Field } from './assets/messaging/field.svg';
import { ReactComponent as Inbox } from './assets/messaging/inbox.svg';
import { ReactComponent as MessageNew } from './assets/messaging/message_new.svg';
import { ReactComponent as Messages } from './assets/messaging/messages.svg';
import { ReactComponent as Mms } from './assets/messaging/mms.svg';
import { ReactComponent as MmsReversed } from './assets/messaging/mms_reversed.svg';
import { ReactComponent as Received } from './assets/messaging/received.svg';
import { ReactComponent as Send } from './assets/messaging/send.svg';
import { ReactComponent as Sent } from './assets/messaging/sent.svg';
import { ReactComponent as Sms } from './assets/messaging/sms.svg';
import { ReactComponent as SmsReversed } from './assets/messaging/sms_reversed.svg';
import { ReactComponent as Voice } from './assets/messaging/voice.svg';
import { ReactComponent as Audio } from './assets/options/audio.svg';
import { ReactComponent as Bell } from './assets/options/bell.svg';
import { ReactComponent as BellSlash } from './assets/options/bell_slash.svg';
import { ReactComponent as Lock } from './assets/options/lock.svg';
import { ReactComponent as Mute } from './assets/options/mute.svg';
import { ReactComponent as Preview } from './assets/options/preview.svg';
import { ReactComponent as PreviewOff } from './assets/options/preview_off.svg';
import { ReactComponent as Settings } from './assets/options/settings.svg';
import { ReactComponent as Star } from './assets/options/star.svg';
import { ReactComponent as StarEmpty } from './assets/options/star_empty.svg';
import { ReactComponent as StarHalf } from './assets/options/star_half.svg';
import { ReactComponent as Unlock } from './assets/options/unlock.svg';
import { ReactComponent as ViewDetailed } from './assets/options/view_detailed.svg';
import { ReactComponent as ViewList } from './assets/options/view_list.svg';
import { ReactComponent as ViewTable } from './assets/options/view_table.svg';
import { ReactComponent as Analytics } from './assets/other/analytics.svg';
import { ReactComponent as Asterisk } from './assets/other/asterisk.svg';
import { ReactComponent as Ban } from './assets/other/ban.svg';
import { ReactComponent as Bolt } from './assets/other/bolt.svg';
import { ReactComponent as BoltSolid } from './assets/other/bolt_solid.svg';
import { ReactComponent as Bookmark } from './assets/other/bookmark.svg';
import { ReactComponent as Calendar } from './assets/other/calendar.svg';
import { ReactComponent as Check } from './assets/other/check.svg';
import { ReactComponent as CheckAll } from './assets/other/check_all.svg';
import { ReactComponent as CheckCircle } from './assets/other/check_circle.svg';
import { ReactComponent as Chip } from './assets/other/chip.svg';
import { ReactComponent as Circle } from './assets/other/circle.svg';
import { ReactComponent as CircleSolid } from './assets/other/circle_solid.svg';
import { ReactComponent as Desktop } from './assets/other/desktop.svg';
import { ReactComponent as Download } from './assets/other/download.svg';
import { ReactComponent as Error } from './assets/other/error.svg';
import { ReactComponent as External } from './assets/other/external.svg';
import { ReactComponent as Gauge } from './assets/other/gauge.svg';
import { ReactComponent as Gift } from './assets/other/gift.svg';
import { ReactComponent as Grip } from './assets/other/grip.svg';
import { ReactComponent as GripHorizontal } from './assets/other/grip_horizontal.svg';
import { ReactComponent as Group } from './assets/other/group.svg';
import { ReactComponent as GroupEmpty } from './assets/other/group_empty.svg';
import { ReactComponent as GroupMixed } from './assets/other/group_mixed.svg';
import { ReactComponent as Help } from './assets/other/help.svg';
import { ReactComponent as HelpSolid } from './assets/other/help_solid.svg';
import { ReactComponent as Important } from './assets/other/important.svg';
import { ReactComponent as InfoSolid } from './assets/other/info_solid.svg';
import { ReactComponent as Key } from './assets/other/key.svg';
import { ReactComponent as LampOff } from './assets/other/lamp_off.svg';
import { ReactComponent as LampOn } from './assets/other/lamp_on.svg';
import { ReactComponent as Link } from './assets/other/link.svg';
import { ReactComponent as LinkShorten } from './assets/other/link_shorten.svg';
import { ReactComponent as Location } from './assets/other/location.svg';
import { ReactComponent as Menu } from './assets/other/menu.svg';
import { ReactComponent as Mobile } from './assets/other/mobile.svg';
import { ReactComponent as Moon } from './assets/other/moon.svg';
import { ReactComponent as MoonSolid } from './assets/other/moon_solid.svg';
import { ReactComponent as More } from './assets/other/more.svg';
import { ReactComponent as MoreVert } from './assets/other/more_vert.svg';
import { ReactComponent as Note } from './assets/other/note.svg';
import { ReactComponent as Phone } from './assets/other/phone.svg';
import { ReactComponent as Planet } from './assets/other/planet.svg';
import { ReactComponent as Plug } from './assets/other/plug.svg';
import { ReactComponent as SidebarLeft } from './assets/other/sidebar_left.svg';
import { ReactComponent as SidebarRight } from './assets/other/sidebar_right.svg';
import { ReactComponent as Snooze } from './assets/other/snooze.svg';
import { ReactComponent as Spinner } from './assets/other/spinner.svg';
import { ReactComponent as Sun } from './assets/other/sun.svg';
import { ReactComponent as SunSolid } from './assets/other/sun_solid.svg';
import { ReactComponent as Tablet } from './assets/other/tablet.svg';
import { ReactComponent as Tag } from './assets/other/tag.svg';
import { ReactComponent as Time } from './assets/other/time.svg';
import { ReactComponent as Upload } from './assets/other/upload.svg';
import { ReactComponent as Warning } from './assets/other/warning.svg';
import { ReactComponent as Widgets } from './assets/other/widgets.svg';
import { ReactComponent as FaceFrowning } from './assets/people/face_frowning.svg';
import { ReactComponent as FaceNeutral } from './assets/people/face_neutral.svg';
import { ReactComponent as FaceSmile } from './assets/people/face_smile.svg';
import { ReactComponent as People } from './assets/people/people.svg';
import { ReactComponent as Person } from './assets/people/person.svg';
import { ReactComponent as PersonAdd } from './assets/people/person_add.svg';
import { ReactComponent as PersonCheck } from './assets/people/person_check.svg';
import { ReactComponent as PersonCheckAll } from './assets/people/person_check_all.svg';
import { ReactComponent as PersonInfoPanel } from './assets/people/person_info_panel.svg';
import { ReactComponent as PersonOptout } from './assets/people/person_optout.svg';
import { ReactComponent as PersonRemove } from './assets/people/person_remove.svg';
import { ReactComponent as Table } from './assets/tables/table.svg';
import { ReactComponent as TableColumnsThree } from './assets/tables/table_columns_three.svg';
import { ReactComponent as TableColumnsTwo } from './assets/tables/table_columns_two.svg';
import { ReactComponent as TableRowsThree } from './assets/tables/table_rows_three.svg';
import { ReactComponent as TableRowsTwo } from './assets/tables/table_rows_two.svg';
import { ReactComponent as TableWithHeader } from './assets/tables/table_with_header.svg';
import { ReactComponent as AlignCenter } from './assets/text/align_center.svg';
import { ReactComponent as AlignJustify } from './assets/text/align_justify.svg';
import { ReactComponent as AlignLeft } from './assets/text/align_left.svg';
import { ReactComponent as AlignRight } from './assets/text/align_right.svg';
import { ReactComponent as Bold } from './assets/text/bold.svg';
import { ReactComponent as Code } from './assets/text/code.svg';
import { ReactComponent as Italic } from './assets/text/italic.svg';
import { ReactComponent as ListBullet } from './assets/text/list_bullet.svg';
import { ReactComponent as ListNumbered } from './assets/text/list_numbered.svg';
import { ReactComponent as Quote } from './assets/text/quote.svg';
import { ReactComponent as Strikethrough } from './assets/text/strikethrough.svg';
import { ReactComponent as Underline } from './assets/text/underline.svg';
import { IconGlyph } from './constants';

export type IconProps = CommonProps &
  TestIdProps & {
    ariaLabel?: SVGProps<SVGSVGElement>['aria-label'];
  } & (
    | {
        glyph: IconGlyph;
        glyphElement?: never;
      }
    | {
        glyph?: never;
        glyphElement: ReactElement;
      }
  );

/**
 * Icon that contains some glyph from {@link IconProps.glyph}.
 *
 * ```tsx
 * import { Icon, IconGlyph } from "ui-kit";
 *
 * <Icon glyph={IconGlyph.Sms} />
 * ```
 * ### Available icons
 *
 * <Story id="components-icon--all-icons" />
 */
export const Icon = forwardRef<SVGSVGElement, IconProps>((props, ref) => {
  const { glyph, glyphElement, className, ariaLabel, testId, ariaDescribedBy, ...rest } = props;
  assertEmptyObject(rest);

  const testIdAttribute = useTestIdAttribute();

  const Svg = useMemo(() => {
    switch (glyph) {
      /* istanbul ignore next */
      case IconGlyph.Chip:
        return Chip;
      /* istanbul ignore next */
      case IconGlyph.Amex:
        return Amex;
      /* istanbul ignore next */
      case IconGlyph.Apple:
        return Apple;
      /* istanbul ignore next */
      case IconGlyph.IntercomOutlined:
        return IntercomOutlined;
      /* istanbul ignore next */
      case IconGlyph.Archive:
        return Archive;
      /* istanbul ignore next */
      case IconGlyph.ArrowCircleDown:
        return ArrowCircleDown;
      /* istanbul ignore next */
      case IconGlyph.ArrowCircleLeft:
        return ArrowCircleLeft;
      /* istanbul ignore next */
      case IconGlyph.ArrowCircleRight:
        return ArrowCircleRight;
      /* istanbul ignore next */
      case IconGlyph.ArrowCircleUp:
        return ArrowCircleUp;
      /* istanbul ignore next */
      case IconGlyph.ArrowDown:
        return ArrowDown;
      /* istanbul ignore next */
      case IconGlyph.ArrowLeft:
        return ArrowLeft;
      /* istanbul ignore next */
      case IconGlyph.ArrowRight:
        return ArrowRight;
      /* istanbul ignore next */
      case IconGlyph.ArrowUp:
        return ArrowUp;
      /* istanbul ignore next */
      case IconGlyph.Asterisk:
        return Asterisk;
      /* istanbul ignore next */
      case IconGlyph.Attachment:
        return Attachment;
      /* istanbul ignore next */
      case IconGlyph.Audio:
        return Audio;
      /* istanbul ignore next */
      case IconGlyph.Ban:
        return Ban;
      /* istanbul ignore next */
      case IconGlyph.Bookmark:
        return Bookmark;
      /* istanbul ignore next */
      case IconGlyph.Calendar:
        return Calendar;
      /* istanbul ignore next */
      case IconGlyph.Camera:
        return Camera;
      /* istanbul ignore next */
      case IconGlyph.Check:
        return Check;
      /* istanbul ignore next */
      case IconGlyph.CheckAll:
        return CheckAll;
      /* istanbul ignore next */
      case IconGlyph.CheckCircle:
        return CheckCircle;
      /* istanbul ignore next */
      case IconGlyph.Cheque:
        return Cheque;
      /* istanbul ignore next */
      case IconGlyph.ChevronDown:
        return ChevronDown;
      /* istanbul ignore next */
      case IconGlyph.ChevronLeft:
        return ChevronLeft;
      /* istanbul ignore next */
      case IconGlyph.ChevronRight:
        return ChevronRight;
      /* istanbul ignore next */
      case IconGlyph.ChevronUp:
        return ChevronUp;
      /* istanbul ignore next */
      case IconGlyph.ChevronFilledDown:
        return ChevronFilledDown;
      /* istanbul ignore next */
      case IconGlyph.ChevronFilledLeft:
        return ChevronFilledLeft;
      /* istanbul ignore next */
      case IconGlyph.ChevronFilledRight:
        return ChevronFilledRight;
      /* istanbul ignore next */
      case IconGlyph.ChevronFilledUp:
        return ChevronFilledUp;
      /* istanbul ignore next */
      case IconGlyph.Circle:
        return Circle;
      /* istanbul ignore next */
      case IconGlyph.CircleSolid:
        return CircleSolid;
      /* istanbul ignore next */
      case IconGlyph.Close:
        return Close;
      /* istanbul ignore next */
      case IconGlyph.CloseCircle:
        return CloseCircle;
      /* istanbul ignore next */
      case IconGlyph.Copy:
        return Copy;
      /* istanbul ignore next */
      case IconGlyph.CreditCard:
        return CreditCard;
      /* istanbul ignore next */
      case IconGlyph.Delete:
        return Delete;
      /* istanbul ignore next */
      case IconGlyph.Desktop:
        return Desktop;
      /* istanbul ignore next */
      case IconGlyph.Discover:
        return Discover;
      /* istanbul ignore next */
      case IconGlyph.Download:
        return Download;
      /* istanbul ignore next */
      case IconGlyph.Edit:
        return Edit;
      /* istanbul ignore next */
      case IconGlyph.Email:
        return Email;
      /* istanbul ignore next */
      case IconGlyph.Error:
        return Error;
      /* istanbul ignore next */
      case IconGlyph.Moon:
        return Moon;
      /* istanbul ignore next */
      case IconGlyph.MoonSolid:
        return MoonSolid;
      /* istanbul ignore next */
      case IconGlyph.Exit:
        return Exit;
      /* istanbul ignore next */
      case IconGlyph.External:
        return External;
      /* istanbul ignore next */
      case IconGlyph.Facebook:
        return Facebook;
      /* istanbul ignore next */
      case IconGlyph.Field:
        return Field;
      /* istanbul ignore next */
      case IconGlyph.File:
        return File;
      /* istanbul ignore next */
      case IconGlyph.FileExcel:
        return FileExcel;
      /* istanbul ignore next */
      case IconGlyph.FileSpreadsheet:
        return FileSpreadsheet;
      /* istanbul ignore next */
      case IconGlyph.FileUpload:
        return FileUpload;
      /* istanbul ignore next */
      case IconGlyph.Filter:
        return Filter;
      /* istanbul ignore next */
      case IconGlyph.Folder:
        return Folder;
      /* istanbul ignore next */
      case IconGlyph.Gift:
        return Gift;
      /* istanbul ignore next */
      case IconGlyph.Google:
        return Google;
      /* istanbul ignore next */
      case IconGlyph.Grip:
        return Grip;
      /* istanbul ignore next */
      case IconGlyph.GripHorizontal:
        return GripHorizontal;
      /* istanbul ignore next */
      case IconGlyph.Group:
        return Group;
      /* istanbul ignore next */
      case IconGlyph.GroupEmpty:
        return GroupEmpty;
      /* istanbul ignore next */
      case IconGlyph.GroupMixed:
        return GroupMixed;
      /* istanbul ignore next */
      case IconGlyph.Help:
        return Help;
      /* istanbul ignore next */
      case IconGlyph.HelpSolid:
        return HelpSolid;
      /* istanbul ignore next */
      case IconGlyph.Image:
        return Image;
      /* istanbul ignore next */
      case IconGlyph.Important:
        return Important;
      /* istanbul ignore next */
      case IconGlyph.Inbox:
        return Inbox;
      /* istanbul ignore next */
      case IconGlyph.InfoSolid:
        return InfoSolid;
      /* istanbul ignore next */
      case IconGlyph.LampOff:
        return LampOff;
      /* istanbul ignore next */
      case IconGlyph.LampOn:
        return LampOn;
      /* istanbul ignore next */
      case IconGlyph.Link:
        return Link;
      /* istanbul ignore next */
      case IconGlyph.LinkShorten:
        return LinkShorten;
      /* istanbul ignore next */
      case IconGlyph.Location:
        return Location;
      /* istanbul ignore next */
      case IconGlyph.Lock:
        return Lock;
      /* istanbul ignore next */
      case IconGlyph.Mailchimp:
        return Mailchimp;
      /* istanbul ignore next */
      case IconGlyph.Mastercard:
        return Mastercard;
      /* istanbul ignore next */
      case IconGlyph.Menu:
        return Menu;
      /* istanbul ignore next */
      case IconGlyph.Merge:
        return Merge;
      /* istanbul ignore next */
      case IconGlyph.MessageNew:
        return MessageNew;
      /* istanbul ignore next */
      case IconGlyph.Minus:
        return Minus;
      /* istanbul ignore next */
      case IconGlyph.MinusCircle:
        return MinusCircle;
      /* istanbul ignore next */
      case IconGlyph.Mms:
        return Mms;
      /* istanbul ignore next */
      case IconGlyph.MmsReversed:
        return MmsReversed;
      /* istanbul ignore next */
      case IconGlyph.Mobile:
        return Mobile;
      /* istanbul ignore next */
      case IconGlyph.More:
        return More;
      /* istanbul ignore next */
      case IconGlyph.MoreVert:
        return MoreVert;
      /* istanbul ignore next */
      case IconGlyph.Sun:
        return Sun;
      /* istanbul ignore next */
      case IconGlyph.SunSolid:
        return SunSolid;
      /* istanbul ignore next */
      case IconGlyph.Mute:
        return Mute;
      /* istanbul ignore next */
      case IconGlyph.Analytics:
        return Analytics;
      /* istanbul ignore next */
      case IconGlyph.Plug:
        return Plug;
      /* istanbul ignore next */
      case IconGlyph.Gauge:
        return Gauge;
      /* istanbul ignore next */
      case IconGlyph.Key:
        return Key;
      /* istanbul ignore next */
      case IconGlyph.Bell:
        return Bell;
      /* istanbul ignore next */
      case IconGlyph.BellSlash:
        return BellSlash;
      /* istanbul ignore next */
      case IconGlyph.Pause:
        return Pause;
      /* istanbul ignore next */
      case IconGlyph.PauseCircle:
        return PauseCircle;
      /* istanbul ignore next */
      case IconGlyph.Paypal:
        return Paypal;
      /* istanbul ignore next */
      case IconGlyph.Phone:
        return Phone;
      /* istanbul ignore next */
      case IconGlyph.Planet:
        return Planet;
      /* istanbul ignore next */
      case IconGlyph.Play:
        return Play;
      /* istanbul ignore next */
      case IconGlyph.PlayCircle:
        return PlayCircle;
      /* istanbul ignore next */
      case IconGlyph.Plus:
        return Plus;
      /* istanbul ignore next */
      case IconGlyph.PlusCircle:
        return PlusCircle;
      /* istanbul ignore next */
      case IconGlyph.Preview:
        return Preview;
      /* istanbul ignore next */
      case IconGlyph.PreviewOff:
        return PreviewOff;
      /* istanbul ignore next */
      case IconGlyph.Receipt:
        return Receipt;
      /* istanbul ignore next */
      case IconGlyph.Received:
        return Received;
      /* istanbul ignore next */
      case IconGlyph.Redo:
        return Redo;
      /* istanbul ignore next */
      case IconGlyph.Refresh:
        return Refresh;
      /* istanbul ignore next */
      case IconGlyph.Return:
        return Return;
      /* istanbul ignore next */
      case IconGlyph.Search:
        return Search;
      /* istanbul ignore next */
      case IconGlyph.Autoresponder:
        return Autoresponder;
      /* istanbul ignore next */
      case IconGlyph.Campaign:
        return Campaign;
      /* istanbul ignore next */
      case IconGlyph.Messages:
        return Messages;
      /* istanbul ignore next */
      case IconGlyph.Send:
        return Send;
      /* istanbul ignore next */
      case IconGlyph.Sent:
        return Sent;
      /* istanbul ignore next */
      case IconGlyph.Settings:
        return Settings;
      /* istanbul ignore next */
      case IconGlyph.Share:
        return Share;
      /* istanbul ignore next */
      case IconGlyph.SidebarLeft:
        return SidebarLeft;
      /* istanbul ignore next */
      case IconGlyph.SidebarRight:
        return SidebarRight;
      /* istanbul ignore next */
      case IconGlyph.Note:
        return Note;
      /* istanbul ignore next */
      case IconGlyph.Bolt:
        return Bolt;
      /* istanbul ignore next */
      case IconGlyph.BoltSolid:
        return BoltSolid;
      /* istanbul ignore next */
      case IconGlyph.Sms:
        return Sms;
      /* istanbul ignore next */
      case IconGlyph.SmsReversed:
        return SmsReversed;
      /* istanbul ignore next */
      case IconGlyph.Snooze:
        return Snooze;
      /* istanbul ignore next */
      case IconGlyph.Sort:
        return Sort;
      /* istanbul ignore next */
      case IconGlyph.Sort19:
        return Sort19;
      /* istanbul ignore next */
      case IconGlyph.Sort91:
        return Sort91;
      /* istanbul ignore next */
      case IconGlyph.SortAz:
        return SortAz;
      /* istanbul ignore next */
      case IconGlyph.SortDown:
        return SortDown;
      /* istanbul ignore next */
      case IconGlyph.SortUp:
        return SortUp;
      /* istanbul ignore next */
      case IconGlyph.SortZa:
        return SortZa;
      /* istanbul ignore next */
      case IconGlyph.Spinner:
        return Spinner;
      /* istanbul ignore next */
      case IconGlyph.Star:
        return Star;
      /* istanbul ignore next */
      case IconGlyph.StarEmpty:
        return StarEmpty;
      /* istanbul ignore next */
      case IconGlyph.StarHalf:
        return StarHalf;
      /* istanbul ignore next */
      case IconGlyph.Person:
        return Person;
      /* istanbul ignore next */
      case IconGlyph.PersonAdd:
        return PersonAdd;
      /* istanbul ignore next */
      case IconGlyph.PersonCheck:
        return PersonCheck;
      /* istanbul ignore next */
      case IconGlyph.PersonCheckAll:
        return PersonCheckAll;
      /* istanbul ignore next */
      case IconGlyph.PersonOptout:
        return PersonOptout;
      /* istanbul ignore next */
      case IconGlyph.PersonInfoPanel:
        return PersonInfoPanel;
      /* istanbul ignore next */
      case IconGlyph.PersonRemove:
        return PersonRemove;
      /* istanbul ignore next */
      case IconGlyph.People:
        return People;
      /* istanbul ignore next */
      case IconGlyph.FaceSmile:
        return FaceSmile;
      /* istanbul ignore next */
      case IconGlyph.FaceFrowning:
        return FaceFrowning;
      /* istanbul ignore next */
      case IconGlyph.FaceNeutral:
        return FaceNeutral;
      /* istanbul ignore next */
      case IconGlyph.Sync:
        return Sync;
      /* istanbul ignore next */
      case IconGlyph.Table:
        return Table;
      /* istanbul ignore next */
      case IconGlyph.TableColumnsThree:
        return TableColumnsThree;
      /* istanbul ignore next */
      case IconGlyph.TableColumnsTwo:
        return TableColumnsTwo;
      /* istanbul ignore next */
      case IconGlyph.TableRowsThree:
        return TableRowsThree;
      /* istanbul ignore next */
      case IconGlyph.TableRowsTwo:
        return TableRowsTwo;
      /* istanbul ignore next */
      case IconGlyph.TableWithHeader:
        return TableWithHeader;
      /* istanbul ignore next */
      case IconGlyph.Tablet:
        return Tablet;
      /* istanbul ignore next */
      case IconGlyph.Tag:
        return Tag;
      /* istanbul ignore next */
      case IconGlyph.Time:
        return Time;
      /* istanbul ignore next */
      case IconGlyph.Twitter:
        return Twitter;
      /* istanbul ignore next */
      case IconGlyph.Undo:
        return Undo;
      /* istanbul ignore next */
      case IconGlyph.Expand:
        return Expand;
      /* istanbul ignore next */
      case IconGlyph.Shrink:
        return Shrink;
      /* istanbul ignore next */
      case IconGlyph.ExpandHorizontal:
        return ExpandHorizontal;
      /* istanbul ignore next */
      case IconGlyph.ShrinkHorizontal:
        return ShrinkHorizontal;
      /* istanbul ignore next */
      case IconGlyph.ExpandVertical:
        return ExpandVertical;
      /* istanbul ignore next */
      case IconGlyph.ShrinkVertical:
        return ShrinkVertical;
      /* istanbul ignore next */
      case IconGlyph.Fork:
        return Fork;
      /* istanbul ignore next */
      case IconGlyph.Unlock:
        return Unlock;
      /* istanbul ignore next */
      case IconGlyph.Upload:
        return Upload;
      /* istanbul ignore next */
      case IconGlyph.ViewDetailed:
        return ViewDetailed;
      /* istanbul ignore next */
      case IconGlyph.ViewList:
        return ViewList;
      /* istanbul ignore next */
      case IconGlyph.ViewTable:
        return ViewTable;
      /* istanbul ignore next */
      case IconGlyph.Visa:
        return Visa;
      /* istanbul ignore next */
      case IconGlyph.Voice:
        return Voice;
      /* istanbul ignore next */
      case IconGlyph.Wallet:
        return Wallet;
      /* istanbul ignore next */
      case IconGlyph.Warning:
        return Warning;
      /* istanbul ignore next */
      case IconGlyph.Widgets:
        return Widgets;
      /* istanbul ignore next */
      case IconGlyph.Bold:
        return Bold;
      /* istanbul ignore next */
      case IconGlyph.Italic:
        return Italic;
      /* istanbul ignore next */
      case IconGlyph.Strikethrough:
        return Strikethrough;
      /* istanbul ignore next */
      case IconGlyph.Underline:
        return Underline;
      /* istanbul ignore next */
      case IconGlyph.Code:
        return Code;
      /* istanbul ignore next */
      case IconGlyph.Quote:
        return Quote;
      /* istanbul ignore next */
      case IconGlyph.ListBullet:
        return ListBullet;
      /* istanbul ignore next */
      case IconGlyph.ListNumbered:
        return ListNumbered;
      /* istanbul ignore next */
      case IconGlyph.AlignJustify:
        return AlignJustify;
      /* istanbul ignore next */
      case IconGlyph.AlignLeft:
        return AlignLeft;
      /* istanbul ignore next */
      case IconGlyph.AlignRight:
        return AlignRight;
      /* istanbul ignore next */
      case IconGlyph.AlignCenter:
        return AlignCenter;
      /* istanbul ignore next */
      default:
        return null;
    }
  }, [glyph]);

  if (Svg && glyph) {
    return (
      <Svg
        ref={ref}
        aria-describedby={ariaDescribedBy}
        aria-hidden
        aria-label={ariaLabel}
        className={className}
        data-glyph={glyph}
        fill="currentColor"
        focusable="false"
        role="img"
        {...{ [testIdAttribute]: testId }}
      />
    );
  }

  return glyphElement || null;
});
