import React, { forwardRef, Ref } from "react"; // import { ReactComponent as DeleteIcon } from "assets/icons/ads/delete.svg"; import { ReactComponent as BookLineIcon } from "assets/icons/ads/book-open-line.svg"; import { ReactComponent as BugIcon } from "assets/icons/ads/bug.svg"; import { ReactComponent as CancelIcon } from "assets/icons/ads/cancel.svg"; // import { ReactComponent as ExpandMore } from "assets/icons/ads/expand-more.svg"; import { ReactComponent as CrossIcon } from "assets/icons/ads/cross.svg"; import { ReactComponent as Fork2Icon } from "assets/icons/ads/fork-2.svg"; import { ReactComponent as OpenIcon } from "assets/icons/ads/open.svg"; import { ReactComponent as UserIcon } from "assets/icons/ads/user.svg"; import { ReactComponent as GeneralIcon } from "assets/icons/ads/general.svg"; import { ReactComponent as BillingIcon } from "assets/icons/ads/billing.svg"; import { ReactComponent as ErrorIcon } from "assets/icons/ads/error.svg"; import { ReactComponent as ShineIcon } from "assets/icons/ads/shine.svg"; import { ReactComponent as SuccessIcon } from "assets/icons/ads/success.svg"; import SearchIcon from "remixicon-react/SearchLineIcon"; import { ReactComponent as CloseIcon } from "assets/icons/ads/close.svg"; // import { ReactComponent as WarningIcon } from "assets/icons/ads/warning.svg"; import { ReactComponent as WarningTriangleIcon } from "assets/icons/ads/warning-triangle.svg"; import { ReactComponent as ShareIcon2 } from "assets/icons/ads/share-2.svg"; import { ReactComponent as InviteUserIcon } from "assets/icons/ads/invite-users.svg"; // import { ReactComponent as ViewAllIcon } from "assets/icons/ads/view-all.svg"; // import { ReactComponent as ViewLessIcon } from "assets/icons/ads/view-less.svg"; // import { ReactComponent as DuplicateIcon } from "assets/icons/ads/duplicate.svg"; // import { ReactComponent as LogoutIcon } from "assets/icons/ads/logout.svg"; import { ReactComponent as ManageIcon } from "assets/icons/ads/manage.svg"; import { ReactComponent as ArrowLeft } from "assets/icons/ads/arrow-left.svg"; // import { ReactComponent as Fork } from "assets/icons/ads/fork.svg"; import { ReactComponent as ChevronLeft } from "assets/icons/ads/chevron_left.svg"; import { ReactComponent as LinkIcon } from "assets/icons/ads/link.svg"; // import { ReactComponent as CloseModalIcon } from "assets/icons/ads/close-modal.svg"; import { ReactComponent as NoResponseIcon } from "assets/icons/ads/no-response.svg"; import { ReactComponent as LightningIcon } from "assets/icons/ads/lightning.svg"; // import { ReactComponent as AddMoreIcon } from "assets/icons/ads/add-more.svg"; // import { ReactComponent as RightArrowIcon } from "assets/icons/ads/right-arrow.svg"; import { ReactComponent as TrendingFlat } from "assets/icons/ads/trending-flat.svg"; // import { ReactComponent as DatasourceIcon } from "assets/icons/ads/datasource.svg"; import { ReactComponent as PlayIcon } from "assets/icons/ads/play.svg"; import { ReactComponent as DesktopIcon } from "assets/icons/ads/desktop.svg"; import { ReactComponent as WandIcon } from "assets/icons/ads/wand.svg"; import { ReactComponent as MobileIcon } from "assets/icons/ads/mobile.svg"; import { ReactComponent as TabletIcon } from "assets/icons/ads/tablet.svg"; import { ReactComponent as FluidIcon } from "assets/icons/ads/fluid.svg"; import { ReactComponent as CardContextMenu } from "assets/icons/ads/card-context-menu.svg"; import { ReactComponent as SendButton } from "assets/icons/comments/send-button.svg"; import { ReactComponent as Pin } from "assets/icons/comments/pin.svg"; import { ReactComponent as TrashOutline } from "assets/icons/form/trash.svg"; import { ReactComponent as ReadPin } from "assets/icons/comments/read-pin.svg"; import { ReactComponent as UnreadPin } from "assets/icons/comments/unread-pin.svg"; // import { ReactComponent as DownArrow2 } from "assets/icons/comments/down-arrow.svg"; import { ReactComponent as Chat } from "assets/icons/comments/chat.svg"; import { ReactComponent as Unpin } from "assets/icons/comments/unpinIcon.svg"; import { ReactComponent as Reaction } from "assets/icons/comments/reaction.svg"; import { ReactComponent as Reaction2 } from "assets/icons/comments/reaction-2.svg"; import { ReactComponent as Upload } from "assets/icons/ads/upload.svg"; // import { ReactComponent as Download } from "assets/icons/ads/download.svg"; import { ReactComponent as ArrowForwardIcon } from "assets/icons/control/arrow_forward.svg"; import { ReactComponent as DoubleArrowRightIcon } from "assets/icons/ads/double-arrow-right.svg"; import { ReactComponent as CapSolidIcon } from "assets/icons/control/cap_solid.svg"; import { ReactComponent as CapDotIcon } from "assets/icons/control/cap_dot.svg"; import { ReactComponent as LineDottedIcon } from "assets/icons/control/line_dotted.svg"; import { ReactComponent as LineDashedIcon } from "assets/icons/control/line_dashed.svg"; import { ReactComponent as TableIcon } from "assets/icons/ads/tables.svg"; import { ReactComponent as ColumnIcon } from "assets/icons/ads/column.svg"; import { ReactComponent as GearIcon } from "assets/icons/ads/gear.svg"; import { ReactComponent as UserV2Icon } from "assets/icons/ads/user-v2.svg"; import { ReactComponent as SupportIcon } from "assets/icons/ads/support.svg"; import { ReactComponent as Snippet } from "assets/icons/ads/snippet.svg"; import { ReactComponent as WorkspaceIcon } from "assets/icons/ads/organizationIcon.svg"; import { ReactComponent as SettingIcon } from "assets/icons/control/settings.svg"; import { ReactComponent as DropdownIcon } from "assets/icons/ads/dropdown.svg"; import { ReactComponent as ChatIcon } from "assets/icons/ads/app-icons/chat.svg"; import styled from "styled-components"; import { CommonComponentProps, Classes } from "./common"; import { noop } from "lodash"; import { theme } from "constants/DefaultTheme"; import Spinner from "./Spinner"; import { ControlIcons } from "icons/ControlIcons"; // remix icons import AddMoreIcon from "remixicon-react/AddCircleLineIcon"; import AddMoreFillIcon from "remixicon-react/AddCircleFillIcon"; // import AlertFillIcon from "remixicon-react/AlertFillIcon"; import ArrowLeftRightIcon from "remixicon-react/ArrowLeftRightLineIcon"; import ArrowDownLineIcon from "remixicon-react/ArrowDownLineIcon"; import BookIcon from "remixicon-react/BookOpenLineIcon"; import ChevronRight from "remixicon-react/ArrowRightSFillIcon"; import CheckLineIcon from "remixicon-react/CheckLineIcon"; import CloseLineIcon from "remixicon-react/CloseLineIcon"; import CloseCircleIcon from "remixicon-react/CloseCircleFillIcon"; import CommentContextMenu from "remixicon-react/More2FillIcon"; import CompassesLine from "remixicon-react/CompassesLineIcon"; import ContextMenuIcon from "remixicon-react/MoreFillIcon"; import CreateNewIcon from "remixicon-react/AddLineIcon"; import Database2Line from "remixicon-react/Database2LineIcon"; import DatasourceIcon from "remixicon-react/CloudFillIcon"; import DeleteBin7 from "remixicon-react/DeleteBin7LineIcon"; import DiscordIcon from "remixicon-react/DiscordLineIcon"; import DownArrow from "remixicon-react/ArrowDownSFillIcon"; import Download from "remixicon-react/DownloadCloud2LineIcon"; import DuplicateIcon from "remixicon-react/FileCopyLineIcon"; import EditIcon from "remixicon-react/PencilFillIcon"; import EditLineIcon from "remixicon-react/EditLineIcon"; import Emoji from "remixicon-react/EmotionLineIcon"; import ExpandMore from "remixicon-react/ArrowDownSLineIcon"; import ExpandLess from "remixicon-react/ArrowUpSLineIcon"; import EyeOn from "remixicon-react/EyeLineIcon"; import EyeOff from "remixicon-react/EyeOffLineIcon"; import FileTransfer from "remixicon-react/FileTransferLineIcon"; import FileLine from "remixicon-react/FileLineIcon"; import Filter from "remixicon-react/Filter2FillIcon"; import GitMerge from "remixicon-react/GitMergeLineIcon"; import GitCommit from "remixicon-react/GitCommitLineIcon"; import GitPullRequst from "remixicon-react/GitPullRequestLineIcon"; import GuideIcon from "remixicon-react/GuideFillIcon"; import HelpIcon from "remixicon-react/QuestionMarkIcon"; // import HelpFillIcon from "remixicon-react/QuestionFillIcon"; import LightbulbFlashLine from "remixicon-react/LightbulbFlashLineIcon"; import InfoIcon from "remixicon-react/InformationLineIcon"; import KeyIcon from "remixicon-react/Key2LineIcon"; import LeftArrowIcon2 from "remixicon-react/ArrowLeftSLineIcon"; import Link2 from "remixicon-react/LinkIcon"; import LeftArrowIcon from "remixicon-react/ArrowLeftLineIcon"; import More2FillIcon from "remixicon-react/More2FillIcon"; import NewsPaperLine from "remixicon-react/NewspaperLineIcon"; import OvalCheck from "remixicon-react/CheckboxCircleLineIcon"; import OvalCheckFill from "remixicon-react/CheckboxCircleFillIcon"; import Pin3 from "remixicon-react/Pushpin2FillIcon"; import QueryIcon from "remixicon-react/CodeSSlashLineIcon"; import RightArrowIcon from "remixicon-react/ArrowRightLineIcon"; import RightArrowIcon2 from "remixicon-react/ArrowRightSLineIcon"; import RocketIcon from "remixicon-react/RocketLineIcon"; import ShareBoxFillIcon from "remixicon-react/ShareBoxFillIcon"; import ShareForwardIcon from "remixicon-react/ShareForwardFillIcon"; import Trash from "remixicon-react/DeleteBinLineIcon"; import UpArrow from "remixicon-react/ArrowUpSFillIcon"; import WarningIcon from "remixicon-react/ErrorWarningFillIcon"; import WarningLineIcon from "remixicon-react/ErrorWarningLineIcon"; import EditUnderlineIcon from "remixicon-react/EditLineIcon"; import LogoutIcon from "remixicon-react/LogoutBoxRLineIcon"; import ShareLineIcon from "remixicon-react/ShareLineIcon"; import DownArrowIcon from "remixicon-react/ArrowDownSLineIcon"; import LoaderLineIcon from "remixicon-react/LoaderLineIcon"; import WidgetIcon from "remixicon-react/FunctionLineIcon"; import RefreshLineIcon from "remixicon-react/RefreshLineIcon"; import GitBranchLineIcon from "remixicon-react/GitBranchLineIcon"; import EditBoxLineIcon from "remixicon-react/EditBoxLineIcon"; import StarLineIcon from "remixicon-react/StarLineIcon"; import StarFillIcon from "remixicon-react/StarFillIcon"; import Settings2LineIcon from "remixicon-react/Settings2LineIcon"; import UploadCloud2LineIcon from "remixicon-react/UploadCloud2LineIcon"; import DownloadLineIcon from "remixicon-react/DownloadLineIcon"; import FileListLineIcon from "remixicon-react/FileListLineIcon"; import HamburgerIcon from "remixicon-react/MenuLineIcon"; import MagicLineIcon from "remixicon-react/MagicLineIcon"; import UserHeartLineIcon from "remixicon-react/UserHeartLineIcon"; export enum IconSize { XXS = "extraExtraSmall", XS = "extraSmall", SMALL = "small", MEDIUM = "medium", LARGE = "large", XL = "extraLarge", XXL = "extraExtraLarge", XXXL = "extraExtraExtraLarge", XXXXL = "extraExtraExtraExtraLarge", } const ICON_SIZE_LOOKUP = { [IconSize.XXS]: theme.iconSizes.XXS, [IconSize.XS]: theme.iconSizes.XS, [IconSize.SMALL]: theme.iconSizes.SMALL, [IconSize.MEDIUM]: theme.iconSizes.MEDIUM, [IconSize.LARGE]: theme.iconSizes.LARGE, [IconSize.XL]: theme.iconSizes.XL, [IconSize.XXL]: theme.iconSizes.XXL, [IconSize.XXXL]: theme.iconSizes.XXXL, [IconSize.XXXXL]: theme.iconSizes.XXXXL, undefined: theme.iconSizes.SMALL, }; export const sizeHandler = (size?: IconSize): number => { return ( ICON_SIZE_LOOKUP[size as keyof typeof ICON_SIZE_LOOKUP] || theme.iconSizes.SMALL ); }; export const IconWrapper = styled.span` &:focus { outline: none; } display: flex; align-items: center; svg { width: ${(props) => sizeHandler(props.size)}px; height: ${(props) => sizeHandler(props.size)}px; ${(props) => !props.keepColors ? ` fill: ${props.fillColor || ""}; circle { fill: ${props.fillColor || ""}; } path { fill: ${props.fillColor || ""}; } ` : ""}; ${(props) => (props.invisible ? `visibility: hidden;` : null)}; &:hover { cursor: ${(props) => (props.clickable ? "pointer" : "default")}; ${(props) => !props.keepColors ? ` fill: ${props.hoverFillColor || ""}; path { fill: ${props.hoverFillColor || ""}; } ` : ""} } } `; function getControlIcon(iconName: string) { const ControlIcon = ControlIcons[iconName]; return ; } const ICON_LOOKUP = { undefined: null, HEADING_ONE: getControlIcon("HEADING_ONE"), HEADING_THREE: getControlIcon("HEADING_THREE"), HEADING_TWO: getControlIcon("HEADING_TWO"), PARAGRAPH: getControlIcon("PARAGRAPH"), PARAGRAPH_TWO: getControlIcon("PARAGRAPH_TWO"), "add-more": , "add-more-fill": , "arrow-forward": , "arrow-left": , "book-line": , "cap-dot": , "cap-solid": , "card-context-menu": , "check-line": , "chevron-left": , "chevron-right": , "close-circle": , "close-modal": , "close-x": , "comment-context-menu": , "compasses-line": , "context-menu": , "database-2-line": , "delete-blank": , "double-arrow-right": , "down-arrow": , "down-arrow-2": , "download-line": , "edit-box-line": , "edit-line": , "edit-underline": , "expand-less": , "expand-more": , "eye-off": , "eye-on": , "file-line": , "file-list-line": , "fork-2": , "file-transfer": , "git-branch": , "git-commit": , "git-pull-request": , "invite-user": , "left-arrow-2": , "lightbulb-flash-line": , "line-dashed": , "line-dotted": , "link-2": , "magic-line": , "more-2-fill": , "news-paper": , "no-response": , "oval-check": , "oval-check-fill": , "pin-3": , "reaction-2": , "read-pin": , "right-arrow": , "right-arrow-2": , "send-button": , "settings-2-line": , "share-2": , "share-box": , "share-line": , "star-fill": , "star-line": , "swap-horizontal": , "trash-outline": , "trending-flat": , "unread-pin": , "upload-cloud": , "user-2": , "user-heart-line": , "view-all": , "view-less": , "warning-line": , "warning-triangle": , "chat-help": , billing: , book: , bug: , cancel: , chat: , close: , column: , cross: , danger: , datasource: , delete: , desktop: , discord: , downArrow: , download: , dropdown: , duplicate: , edit: , emoji: , enterprise: , error: , filter: , fluid: , fork: , gear: , general: , guide: , hamburger: , help: , info: , key: , lightning: , link: , loader: , logout: , manage: , member: , mobile: , open: , pin: , play: , plus: , query: , reaction: , refresh: , rocket: , search: , setting: , share: , shine: , snippet: , success: , support: , tables: , tablet: , trash: , unpin: , upArrow: , upload: , user: , wand: , warning: , widget: , workspace: , }; export const IconCollection = Object.keys(ICON_LOOKUP); export type IconName = typeof IconCollection[number]; export type IconProps = { size?: IconSize; name?: IconName; invisible?: boolean; className?: string; onClick?: (e: React.MouseEvent) => void; fillColor?: string; hoverFillColor?: string; keepColors?: boolean; loaderWithIconWrapper?: boolean; clickable?: boolean; }; const Icon = forwardRef( (props: IconProps & CommonComponentProps, ref: Ref) => { const iconName = props.name; const returnIcon = ICON_LOOKUP[iconName as keyof typeof ICON_LOOKUP] || null; const clickable = props.clickable === undefined ? true : props.clickable; let loader = ; if (props.loaderWithIconWrapper) { loader = ( ); } return returnIcon && !props.isLoading ? ( {returnIcon} ) : props.isLoading ? ( loader ) : null; }, ); Icon.displayName = "Icon"; export default Icon;