@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
1 lines • 14.2 kB
Source Map (JSON)
{"version":3,"file":"Icon.mjs","sourceRoot":"","sources":["../../../src/jsx/components/Icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,yBAAqB;AAEnD,0HAA0H;AAC1H,4DAA4D;AAC5D,MAAM,CAAN,IAAY,QAkRX;AAlRD,WAAY,QAAQ;IAClB,2CAA+B,CAAA;IAC/B,iCAAqB,CAAA;IACrB,gCAAoB,CAAA;IACpB,oCAAwB,CAAA;IACxB,oCAAwB,CAAA;IACxB,uBAAW,CAAA;IACX,qBAAS,CAAA;IACT,8CAAkC,CAAA;IAClC,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,uCAA2B,CAAA;IAC3B,uCAA2B,CAAA;IAC3B,yCAA6B,CAAA;IAC7B,8CAAkC,CAAA;IAClC,mCAAuB,CAAA;IACvB,iDAAqC,CAAA;IACrC,6CAAiC,CAAA;IACjC,iDAAqC,CAAA;IACrC,mDAAuC,CAAA;IACvC,oCAAwB,CAAA;IACxB,0DAA8C,CAAA;IAC9C,oCAAwB,CAAA;IACxB,sCAA0B,CAAA;IAC1B,gCAAoB,CAAA;IACpB,qCAAyB,CAAA;IACzB,uBAAW,CAAA;IACX,wCAA4B,CAAA;IAC5B,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,mCAAuB,CAAA;IACvB,yBAAa,CAAA;IACb,gCAAoB,CAAA;IACpB,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,gCAAoB,CAAA;IACpB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,oCAAwB,CAAA;IACxB,2BAAe,CAAA;IACf,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6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,iDAAqC,CAAA;IACrC,oCAAwB,CAAA;IACxB,6CAAiC,CAAA;IACjC,gCAAoB,CAAA;IACpB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,2BAAe,CAAA;IACf,oCAAwB,CAAA;IACxB,gCAAoB,CAAA;IACpB,sCAA0B,CAAA;IAC1B,0CAA8B,CAAA;IAC9B,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,8CAAkC,CAAA;IAClC,2BAAe,CAAA;IACf,sCAA0B,CAAA;IAC1B,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,oCAAwB,CAAA;IACxB,6CAAiC,CAAA;IACjC,mDAAuC,CAAA;IACvC,sCAA0B,CAAA;IAC1B,yBAAa,CAAA;IACb,8CAAkC,CAAA;IAClC,iCAAqB,CAAA;IACrB,iCAAqB,CAAA;IACrB,sCAA0B,CAAA;IAC1B,mCAAuB,CAAA;IACvB,oCAAwB,CAAA;IACxB,kCAAsB,CAAA;IACtB,0CAA8B,CAAA;IAC9B,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;IACnB,sCAA0B,CAAA;IAC1B,+BAAmB,CAAA;IACnB,gCAAoB,CAAA;IACpB,yBAAa,CAAA;IACb,mBAAO,CAAA;AACT,CAAC,EAlRW,QAAQ,KAAR,QAAQ,QAkRnB;AA2BD,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,mBAAmB,CAAyB,IAAI,CAAC,CAAC","sourcesContent":["import { createSnapComponent } from '../component';\n\n// Copied from https://github.com/MetaMask/metamask-extension/blob/main/ui/components/component-library/icon/icon.types.ts\n// Currently requires manual syncing when new icon is added.\nexport enum IconName {\n Accessibility = 'accessibility',\n Activity = 'activity',\n AddCard = 'add-card',\n AddCircle = 'add-circle',\n AddSquare = 'add-square',\n Add = 'add',\n Ai = 'ai',\n AlternateEmail = 'alternate-email',\n Apple = 'apple',\n Apps = 'apps',\n Arrow2Down = 'arrow-2-down',\n Arrow2Left = 'arrow-2-left',\n Arrow2Right = 'arrow-2-right',\n Arrow2UpRight = 'arrow-2-up-right',\n Arrow2Up = 'arrow-2-up',\n ArrowCircleDown = 'arrow-circle-down',\n ArrowCircleUp = 'arrow-circle-up',\n ArrowDoubleLeft = 'arrow-double-left',\n ArrowDoubleRight = 'arrow-double-right',\n ArrowDown = 'arrow-down',\n ArrowDropDownCircle = 'arrow-drop-down-circle',\n ArrowLeft = 'arrow-left',\n ArrowRight = 'arrow-right',\n ArrowUp = 'arrow-up',\n Attachment = 'attachment',\n Ban = 'ban',\n BankAssured = 'bank-assured',\n Bank = 'bank',\n Bold = 'bold',\n Book = 'book',\n Bookmark = 'bookmark',\n Bridge = 'bridge',\n Briefcase = 'briefcase',\n Bulb = 'bulb',\n BuySell = 'buy-sell',\n Cake = 'cake',\n Calculator = 'calculator',\n Calendar = 'calendar',\n Call = 'call',\n Camera = 'camera',\n Campaign = 'campaign',\n CardPos = 'card-pos',\n Card = 'card',\n Cash = 'cash',\n Category = 'category',\n Chart = 'chart',\n CheckBold = 'check-bold',\n Check = 'check',\n CircleX = 'circle-x',\n ClockFilled = 'clock-filled',\n Clock = 'clock',\n Close = 'close',\n CloudDownload = 'cloud-download',\n CloudUpload = 'cloud-upload',\n Cloud = 'cloud',\n CodeCircle = 'code-circle',\n Code = 'code',\n Coin = 'coin',\n Collapse = 'collapse',\n Confirmation = 'confirmation',\n Connect = 'connect',\n CopySuccess = 'copy-success',\n Copy = 'copy',\n CreditCheck = 'credit-check',\n CurrencyFranc = 'currency-franc',\n CurrencyLira = 'currency-lira',\n CurrencyPound = 'currency-pound',\n CurrencyYuan = 'currency-yuan',\n Customize = 'customize',\n Danger = 'danger',\n DarkFilled = 'dark-filled',\n Dark = 'dark',\n Data = 'data',\n Description = 'description',\n Details = 'details',\n Diagram = 'diagram',\n DocumentCode = 'document-code',\n Download = 'download',\n Draft = 'draft',\n EcoLeaf = 'eco-leaf',\n EditSquare = 'edit-square',\n Edit = 'edit',\n EncryptedAdd = 'encrypted-add',\n Eraser = 'eraser',\n Error = 'error',\n Ethereum = 'ethereum',\n Exchange = 'exchange',\n ExpandVertical = 'expand-vertical',\n Expand = 'expand',\n ExploreFilled = 'explore-filled',\n Explore = 'explore',\n Export = 'export',\n Extension = 'extension',\n EyeSlash = 'eye-slash',\n Eye = 'eye',\n FaceId = 'face-id',\n Feedback = 'feedback',\n File = 'file',\n Filter = 'filter',\n Fingerprint = 'fingerprint',\n Fire = 'fire',\n FirstPage = 'first-page',\n Flag = 'flag',\n FlashSlash = 'flash-slash',\n Flash = 'flash',\n Flask = 'flask',\n Flower = 'flower',\n Folder = 'folder',\n Forest = 'forest',\n FullCircle = 'full-circle',\n Gas = 'gas',\n Gift = 'gift',\n GlobalSearch = 'global-search',\n Global = 'global',\n Graph = 'graph',\n Hardware = 'hardware',\n HashTag = 'hash-tag',\n HeartFilled = 'heart-filled',\n Heart = 'heart',\n Hierarchy = 'hierarchy',\n HomeFilled = 'home-filled',\n Home = 'home',\n Image = 'image',\n Info = 'info',\n Inventory = 'inventory',\n Joystick = 'joystick',\n KeepFilled = 'keep-filled',\n Keep = 'keep',\n Key = 'key',\n LastPage = 'last-page',\n LightFilled = 'light-filled',\n Light = 'light',\n Link = 'link',\n Loading = 'loading',\n Location = 'location',\n LockSlash = 'lock-slash',\n Lock = 'lock',\n LockedFilled = 'locked-filled',\n Login = 'login',\n Logout = 'logout',\n Mail = 'mail',\n Map = 'map',\n Menu = 'menu',\n MessageQuestion = 'message-question',\n Messages = 'messages',\n Mic = 'mic',\n MinusBold = 'minus-bold',\n MinusSquare = 'minus-square',\n Minus = 'minus',\n Mobile = 'mobile',\n MoneyBag = 'money-bag',\n Money = 'money',\n Monitor = 'monitor',\n MoreHorizontal = 'more-horizontal',\n MoreVertical = 'more-vertical',\n MountainFlag = 'mountain-flag',\n MusicNote = 'music-note',\n Notification = 'notification',\n PageInfo = 'page-info',\n Palette = 'palette',\n PasswordCheck = 'password-check',\n Pending = 'pending',\n People = 'people',\n PersonCancel = 'person-cancel',\n Pin = 'pin',\n Plant = 'plant',\n Plug = 'plug',\n PlusAndMinus = 'plus-and-minus',\n PolicyAlert = 'policy-alert',\n Print = 'print',\n PriorityHigh = 'priority-high',\n PrivacyTip = 'privacy-tip',\n ProgrammingArrows = 'programming-arrows',\n Publish = 'publish',\n QrCode = 'qr-code',\n Question = 'question',\n Receive = 'receive',\n Received = 'received',\n Refresh = 'refresh',\n RemoveMinus = 'remove-minus',\n Report = 'report',\n Rocket = 'rocket',\n SaveFilled = 'save-filled',\n Save = 'save',\n Saving = 'saving',\n ScanBarcode = 'scan-barcode',\n ScanFocus = 'scan-focus',\n Scan = 'scan',\n Search = 'search',\n SecurityAlert = 'security-alert',\n SecurityCross = 'security-cross',\n SecurityKey = 'security-key',\n SecuritySearch = 'security-search',\n SecuritySlash = 'security-slash',\n SecurityTick = 'security-tick',\n SecurityTime = 'security-time',\n SecurityUser = 'security-user',\n Security = 'security',\n Send = 'send',\n SentimentDissatisfied = 'sentiment-dissatisfied',\n SentimentNeutral = 'sentiment-neutral',\n SentimentSatisfied = 'sentiment-satisfied',\n SentimentVerySatisfied = 'sentiment-very-satisfied',\n SettingFilled = 'setting-filled',\n Setting = 'setting',\n Share = 'share',\n ShieldLock = 'shield-lock',\n ShoppingBag = 'shopping-bag',\n ShoppingCart = 'shopping-cart',\n SignalCellular = 'signal-cellular',\n Slash = 'slash',\n Sms = 'sms',\n SnapsMobile = 'snaps-mobile',\n SnapsPlus = 'snaps-plus',\n SnapsRound = 'snaps-round',\n Snaps = 'snaps',\n SortByAlpha = 'sort-by-alpha',\n Sort = 'sort',\n Sparkle = 'sparkle',\n Speed = 'speed',\n Speedometer = 'speedometer',\n Square = 'square',\n Stake = 'stake',\n StarFilled = 'star-filled',\n Star = 'star',\n Start = 'start',\n Storefront = 'storefront',\n Student = 'student',\n SwapHorizontal = 'swap-horizontal',\n SwapVertical = 'swap-vertical',\n TabClose = 'tab-close',\n TableRow = 'table-row',\n Tablet = 'tablet',\n Tag = 'tag',\n ThumbDownFilled = 'thumb-down-filled',\n ThumbDown = 'thumb-down',\n ThumbUpFilled = 'thumb-up-filled',\n ThumbUp = 'thumb-up',\n Tint = 'tint',\n Tooltip = 'tooltip',\n Translate = 'translate',\n Trash = 'trash',\n TrendDown = 'trend-down',\n TrendUp = 'trend-up',\n TriangleUp = 'triangle-up',\n TriangleDown = 'triangle-down',\n Undo = 'undo',\n Unfold = 'unfold',\n UnlockedFilled = 'unlocked-filled',\n Unpin = 'unpin',\n UploadFile = 'upload-file',\n Upload = 'upload',\n Usb = 'usb',\n UserCheck = 'user-check',\n UserCircleAdd = 'user-circle-add',\n UserCircleRemove = 'user-circle-remove',\n UserCircle = 'user-circle',\n User = 'user',\n VerifiedFilled = 'verified-filled',\n Verified = 'verified',\n Videocam = 'videocam',\n ViewColumn = 'view-column',\n ViewInAr = 'view-in-ar',\n VolumeOff = 'volume-off',\n VolumeUp = 'volume-up',\n WalletFilled = 'wallet-filled',\n Wallet = 'wallet',\n Warning = 'warning',\n WebTraffic = 'web-traffic',\n Widgets = 'widgets',\n WifiOff = 'wifi-off',\n Wifi = 'wifi',\n X = 'x',\n}\n\n/**\n * The colors available to the {@link Link} component.\n */\nexport type IconColor =\n | 'default'\n | 'primary'\n | 'muted'\n | 'error'\n | 'success'\n | 'warning';\n\n/**\n * The props of the {@link Icon} component.\n *\n * @property name - The name of the icon to display from a pre-defined list.\n * @property color - The color of the displayed icon.\n * @property size - The size of the displayed icon. Use `inherit` to size it the same as the text.\n * @category Component Props\n */\nexport type IconProps = {\n name: `${IconName}`;\n color?: IconColor | undefined;\n size?: 'md' | 'inherit' | undefined;\n};\n\nconst TYPE = 'Icon';\n\n/**\n * An icon component which is used to display an icon from a pre-defined list.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the icon to display from a pre-defined list.\n * @param props.color - The color of the displayed icon.\n * @param props.size - The size of the displayed icon. Use `inherit` to size it the same as the text.\n * @returns An icon element.\n * @example\n * <Icon name=\"warning\" color=\"warning\" size=\"md\" />\n * @category Components\n */\nexport const Icon = createSnapComponent<IconProps, typeof TYPE>(TYPE);\n\n/**\n * An icon element.\n *\n * @see {@link Icon}\n * @category Elements\n */\nexport type IconElement = ReturnType<typeof Icon>;\n"]}