From 74a768e9420165c0b1b4ef83927c64ef5e8d1270 Mon Sep 17 00:00:00 2001 From: Jason Woodland Date: Tue, 9 Aug 2022 12:03:24 +1000 Subject: [PATCH] feat: consolidate input and input group components --- assets/styles/base.less | 24 --- components/interactables/Input/Input.html | 75 ++++---- components/interactables/Input/Input.less | 104 ++++++----- components/interactables/Input/Input.vue | 167 ++++++------------ components/interactables/Input/README.md | 26 ++- components/interactables/Input/types.d.ts | 7 +- .../interactables/InputGroup/InputGroup.html | 41 ----- .../interactables/InputGroup/InputGroup.less | 55 ------ .../interactables/InputGroup/InputGroup.vue | 110 ------------ components/interactables/InputGroup/README.md | 39 ---- .../interactables/InputGroup/types.d.ts | 10 -- .../QuickProfile/QuickProfile.html | 4 +- .../interactables/UserPicker/UserPicker.html | 3 +- .../views/chat/enhancers/Enhancers.html | 2 +- .../views/chat/enhancers/glyphs/Glyphs.html | 2 +- components/views/files/controls/Controls.html | 8 +- components/views/files/rename/Rename.html | 4 +- components/views/friends/add/Add.html | 3 +- .../marketplace/searchbox/Searchbox.html | 4 +- .../navigation/server/sidebar/Sidebar.html | 3 +- .../views/navigation/sidebar/Sidebar.html | 7 +- .../views/navigation/sidebar/quick/Quick.html | 9 +- components/views/servers/create/Create.html | 2 - .../settings/pages/accounts/Accounts.html | 8 +- .../views/settings/pages/developer/Info.html | 8 +- .../pages/notifications/Notifications.html | 8 +- .../views/settings/pages/privacy/Privacy.html | 2 +- .../views/settings/pages/profile/Profile.html | 8 +- components/views/wallet/balance/Balance.html | 4 +- components/views/wallet/mini/body/Body.html | 4 +- pages/auth/unlock/Unlock.html | 5 +- pages/components.vue | 11 +- pages/message/NewMessage.html | 4 +- pages/mobile/chat/_id.vue | 4 +- 34 files changed, 228 insertions(+), 547 deletions(-) delete mode 100644 components/interactables/InputGroup/InputGroup.html delete mode 100644 components/interactables/InputGroup/InputGroup.less delete mode 100644 components/interactables/InputGroup/InputGroup.vue delete mode 100644 components/interactables/InputGroup/README.md delete mode 100644 components/interactables/InputGroup/types.d.ts diff --git a/assets/styles/base.less b/assets/styles/base.less index eb0f782bf7..25c0eceb4e 100644 --- a/assets/styles/base.less +++ b/assets/styles/base.less @@ -733,34 +733,10 @@ button { } } -//Inputs -.input { - &:extend(.input-bg); - &:extend(.font-primary); - box-shadow: none !important; - &:active, - &:focus { - background: @semitransparent-lightest-gradient !important; - } -} - ::placeholder { color: @text-muted !important; } -.is-primary.input, -.is-dark.input { - &:extend(.input-bg); - &:extend(.font-primary); - border-color: transparent; - - &:active, - &:focus { - border: none; - outline: none; - } -} - //Search Input .search-query-highlight { &:extend(.background-flair); diff --git a/components/interactables/Input/Input.html b/components/interactables/Input/Input.html index e136c7b600..90b40b374f 100644 --- a/components/interactables/Input/Input.html +++ b/components/interactables/Input/Input.html @@ -1,36 +1,49 @@ -
- -
- +
+ +
+
+ + +
+ + {{ text.length }}/{{ maxLength }} + +
diff --git a/components/interactables/Input/Input.less b/components/interactables/Input/Input.less index 1be10150cf..d8bfced3eb 100644 --- a/components/interactables/Input/Input.less +++ b/components/interactables/Input/Input.less @@ -1,51 +1,69 @@ -.input-label { - text-align: left; -} -.is-full-width { - &:extend(.full-width); -} -.search-box { - &.right-icon { - input { - padding-right: 34px; +.input-group { + display: flex; + flex-direction: column; + width: 100%; + + .input-outer { + display: flex; + align-items: stretch; + flex-grow: 1; + + .input-inner { + position: relative; + display: flex; + flex-grow: 1; + + .input { + flex-grow: 1; + padding: @light-spacing; + &:extend(.input-bg); + &:extend(.round-corners); + box-shadow: none; + color: @white; + + &.show-clear-button { + padding-right: 2rem; + } + } + + .clear-button { + position: absolute; + inset: 0 0 0 auto; + font-size: @tiny-icon-size; + display: flex; + align-items: center; + justify-content: center; + padding: @light-spacing; + color: @text-muted; + } + + &:not(:last-child) .input { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right: 0; + } } - } - .search-clear { - &:extend(.font-primary); - &:focus { - background: @background; + + .button { + border-top-left-radius: 0; + border-bottom-left-radius: 0; } - position: absolute; - font-size: @tiny-icon-size; - top: 0; - right: 0; - width: 34px; - height: @full; - background: transparent; - border-color: transparent; - cursor: pointer; - &:extend(.first-layer); } - position: relative; - .input { + .char-limit { + float: right; + margin-right: @light-spacing; font-size: @mini-text-size; - font-family: @secondary-font; - &.is-normal { - height: 2.3rem; - } - &:disabled { - &::placeholder { - /* without !important it does not work */ - color: grey !important; - } - } - &.invalid { - border: 1px solid @red; - } + &:extend(.font-muted); + margin-left: auto; + } - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; + .error { + margin-top: @light-spacing; + } + + // TODO: remove after removing bulma + .is-primary:not(.is-danger) { + border-color: transparent; } } diff --git a/components/interactables/Input/Input.vue b/components/interactables/Input/Input.vue index 1d92f429ec..16f164393c 100644 --- a/components/interactables/Input/Input.vue +++ b/components/interactables/Input/Input.vue @@ -1,10 +1,9 @@ + + diff --git a/components/interactables/Input/README.md b/components/interactables/Input/README.md index da365c50de..60f36847c3 100644 --- a/components/interactables/Input/README.md +++ b/components/interactables/Input/README.md @@ -6,11 +6,15 @@ Generic input component. ```vue ``` @@ -18,10 +22,18 @@ Generic input component. **text** Input display text -**delete-icon** Show delete text icon - **size** Input display size, honors bulma.io sizes **input-kind** Abstracts generic input type attribute +**disabled** Disables the input button + +**action** Action that should happen when the attached button is pressed + +**icon** Provide in component slot + +**buttonText** Optional attached button text + **label-text** Optional label appended to input + +**copy-content** If provided, the button will also copy the content to clipboard diff --git a/components/interactables/Input/types.d.ts b/components/interactables/Input/types.d.ts index 754f398cb3..2f8d25eede 100644 --- a/components/interactables/Input/types.d.ts +++ b/components/interactables/Input/types.d.ts @@ -1,9 +1,10 @@ -export type InputTypes = 'text' | 'number' | 'password' -export type InputStyle = +export type InputType = 'text' | 'number' | 'password' +export type InputColor = | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' -export type InputSize = 'small' | 'normal' | 'medium' | 'large' + | null +export type InputSize = 'sm' | 'md' | 'lg' | 'xl' diff --git a/components/interactables/InputGroup/InputGroup.html b/components/interactables/InputGroup/InputGroup.html deleted file mode 100644 index 29f5421953..0000000000 --- a/components/interactables/InputGroup/InputGroup.html +++ /dev/null @@ -1,41 +0,0 @@ -
- -
-
- - -
- -
- - {{ text.length }}/{{ maxLength }} - -
diff --git a/components/interactables/InputGroup/InputGroup.less b/components/interactables/InputGroup/InputGroup.less deleted file mode 100644 index 689da430d4..0000000000 --- a/components/interactables/InputGroup/InputGroup.less +++ /dev/null @@ -1,55 +0,0 @@ -.input-group { - display: flex; - flex-direction: column; - width: 100%; - - .input-outer { - display: flex; - align-items: stretch; - flex-grow: 1; - &:extend(.bordered); - &:extend(.round-corners); - - .input-inner { - position: relative; - display: flex; - flex-grow: 1; - - .input { - &.show-clear-button { - padding-right: 2rem; - } - } - - .clear-button { - position: absolute; - inset: 0 0 0 auto; - font-size: @tiny-icon-size; - display: flex; - align-items: center; - justify-content: center; - padding: @light-spacing; - color: @text-muted; - } - - &:not(:last-child) .input { - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-right: 0; - } - } - - .button { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } - } - - .char-limit { - float: right; - margin-right: @light-spacing; - font-size: @mini-text-size; - &:extend(.font-muted); - margin-left: auto; - } -} diff --git a/components/interactables/InputGroup/InputGroup.vue b/components/interactables/InputGroup/InputGroup.vue deleted file mode 100644 index cdadc95950..0000000000 --- a/components/interactables/InputGroup/InputGroup.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - - - diff --git a/components/interactables/InputGroup/README.md b/components/interactables/InputGroup/README.md deleted file mode 100644 index 4be5792227..0000000000 --- a/components/interactables/InputGroup/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Description - -Generic input group component. - -# Usage - -```vue - -``` - -# Props - -**text** Input display text - -**size** Input display size, honors bulma.io sizes - -**input-kind** Abstracts generic input type attribute - -**disabled** Disables the input button - -**action** Action that should happen when the attached button is pressed - -**icon** Provide in component slot - -**buttonText** Optional attached button text - -**label-text** Optional label appended to input - -**copy-content** If provided, the button will also copy the content to clipboard diff --git a/components/interactables/InputGroup/types.d.ts b/components/interactables/InputGroup/types.d.ts deleted file mode 100644 index 2f8d25eede..0000000000 --- a/components/interactables/InputGroup/types.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type InputType = 'text' | 'number' | 'password' -export type InputColor = - | 'primary' - | 'link' - | 'info' - | 'success' - | 'warning' - | 'danger' - | null -export type InputSize = 'sm' | 'md' | 'lg' | 'xl' diff --git a/components/interactables/QuickProfile/QuickProfile.html b/components/interactables/QuickProfile/QuickProfile.html index f00b53874b..70f28d57d3 100644 --- a/components/interactables/QuickProfile/QuickProfile.html +++ b/components/interactables/QuickProfile/QuickProfile.html @@ -25,7 +25,7 @@