Skip to content

Commit 02fd049

Browse files
committed
Display: Fix styles for primevue calendar
1 parent fbfee50 commit 02fd049

File tree

3 files changed

+202
-13
lines changed

3 files changed

+202
-13
lines changed

assets/css/scss/atoms/_calendar.scss

Lines changed: 186 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,191 @@
1-
.p-calendar {
2-
@apply flex;
1+
.p-datepicker {
2+
@apply inline-flex max-w-full;
33

4-
.p-inputtext {
5-
@apply rounded-r-none;
4+
&-input {
5+
@apply flex-auto w-[1%];
66
}
77

8-
.p-button {
9-
@apply rounded-l-none;
8+
&:has(&-dropdown) &-input {
9+
@apply rounded-r-lg;
10+
}
11+
12+
&-dropdown {
13+
@apply cursor-pointer inline-flex select-none items-center justify-center overflow-hidden relative w-full bg-white transition-colors outline-none rounded-l-lg
14+
focus-visible:outline-none;
15+
16+
&:not(:disabled) {
17+
@apply
18+
hover:bg-support-1
19+
active:bg-support-1
20+
focus:bg-support-1;
21+
}
22+
}
23+
24+
&:has(&-input-icon-container) {
25+
@apply relative;
26+
}
27+
28+
&:has(&-input-icon-container) &-input {
29+
@apply pr-12;
30+
}
31+
32+
&-input-icon-container {
33+
@apply cursor-pointer absolute top-3 right-4 text-gray-90;
34+
35+
.p-icon {
36+
@apply w-4 h-4 text-body-1 leading-none;
37+
}
38+
}
39+
40+
&-fluid {
41+
@apply flex;
42+
}
43+
44+
&-fluid &-input {
45+
@apply w-[1%];
46+
}
47+
48+
& &-panel {
49+
@apply min-w-full;
50+
}
51+
52+
&-panel {
53+
@apply absolute overflow-auto top-0 left-0 bg-white drop-shadow-lg rounded-lg border-none text-gray-90 mt-1 p-0
54+
before:content-[""] before:w-full before:block before:h-3 before:sticky before:bg-white before:z-[2] before:top-0 before:rounded-t-lg before:rounded-b-none
55+
after:content-[""] after:w-full after:block after:h-3 after:sticky after:bg-white after:z-[2] after:bottom-0 after:rounded-b-lg after:rounded-t-none;
56+
}
57+
58+
&-panel-inline {
59+
@apply inline-block overflow-x-auto drop-shadow-none;
60+
}
61+
62+
&-header {
63+
@apply flex items-center justify-between p-0 text-gray-90;
64+
}
65+
66+
&-next-button {
67+
@apply rtl:-order-1;
68+
}
69+
70+
&-prev-button {
71+
@apply rtl:order-1;
72+
}
73+
74+
&-title {
75+
@apply flex items-center justify-between gap-2 font-semibold;
76+
}
77+
78+
&-select-year,
79+
&-select-month {
80+
@apply border-none bg-transparent m-0 cursor-pointer transition-colors text-gray-90 px-2 py-0
81+
enabled:text-primary
82+
hover:text-primary
83+
focus-visible:text-primary focus-visible:outline-none;
84+
}
85+
86+
&-calendar-container {
87+
@apply flex px-4;
88+
}
89+
90+
&-calendar-container &-calendar {
91+
@apply flex-auto border-0 p-0;
92+
}
93+
94+
&-day-view {
95+
@apply w-full border-collapse text-base m-0;
96+
}
97+
98+
&-weekday {
99+
@apply font-semibold text-gray-90;
100+
}
101+
102+
&-day-cell {
103+
@apply p-1;
104+
}
105+
106+
&-day {
107+
@apply flex justify-center items-center cursor-pointer m-0 overflow-hidden relative w-7 h-7 border-0 rounded-lg text-gray-90 text-body-2 transition-colors outline-none
108+
focus-visible:outline-none;
109+
110+
.p-datepicker-today > & {
111+
@apply font-semibold;
112+
}
113+
114+
&-selected,
115+
&-selected-range {
116+
@apply bg-support-1 text-primary;
117+
118+
.p-datepicker-today > & {
119+
}
120+
}
121+
}
122+
123+
&-day:not(.p-disabled):not(&-day-selected),
124+
&-month:not(.p-disabled):not(&-month-selected),
125+
&-year:not(.p-disabled):not(&-year-selected) {
126+
@apply hover:bg-support-1;
127+
}
128+
129+
&-weeknumber {
130+
@apply font-semibold text-secondary text-center;
131+
}
132+
133+
&-month-view,
134+
&-year-view,
135+
&-time-picker {
136+
@apply mx-4;
137+
}
138+
139+
&-month,
140+
&-year{
141+
@apply w-1/3 h-7 inline-flex items-center justify-center cursor-pointer overflow-hidden relative p-0 transition-colors rounded-lg outline-none text-gray-90 text-body-2;
142+
143+
&-selected {
144+
@apply bg-support-1 text-primary;
145+
}
146+
}
147+
148+
&-month:not(.p-disabled),
149+
&-year:not(.p-disabled) {
150+
@apply focus-visible:outline-none;
151+
}
152+
153+
&-buttonbar {
154+
@apply flex justify-between items-center p-2;
155+
156+
.p-button {
157+
@apply w-auto;
158+
}
159+
}
160+
161+
&-time-picker {
162+
@apply flex justify-center items-center gap-4;
163+
164+
& > div {
165+
@apply flex items-center flex-col gap-1;
166+
}
167+
168+
span {
169+
@apply text-body-2;
170+
}
171+
172+
.p-timepicker-only & {
173+
}
174+
}
175+
176+
&:has(.p-inputtext-sm) &-dropdown {
177+
.p-icon {
178+
}
179+
}
180+
181+
&:has(.p-inputtext-sm) &-input-icon {
182+
}
183+
184+
&:has(.p-inputtext-lg) &-dropdown {
185+
.p-icon {
186+
}
187+
}
188+
189+
&:has(.p-inputtext-lg) &-input-icon {
10190
}
11191
}

assets/vue/components/basecomponents/BaseCalendar.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup>
22
import { computed, onMounted, ref, watch } from "vue"
33
import DatePicker from "primevue/datepicker"
4+
import FloatLabel from "primevue/floatlabel"
45
import { calendarLocales } from "../../utils/calendarLocales"
56
import { useLocale } from "../../composables/locale"
67
import { usePrimeVue } from "primevue/config"
@@ -94,20 +95,24 @@ onMounted(() => {
9495
</script>
9596
<template>
9697
<div class="field">
97-
<div class="p-float-label">
98+
<FloatLabel variant="on">
9899
<DatePicker
99-
:id="id"
100100
v-model="model"
101101
:class="{ 'p-invalid': isInvalid }"
102102
:date-format="dateFormat"
103+
:input-id="id"
103104
:locale="selectedLocale"
104105
:manual-input="type !== 'range'"
105106
:selection-mode="type"
106107
:show-icon="showIcon"
107108
:show-time="showTime"
109+
fluid
110+
icon-display="input"
108111
/>
109-
<label v-text="label" />
110-
</div>
111-
<small></small>
112+
<label
113+
:for="id"
114+
v-text="label"
115+
/>
116+
</FloatLabel>
112117
</div>
113118
</template>

assets/vue/components/basecomponents/BaseInputDate.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<template>
22
<div class="field">
3-
<div class="p-float-label">
3+
<FloatLabel variant="on">
44
<DatePicker
55
:class="{ 'p-invalid': isInvalid }"
66
:input-id="id"
77
:model-value="modelValue"
88
:show-time="showTime"
9+
fluid
10+
icon-display="input"
11+
show-icon
912
@update:model-value="$emit('update:modelValue', $event)"
1013
/>
1114
<label
1215
:for="id"
1316
v-text="label"
1417
/>
15-
</div>
18+
</FloatLabel>
1619
<small
1720
v-if="isInvalid"
1821
:class="{ 'p-error': isInvalid }"
@@ -22,6 +25,7 @@
2225
</template>
2326

2427
<script setup>
28+
import FloatLabel from "primevue/floatlabel"
2529
import DatePicker from "primevue/datepicker"
2630
2731
defineProps({

0 commit comments

Comments
 (0)