233 lines · 8.4 KBRaw
| 1 | import { |
| 2 | ArrowLeft, |
| 3 | ArrowLeftRight, |
| 4 | ArrowRight, |
| 5 | AtSign, |
| 6 | BookOpen, |
| 7 | Bot, |
| 8 | Box, |
| 9 | Building2, |
| 10 | Calendar, |
| 11 | ChartLine, |
| 12 | Check, |
| 13 | ChevronDown, |
| 14 | ChevronLeft, |
| 15 | ChevronRight, |
| 16 | ChevronsUpDown, |
| 17 | CircleAlert, |
| 18 | CircleCheck, |
| 19 | CircleDashed, |
| 20 | CircleMinus, |
| 21 | CircleStop, |
| 22 | CircleDot, |
| 23 | CircleQuestionMark, |
| 24 | CircleUserRound, |
| 25 | CircleX, |
| 26 | Clock, |
| 27 | Compass, |
| 28 | Copy, |
| 29 | CornerDownRight, |
| 30 | Database, |
| 31 | Ellipsis, |
| 32 | File, |
| 33 | FileCode, |
| 34 | FileQuestionMark, |
| 35 | Folder, |
| 36 | GitBranch, |
| 37 | GitCommitHorizontal, |
| 38 | GitCompare, |
| 39 | GitFork, |
| 40 | GitMerge, |
| 41 | GitPullRequest, |
| 42 | HardDrive, |
| 43 | History, |
| 44 | Hourglass, |
| 45 | House, |
| 46 | Info, |
| 47 | KeyRound, |
| 48 | Layers, |
| 49 | ListChecks, |
| 50 | LoaderCircle, |
| 51 | Lock, |
| 52 | LogOut, |
| 53 | Mail, |
| 54 | Menu, |
| 55 | MessageCircle, |
| 56 | Monitor, |
| 57 | Moon, |
| 58 | Network, |
| 59 | PanelLeft, |
| 60 | Pencil, |
| 61 | Play, |
| 62 | Plug, |
| 63 | Plus, |
| 64 | Radio, |
| 65 | RefreshCw, |
| 66 | RotateCcw, |
| 67 | RotateCw, |
| 68 | Route, |
| 69 | Settings, |
| 70 | ShieldAlert, |
| 71 | ShieldCheck, |
| 72 | SquareCheck, |
| 73 | SquareTerminal, |
| 74 | Sun, |
| 75 | Tag, |
| 76 | Timer, |
| 77 | Trash2, |
| 78 | TriangleAlert, |
| 79 | Type, |
| 80 | UserRound, |
| 81 | UsersRound, |
| 82 | X, |
| 83 | Zap, |
| 84 | ChevronUp, |
| 85 | Maximize2, |
| 86 | Minimize2, |
| 87 | Minus, |
| 88 | Redo2, |
| 89 | Scan, |
| 90 | Search, |
| 91 | Undo2, |
| 92 | type LucideIcon, |
| 93 | } from "lucide-react"; |
| 94 | import { useId, type ReactElement, type ReactNode, type SVGProps } from "react"; |
| 95 | |
| 96 | /** |
| 97 | * The refs icon set. Every icon in the product comes from this file, so the set can change in one place. |
| 98 | * The glyphs are Lucide outlines, drawn with `currentColor` at one optical weight: a 1.5px stroke at every |
| 99 | * size (see `.lucide` in styles.css). `bold` is for emphasis, and `fill` is the solid form of a status mark. |
| 100 | */ |
| 101 | export interface IconProps extends Omit<SVGProps<SVGSVGElement>, "ref"> { |
| 102 | /** A number is pixels. The default follows the text size. */ |
| 103 | size?: number | string; |
| 104 | weight?: "regular" | "bold" | "fill"; |
| 105 | } |
| 106 | |
| 107 | export type Icon = (props: IconProps) => ReactElement; |
| 108 | |
| 109 | function outline(Glyph: LucideIcon, Solid?: Icon): Icon { |
| 110 | return function OutlineIcon({ size = "1em", weight = "regular", ...props }) { |
| 111 | if (weight === "fill" && Solid) return <Solid size={size} {...props} />; |
| 112 | return <Glyph size={size} data-weight={weight === "regular" ? undefined : weight} {...props} />; |
| 113 | }; |
| 114 | } |
| 115 | |
| 116 | /** A solid disc with its mark cut out, so the surface behind shows through in any theme. */ |
| 117 | function disc(mark: ReactNode): Icon { |
| 118 | return function SolidIcon({ size = "1em", weight: _weight, className, ...props }) { |
| 119 | const mask = useId(); |
| 120 | return ( |
| 121 | <svg width={size} height={size} viewBox="0 0 24 24" fill="none" aria-hidden={props["aria-label"] ? undefined : true} className={`shrink-0 ${className ?? ""}`} {...props}> |
| 122 | <mask id={mask}> |
| 123 | <rect width="24" height="24" fill="#fff" /> |
| 124 | <g stroke="#000" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"> |
| 125 | {mark} |
| 126 | </g> |
| 127 | </mask> |
| 128 | <circle cx="12" cy="12" r="10.5" fill="currentColor" mask={`url(#${mask})`} /> |
| 129 | </svg> |
| 130 | ); |
| 131 | }; |
| 132 | } |
| 133 | |
| 134 | const SolidFolder: Icon = ({ size = "1em", weight: _weight, ...props }) => <Folder size={size} fill="currentColor" {...props} />; |
| 135 | |
| 136 | /** The GitHub mark. A brand glyph is solid, so it is the one icon that is not a Lucide outline. */ |
| 137 | export const GithubIcon: Icon = ({ size = "1em", weight: _weight, className, ...props }) => ( |
| 138 | <svg width={size} height={size} viewBox="0 0 24 24" fill="currentColor" aria-hidden={props["aria-label"] ? undefined : true} className={`shrink-0 ${className ?? ""}`} {...props}> |
| 139 | <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" /> |
| 140 | </svg> |
| 141 | ); |
| 142 | |
| 143 | export const ArrowBendDownRightIcon = outline(CornerDownRight); |
| 144 | export const ArrowClockwiseIcon = outline(RotateCw); |
| 145 | export const ArrowCounterClockwiseIcon = outline(RotateCcw); |
| 146 | export const ArrowLeftIcon = outline(ArrowLeft); |
| 147 | export const ArrowRightIcon = outline(ArrowRight); |
| 148 | export const ArrowUUpLeftIcon = outline(Undo2); |
| 149 | export const ArrowUUpRightIcon = outline(Redo2); |
| 150 | export const ArrowsClockwiseIcon = outline(RefreshCw); |
| 151 | export const ArrowsInIcon = outline(Minimize2); |
| 152 | export const ArrowsLeftRightIcon = outline(ArrowLeftRight); |
| 153 | export const ArrowsOutIcon = outline(Maximize2); |
| 154 | export const AtIcon = outline(AtSign); |
| 155 | export const BookOpenIcon = outline(BookOpen); |
| 156 | export const BroadcastIcon = outline(Radio); |
| 157 | export const BuildingsIcon = outline(Building2); |
| 158 | export const CalendarIcon = outline(Calendar); |
| 159 | export const CaretDownIcon = outline(ChevronDown); |
| 160 | export const CaretLeftIcon = outline(ChevronLeft); |
| 161 | export const CaretRightIcon = outline(ChevronRight); |
| 162 | export const CaretUpDownIcon = outline(ChevronsUpDown); |
| 163 | export const CaretUpIcon = outline(ChevronUp); |
| 164 | export const ChartLineUpIcon = outline(ChartLine); |
| 165 | export const ChatCircleIcon = outline(MessageCircle); |
| 166 | export const CheckCircleIcon = outline(CircleCheck, disc(<path d="m8.5 12.2 2.4 2.4 4.6-4.9" />)); |
| 167 | export const CheckIcon = outline(Check); |
| 168 | export const CheckSquareIcon = outline(SquareCheck); |
| 169 | export const CircleDashedIcon = outline(CircleDashed); |
| 170 | export const MinusCircleIcon = outline(CircleMinus); |
| 171 | export const StopCircleIcon = outline(CircleStop); |
| 172 | export const CircleNotchIcon = outline(LoaderCircle); |
| 173 | export const ClockClockwiseIcon = outline(Timer); |
| 174 | export const ClockCounterClockwiseIcon = outline(History); |
| 175 | export const ClockIcon = outline(Clock); |
| 176 | export const CompassIcon = outline(Compass); |
| 177 | export const CopyIcon = outline(Copy); |
| 178 | export const CubeIcon = outline(Box); |
| 179 | export const DatabaseIcon = outline(Database); |
| 180 | export const DesktopIcon = outline(Monitor); |
| 181 | export const DotsThreeIcon = outline(Ellipsis); |
| 182 | export const EnvelopeSimpleIcon = outline(Mail); |
| 183 | export const FileCodeIcon = outline(FileCode); |
| 184 | export const FileDashedIcon = outline(FileQuestionMark); |
| 185 | export const FileIcon = outline(File); |
| 186 | export const FolderIcon = outline(Folder, SolidFolder); |
| 187 | export const FrameCornersIcon = outline(Scan); |
| 188 | export const GearIcon = outline(Settings); |
| 189 | export const GitBranchIcon = outline(GitBranch); |
| 190 | export const GitCommitIcon = outline(GitCommitHorizontal); |
| 191 | export const GitDiffIcon = outline(GitCompare); |
| 192 | export const GitForkIcon = outline(GitFork); |
| 193 | export const GitMergeIcon = outline(GitMerge); |
| 194 | export const GitPullRequestIcon = outline(GitPullRequest); |
| 195 | export const HardDrivesIcon = outline(HardDrive); |
| 196 | export const HourglassIcon = outline(Hourglass); |
| 197 | export const HouseIcon = outline(House); |
| 198 | export const InfoIcon = outline(Info); |
| 199 | export const KeyIcon = outline(KeyRound); |
| 200 | export const LightningIcon = outline(Zap); |
| 201 | export const ListChecksIcon = outline(ListChecks); |
| 202 | export const ListIcon = outline(Menu); |
| 203 | export const LockIcon = outline(Lock); |
| 204 | export const MagnifyingGlassIcon = outline(Search); |
| 205 | export const MinusIcon = outline(Minus); |
| 206 | export const MoonIcon = outline(Moon); |
| 207 | export const PathIcon = outline(Route); |
| 208 | export const PencilSimpleIcon = outline(Pencil); |
| 209 | export const PlugsConnectedIcon = outline(Plug); |
| 210 | export const PlayIcon = outline(Play); |
| 211 | export const PlusIcon = outline(Plus); |
| 212 | export const QuestionIcon = outline(CircleQuestionMark); |
| 213 | export const QueueIcon = outline(Layers); |
| 214 | export const RecordIcon = outline(CircleDot); |
| 215 | export const RobotIcon = outline(Bot); |
| 216 | export const ShieldCheckIcon = outline(ShieldCheck); |
| 217 | export const ShieldWarningIcon = outline(ShieldAlert); |
| 218 | export const SidebarIcon = outline(PanelLeft); |
| 219 | export const SignOutIcon = outline(LogOut); |
| 220 | export const SunIcon = outline(Sun); |
| 221 | export const TagIcon = outline(Tag); |
| 222 | export const TerminalWindowIcon = outline(SquareTerminal); |
| 223 | export const TextAaIcon = outline(Type); |
| 224 | export const TrashIcon = outline(Trash2); |
| 225 | export const TreeStructureIcon = outline(Network); |
| 226 | export const UserCircleIcon = outline(CircleUserRound); |
| 227 | export const UserIcon = outline(UserRound); |
| 228 | export const UsersIcon = outline(UsersRound); |
| 229 | export const UsersThreeIcon = outline(UsersRound); |
| 230 | export const WarningCircleIcon = outline(CircleAlert, disc(<path d="M12 7.5v5M12 16.4v.1" />)); |
| 231 | export const WarningIcon = outline(TriangleAlert); |
| 232 | export const XCircleIcon = outline(CircleX); |
| 233 | export const XIcon = outline(X); |