Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 20 additions & 14 deletions core/src/components/datetime/datetime.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@include padding($datetime-ios-padding, $datetime-ios-padding, $datetime-ios-padding, $datetime-ios-padding);

border-bottom: $datetime-ios-border-color;

font-size: 14px;
}

Expand Down Expand Up @@ -85,27 +85,33 @@
*/
@include padding($datetime-ios-padding * 0.5, $datetime-ios-padding * 0.5, $datetime-ios-padding * 0.5, $datetime-ios-padding * 0.5);

align-items: center;

height: calc(100% - #{$datetime-ios-padding});
}

:host .calendar-day {
font-size: 20px;
}
:host .calendar-day-wrapper {
@include padding(4px);

.calendar-day:focus .calendar-day-highlight,
.calendar-day.calendar-day-active .calendar-day-highlight {
opacity: 0.2;
// This is required so that the calendar day wrapper
// will collapse instead of expanding to fill the button
height: 0;

min-height: 16px;
}

.calendar-day.calendar-day-active .calendar-day-highlight {
background: current-color(base);
:host .calendar-day {
width: 40px;
min-width: 40px;

height: 40px;

font-size: 20px;
}

// !important is needed here to overwrite custom highlight background, which is inline.
// Does not apply to the active state because highlights aren't applied at all there.
.calendar-day:focus .calendar-day-highlight {
/* stylelint-disable-next-line declaration-no-important */
background: current-color(base) !important;
.calendar-day:focus,
.calendar-day.calendar-day-active {
background: current-color(base, 0.2);
}

/**
Expand Down
15 changes: 8 additions & 7 deletions core/src/components/datetime/datetime.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@

// Individual day button in month
:host .calendar-day {
@include padding(13px, 0, 13px, 0px);
width: 42px;
min-width: 42px;

height: 42px;

font-size: $datetime-md-calendar-item-font-size;
}

.calendar-day:focus .calendar-day-highlight {
.calendar-day:focus {
background: current-color(base, 0.2);

box-shadow: 0px 0px 0px 4px current-color(base, 0.2);
Expand All @@ -85,11 +88,9 @@
* should have ion-color for text color.
*/
:host .calendar-day.calendar-day-today {
color: current-color(base);
}

.calendar-day.calendar-day-today .calendar-day-highlight {
border: 1px solid current-color(base);

color: current-color(base);
}

/**
Expand All @@ -101,7 +102,7 @@
color: current-color(contrast);
}

.calendar-day.calendar-day-active .calendar-day-highlight {
.calendar-day.calendar-day-active {
border: 1px solid current-color(base);

background: current-color(base);
Expand Down
41 changes: 23 additions & 18 deletions core/src/components/datetime/datetime.scss
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,19 @@ ion-picker-column-internal {
}

:host .calendar-body .calendar-month {
display: flex;

flex-flow: column;

flex-shrink: 0;

width: 100%;
/**
* Swiping should snap to at
* most one month at a time.
*/
scroll-snap-align: start;
scroll-snap-stop: always;

flex-shrink: 0;

width: 100%;
}

:host .calendar-body .calendar-month-disabled {
Expand All @@ -325,13 +328,27 @@ ion-picker-column-internal {
grid-template-columns: repeat(7, 1fr);
}

:host .calendar-day-wrapper {
display: flex;

align-items: center;
justify-content: center;

min-width: 0;

min-height: 0;

overflow: visible;
}

/**
* Center the day text vertically
* and horizontally within its grid cell.
*/
:host .calendar-day {
@include padding(0px, 0px, 0px, 0px);
@include margin(0px, 0px, 0px, 0px);
@include border-radius(50%);
@include padding(0px);
@include margin(0px);

display: flex;

Expand Down Expand Up @@ -362,18 +379,6 @@ ion-picker-column-internal {
opacity: 0.4;
}

.calendar-day-highlight {
@include border-radius(32px, 32px, 32px, 32px);
@include padding(4px, 4px, 4px, 4px);

position: absolute;

width: 32px;
height: 32px;

z-index: -1;
}

// Time / Header
// -----------------------------------

Expand Down
109 changes: 53 additions & 56 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2084,68 +2084,65 @@ export class Datetime implements ComponentInterface {
}

return (
<button
tabindex="-1"
data-day={day}
data-month={month}
data-year={year}
data-index={index}
data-day-of-week={dayOfWeek}
disabled={isCalDayDisabled}
class={{
'calendar-day-padding': isCalendarPadding,
'calendar-day': true,
'calendar-day-active': isActive,
'calendar-day-today': isToday,
}}
style={
dateStyle && {
color: dateStyle.textColor,
}
}
aria-hidden={isCalendarPadding ? 'true' : null}
aria-selected={ariaSelected}
aria-label={ariaLabel}
onClick={() => {
if (isCalendarPadding) {
return;
<div class="calendar-day-wrapper">
<button
tabindex="-1"
data-day={day}
data-month={month}
data-year={year}
data-index={index}
data-day-of-week={dayOfWeek}
disabled={isCalDayDisabled}
class={{
'calendar-day-padding': isCalendarPadding,
'calendar-day': true,
'calendar-day-active': isActive,
'calendar-day-today': isToday,
}}
style={
dateStyle && {
color: dateStyle.textColor,
backgroundColor: dateStyle.backgroundColor,
}
}

this.setWorkingParts({
...this.workingParts,
month,
day,
year,
});

// multiple only needs date info, so we can wipe out other fields like time
if (multiple) {
this.setActiveParts(
{
month,
day,
year,
},
isActive
);
} else {
this.setActiveParts({
...activePart,
aria-hidden={isCalendarPadding ? 'true' : null}
aria-selected={ariaSelected}
aria-label={ariaLabel}
onClick={() => {
if (isCalendarPadding) {
return;
}

this.setWorkingParts({
...this.workingParts,
month,
day,
year,
});
}
}}
>
<div
class="calendar-day-highlight"
style={{
backgroundColor: dateStyle?.backgroundColor,

// multiple only needs date info, so we can wipe out other fields like time
if (multiple) {
this.setActiveParts(
{
month,
day,
year,
},
isActive
);
} else {
this.setActiveParts({
...activePart,
month,
day,
year,
});
}
}}
></div>
{text}
</button>
>
{text}
</button>
</div>
);
})}
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.