Implemented Striped Rows for Listbox

pull/5806/head
Cagatay Civici 2024-05-26 00:53:16 +03:00
parent c6663196a0
commit cb20a7b158
5 changed files with 44 additions and 4 deletions

View File

@ -69,6 +69,10 @@ const theme = ({ dt }) => `
box-shadow ${dt('listbox.transition.duration')}, outline-color ${dt('listbox.transition.duration')}; box-shadow ${dt('listbox.transition.duration')}, outline-color ${dt('listbox.transition.duration')};
} }
.p-listbox-striped li:nth-child(even of .p-listbox-option) {
background: ${dt('listbox.option.striped.background')};
}
.p-listbox .p-listbox-list .p-listbox-option.p-listbox-option-selected { .p-listbox .p-listbox-list .p-listbox-option.p-listbox-option-selected {
background: ${dt('listbox.option.selected.background')}; background: ${dt('listbox.option.selected.background')};
color: ${dt('listbox.option.selected.color')}; color: ${dt('listbox.option.selected.color')};

View File

@ -50,5 +50,17 @@ export default {
}, },
emptyMessage: { emptyMessage: {
padding: '{list.option.padding}' padding: '{list.option.padding}'
},
colorScheme: {
light: {
option: {
stripedBackground: '{surface.50}'
}
},
dark: {
option: {
stripedBackground: '{surface.900}'
}
}
} }
}; };

View File

@ -50,5 +50,17 @@ export default {
}, },
emptyMessage: { emptyMessage: {
padding: '{list.option.padding}' padding: '{list.option.padding}'
},
colorScheme: {
light: {
option: {
stripedBackground: '{surface.50}'
}
},
dark: {
option: {
stripedBackground: '{surface.900}'
}
}
} }
}; };

View File

@ -50,5 +50,17 @@ export default {
}, },
emptyMessage: { emptyMessage: {
padding: '{list.option.padding}' padding: '{list.option.padding}'
},
colorScheme: {
light: {
option: {
stripedBackground: '{surface.100}'
}
},
dark: {
option: {
stripedBackground: '{surface.800}'
}
}
} }
}; };

View File

@ -6,7 +6,7 @@
</p> </p>
</DocSectionText> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value" :virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" /> <Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value" :virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" stripedRows />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -20,13 +20,13 @@ export default {
code: { code: {
basic: ` basic: `
<Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value" <Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value"
:virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" /> :virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" stripedRows />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value" <Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value"
:virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" /> :virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" stripedRows />
</div> </div>
</template> </template>
@ -45,7 +45,7 @@ export default {
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value" <Listbox v-model="selectedItem" :options="items" optionLabel="label" optionValue="value"
:virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" /> :virtualScrollerOptions="{ itemSize: 38 }" class="w-full md:w-56" listStyle="height:250px" stripedRows />
</div> </div>
</template> </template>