Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update form input css #8554

Merged
merged 46 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bc638ea
Update form input css
hurradieweltgehtunter Mar 7, 2023
9b96f44
add changelog
hurradieweltgehtunter Mar 7, 2023
fa14e3b
fix
hurradieweltgehtunter Mar 7, 2023
0a98da3
fix avatarInitials color
hurradieweltgehtunter Mar 7, 2023
9329c7b
fix dark mode
hurradieweltgehtunter Mar 7, 2023
96c286f
fixes
hurradieweltgehtunter Mar 10, 2023
cfbbe74
improve combobox select options layout
hurradieweltgehtunter Mar 10, 2023
6ddc15e
make component disable-able like underlying oc-select
hurradieweltgehtunter Mar 10, 2023
c68947e
use consistent border radius
hurradieweltgehtunter Mar 10, 2023
e4c98f9
Make Quota select box visible and disabled instead of hide it; First-…
hurradieweltgehtunter Mar 10, 2023
5327739
add alert css (needs to be moved to own component)
hurradieweltgehtunter Mar 10, 2023
58ab25a
add success|warning|danger backgorund colors and update color values …
hurradieweltgehtunter Mar 10, 2023
df473ad
Add OcAlert Component
hurradieweltgehtunter Mar 13, 2023
d7a4818
render Icon alsways if custom icon is used
hurradieweltgehtunter Mar 13, 2023
240d09f
add color to close button
hurradieweltgehtunter Mar 13, 2023
af7e633
Add changelog
hurradieweltgehtunter Mar 13, 2023
47e08a1
replace css class by v-if
hurradieweltgehtunter Mar 13, 2023
fbf0bf7
cleanup
hurradieweltgehtunter Mar 13, 2023
0c148e1
add tests
hurradieweltgehtunter Mar 13, 2023
e8c7c68
replace reserved param "style"
hurradieweltgehtunter Mar 13, 2023
8594917
lint
hurradieweltgehtunter Mar 13, 2023
8a95f7d
update snapshot
hurradieweltgehtunter Mar 13, 2023
a8128fc
fix
hurradieweltgehtunter Mar 13, 2023
6d36f38
improive alerts in dark mode
hurradieweltgehtunter Mar 14, 2023
f93157c
add subline text message to quota select and ocSelect and use it inst…
hurradieweltgehtunter Mar 14, 2023
fa08b53
lint
hurradieweltgehtunter Mar 14, 2023
6b4855f
add fixMessageLine to ocmply with other inputs
hurradieweltgehtunter Mar 14, 2023
8b975e7
remove unnecessary aria attributes
hurradieweltgehtunter Mar 15, 2023
71dc0c3
reduce form input size
hurradieweltgehtunter Mar 15, 2023
2dc389c
fix
hurradieweltgehtunter Mar 15, 2023
f7c93b9
rename
hurradieweltgehtunter Mar 15, 2023
8248ae4
Move OcAlert to own PR, remove here
hurradieweltgehtunter Mar 15, 2023
fc1a97c
Fix linter and unit tests
JammingBen Mar 15, 2023
86257ae
make inputs & select look the same; replace border set via background…
hurradieweltgehtunter Mar 16, 2023
0e8148b
use consistent border-radius
hurradieweltgehtunter Mar 16, 2023
8244041
fix style
hurradieweltgehtunter Mar 16, 2023
b5a37ee
adapt to input field heights
hurradieweltgehtunter Mar 16, 2023
710cd02
unify select field styling
hurradieweltgehtunter Mar 16, 2023
3bbdc2d
increase space around deselect button
hurradieweltgehtunter Mar 16, 2023
7bf4a8f
cleanup
hurradieweltgehtunter Mar 16, 2023
01a0c42
use border color which respects light/dark mode
hurradieweltgehtunter Mar 23, 2023
cad44fd
avoid doubled border on dropdown options
hurradieweltgehtunter Mar 23, 2023
fbd20ae
update snapshots
hurradieweltgehtunter Mar 23, 2023
50d2096
remove duplicate css selector
hurradieweltgehtunter Mar 24, 2023
3a3e658
fix dropdown option height
hurradieweltgehtunter Mar 24, 2023
a85964c
remove duplicate block
hurradieweltgehtunter Mar 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/enhancement-beautify-form-inputs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Beautify form inputs

We've updated the styling of text inputs.

https://github.com/owncloud/web/pull/8554
4 changes: 4 additions & 0 deletions packages/design-system/src/components/OcAvatar/OcAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ export default defineComponent({
height: auto;
border-radius: 50%;
}

.avatarInitials {
color: white !important;
}
}
</style>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,14 @@ export default defineComponent({

&-input {
border-radius: 25px !important;
border: 1px solid var(--oc-color-input-border) !important;
border: none;
color: var(--oc-color-input-text-muted) !important;

&:focus {
background-color: var(--oc-color-input-bg);
border-color: var(--oc-color-input-text-default);
color: var(--oc-color-input-text-default);
background-image: none;
}

&::-ms-clear,
Expand Down
209 changes: 181 additions & 28 deletions packages/design-system/src/components/OcSelect/OcSelect.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<label :for="id" v-text="label" />
<label :for="id" class="oc-label" v-text="label" />
<vue-select
ref="select"
:disabled="disabled"
Expand All @@ -24,6 +24,33 @@
<oc-spinner v-if="loading" />
</template>
</vue-select>

<div
v-if="showMessageLine"
class="oc-text-input-message"
:class="{
'oc-text-input-description': !!descriptionMessage,
'oc-text-input-warning': !!warningMessage,
'oc-text-input-danger': !!errorMessage
}"
>
<oc-icon
v-if="messageText !== null && !!descriptionMessage"
name="information"
size="small"
fill-type="line"
/>

<span
:id="messageId"
:class="{
'oc-text-input-description': !!descriptionMessage,
'oc-text-input-warning': !!warningMessage,
'oc-text-input-danger': !!errorMessage
}"
v-text="messageText"
/>
</div>
</div>
</template>

Expand Down Expand Up @@ -124,6 +151,36 @@ export default defineComponent({
type: Boolean,
required: false,
default: false
},

/**
* A warning message which is shown below the select.
*/
warningMessage: {
type: String,
default: null
},
/**
* An error message which is shown below the select.
*/
errorMessage: {
type: String,
default: null
},
/**
* Whether or not vertical space below the select should be reserved for a one line message,
* so that content actually appearing there doesn't shift the layout.
*/
fixMessageLine: {
type: Boolean,
default: false
},
/**
* A description text which is shown below the select field.
*/
descriptionMessage: {
type: String,
default: null
}
},
emits: ['search:input', 'update:modelValue'],
Expand All @@ -136,6 +193,28 @@ export default defineComponent({
additionalAttrs['label'] = this.optionLabel
}
return { ...this.$attrs, ...additionalAttrs }
},
showMessageLine() {
return (
this.fixMessageLine ||
!!this.warningMessage ||
!!this.errorMessage ||
!!this.descriptionMessage
)
},
messageText() {
if (this.errorMessage) {
return this.errorMessage
}

if (this.warningMessage) {
return this.warningMessage
}

return this.descriptionMessage
},
messageId() {
return `${this.id}-message`
}
},

Expand All @@ -162,51 +241,81 @@ export default defineComponent({

<style lang="scss">
.vs--disabled {
cursor: not-allowed;

.vs__clear,
.vs__dropdown-toggle,
.vs__open-indicator,
.vs__search,
.vs__selected {
background-color: var(--oc-color-background-muted) !important;
color: var(--oc-color-text-muted) !important;
cursor: default;
color: var(--oc-color-input-text-muted) !important;
pointer-events: none;
}
}

.vs--single.vs--open .vs__selected {
opacity: 0.8 !important;
.vs__actions {
opacity: 0.3;
}
}

.oc-select {
background-image: none !important;
line-height: 24px !important;
line-height: normal;
padding: 1px 0;
color: var(--oc-color-input-text-default);

.vs {
&__search,
&__selected {
&__search {
color: var(--oc-color-input-text-default);
}
&__selected {
background-color: var(--oc-color-background-default);
}

&__search::placeholder,
&__dropdown-toggle,
&__dropdown-menu {
background-color: var(--oc-color-input-bg);
-webkit-appearance: none;
background-color: var(--oc-color-background-highlight);
border-radius: 0;
border-radius: 5px;
border: 1px solid var(--oc-color-input-border);
box-sizing: border-box;
color: var(--oc-color-input-text-default);
line-height: inherit;
margin: 0;
max-width: 100%;
outline: none;
overflow: visible;
padding: 2px;
transition-duration: 0.2s;
transition-timing-function: ease-in-out;
transition-property: color, background-color;
width: 100%;
}

&__search,
&__search:focus {
padding: 0 5px;
}

&__dropdown-menu {
padding: 0;
background-color: var(--oc-color-background-default);
margin-top: -1px;
}

&__clear,
&__open-indicator,
&__deselect {
fill: var(--oc-color-input-text-default);
}
&__deselect {
margin: 0 var(--oc-space-small);
}

&__dropdown-option {
color: var(--oc-color-input-text-default);
white-space: normal;
padding: 6px 0.6rem;
border-radius: 5px;
line-height: var(--vs-line-height);

&--highlight {
background-color: var(--oc-color-background-hover);
Expand All @@ -229,36 +338,80 @@ export default defineComponent({
max-width: var(--oc-space-small);
}

&__open-indicator {
margin-top: 2px;
}

&__selected-options {
flex: auto;
}
}
padding: 0;

&[multiple='multiple'] {
.vs {
&__selected {
background-color: var(--oc-color-swatch-inverse-default);
border: 1px solid var(--oc-color-input-border);
fill: var(--oc-color-text-default);
> * {
padding: 0px 2px;
margin: 2px 2px 2px 1px;
color: var(--oc-color-input-text-default);
}

&__deselect {
> *:not(input) {
padding-left: 3px;
background-color: var(--oc-color-background-default);
fill: var(--oc-color-text-default);
}
}
}

&.vs--multiple {
.vs {
&__selected-options > *:not(input) {
color: var(--oc-color-input-text-default);
background-color: var(--oc-color-background-default);
padding: 2px;
}
}
}

&:focus-within {
.vs__dropdown-menu,
.vs__dropdown-toggle {
border: 1px solid var(--oc-color-input-text-default);
border-color: var(--oc-color-swatch-passive-default);
}
}
}

.oc-background-highlight {
.oc-select {
.vs {
&__search {
color: var(--oc-color-input-text-default);
}

&__search::placeholder,
&__dropdown-toggle,
&__dropdown-menu {
background-color: var(--oc-color-input-bg);
}
}

&.vs--multiple {
.vs__selected-options > *:not(input) {
color: var(--oc-color-input-text-default);
background-color: var(--oc-color-background-highlight);
}
}

&:focus-within {
.vs__dropdown-menu,
.vs__dropdown-toggle {
background-color: var(--oc-color-background-default);
}
}
}
}

.vs--single {
&.vs--open .vs__selected {
opacity: 0.8 !important;
}
.vs__selected-options > *:not(input) {
background-color: transparent !important;
}
}
</style>

<docs>
Expand Down
4 changes: 0 additions & 4 deletions packages/design-system/src/components/OcTable/OcTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,6 @@ export default defineComponent({
transition: background-color $transition-duration-short ease-in-out;
}

&-hover tr:hover td:not(:last-child) span:not(.avatarInitials):not(button span) {
color: var(--oc-color-swatch-brand-hover) !important;
}

tr {
outline: none;
height: var(--oc-size-height-table-row);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ describe('OcTextInput', () => {
const selectors = {
textInputMessage: '.oc-text-input-message span',
clearInputButton: '.oc-text-input-btn-clear',
inputField: '.oc-text-input'
inputField: '.oc-text-input',
infoIcon: '.oc-text-input-message .oc-icon'
}

describe('id prop', () => {
Expand Down Expand Up @@ -61,6 +62,11 @@ describe('OcTextInput', () => {
it('should show the description message as the input message text', () => {
expect(wrapper.find(selectors.textInputMessage).text()).toBe('You should pass.')
})

const mountedWrapper = getMountedWrapper({ props: { descriptionMessage: 'You should pass.' } })
it('should show an info icon', () => {
expect(mountedWrapper.find(selectors.infoIcon).exists()).toBe(true)
})
})

describe('when a warning message is provided', () => {
Expand Down
Loading