/* * Vencord, a modification for Discord's desktop app * Copyright (c) 2023 Vendicated and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ // eslint-disable-next-line path-alias/no-relative import { filters, findByPropsLazy } from "../webpack"; import { waitForComponent } from "./internal"; import * as t from "./types/components"; export const Forms = { FormTitle: waitForComponent("FormTitle", filters.byCode("errorSeparator")), FormSection: waitForComponent("FormSection", filters.byCode("titleClassName", "sectionTitle")), FormDivider: waitForComponent("FormDivider", m => { if (typeof m !== "function") return false; const s = m.toString(); return s.length < 200 && s.includes(".divider"); }), FormText: waitForComponent("FormText", m => m.Types?.INPUT_PLACEHOLDER), }; export const Card = waitForComponent("Card", m => m.Types?.PRIMARY && m.defaultProps); export const Button = waitForComponent("Button", ["Hovers", "Looks", "Sizes"]); export const Switch = waitForComponent("Switch", filters.byCode("tooltipNote", "ringTarget")); export const Tooltip = waitForComponent("Tooltip", filters.byCode("shouldShowTooltip:!1", "clickableOnMobile||")); export const Timestamp = waitForComponent("Timestamp", filters.byCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format")); export const TextInput = waitForComponent("TextInput", ["defaultProps", "Sizes", "contextType"]); export const TextArea = waitForComponent("TextArea", filters.byCode("handleSetRef", "textArea")); export const Text = waitForComponent("Text", m => { if (typeof m !== "function") return false; const s = m.toString(); return (s.length < 1500 && s.includes("data-text-variant") && s.includes("always-white")); }); export const Select = waitForComponent("Select", filters.byCode("optionClassName", "popoutPosition", "autoFocus", "maxVisibleItems")); export const Slider = waitForComponent("Slider", filters.byCode("closestMarkerIndex", "stickToMarkers")); export const Flex = waitForComponent("Flex", ["Justify", "Align", "Wrap"]); export const ButtonWrapperClasses = findByPropsLazy("buttonWrapper", "buttonContent") as Record; /** * @deprecated Use @utils/margins instead */ export const Margins: t.Margins = findByPropsLazy("marginTop20"); export const ButtonLooks: t.ButtonLooks = findByPropsLazy("BLANK", "FILLED", "INVERTED");