Rename elements to not start with React.
This commit is contained in:
parent
651b490ea5
commit
ead00aaef6
|
@ -1,48 +0,0 @@
|
|||
import { MarginInline } from "./MarginInline";
|
||||
import { addClipboardNotifications } from "../pageUtils";
|
||||
import { makeElement } from "z-makeelement";
|
||||
import ClipboardJS from "clipboard";
|
||||
import i18next from "i18next";
|
||||
|
||||
export interface CopyableInputBoxType extends HTMLElement {
|
||||
setText(text: string): void;
|
||||
}
|
||||
|
||||
export function CopyableInputBox(text: string, copyable = true): CopyableInputBoxType {
|
||||
const inputBoxDiv = makeElement({ tag: "div" }) as CopyableInputBoxType;
|
||||
let inputBoxCopyButton: HTMLElement = null;
|
||||
if (copyable) {
|
||||
inputBoxCopyButton = makeElement({
|
||||
tag: "a",
|
||||
class: "uk-form-icon",
|
||||
attributes: {
|
||||
"uk-icon": "icon: copy",
|
||||
role: "img",
|
||||
"aria-label": i18next.t("copy_input_box_copy_icon_text"),
|
||||
},
|
||||
thenRun: (e) => {
|
||||
const clipboard = new ClipboardJS(e);
|
||||
addClipboardNotifications(clipboard, 600);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const inputBoxInput = makeElement({
|
||||
tag: "input",
|
||||
class: ["uk-input", "uk-input-copyable"],
|
||||
attributes: { readonly: "true", type: "text" },
|
||||
}) as HTMLInputElement;
|
||||
|
||||
const inputBoxInner = MarginInline([inputBoxCopyButton, inputBoxInput]);
|
||||
inputBoxDiv.appendChild(inputBoxInner);
|
||||
|
||||
inputBoxDiv.setText = function (text) {
|
||||
inputBoxInput.value = `${text}`;
|
||||
if (copyable) {
|
||||
inputBoxCopyButton.dataset.clipboardText = `${text}`;
|
||||
}
|
||||
};
|
||||
inputBoxDiv.setText(text);
|
||||
|
||||
return inputBoxDiv;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
import { makeElement } from "z-makeelement";
|
||||
|
||||
export function Option(label: string, value: string): HTMLElement {
|
||||
return makeElement({
|
||||
tag: "option",
|
||||
text: label,
|
||||
attributes: {
|
||||
label: label,
|
||||
value: value,
|
||||
},
|
||||
});
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
import { makeElement } from "z-makeelement";
|
||||
|
||||
export type TileParams = {
|
||||
condition?: boolean;
|
||||
color?: string;
|
||||
title: string;
|
||||
description: string;
|
||||
icon?: string;
|
||||
iconText?: string;
|
||||
onclick: () => void;
|
||||
};
|
||||
|
||||
export function Tile(params: TileParams): HTMLElement {
|
||||
if (params.condition == false) return;
|
||||
return makeElement({
|
||||
tag: "a",
|
||||
class: "uk-link-heading",
|
||||
onclick: params.onclick,
|
||||
children: makeElement({
|
||||
tag: "div",
|
||||
class: ["uk-padding-small", "uk-background-" + (params.color || "primary")],
|
||||
children: [
|
||||
makeElement({
|
||||
tag: "p",
|
||||
class: "uk-h4",
|
||||
text: params.title,
|
||||
children: makeElement({
|
||||
condition: typeof params.icon == "string",
|
||||
tag: "span",
|
||||
class: ["uk-icon", "uk-margin-small-left"],
|
||||
attributes: {
|
||||
"uk-icon": `icon: ${params.icon}`,
|
||||
role: "img",
|
||||
"aria-label": params.iconText,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
makeElement({
|
||||
tag: "span",
|
||||
class: "uk-text-muted",
|
||||
text: params.description,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import { AuthMethod } from "../../../api/types/auth";
|
||||
import { HeaderAndContent } from "../../../elements/ReactHeaderAndContent";
|
||||
import { HeaderAndContent } from "../../../elements/HeaderAndContent";
|
||||
import { Page } from "../../../types/Page";
|
||||
import { listAuth } from "../../../api/auth/listAuth";
|
||||
import { objectToMap, toStr } from "../../../utils";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Form } from "../../../../elements/ReactForm";
|
||||
import { InputWithTitle } from "../../../../elements/ReactInputWithTitle";
|
||||
import { InputWithTitle } from "../../../../elements/InputWithTitle";
|
||||
import { MarginInline } from "../../../../elements/ReactMarginInline";
|
||||
import { Page } from "../../../../types/Page";
|
||||
import { UserType } from "../../../../api/types/userpass/user";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { HeaderAndContent } from "../../../../elements/ReactHeaderAndContent";
|
||||
import { HeaderAndContent } from "../../../../elements/HeaderAndContent";
|
||||
import { Page } from "../../../../types/Page";
|
||||
import { getUserPassUser } from "../../../../api/auth/userpass/getUserPassUser";
|
||||
import { render } from "preact";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, JSX, createRef, render } from "preact";
|
||||
import { CopyableInputBox } from "../elements/ReactCopyableInputBox";
|
||||
import { CopyableInputBox } from "../elements/CopyableInputBox";
|
||||
import { Form } from "../elements/ReactForm";
|
||||
import { Margin } from "../elements/ReactMargin";
|
||||
import { Page } from "../types/Page";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CopyableInputBox } from "../../../elements/ReactCopyableInputBox";
|
||||
import { CopyableInputBox } from "../../../elements/CopyableInputBox";
|
||||
import { Page } from "../../../types/Page";
|
||||
import { SecretTitleElement } from "../SecretTitleElement";
|
||||
import { getCapabilities } from "../../../api/sys/getCapabilities";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, JSX, render } from "preact";
|
||||
import { CopyableInputBox } from "../../../elements/ReactCopyableInputBox";
|
||||
import { CopyableInputBox } from "../../../elements/CopyableInputBox";
|
||||
import { DoesNotExistError } from "../../../types/internalErrors";
|
||||
import { MarginInline } from "../../../elements/ReactMarginInline";
|
||||
import { Page } from "../../../types/Page";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { CopyableModal } from "../../../elements/ReactCopyableModal";
|
||||
import { FileUploadInput } from "../../../elements/ReactFileUploadInput";
|
||||
import { CopyableModal } from "../../../elements/CopyableModal";
|
||||
import { FileUploadInput } from "../../../elements/FileUploadInput";
|
||||
import { Form } from "../../../elements/ReactForm";
|
||||
import { InputWithTitle } from "../../../elements/ReactInputWithTitle";
|
||||
import { InputWithTitle } from "../../../elements/InputWithTitle";
|
||||
import { Margin } from "../../../elements/ReactMargin";
|
||||
import { Page } from "../../../types/Page";
|
||||
import { SecretTitleElement } from "../SecretTitleElement";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { CopyableModal } from "../../../elements/ReactCopyableModal";
|
||||
import { FileUploadInput } from "../../../elements/ReactFileUploadInput";
|
||||
import { CopyableModal } from "../../../elements/CopyableModal";
|
||||
import { FileUploadInput } from "../../../elements/FileUploadInput";
|
||||
import { Form } from "../../../elements/ReactForm";
|
||||
import { InputWithTitle } from "../../../elements/ReactInputWithTitle";
|
||||
import { InputWithTitle } from "../../../elements/InputWithTitle";
|
||||
import { Margin } from "../../../elements/ReactMargin";
|
||||
import { Page } from "../../../types/Page";
|
||||
import { SecretTitleElement } from "../SecretTitleElement";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CopyableModal } from "../../../elements/ReactCopyableModal";
|
||||
import { CopyableModal } from "../../../elements/CopyableModal";
|
||||
import { Form } from "../../../elements/ReactForm";
|
||||
import { Margin } from "../../../elements/ReactMargin";
|
||||
import { Page } from "../../../types/Page";
|
||||
|
|
Loading…
Reference in a new issue