feat(ui): [WIP] implement Pills (Multi-pill widget)
This commit is contained in:
parent
3ffa784027
commit
713c2fe34f
|
@ -234,13 +234,14 @@ watch(model, () => {
|
|||
margin: 0 -4px;
|
||||
|
||||
padding:4px;
|
||||
border-radius: 24px;
|
||||
border-radius: 22px;
|
||||
|
||||
min-height: 48px;
|
||||
min-width: 160px;
|
||||
|
||||
gap: 4px;
|
||||
|
||||
> .pill {
|
||||
margin: 4px;
|
||||
padding: 2px;
|
||||
&.static {
|
||||
text-decoration: none;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import Pill from '~/components/ui/Pill.vue';
|
||||
import Pills from '~/components/ui/Pills.vue';
|
||||
import Spacer from '~/components/ui/Spacer.vue';
|
||||
import Layout from '~/components/ui/Layout.vue';
|
||||
|
@ -26,6 +27,12 @@ const customModel = ref({
|
|||
});
|
||||
|
||||
const search = ref()
|
||||
|
||||
const countryInput = ref("")
|
||||
|
||||
const inputModel = ref({ input: "Custom", isEditing: false })
|
||||
|
||||
const update = (e)=>{console.log(e)}
|
||||
</script>
|
||||
|
||||
```ts
|
||||
|
@ -49,6 +56,73 @@ If you place custom pills into `others`, the user will be able to select, edit a
|
|||
|
||||
:::
|
||||
|
||||
## Test
|
||||
|
||||
<label for="selectTag">
|
||||
|
||||
<b>Select tag</b>
|
||||
|
||||
<Layout flex gap-12 style="background:transparent;padding:12px; outline-inset: -4px; border-radius: 24px;">
|
||||
|
||||
<Pill>
|
||||
#Pell
|
||||
</Pill>
|
||||
|
||||
<input autocomplete="off" style="flex-grow: 1; min-width: 44px; flex-basis: 44px; padding: 12px 22px; margin: -12px; border-radius: inherit; outline: 1px solid red;" value="pill"></input>
|
||||
|
||||
<Pill>
|
||||
VeryLongPill
|
||||
</Pill>
|
||||
|
||||
<Pill>
|
||||
VeryLongEvenLongerPill
|
||||
</Pill>
|
||||
|
||||
<Pill v-model="inputModel"/>
|
||||
|
||||
<input id="selectTag" size="50" list="tags" autocomplete="off" style="flex-grow: 1; min-width: 44px; flex-basis: 44px; padding: 12px 22px; margin: -12px; border-radius: inherit; outline: 1px solid red;" @input="update">
|
||||
</input>
|
||||
|
||||
<!-- https://www.sitepoint.com/html5-datalist-autocomplete/ -->
|
||||
|
||||
<datalist id="tags">
|
||||
<option>Russia</option>
|
||||
<option>Germany</option>
|
||||
<option>UnitedKingdom</option>
|
||||
</datalist>
|
||||
|
||||
<style scoped>
|
||||
*:has(> input){
|
||||
outline: 4px solid transparent;
|
||||
}
|
||||
*:has(> input:focus){
|
||||
outline-color:var(--focus-ring-color)
|
||||
}
|
||||
input:focus+datalist {
|
||||
position: absolute;
|
||||
max-height: 20em;
|
||||
border: 0 none;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
datalist option {
|
||||
font-size: 0.8em;
|
||||
padding: 0.3em 1em;
|
||||
background-color: #ccc;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
datalist option:hover, datalist option:focus {
|
||||
color: #fff;
|
||||
background-color: #036;
|
||||
outline: 0 none;
|
||||
}
|
||||
</style>
|
||||
|
||||
</Layout>
|
||||
|
||||
</label>
|
||||
|
||||
## No pills
|
||||
|
||||
```ts
|
||||
|
|
Loading…
Reference in New Issue