diff --git a/src/elements/CopyableInputBox.ts b/src/elements/CopyableInputBox.ts deleted file mode 100644 index 6f6a19e..0000000 --- a/src/elements/CopyableInputBox.ts +++ /dev/null @@ -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; -} diff --git a/src/elements/ReactCopyableInputBox.tsx b/src/elements/CopyableInputBox.tsx similarity index 100% rename from src/elements/ReactCopyableInputBox.tsx rename to src/elements/CopyableInputBox.tsx diff --git a/src/elements/ReactCopyableModal.tsx b/src/elements/CopyableModal.tsx similarity index 100% rename from src/elements/ReactCopyableModal.tsx rename to src/elements/CopyableModal.tsx diff --git a/src/elements/ReactFileUploadInput.tsx b/src/elements/FileUploadInput.tsx similarity index 100% rename from src/elements/ReactFileUploadInput.tsx rename to src/elements/FileUploadInput.tsx diff --git a/src/elements/ReactHeaderAndContent.tsx b/src/elements/HeaderAndContent.tsx similarity index 100% rename from src/elements/ReactHeaderAndContent.tsx rename to src/elements/HeaderAndContent.tsx diff --git a/src/elements/ReactInputWithTitle.tsx b/src/elements/InputWithTitle.tsx similarity index 100% rename from src/elements/ReactInputWithTitle.tsx rename to src/elements/InputWithTitle.tsx diff --git a/src/elements/Option.ts b/src/elements/Option.ts deleted file mode 100644 index 7bcb6b3..0000000 --- a/src/elements/Option.ts +++ /dev/null @@ -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, - }, - }); -} diff --git a/src/elements/Tile.ts b/src/elements/Tile.ts deleted file mode 100644 index 77f575e..0000000 --- a/src/elements/Tile.ts +++ /dev/null @@ -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, - }), - ], - }), - }); -} diff --git a/src/pages/Access/Auth/AuthViewConfig.tsx b/src/pages/Access/Auth/AuthViewConfig.tsx index 2472a1a..7501567 100644 --- a/src/pages/Access/Auth/AuthViewConfig.tsx +++ b/src/pages/Access/Auth/AuthViewConfig.tsx @@ -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"; diff --git a/src/pages/Access/Auth/userpass/UserPassUserEdit.tsx b/src/pages/Access/Auth/userpass/UserPassUserEdit.tsx index 266ed03..64028d0 100644 --- a/src/pages/Access/Auth/userpass/UserPassUserEdit.tsx +++ b/src/pages/Access/Auth/userpass/UserPassUserEdit.tsx @@ -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"; diff --git a/src/pages/Access/Auth/userpass/UserPassUserView.tsx b/src/pages/Access/Auth/userpass/UserPassUserView.tsx index 9a51caf..e5feac5 100644 --- a/src/pages/Access/Auth/userpass/UserPassUserView.tsx +++ b/src/pages/Access/Auth/userpass/UserPassUserView.tsx @@ -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"; diff --git a/src/pages/PwGen.tsx b/src/pages/PwGen.tsx index 3f8cf74..97ff994 100644 --- a/src/pages/PwGen.tsx +++ b/src/pages/PwGen.tsx @@ -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"; diff --git a/src/pages/Secrets/KeyValue/KeyValueSecret.tsx b/src/pages/Secrets/KeyValue/KeyValueSecret.tsx index f059932..cffe87e 100644 --- a/src/pages/Secrets/KeyValue/KeyValueSecret.tsx +++ b/src/pages/Secrets/KeyValue/KeyValueSecret.tsx @@ -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"; diff --git a/src/pages/Secrets/TOTP/TOTPView.tsx b/src/pages/Secrets/TOTP/TOTPView.tsx index 57698fa..7cf3e6f 100644 --- a/src/pages/Secrets/TOTP/TOTPView.tsx +++ b/src/pages/Secrets/TOTP/TOTPView.tsx @@ -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"; diff --git a/src/pages/Secrets/Transit/TransitDecrypt.tsx b/src/pages/Secrets/Transit/TransitDecrypt.tsx index 7fb2ea9..ce64305 100644 --- a/src/pages/Secrets/Transit/TransitDecrypt.tsx +++ b/src/pages/Secrets/Transit/TransitDecrypt.tsx @@ -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"; diff --git a/src/pages/Secrets/Transit/TransitEncrypt.tsx b/src/pages/Secrets/Transit/TransitEncrypt.tsx index 05c3381..3527313 100644 --- a/src/pages/Secrets/Transit/TransitEncrypt.tsx +++ b/src/pages/Secrets/Transit/TransitEncrypt.tsx @@ -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"; diff --git a/src/pages/Secrets/Transit/TransitRewrap.tsx b/src/pages/Secrets/Transit/TransitRewrap.tsx index 8146664..a585e3e 100644 --- a/src/pages/Secrets/Transit/TransitRewrap.tsx +++ b/src/pages/Secrets/Transit/TransitRewrap.tsx @@ -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";