mirror of
https://github.com/picocss/pico.git
synced 2025-04-21 17:16:14 -04:00
Merge pull request #174 from hayatbiralem/add-states-support-to-search-input
Add states support to search input with rtl support
This commit is contained in:
commit
de89731695
15 changed files with 113 additions and 16 deletions
|
@ -1544,19 +1544,38 @@ input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[
|
||||||
}
|
}
|
||||||
|
|
||||||
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
||||||
padding-left: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
-webkit-padding-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
border-radius: 5rem;
|
border-radius: 5rem;
|
||||||
background-image: var(--icon-search);
|
background-image: var(--icon-search);
|
||||||
background-position: center left 1.125rem;
|
background-position: center left 1.125rem;
|
||||||
background-size: 1rem auto;
|
background-size: 1rem auto;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid] {
|
||||||
|
-webkit-padding-start: calc(var(--form-element-spacing-horizontal) + 1.75rem) !important;
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem) !important;
|
||||||
|
background-position: center left 1.125rem, center right 0.75rem;
|
||||||
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid=false] {
|
||||||
|
background-image: var(--icon-search), var(--icon-valid);
|
||||||
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid=true] {
|
||||||
|
background-image: var(--icon-search), var(--icon-invalid);
|
||||||
|
}
|
||||||
|
|
||||||
[type=search]::-webkit-search-cancel-button {
|
[type=search]::-webkit-search-cancel-button {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[dir=rtl] :where(input):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
||||||
|
background-position: center right 1.125rem;
|
||||||
|
}
|
||||||
|
[dir=rtl] :where(input):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid] {
|
||||||
|
background-position: center right 1.125rem, center left 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table
|
* Table
|
||||||
*/
|
*/
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
css/pico.classless.min.css
vendored
2
css/pico.classless.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
21
css/pico.css
21
css/pico.css
|
@ -1647,19 +1647,38 @@ input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[
|
||||||
}
|
}
|
||||||
|
|
||||||
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
||||||
padding-left: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
-webkit-padding-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
border-radius: 5rem;
|
border-radius: 5rem;
|
||||||
background-image: var(--icon-search);
|
background-image: var(--icon-search);
|
||||||
background-position: center left 1.125rem;
|
background-position: center left 1.125rem;
|
||||||
background-size: 1rem auto;
|
background-size: 1rem auto;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid] {
|
||||||
|
-webkit-padding-start: calc(var(--form-element-spacing-horizontal) + 1.75rem) !important;
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem) !important;
|
||||||
|
background-position: center left 1.125rem, center right 0.75rem;
|
||||||
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid=false] {
|
||||||
|
background-image: var(--icon-search), var(--icon-valid);
|
||||||
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid=true] {
|
||||||
|
background-image: var(--icon-search), var(--icon-invalid);
|
||||||
|
}
|
||||||
|
|
||||||
[type=search]::-webkit-search-cancel-button {
|
[type=search]::-webkit-search-cancel-button {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[dir=rtl] :where(input):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
||||||
|
background-position: center right 1.125rem;
|
||||||
|
}
|
||||||
|
[dir=rtl] :where(input):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid] {
|
||||||
|
background-position: center right 1.125rem, center left 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table
|
* Table
|
||||||
*/
|
*/
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1514,19 +1514,38 @@ input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[
|
||||||
}
|
}
|
||||||
|
|
||||||
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
||||||
padding-left: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
-webkit-padding-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
border-radius: 5rem;
|
border-radius: 5rem;
|
||||||
background-image: var(--icon-search);
|
background-image: var(--icon-search);
|
||||||
background-position: center left 1.125rem;
|
background-position: center left 1.125rem;
|
||||||
background-size: 1rem auto;
|
background-size: 1rem auto;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid] {
|
||||||
|
-webkit-padding-start: calc(var(--form-element-spacing-horizontal) + 1.75rem) !important;
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem) !important;
|
||||||
|
background-position: center left 1.125rem, center right 0.75rem;
|
||||||
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid=false] {
|
||||||
|
background-image: var(--icon-search), var(--icon-valid);
|
||||||
|
}
|
||||||
|
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid=true] {
|
||||||
|
background-image: var(--icon-search), var(--icon-invalid);
|
||||||
|
}
|
||||||
|
|
||||||
[type=search]::-webkit-search-cancel-button {
|
[type=search]::-webkit-search-cancel-button {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[dir=rtl] :where(input):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search] {
|
||||||
|
background-position: center right 1.125rem;
|
||||||
|
}
|
||||||
|
[dir=rtl] :where(input):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file])[type=search][aria-invalid] {
|
||||||
|
background-position: center right 1.125rem, center left 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table
|
* Table
|
||||||
*/
|
*/
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
css/pico.fluid.classless.min.css
vendored
2
css/pico.fluid.classless.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
css/pico.min.css
vendored
2
css/pico.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -79,7 +79,10 @@
|
||||||
</<b>label</b>>
|
</<b>label</b>>
|
||||||
</<b>fieldset</b>></code></pre></footer></article><p>You can change a checkbox to an indeterminate state by setting the <code><i>indeterminate</i></code> property to <code><u>true</u></code></p><article aria-label="Indeterminate checkbox example"><label for="indeterminate-checkbox"><input type="checkbox" id="indeterminate-checkbox" name="indeterminate-checkbox"> Select all</label><script>document.getElementById("indeterminate-checkbox").indeterminate=!0</script><footer class="code"><pre><code><<b>script</b>>
|
</<b>fieldset</b>></code></pre></footer></article><p>You can change a checkbox to an indeterminate state by setting the <code><i>indeterminate</i></code> property to <code><u>true</u></code></p><article aria-label="Indeterminate checkbox example"><label for="indeterminate-checkbox"><input type="checkbox" id="indeterminate-checkbox" name="indeterminate-checkbox"> Select all</label><script>document.getElementById("indeterminate-checkbox").indeterminate=!0</script><footer class="code"><pre><code><<b>script</b>>
|
||||||
<i>document</i>.<b>getElementById</b>(<u>'indeterminate-checkbox'</u>).<i>indeterminate</i> = <u>true</u>;
|
<i>document</i>.<b>getElementById</b>(<u>'indeterminate-checkbox'</u>).<i>indeterminate</i> = <u>true</u>;
|
||||||
</<b>script</b>></code></pre></footer></article><p>Others input types:</p><article aria-label="File browser, range slider, date, time, color examples"><label for="file">File browser <input type="file" id="file" name="file"></label> <label for="range">Range slider <input type="range" min="0" max="100" value="50" id="range" name="range"></label> <label for="date">Date <input type="date" id="date" name="date"></label> <label for="time">Time <input type="time" id="time" name="time"></label> <label for="color">Color <input type="color" id="color" name="color" value="#0eaaaa"></label><footer class="code"><pre><code><em><!-- File browser --></em>
|
</<b>script</b>></code></pre></footer></article><p>Others input types:</p><article aria-label="Search, file browser, range slider, date, time, color examples"><input type="search" id="search" name="search" placeholder="Search"> <label for="file">File browser <input type="file" id="file" name="file"></label> <label for="range">Range slider <input type="range" min="0" max="100" value="50" id="range" name="range"></label> <label for="date">Date <input type="date" id="date" name="date"></label> <label for="time">Time <input type="time" id="time" name="time"></label> <label for="color">Color <input type="color" id="color" name="color" value="#0eaaaa"></label><footer class="code"><pre><code><em><!-- Search --></em>
|
||||||
|
<<b>input</b> <i>type</i>=<u>"search"</u> <i>id</i>=<u>"search"</u> <i>name</i>=<u>"search"</u> <i>placeholder</i>=<u>"Search"</u>>
|
||||||
|
|
||||||
|
<!-- File browser -->
|
||||||
<<b>label</b> <i>for</i>=<u>"file"</u>>File browser
|
<<b>label</b> <i>for</i>=<u>"file"</u>>File browser
|
||||||
<<b>input</b> <i>type</i>=<u>"file"</u> <i>id</i>=<u>"file"</u> <i>name</i>=<u>"file"</u>>
|
<<b>input</b> <i>type</i>=<u>"file"</u> <i>id</i>=<u>"file"</u> <i>name</i>=<u>"file"</u>>
|
||||||
</<b>label</b>>
|
</<b>label</b>>
|
||||||
|
|
|
@ -210,8 +210,10 @@
|
||||||
|
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<p>Others input types:</p>
|
<p>Others input types:</p>
|
||||||
<article aria-label="File browser, range slider, date, time, color examples">
|
<article aria-label="Search, file browser, range slider, date, time, color examples">
|
||||||
|
<input type="search" id="search" name="search" placeholder="Search">
|
||||||
<label for="file">File browser
|
<label for="file">File browser
|
||||||
<input type="file" id="file" name="file">
|
<input type="file" id="file" name="file">
|
||||||
</label>
|
</label>
|
||||||
|
@ -229,7 +231,10 @@
|
||||||
</label>
|
</label>
|
||||||
<footer class="code">
|
<footer class="code">
|
||||||
|
|
||||||
<pre><code><em><!-- File browser --></em>
|
<pre><code><em><!-- Search --></em>
|
||||||
|
<<b>input</b> <i>type</i>=<u>"search"</u> <i>id</i>=<u>"search"</u> <i>name</i>=<u>"search"</u> <i>placeholder</i>=<u>"Search"</u>>
|
||||||
|
|
||||||
|
<!-- File browser --></em>
|
||||||
<<b>label</b> <i>for</i>=<u>"file"</u>>File browser
|
<<b>label</b> <i>for</i>=<u>"file"</u>>File browser
|
||||||
<<b>input</b> <i>type</i>=<u>"file"</u> <i>id</i>=<u>"file"</u> <i>name</i>=<u>"file"</u>>
|
<<b>input</b> <i>type</i>=<u>"file"</u> <i>id</i>=<u>"file"</u> <i>name</i>=<u>"file"</u>>
|
||||||
</<b>label</b>>
|
</<b>label</b>>
|
||||||
|
|
|
@ -226,12 +226,30 @@ input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="
|
||||||
// :not() are needed to add Specificity and avoid !important on padding
|
// :not() are needed to add Specificity and avoid !important on padding
|
||||||
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
|
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
|
||||||
&[type="search"] {
|
&[type="search"] {
|
||||||
padding-left: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
border-radius: 5rem;
|
border-radius: 5rem;
|
||||||
background-image: var(--icon-search);
|
background-image: var(--icon-search);
|
||||||
background-position: center left 1.125rem;
|
background-position: center left 1.125rem;
|
||||||
background-size: 1rem auto;
|
background-size: 1rem auto;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
|
&[aria-invalid] {
|
||||||
|
@if $enable-important {
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem) !important;
|
||||||
|
}
|
||||||
|
@else {
|
||||||
|
padding-inline-start: calc(var(--form-element-spacing-horizontal) + 1.75rem);
|
||||||
|
}
|
||||||
|
background-position: center left 1.125rem, center right 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[aria-invalid="false"] {
|
||||||
|
background-image: var(--icon-search), var(--icon-valid);
|
||||||
|
}
|
||||||
|
|
||||||
|
&[aria-invalid="true"] {
|
||||||
|
background-image: var(--icon-search), var(--icon-invalid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,3 +260,17 @@ input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[dir="rtl"] {
|
||||||
|
:where(input) {
|
||||||
|
&:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
|
||||||
|
&[type="search"] {
|
||||||
|
background-position: center right 1.125rem;
|
||||||
|
|
||||||
|
&[aria-invalid] {
|
||||||
|
background-position: center right 1.125rem, center left 0.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue