Files
ionic-framework/core/src/components/datetime/datetime.ios.scss
Brandy Carney 79b005da70 feat(datetime): add parts for calendar day, active, and today (#27641)
Issue number: resolves #25340

---------

- Exposes the following parts for a calendar day: `calendar-day`,
`today`, and `active`
- Combines the `calendar-day-highlight` element with the `calendar-day`
element so developers don't have to know to style two different elements
& we don't have to expose them as separate parts
- Improves height parity of the calendar day across browsers
- Updates the `custom` e2e test to include an example of styling days
using the newly exposed CSS parts
- Adds tests for the focus states of the calendar day
2023-09-06 11:58:41 -04:00

174 lines
4.0 KiB
SCSS

@import "./datetime.scss";
@import "./datetime.ios.vars.scss";
@import "../../themes/ionic.globals.ios";
:host {
--background: var(--ion-color-light, #ffffff);
--background-rgb: var(--ion-color-light-rgb);
--title-color: #{$text-color-step-400};
}
:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),
:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),
:host(.datetime-presentation-date:not(.datetime-prefer-wheel)) {
min-height: 350px;
}
// Header
// -----------------------------------
:host .datetime-header {
@include padding($datetime-ios-padding, $datetime-ios-padding, $datetime-ios-padding, $datetime-ios-padding);
border-bottom: $datetime-ios-border-color;
font-size: 14px;
}
:host .datetime-header .datetime-title {
color: var(--title-color);
}
:host .datetime-header .datetime-selected-date {
@include margin(10px, null, null, null);
}
// Calendar / Header / Action Buttons
// -----------------------------------
:host .calendar-action-buttons ion-item {
--padding-start: #{$datetime-ios-padding};
--background-hover: transparent;
--background-activated: transparent;
font-size: 16px;
font-weight: 600;
}
:host .calendar-action-buttons ion-item ion-icon,
:host .calendar-action-buttons ion-buttons ion-button {
color: current-color(base);
}
:host .calendar-action-buttons ion-buttons {
@include padding($datetime-ios-padding * 0.5, 0, 0, 0);
}
:host .calendar-action-buttons ion-buttons ion-button {
@include margin(0, 0, 0, 0);
}
// Calendar / Header / Days of Week
// -----------------------------------
:host .calendar-days-of-week {
@include padding(0, $datetime-ios-padding * 0.5, 0, $datetime-ios-padding * 0.5);
color: $text-color-step-700;
font-size: 12px;
font-weight: 600;
line-height: 24px;
text-transform: uppercase;
}
// Calendar / Body
// -----------------------------------
:host .calendar-body .calendar-month .calendar-month-grid {
/**
* We need to apply the padding to
* each month grid item otherwise
* older versions of WebKit will consider
* this padding a snapping point if applied
* on .calendar-month
*/
@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-wrapper {
@include padding(4px);
// This is required so that the calendar day wrapper
// will collapse instead of expanding to fill the button
height: 0;
min-height: 16px;
}
:host .calendar-day {
width: $datetime-ios-day-width;
min-width: $datetime-ios-day-width;
height: $datetime-ios-day-height;
font-size: 20px;
}
.calendar-day.calendar-day-active {
background: current-color(base, 0.2);
}
/**
* Day that today but not selected
* should have ion-color for text color.
*/
:host .calendar-day.calendar-day-today {
color: current-color(base);
}
/**
* Day that is not today but
* is selected should have ion-color for
* text color and be bolder.
*/
:host .calendar-day.calendar-day-active {
color: current-color(base);
font-weight: 600;
}
/**
* Day that is selected and is today
* should have white color.
*/
:host .calendar-day.calendar-day-today.calendar-day-active {
color: current-color(contrast);
}
// Time / Header
// -----------------------------------
:host .datetime-time {
@include padding($datetime-ios-padding * 0.5, $datetime-ios-padding, $datetime-ios-padding, $datetime-ios-padding);
font-size: 16px;
}
:host .datetime-time .time-header {
font-weight: 600;
}
// Footer
// -----------------------------------
:host .datetime-buttons {
@include padding($datetime-ios-padding * 0.5, $datetime-ios-padding * 0.5, $datetime-ios-padding * 0.5, $datetime-ios-padding * 0.5);
border-top: $datetime-ios-border-color;
}
:host .datetime-buttons ::slotted(ion-buttons),
:host .datetime-buttons ion-buttons {
display: flex;
align-items: center;
justify-content: space-between;
}
:host .datetime-action-buttons {
width: 100%;
}