diff --git a/core/api.txt b/core/api.txt index 7ba90bf1160..f7e8cc1030a 100644 --- a/core/api.txt +++ b/core/api.txt @@ -425,6 +425,12 @@ ion-datetime,event,ionFocus,void,true ion-datetime,css-prop,--background ion-datetime,css-prop,--background-rgb ion-datetime,css-prop,--title-color +ion-datetime,css-prop,--wheel-fade-background-rgb +ion-datetime,css-prop,--wheel-highlight-background +ion-datetime,part,time-button +ion-datetime,part,time-button active +ion-datetime,part,wheel-item +ion-datetime,part,wheel-item active ion-datetime-button,shadow ion-datetime-button,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record | undefined,'primary',false,true diff --git a/core/src/components/datetime/datetime.scss b/core/src/components/datetime/datetime.scss index 3bd90f3bb29..34eca2603cc 100644 --- a/core/src/components/datetime/datetime.scss +++ b/core/src/components/datetime/datetime.scss @@ -8,6 +8,12 @@ * @prop --background: The primary background of the datetime component. * @prop --background-rgb: The primary background of the datetime component in RGB format. * @prop --title-color: The text color of the title. + * + * @prop --wheel-highlight-background: The background of the highlight under the selected + * item when using a wheel style layout, or in the month/year picker for grid style layouts. + * @prop --wheel-fade-background-rgb: The color of the gradient covering non-selected items + * when using a wheel style layout, or in the month/year picker for grid style layouts. Must + * be in RGB format, e.g. `255, 255, 255`. */ display: flex; diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index 7acca99b801..87c4d5301e7 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -74,6 +74,14 @@ import { * @slot title - The title of the datetime. * @slot buttons - The buttons in the datetime. * @slot time-label - The label for the time selector in the datetime. + * + * @part wheel-item - The individual items when using a wheel style layout, or in the + * month/year picker when using a grid style layout. + * @part wheel-item active - The currently selected wheel-item. + * + * @part time-button - The button that opens the time picker when using a grid style + * layout with `presentation="date-time"` or `"time-date"`. + * @part time-button active - The time picker button when the picker is open. */ @Component({ tag: 'ion-datetime', @@ -2167,7 +2175,8 @@ export class Datetime implements ComponentInterface { } private renderTimeOverlay() { - const use24Hour = is24Hour(this.locale, this.hourCycle); + const { hourCycle, isTimePopoverOpen, locale } = this; + const use24Hour = is24Hour(locale, hourCycle); const activePart = this.getActivePartsWithFallback(); return [ @@ -2175,8 +2184,9 @@ export class Datetime implements ComponentInterface { , { + test.describe(title('datetime: custom'), () => { + test.beforeEach(async ({ page }) => { + await page.goto(`/src/components/datetime/test/custom`, config); + }); + + test('should allow styling wheel style datetimes', async ({ page }) => { + const datetime = page.locator('#custom-wheel'); + + await expect(datetime).toHaveScreenshot(screenshot(`datetime-custom-wheel`)); + }); + + test('should allow styling month/year picker in grid style datetimes', async ({ page }) => { + const datetime = page.locator('#custom-grid'); + const monthYearToggle = datetime.locator('.calendar-month-year'); + + await monthYearToggle.click(); + await page.waitForChanges(); + + await expect(datetime).toHaveScreenshot(screenshot(`datetime-custom-month-year`)); + }); + + test('should allow styling time picker in grid style datetimes', async ({ page }) => { + const timeButton = page.locator('ion-datetime .time-body'); + const popover = page.locator('.popover-viewport'); + const ionPopoverDidPresent = await page.spyOnEvent('ionPopoverDidPresent'); + + await expect(timeButton).toHaveScreenshot(screenshot(`datetime-custom-time-button`)); + + await timeButton.click(); + await ionPopoverDidPresent.next(); + + await expect(popover).toHaveScreenshot(screenshot(`datetime-custom-time-picker`)); + await expect(timeButton).toHaveScreenshot(screenshot(`datetime-custom-time-button-active`)); + }); + }); +}); diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..1bfe630bf4e Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..7fa479c0964 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..b6e53a62adc Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..f72f2f664d8 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..db60acbf8bd Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..f2e69805106 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-month-year-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..912df56ea95 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..d42fedf7473 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..7c5a8a3dd63 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..ff38ee55f4e Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..c1e3fe559dd Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..f6a23c7a146 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-active-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..c56abdbba71 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..c84b92e3f33 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..52b7447a676 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..6c44ee7a687 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..73c0ea15fb7 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..ea1d2a3cf35 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-button-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..26407824fb9 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..b12a1f8b12e Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..af2ff059e1c Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..6dc7b71ce3e Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..ee7bf829ec8 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..a560454e4d4 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-time-picker-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..431c7cc96d1 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..a855426ba0a Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..2a7ae19d738 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Chrome-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..32544519862 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Firefox-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..82c71323a69 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Safari-linux.png b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..54116af5296 Binary files /dev/null and b/core/src/components/datetime/test/custom/datetime.e2e.ts-snapshots/datetime-custom-wheel-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/datetime/test/custom/index.html b/core/src/components/datetime/test/custom/index.html new file mode 100644 index 00000000000..722a026dc56 --- /dev/null +++ b/core/src/components/datetime/test/custom/index.html @@ -0,0 +1,98 @@ + + + + + Datetime - Custom + + + + + + + + + + + + + Datetime - Custom + + + +
+
+

Grid Style

+ +
+
+

Wheel Style

+ +
+
+
+
+ + diff --git a/core/src/components/picker-column-internal/picker-column-internal.tsx b/core/src/components/picker-column-internal/picker-column-internal.tsx index fd6e5209b38..01a152ee984 100644 --- a/core/src/components/picker-column-internal/picker-column-internal.tsx +++ b/core/src/components/picker-column-internal/picker-column-internal.tsx @@ -90,15 +90,21 @@ export class PickerColumnInternal implements ComponentInterface { const ev = entries[0]; if (ev.isIntersecting) { + const { activeItem, el } = this; + this.isColumnVisible = true; /** * Because this initial call to scrollActiveItemIntoView has to fire before * the scroll listener is set up, we need to manage the active class manually. */ - const oldActive = getElementRoot(this.el).querySelector(`.${PICKER_COL_ACTIVE}`); - oldActive?.classList.remove(PICKER_COL_ACTIVE); + const oldActive = getElementRoot(el).querySelector(`.${PICKER_ITEM_ACTIVE_CLASS}`); + if (oldActive) { + this.setPickerItemActiveState(oldActive, false); + } this.scrollActiveItemIntoView(); - this.activeItem?.classList.add(PICKER_COL_ACTIVE); + if (activeItem) { + this.setPickerItemActiveState(activeItem, true); + } this.initializeScrollListener(); } else { @@ -189,6 +195,16 @@ export class PickerColumnInternal implements ComponentInterface { } }; + private setPickerItemActiveState = (item: Element, isActive: boolean) => { + if (isActive) { + item.classList.add(PICKER_ITEM_ACTIVE_CLASS); + item.part.add(PICKER_ITEM_ACTIVE_PART); + } else { + item.classList.remove(PICKER_ITEM_ACTIVE_CLASS); + item.part.remove(PICKER_ITEM_ACTIVE_PART); + } + }; + /** * When ionInputModeChange is emitted, each column * needs to check if it is the one being made available @@ -275,7 +291,7 @@ export class PickerColumnInternal implements ComponentInterface { const activeElement = el.shadowRoot!.elementFromPoint(centerX, centerY) as HTMLButtonElement | null; if (activeEl !== null) { - activeEl.classList.remove(PICKER_COL_ACTIVE); + this.setPickerItemActiveState(activeEl, false); } if (activeElement === null || activeElement.disabled) { @@ -306,7 +322,7 @@ export class PickerColumnInternal implements ComponentInterface { } activeEl = activeElement; - activeElement.classList.add(PICKER_COL_ACTIVE); + this.setPickerItemActiveState(activeElement, true); timeout = setTimeout(() => { this.isScrolling = false; @@ -401,8 +417,15 @@ export class PickerColumnInternal implements ComponentInterface { const { items, color, isActive, numericInput } = this; const mode = getIonMode(this); + /** + * exportparts is needed so ion-datetime can expose the parts + * from two layers of shadow nesting. If this causes problems, + * the attribute can be moved to datetime.tsx and set on every + * instance of ion-picker-column-internal there instead. + */ return ( {item.text} @@ -462,4 +486,6 @@ export class PickerColumnInternal implements ComponentInterface { } } -const PICKER_COL_ACTIVE = 'picker-item-active'; +const PICKER_ITEM_ACTIVE_CLASS = 'picker-item-active'; +const PICKER_ITEM_PART = 'wheel-item'; +const PICKER_ITEM_ACTIVE_PART = 'active'; diff --git a/core/src/components/picker-internal/picker-internal.ios.scss b/core/src/components/picker-internal/picker-internal.ios.scss index 60613a28472..fdd3faeb38a 100644 --- a/core/src/components/picker-internal/picker-internal.ios.scss +++ b/core/src/components/picker-internal/picker-internal.ios.scss @@ -1,14 +1,15 @@ @import "./picker-internal.scss"; +@import "./picker-internal.vars.scss"; @import "../../themes/ionic.globals.ios"; :host .picker-before { - background: linear-gradient(to bottom, var(--background, var(--ion-background-color, #fff)) 20%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8) 100%); + background: linear-gradient(to bottom, rgba(#{$picker-fade-background}, 1) 20%, rgba(#{$picker-fade-background}, 0.8) 100%); } :host .picker-after { - background: linear-gradient(to top, var(--background, var(--ion-background-color, #fff)) 20%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0.8) 100%); + background: linear-gradient(to top, rgba(#{$picker-fade-background}, 1) 20%, rgba(#{$picker-fade-background}, 0.8) 100%); } :host .picker-highlight { - background: var(--ion-color-step-150, #eeeeef); + background: var(--wheel-highlight-background, var(--ion-color-step-150, #eeeeef)); } diff --git a/core/src/components/picker-internal/picker-internal.md.scss b/core/src/components/picker-internal/picker-internal.md.scss index 987353b6aeb..c7fd47f014c 100644 --- a/core/src/components/picker-internal/picker-internal.md.scss +++ b/core/src/components/picker-internal/picker-internal.md.scss @@ -1,10 +1,11 @@ @import "./picker-internal.scss"; +@import "./picker-internal.vars.scss"; @import "../../themes/ionic.globals.md"; :host .picker-before { - background: linear-gradient(to bottom, var(--background, var(--ion-background-color, #fff)) 20%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0) 90%); + background: linear-gradient(to bottom, rgba(#{$picker-fade-background}, 1) 20%, rgba(#{$picker-fade-background}, 0) 90%); } :host .picker-after { - background: linear-gradient(to top, var(--background, var(--ion-background-color, #fff)) 30%, rgba(var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)), 0) 90%); + background: linear-gradient(to top, rgba(#{$picker-fade-background}, 1) 30%, rgba(#{$picker-fade-background}, 0) 90%); } diff --git a/core/src/components/picker-internal/picker-internal.scss b/core/src/components/picker-internal/picker-internal.scss index d23b73ef83d..9b4d10365b2 100644 --- a/core/src/components/picker-internal/picker-internal.scss +++ b/core/src/components/picker-internal/picker-internal.scss @@ -71,6 +71,8 @@ height: 34px; transform: translateY(-50%); + + background: var(--wheel-highlight-background); z-index: -1; } diff --git a/core/src/components/picker-internal/picker-internal.vars.scss b/core/src/components/picker-internal/picker-internal.vars.scss new file mode 100644 index 00000000000..ee005fcd7f0 --- /dev/null +++ b/core/src/components/picker-internal/picker-internal.vars.scss @@ -0,0 +1,2 @@ +$picker-fade-background-fallback: var(--background-rgb, var(--ion-background-color-rgb, 255, 255, 255)); +$picker-fade-background: var(--wheel-fade-background-rgb, $picker-fade-background-fallback); \ No newline at end of file