Skip to content

feat(ui5-calendar): expose shadow parts for YearRangePicker and CalendarHeader arrows #12114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions packages/main/src/Calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ type CalendarYearRangeT = {
* @csspart year-range-cell - Used to style the year range cells.
* @csspart year-range-cell-selected - Used to style the year range cells when selected.
* @csspart year-range-cell-selected-between - Used to style the year range cells in between of selected year ranges.
* @csspart year-range-picker-root - Used to style the year range picker root container.
* @csspart calendar-header-middle-button - Used to style the calendar header middle buttons (month/year/year-range buttons).
* @csspart calendar-header-arrow-button - Used to style the calendar header navigation arrow buttons (previous/next buttons).
* @since 1.0.0-rc.11
*/
@customElement({
Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/CalendarHeaderTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function CalendarTemplate(this: Calendar) {
"ui5-calheader-arrowbtn": true,
"ui5-calheader-arrowbtn-disabled": this._previousButtonDisabled,
}}
part="calendar-header-arrow-button"
role="button"
onMouseDown={this.onPrevButtonClick}
title={this.headerPreviousButtonText}
Expand Down Expand Up @@ -79,6 +80,7 @@ export default function CalendarTemplate(this: Calendar) {
"ui5-calheader-arrowbtn": true,
"ui5-calheader-arrowbtn-disabled": this._nextButtonDisabled,
}}
part="calendar-header-arrow-button"
role="button"
onMouseDown={this.onNextButtonClick}
title={this.headerNextButtonText}
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/CalendarTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ export default function CalendarTemplate(this: Calendar) {
_currentYearRange = {this._currentYearRange}
onChange={this.onSelectedYearRangeChange}
onNavigate={this.onNavigate}
exportparts="year-range-cell, year-range-cell-selected, year-range-cell-selected-between"
exportparts="year-range-cell, year-range-cell-selected, year-range-cell-selected-between, year-range-picker-root"
/>
</div>

<div class="ui5-calheader">
<div class="ui5-calheader" exportparts="calendar-header-arrow-button, calendar-header-middle-button">
{ CalendarHeaderTemplate.call(this) }
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/YearRangePickerTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default function YearRangePickerTemplate(this: YearRangePicker) {
return (
<div
class="ui5-yrp-root"
part="year-range-picker-root"
role="grid"
aria-roledescription={this.roleDescription}
aria-readonly="false"
Expand Down
35 changes: 31 additions & 4 deletions packages/main/test/pages/Calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,38 @@
border: 2px solid #7b1fa2;
}

.header-parts-demo::part(calendar-header-arrow-button) {
color: #354a5f;
border: 1px solid #d1d5db;
border-radius: 6px;
min-width: 36px;
min-height: 36px;
}

.header-parts-demo::part(calendar-header-arrow-button):hover {
border-color: #9ca3af;
}

.header-parts-demo::part(year-range-picker-root) {
padding: 20px 24px;
background: #fafbfc;
border: 1px solid #e1e5e9;
border-radius: 8px;
margin: 4px;
}

.header-parts-demo::part(calendar-header-middle-button) {
background: #673ab7;
color: white;
border: 2px solid #512da8;
transform: scale(1.1);
background: #ffffff;
border: 1px solid #d1d5db;
color: #374151;
padding: 8px 16px;
border-radius: 6px;
}

.header-parts-demo::part(calendar-header-middle-button):hover {
background: #f9fafb;
border-color: #9ca3af;
color: #111827;
}
</style>
</head>
Expand Down
Loading