Material datepicker

pull/6501/head
Cagatay Civici 2024-09-30 12:25:22 +03:00
parent f6fc6cc435
commit 2e98080f37
6 changed files with 91 additions and 44 deletions

View File

@ -9,7 +9,7 @@
</FloatLabel> </FloatLabel>
<FloatLabel variant="in"> <FloatLabel variant="in">
<DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" /> <DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" variant="filled" />
<label for="in_label">In Label</label> <label for="in_label">In Label</label>
</FloatLabel> </FloatLabel>
@ -36,7 +36,7 @@ export default {
</FloatLabel> </FloatLabel>
<FloatLabel variant="in"> <FloatLabel variant="in">
<DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" /> <DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" variant="filled" />
<label for="in_label">In Label</label> <label for="in_label">In Label</label>
</FloatLabel> </FloatLabel>
@ -54,7 +54,7 @@ export default {
</FloatLabel> </FloatLabel>
<FloatLabel variant="in"> <FloatLabel variant="in">
<DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" /> <DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" variant="filled" />
<label for="in_label">In Label</label> <label for="in_label">In Label</label>
</FloatLabel> </FloatLabel>
@ -86,7 +86,7 @@ export default {
</FloatLabel> </FloatLabel>
<FloatLabel variant="in"> <FloatLabel variant="in">
<DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" /> <DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" variant="filled" />
<label for="in_label">In Label</label> <label for="in_label">In Label</label>
</FloatLabel> </FloatLabel>

View File

@ -4,7 +4,7 @@
</DocSectionText> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<IftaLabel> <IftaLabel>
<DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" /> <DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" variant="filled" />
<label for="date">Date</label> <label for="date">Date</label>
</IftaLabel> </IftaLabel>
</div> </div>
@ -19,7 +19,7 @@ export default {
code: { code: {
basic: ` basic: `
<IftaLabel> <IftaLabel>
<DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" /> <DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" variant="filled" />
<label for="date">Date</label> <label for="date">Date</label>
</IftaLabel> </IftaLabel>
`, `,
@ -27,7 +27,7 @@ export default {
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<IftaLabel> <IftaLabel>
<DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" /> <DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" variant="filled" />
<label for="date">Date</label> <label for="date">Date</label>
</IftaLabel> </IftaLabel>
</div> </div>
@ -47,7 +47,7 @@ export default {
<template> <template>
<div class="card flex justify-center"> <div class="card flex justify-center">
<IftaLabel> <IftaLabel>
<DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" /> <DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" variant="filled" />
<label for="date">Date</label> <label for="date">Date</label>
</IftaLabel> </IftaLabel>
</div> </div>

View File

@ -2,8 +2,9 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p> <p>Invalid state is displayed using the <i>invalid</i> prop to indicate a failed validation. You can use this style when integrating with form validation libraries.</p>
</DocSectionText> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex flex-wrap justify-center gap-4">
<DatePicker v-model="date" :invalid="date === null" /> <DatePicker v-model="date1" :invalid="!date1" />
<DatePicker v-model="date2" :invalid="!date2" variant="filled" />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -12,15 +13,18 @@
export default { export default {
data() { data() {
return { return {
date: null, date1: null,
date2: null,
code: { code: {
basic: ` basic: `
<DatePicker v-model="date" :invalid="date === null" /> <DatePicker v-model="date1" :invalid="!date1" />
<DatePicker v-model="date2" :invalid="!date2" variant="filled" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex flex-wrap justify-center gap-4">
<DatePicker v-model="date" :invalid="date === null" /> <DatePicker v-model="date1" :invalid="!date1" />
<DatePicker v-model="date2" :invalid="!date2" variant="filled" />
</div> </div>
</template> </template>
@ -28,7 +32,8 @@ export default {
export default { export default {
data() { data() {
return { return {
date: null date1: null,
date2: null
}; };
} }
}; };
@ -36,15 +41,17 @@ export default {
`, `,
composition: ` composition: `
<template> <template>
<div class="card flex justify-center"> <div class="card flex flex-wrap justify-center gap-4">
<DatePicker v-model="date" :invalid="date === null" /> <DatePicker v-model="date1" :invalid="!date1" />
<DatePicker v-model="date2" :invalid="!date2" variant="filled" />
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
const date = ref(); const date1 = ref(null);
const date2 = ref(null);
<\/script> <\/script>
` `
} }

View File

@ -106,6 +106,11 @@ export default {
label: 'Inline', label: 'Inline',
component: InlineDoc component: InlineDoc
}, },
{
id: 'filled',
label: 'Filled',
component: FilledDoc
},
{ {
id: 'floatlabel', id: 'floatlabel',
label: 'Float Label', label: 'Float Label',
@ -116,11 +121,6 @@ export default {
label: 'Ifta Label', label: 'Ifta Label',
component: IftaLabelDoc component: IftaLabelDoc
}, },
{
id: 'filled',
label: 'Filled',
component: FilledDoc
},
{ {
id: 'invalid', id: 'invalid',
label: 'Invalid', label: 'Invalid',

View File

@ -98,6 +98,8 @@ export default {
style: ({ dt }) => ` style: ({ dt }) => `
.p-autocomplete-dropdown:focus-visible { .p-autocomplete-dropdown:focus-visible {
background: ${dt('autocomplete.dropdown.hover.background')}; background: ${dt('autocomplete.dropdown.hover.background')};
border-color: ${dt('autocomplete.dropdown.hover.border.color')};
color: ${dt('autocomplete.dropdown.hover.color')};
} }
.p-variant-filled.p-autocomplete-input-multiple { .p-variant-filled.p-autocomplete-input-multiple {

View File

@ -14,26 +14,26 @@ export default {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}', color: '{content.color}',
padding: '0 0 0.5rem 0', padding: '0 0 0.75rem 0',
fontWeight: '500', fontWeight: '500',
gap: '0.5rem' gap: '0.5rem'
}, },
title: { title: {
gap: '0.5rem', gap: '0.5rem',
fontWeight: '500' fontWeight: '700'
}, },
dropdown: { dropdown: {
width: '2.5rem', width: '3rem',
borderColor: '{form.field.border.color}', borderColor: '{form.field.border.color}',
hoverBorderColor: '{form.field.border.color}', hoverBorderColor: '{form.field.border.color}',
activeBorderColor: '{form.field.border.color}', activeBorderColor: '{form.field.border.color}',
borderRadius: '{form.field.border.radius}', borderRadius: '{form.field.border.radius}',
focusRing: { focusRing: {
width: '{focus.ring.width}', width: '0',
style: '{focus.ring.style}', style: 'none',
color: '{focus.ring.color}', color: 'unset',
offset: '{focus.ring.offset}', offset: '0',
shadow: '{focus.ring.shadow}' shadow: 'nıne'
} }
}, },
inputIcon: { inputIcon: {
@ -43,14 +43,14 @@ export default {
hoverBackground: '{content.hover.background}', hoverBackground: '{content.hover.background}',
color: '{content.color}', color: '{content.color}',
hoverColor: '{content.hover.color}', hoverColor: '{content.hover.color}',
padding: '0.25rem 0.5rem', padding: '0.5rem 0.75rem',
borderRadius: '{content.border.radius}' borderRadius: '{content.border.radius}'
}, },
selectYear: { selectYear: {
hoverBackground: '{content.hover.background}', hoverBackground: '{content.hover.background}',
color: '{content.color}', color: '{content.color}',
hoverColor: '{content.hover.color}', hoverColor: '{content.hover.color}',
padding: '0.25rem 0.5rem', padding: '0.5rem 0.75rem',
borderRadius: '{content.border.radius}' borderRadius: '{content.border.radius}'
}, },
group: { group: {
@ -58,11 +58,11 @@ export default {
gap: '{overlay.popover.padding}' gap: '{overlay.popover.padding}'
}, },
dayView: { dayView: {
margin: '0.5rem 0 0 0' margin: '0.75rem 0 0 0'
}, },
weekDay: { weekDay: {
padding: '0.25rem', padding: '0.5rem',
fontWeight: '500', fontWeight: '700',
color: '{content.color}' color: '{content.color}'
}, },
date: { date: {
@ -73,10 +73,10 @@ export default {
hoverColor: '{content.hover.color}', hoverColor: '{content.hover.color}',
selectedColor: '{primary.contrast.color}', selectedColor: '{primary.contrast.color}',
rangeSelectedColor: '{highlight.color}', rangeSelectedColor: '{highlight.color}',
width: '2rem', width: '2.5rem',
height: '2rem', height: '2.5rem',
borderRadius: '50%', borderRadius: '50%',
padding: '0.25rem', padding: '0.5rem',
focusRing: { focusRing: {
width: '{focus.ring.width}', width: '{focus.ring.width}',
style: '{focus.ring.style}', style: '{focus.ring.style}',
@ -86,23 +86,23 @@ export default {
} }
}, },
monthView: { monthView: {
margin: '0.5rem 0 0 0' margin: '0.75rem 0 0 0'
}, },
month: { month: {
borderRadius: '{content.border.radius}' borderRadius: '{content.border.radius}'
}, },
yearView: { yearView: {
margin: '0.5rem 0 0 0' margin: '0.75rem 0 0 0'
}, },
year: { year: {
borderRadius: '{content.border.radius}' borderRadius: '{content.border.radius}'
}, },
buttonbar: { buttonbar: {
padding: '0.5rem 0 0 0', padding: '0.75rem 0 0 0',
borderColor: '{content.border.color}' borderColor: '{content.border.color}'
}, },
timePicker: { timePicker: {
padding: '0.5rem 0 0 0', padding: '0.75rem 0 0 0',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
gap: '0.5rem', gap: '0.5rem',
buttonGap: '0.25rem' buttonGap: '0.25rem'
@ -136,5 +136,43 @@ export default {
color: '{surface.0}' color: '{surface.0}'
} }
} }
} },
style: ({ dt }) => `
.p-datepicker-header {
justify-content: start;
}
.p-datepicker-title {
order: 1;
}
.p-datepicker-prev-button {
order: 2;
margin-inline-start: auto;
}
.p-datepicker-next-button {
order: 2;
margin-inline-start: 0.5rem;
}
.p-datepicker-select-month:focus-visible {
background: ${dt('datepicker.select.month.hover.background')};
color: ${dt('datepicker.select.month.hover.color')};
outline: 0 none;
}
.p-datepicker-select-year:focus-visible {
background: ${dt('datepicker.select.year.hover.background')};
color: ${dt('datepicker.select.year.hover.color')};
outline: 0 none;
}
.p-datepicker-dropdown:focus-visible {
outline: 0 none;
background: ${dt('datepicker.dropdown.hover.background')};
border-color: ${dt('datepicker.dropdown.hover.border.color')};
color: ${dt('datepicker.dropdown.hover.color')};
}
`
}; };