From 4308dc1d198e65ef8833b3407215966591fd539a Mon Sep 17 00:00:00 2001 From: Raphael Goetter Date: Mon, 31 Jul 2017 17:16:08 +0200 Subject: [PATCH] refonte des styles de formulaires --- changelog.md | 1 + sass/components/forms.scss | 85 ++++++++++++++++++++++++++------------ 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/changelog.md b/changelog.md index 9dc194c..49ce687 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ - refonte complète des boutons, avec possibilités de variantes (primary, success, warning, etc.) - ajout des badges (tags), avec possibilités de variantes (primary, success, warning, etc.) - ajout des alertes, avec possibilités de variantes (primary, success, warning, etc.) +- refonte des styles de formulaires - autogrid object en Grid Layout - regroupement des styles des tableaux - suppression du namespace "kna-", ne devrait pas être problématique dès lors que Grillade sera devenu inutile dans KNACSS diff --git a/sass/components/forms.scss b/sass/components/forms.scss index 1931a4b..da48d36 100644 --- a/sass/components/forms.scss +++ b/sass/components/forms.scss @@ -1,10 +1,7 @@ /* ----------------------------- */ /* ==Forms */ /* ----------------------------- */ -/* thanks to HTML5boilerplate, -* github.com/nathansmith/formalize and www.sitepen.com -*/ - +/* thanks to HTML5boilerplate and https://shoelace.style/ */ /* forms items */ form, @@ -12,45 +9,74 @@ fieldset { border: none; } -input, -select, -label { - font-family: inherit; - font-size: inherit; -} +fieldset { + padding: $medium-value; -input, -optgroup, -select, -textarea { - color: $color-base; + & legend { + padding: 0 $tiny-value; + border: 0; + white-space: normal; + } } label { + display: inline-block; vertical-align: middle; cursor: pointer; } -legend { - border: 0; - white-space: normal; +input[type="color"], +input[type="date"], +input[type="datetime-local"], +input[type="email"], +input[type="month"], +input[type="number"], +input[type="password"], +input[type="search"], +input[type="tel"], +input[type="text"], +input[type="time"], +input[type="url"], +input[type="week"], +select, +textarea { + font-family: inherit; + font-size: inherit; + color: $color-base; + vertical-align: middle; + padding: $tiny-value $small-value; + margin: 0; + transition: 0.25s; + transition-property: box-shadow, background-color, color, border; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +input[disabled] { + opacity: .5; + cursor: not-allowed; +} + +input[readonly] { + background-color: $color-muted; +} + +select { + padding-right: 2rem; + border-radius: $border-radius; + background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='41px' height='26px' viewBox='0 0 41 26' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3C/defs%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cpolygon id='Path-3' fill='%23000000' points='0 5.38215461 19.9830489 25.3652035 40.1398855 5.20836689 34.9315186 0 19.8691842 15.0623344 4.83971338 0.0328636246'%3E%3C/polygon%3E%3C/g%3E%3C/svg%3E%0A"); + background-position: right .5rem center; + background-repeat: no-repeat; + background-size: 1rem; } textarea { min-height: 5em; vertical-align: top; - font-family: inherit; - font-size: inherit; resize: vertical; } -select { - -webkit-appearance: menulist-button; -} - -/* if select styling bugs on WebKit */ -/* select { -webkit-appearance: none; } */ - /* 'x' appears on right of search input when text is entered. This removes it */ input[type="search"] { &::-webkit-search-decoration, @@ -69,3 +95,8 @@ input:-moz-placeholder, textarea:-moz-placeholder { color: #777; } + +progress { + width: 100%; + vertical-align: middle; +}