feat(datetime): add part for month/year button (#27618)

Issue number: resolves #26596

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

There is no way to customize the month/year toggle button using CSS.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Adds a Shadow Part to the month/year toggle button.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: ionitron <hi@ionicframework.com>
This commit is contained in:
Liam DeBeasi
2023-06-08 16:07:00 -04:00
committed by GitHub
parent d20bea561c
commit d44422e224
6 changed files with 6 additions and 1 deletions

View File

@ -427,6 +427,7 @@ ion-datetime,css-prop,--background-rgb
ion-datetime,css-prop,--title-color ion-datetime,css-prop,--title-color
ion-datetime,css-prop,--wheel-fade-background-rgb ion-datetime,css-prop,--wheel-fade-background-rgb
ion-datetime,css-prop,--wheel-highlight-background ion-datetime,css-prop,--wheel-highlight-background
ion-datetime,part,month-year-button
ion-datetime,part,time-button ion-datetime,part,time-button
ion-datetime,part,time-button active ion-datetime,part,time-button active
ion-datetime,part,wheel-item ion-datetime,part,wheel-item

View File

@ -36,7 +36,7 @@
:host .calendar-action-buttons ion-item, :host .calendar-action-buttons ion-item,
:host .calendar-action-buttons ion-button { :host .calendar-action-buttons ion-button {
color: #{$text-color-step-350}; --color: #{$text-color-step-350};
} }
// Calendar / Header / Days of Week // Calendar / Header / Days of Week

View File

@ -82,6 +82,9 @@ import {
* @part time-button - The button that opens the time picker when using a grid style * @part time-button - The button that opens the time picker when using a grid style
* layout with `presentation="date-time"` or `"time-date"`. * layout with `presentation="date-time"` or `"time-date"`.
* @part time-button active - The time picker button when the picker is open. * @part time-button active - The time picker button when the picker is open.
*
* @part month-year-button - The button that opens the month/year picker when
* using a grid style layout.
*/ */
@Component({ @Component({
tag: 'ion-datetime', tag: 'ion-datetime',
@ -1928,6 +1931,7 @@ export class Datetime implements ComponentInterface {
<div class="calendar-action-buttons"> <div class="calendar-action-buttons">
<div class="calendar-month-year"> <div class="calendar-month-year">
<ion-item <ion-item
part="month-year-button"
ref={(el) => (this.monthYearToggleItemRef = el)} ref={(el) => (this.monthYearToggleItemRef = el)}
button button
aria-label="Show year picker" aria-label="Show year picker"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB