From 634292cb8b4ae113b2586e940fc1d0356d6d8dd6 Mon Sep 17 00:00:00 2001 From: ChaotiCryptidz Date: Sat, 22 Jan 2022 13:09:39 +0000 Subject: [PATCH] move all input things into their own files --- src/ui/elements/forms/Checkbox.tsx | 17 +++++ src/ui/elements/{ => forms}/Form.tsx | 0 src/ui/elements/forms/InputProps.tsx | 9 +++ src/ui/elements/forms/NumberInput.tsx | 17 +++++ src/ui/elements/forms/PasswordInput.tsx | 17 +++++ src/ui/elements/forms/Select.tsx | 33 ++++++++ src/ui/elements/forms/TextArea.tsx | 16 ++++ src/ui/elements/forms/TextInput.tsx | 17 +++++ .../Access/Auth/userpass/UserPassUserEdit.tsx | 76 +++++-------------- .../Access/Auth/userpass/UserPassUserNew.tsx | 24 +++--- src/ui/pages/Login_Token.tsx | 16 ++-- src/ui/pages/Login_Username.tsx | 30 +++----- src/ui/pages/Policies/PolicyNew.tsx | 13 ++-- src/ui/pages/PwGen.tsx | 20 ++--- src/ui/pages/Secrets/DeleteSecretsEngine.tsx | 2 +- .../pages/Secrets/KeyValue/KeyValueEdit.tsx | 12 +-- .../pages/Secrets/KeyValue/KeyValueList.tsx | 48 +++++++----- src/ui/pages/Secrets/KeyValue/KeyValueNew.tsx | 13 ++-- .../pages/Secrets/KeyValue/KeyValueView.tsx | 12 +-- .../pages/Secrets/NewEngines/NewKVEngine.tsx | 20 ++--- .../Secrets/NewEngines/NewTOTPEngine.tsx | 7 +- .../Secrets/NewEngines/NewTransitEngine.tsx | 7 +- src/ui/pages/Secrets/TOTP/TOTPNew.tsx | 19 ++--- .../pages/Secrets/TOTP/TOTPNewGenerated.tsx | 40 ++++------ .../pages/Secrets/Transit/TransitDecrypt.tsx | 11 ++- .../pages/Secrets/Transit/TransitEncrypt.tsx | 11 ++- src/ui/pages/Secrets/Transit/TransitNew.tsx | 23 +++--- .../pages/Secrets/Transit/TransitRewrap.tsx | 15 ++-- src/ui/pages/SetLanguage.tsx | 26 ++++--- src/ui/pages/SetVaultURL.tsx | 18 +++-- src/ui/pages/Settings/GeneralSettings.tsx | 54 ++++++------- src/ui/pages/Settings/KeyValueSettings.tsx | 53 ++++++------- src/ui/pages/Unseal_Form.tsx | 26 +++---- 33 files changed, 394 insertions(+), 328 deletions(-) create mode 100644 src/ui/elements/forms/Checkbox.tsx rename src/ui/elements/{ => forms}/Form.tsx (100%) create mode 100644 src/ui/elements/forms/InputProps.tsx create mode 100644 src/ui/elements/forms/NumberInput.tsx create mode 100644 src/ui/elements/forms/PasswordInput.tsx create mode 100644 src/ui/elements/forms/Select.tsx create mode 100644 src/ui/elements/forms/TextArea.tsx create mode 100644 src/ui/elements/forms/TextInput.tsx diff --git a/src/ui/elements/forms/Checkbox.tsx b/src/ui/elements/forms/Checkbox.tsx new file mode 100644 index 0000000..e7b58fb --- /dev/null +++ b/src/ui/elements/forms/Checkbox.tsx @@ -0,0 +1,17 @@ +import { JSX, RefObject } from "preact"; +import { InputProps } from "./InputProps"; + +type CheckboxProps = InputProps & { + checkboxRef?: RefObject; +} + +export function Checkbox(props: CheckboxProps): JSX.Element { + return ( + + ) +} \ No newline at end of file diff --git a/src/ui/elements/Form.tsx b/src/ui/elements/forms/Form.tsx similarity index 100% rename from src/ui/elements/Form.tsx rename to src/ui/elements/forms/Form.tsx diff --git a/src/ui/elements/forms/InputProps.tsx b/src/ui/elements/forms/InputProps.tsx new file mode 100644 index 0000000..fb1ce06 --- /dev/null +++ b/src/ui/elements/forms/InputProps.tsx @@ -0,0 +1,9 @@ +export type InputProps = { + name?: string; + value?: string; + placeholder?: string; + onChange?: () => void; + required?: boolean; + checked?: boolean; + extraProps?: {}; +} \ No newline at end of file diff --git a/src/ui/elements/forms/NumberInput.tsx b/src/ui/elements/forms/NumberInput.tsx new file mode 100644 index 0000000..4f6b7e0 --- /dev/null +++ b/src/ui/elements/forms/NumberInput.tsx @@ -0,0 +1,17 @@ +import { JSX, RefObject } from "preact"; +import { InputProps } from "./InputProps"; + +type NumberInputProps = InputProps & { + inputRef?: RefObject; +} + +export function NumberInput(props: NumberInputProps): JSX.Element { + return ( + + ) +} \ No newline at end of file diff --git a/src/ui/elements/forms/PasswordInput.tsx b/src/ui/elements/forms/PasswordInput.tsx new file mode 100644 index 0000000..6c05276 --- /dev/null +++ b/src/ui/elements/forms/PasswordInput.tsx @@ -0,0 +1,17 @@ +import { JSX, RefObject } from "preact"; +import { InputProps } from "./InputProps"; + +type PasswordInputProps = InputProps & { + inputRef?: RefObject; +} + +export function PasswordInput(props: PasswordInputProps): JSX.Element { + return ( + + ) +} \ No newline at end of file diff --git a/src/ui/elements/forms/Select.tsx b/src/ui/elements/forms/Select.tsx new file mode 100644 index 0000000..182d294 --- /dev/null +++ b/src/ui/elements/forms/Select.tsx @@ -0,0 +1,33 @@ +import { JSX, RefObject } from "preact"; +import { InputProps } from "./InputProps"; + +type SelectProps = InputProps & { + selectRef?: RefObject; + children?: JSX.Element | JSX.Element[]; +} + +export function Select(props: SelectProps): JSX.Element { + return ( + + ) +} + +type SelectOptionProps = { + name: string; + value: string; + selected?: boolean; +} + +export function SelectOption(props: SelectOptionProps): JSX.Element { + return ( + + ) +} \ No newline at end of file diff --git a/src/ui/elements/forms/TextArea.tsx b/src/ui/elements/forms/TextArea.tsx new file mode 100644 index 0000000..1627d32 --- /dev/null +++ b/src/ui/elements/forms/TextArea.tsx @@ -0,0 +1,16 @@ +import { JSX, RefObject } from "preact"; +import { InputProps } from "./InputProps"; + +type TextInputProps = InputProps & { + textAreaRef?: RefObject; +} + +export function TextArea(props: TextInputProps): JSX.Element { + return ( +