Skip to content

Commit 916eb31

Browse files
committed
fix: Inline time-picker with is-24="false" overflowing the container (fixes #990)
1 parent c22287b commit 916eb31

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

src/VueDatePicker/components/TimePicker/TimeInput.vue

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<template>
22
<div v-if="!disabled" class="dp__time_input">
3-
<div v-for="(timeInput, i) in timeInputs" :key="i" :class="timeColClass">
3+
<div
4+
v-for="(timeInput, i) in timeInputs"
5+
:key="i"
6+
:class="timeColClass"
7+
:data-compact="isCompact && !enableSeconds"
8+
:data-collapsed="isCompact && enableSeconds"
9+
>
410
<template v-if="timeInput.separator"> <template v-if="!timeOverlayOpen">:</template> </template>
511
<template v-else>
612
<button
@@ -115,6 +121,7 @@
115121
role="button"
116122
:aria-label="defaultedAriaLabels?.amPmButton"
117123
tabindex="0"
124+
:data-compact="isCompact"
118125
@click="setAmPm"
119126
@keydown="checkKeyDown($event, () => setAmPm(), true)"
120127
>
@@ -212,8 +219,14 @@
212219
});
213220
214221
const { setTimePickerElements, setTimePickerBackRef } = useArrowNavigation();
215-
const { defaultedAriaLabels, defaultedTransitions, defaultedFilters, defaultedConfig, defaultedRange } =
216-
useDefaults(props);
222+
const {
223+
defaultedAriaLabels,
224+
defaultedTransitions,
225+
defaultedFilters,
226+
defaultedConfig,
227+
defaultedRange,
228+
defaultedMultiCalendars,
229+
} = useDefaults(props);
217230
218231
const { transitionName, showTransition } = useTransitions(defaultedTransitions);
219232
@@ -287,6 +300,10 @@
287300
}),
288301
);
289302
303+
const isCompact = computed(
304+
() => props.timePickerInline && defaultedRange.value.enabled && !defaultedMultiCalendars.value.count,
305+
);
306+
290307
const timeInputs = computed((): TimeInput[] => {
291308
const inputs = [{ type: 'hours' }];
292309
if (props.enableMinutes) {

src/VueDatePicker/style/components/_SelectionOverlay.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
padding: 0;
6262
box-sizing: border-box;
6363
display: flex;
64-
margin-inline: auto auto;
64+
margin-inline: auto;
6565
flex-wrap: wrap;
6666
max-width: 100%;
6767
width: 100%;

src/VueDatePicker/style/components/_TimeInput.scss

+12
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424

2525
.dp__time_col_reg_with_button {
2626
padding: 0 15px;
27+
28+
&[data-compact~="true"] {
29+
padding: 0 5px;
30+
}
2731
}
2832

2933
.dp__time_col_sec {
@@ -32,6 +36,10 @@
3236

3337
.dp__time_col_sec_with_button {
3438
padding: 0 5px;
39+
40+
&[data-collapsed~="true"] {
41+
padding: 0;
42+
}
3543
}
3644

3745
.dp__time_col {
@@ -133,6 +141,10 @@
133141
padding: var(--dp-common-padding);
134142
border-radius: var(--dp-border-radius);
135143
cursor: pointer;
144+
145+
&[data-compact~="true"] {
146+
padding: 7px;
147+
}
136148
}
137149

138150
.dp__tp_inline_btn_bar {

0 commit comments

Comments
 (0)