diff --git a/BREAKING.md b/BREAKING.md
index 0d14761f82..725bcdf409 100644
--- a/BREAKING.md
+++ b/BREAKING.md
@@ -16,6 +16,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
- [Browser and Platform Support](#version-8x-browser-platform-support)
- [Components](#version-8x-components)
- [Content](#version-8x-content)
+ - [Datetime](#version-8x-datetime)
@@ -46,4 +47,16 @@ This section details the desktop browser, JavaScript framework, and mobile platf
Content
-- Content no longer sets the `--background` custom property when the `.outer-content` class is set on the host.
\ No newline at end of file
+- Content no longer sets the `--background` custom property when the `.outer-content` class is set on the host.
+
+Datetime
+
+- The CSS shadow part for `month-year-button` has been changed to target a `button` element instead of `ion-item`. Developers should verify their UI renders as expected for the month/year toggle button inside of `ion-datetime`.
+ - Developers using the CSS variables available on `ion-item` will need to migrate their CSS to use CSS properties. For example:
+ ```diff
+ ion-datetime::part(month-year-button) {
+ - --background: red;
+
+ + background: red;
+ }
+ ```
\ No newline at end of file
diff --git a/core/src/components/datetime/datetime.ios.scss b/core/src/components/datetime/datetime.ios.scss
index 145053d2f7..54a5db6539 100644
--- a/core/src/components/datetime/datetime.ios.scss
+++ b/core/src/components/datetime/datetime.ios.scss
@@ -34,16 +34,24 @@
// Calendar / Header / Action Buttons
// -----------------------------------
-:host .calendar-action-buttons ion-item {
- --padding-start: #{$datetime-ios-padding};
- --background-hover: transparent;
- --background-activated: transparent;
+.calendar-month-year-toggle {
+ @include padding(0px, 16px, 0px, #{$datetime-ios-padding});
+
+ min-height: 44px;
font-size: dynamic-font-max(16px, 1.6);
font-weight: 600;
+
+ &.ion-focused::after {
+ opacity: 0.15;
+ }
}
-:host .calendar-action-buttons ion-item ion-icon,
+.calendar-month-year-toggle #toggle-wrapper {
+ @include margin(10px, 8px, 10px, 0);
+}
+
+:host .calendar-action-buttons .calendar-month-year-toggle ion-icon,
:host .calendar-action-buttons ion-buttons ion-button {
color: current-color(base);
}
diff --git a/core/src/components/datetime/datetime.md.scss b/core/src/components/datetime/datetime.md.scss
index a900eeecbb..0e25f96784 100644
--- a/core/src/components/datetime/datetime.md.scss
+++ b/core/src/components/datetime/datetime.md.scss
@@ -30,15 +30,41 @@
// Calendar / Header / Action Buttons
// -----------------------------------
-:host .datetime-calendar .calendar-action-buttons ion-item {
- --padding-start: #{$datetime-md-header-padding};
-}
-:host .calendar-action-buttons ion-item,
:host .calendar-action-buttons ion-button {
--color: #{$text-color-step-350};
}
+.calendar-month-year-toggle {
+ @include padding(12px, 16px, 12px, #{$datetime-md-header-padding});
+
+ min-height: 48px;
+
+ background: transparent;
+
+ color: #{$text-color-step-350};
+
+ z-index: 1;
+
+ &.ion-focused::after {
+ opacity: 0.04;
+ }
+}
+
+.calendar-month-year-toggle ion-ripple-effect {
+ color: currentColor;
+}
+
+@media (any-hover: hover) {
+ .calendar-month-year-toggle.ion-activatable:not(.ion-focused):hover {
+ &::after {
+ background: currentColor;
+
+ opacity: 0.04;
+ }
+ }
+}
+
// Calendar / Header / Days of Week
// -----------------------------------
:host .calendar-days-of-week {
@@ -64,7 +90,6 @@
* if necessary.
*/
grid-template-rows: repeat(6, 1fr);
-
}
// Individual day button in month
diff --git a/core/src/components/datetime/datetime.scss b/core/src/components/datetime/datetime.scss
index 39449279d4..5d6d65b512 100644
--- a/core/src/components/datetime/datetime.scss
+++ b/core/src/components/datetime/datetime.scss
@@ -48,7 +48,7 @@ ion-picker-column-internal {
}
/**
- * This ensures that the picker is apppropriately
+ * This ensures that the picker is appropriately
* sized and never truncates the text.
*/
:host(.datetime-size-fixed.datetime-prefer-wheel) {
@@ -267,19 +267,8 @@ ion-picker-column-internal {
justify-content: space-between;
}
-:host .calendar-action-buttons ion-item,
:host .calendar-action-buttons ion-button {
- --background: translucent;
-}
-
-:host .calendar-action-buttons ion-item ion-label {
- display: flex;
-
- align-items: center;
-}
-
-:host .calendar-action-buttons ion-item ion-icon {
- @include padding(0, 0, 0, 4px);
+ --background: transparent;
}
// Calendar / Header / Days of Week
@@ -488,6 +477,55 @@ ion-picker-column-internal {
// Year Picker
// -----------------------------------
-:host(.show-month-and-year) .calendar-action-buttons ion-item {
- --color: #{current-color(base)};
+:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle {
+ color: #{current-color(base)};
+}
+
+.calendar-month-year {
+ min-width: 0;
+}
+
+.calendar-month-year-toggle {
+ @include text-inherit();
+
+ position: relative;
+
+ border: 0;
+
+ outline: none;
+
+ background: transparent;
+
+ cursor: pointer;
+
+ z-index: 1;
+
+ &::after {
+ @include button-state();
+
+ transition: opacity 15ms linear, background-color 15ms linear;
+
+ z-index: -1;
+ }
+
+ &.ion-focused::after {
+ background: currentColor;
+ }
+
+ &:disabled {
+ opacity: 0.3;
+ pointer-events: none;
+ }
+}
+
+.calendar-month-year-toggle ion-icon {
+ @include padding(0, 0, 0, 4px);
+
+ flex-shrink: 0;
+}
+
+.calendar-month-year-toggle #toggle-wrapper {
+ display: inline-flex;
+
+ align-items: center;
}
diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx
index cdf3859715..53d1ee6cd8 100644
--- a/core/src/components/datetime/datetime.tsx
+++ b/core/src/components/datetime/datetime.tsx
@@ -104,7 +104,6 @@ import {
export class Datetime implements ComponentInterface {
private inputId = `ion-dt-${datetimeIds++}`;
private calendarBodyRef?: HTMLElement;
- private monthYearToggleItemRef?: HTMLIonItemElement;
private popoverRef?: HTMLIonPopoverElement;
private clearFocusVisible?: () => void;
private parsedMinuteValues?: number[];
@@ -2000,35 +1999,18 @@ export class Datetime implements ComponentInterface {