diff --git a/core/api.txt b/core/api.txt index 8a02f2a89b..d2b8e7863d 100644 --- a/core/api.txt +++ b/core/api.txt @@ -919,6 +919,7 @@ ion-picker-column,prop,value,number | string | undefined,undefined,false,false ion-picker-column,event,ionChange,PickerColumnItem,true ion-picker-column-option,shadow +ion-picker-column-option,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record | undefined,'primary',false,true ion-picker-column-option,prop,disabled,boolean,false,false,false ion-picker-column-option,prop,value,any,undefined,false,false diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 54929a2188..22c336a309 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -1987,6 +1987,10 @@ export namespace Components { "value"?: string | number; } interface IonPickerColumnOption { + /** + * The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). + */ + "color"?: Color; /** * If `true`, the user cannot interact with the picker column option. */ @@ -6634,6 +6638,10 @@ declare namespace LocalJSX { "value"?: string | number; } interface IonPickerColumnOption { + /** + * The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). + */ + "color"?: Color; /** * If `true`, the user cannot interact with the picker column option. */ diff --git a/core/src/components/picker-column-option/picker-column-option.ios.scss b/core/src/components/picker-column-option/picker-column-option.ios.scss new file mode 100644 index 0000000000..18b8434b2d --- /dev/null +++ b/core/src/components/picker-column-option/picker-column-option.ios.scss @@ -0,0 +1 @@ +@import "./picker-column-option"; diff --git a/core/src/components/picker-column-option/picker-column-option.md.scss b/core/src/components/picker-column-option/picker-column-option.md.scss new file mode 100644 index 0000000000..8dc535d899 --- /dev/null +++ b/core/src/components/picker-column-option/picker-column-option.md.scss @@ -0,0 +1,5 @@ +@import "./picker-column-option.scss"; + +:host(.option-active) button { + color: current-color(base); +} diff --git a/core/src/components/picker-column-option/picker-column-option.scss b/core/src/components/picker-column-option/picker-column-option.scss new file mode 100644 index 0000000000..a414a3580e --- /dev/null +++ b/core/src/components/picker-column-option/picker-column-option.scss @@ -0,0 +1,45 @@ +@import "../../themes/ionic.globals"; + +// Picker Column +// -------------------------------------------------- + +button { + @include padding(0); + @include margin(0); + + width: 100%; + + height: 34px; + + border: 0px; + + outline: none; + + background: transparent; + + color: inherit; + + font-family: $font-family-base; + + font-size: inherit; + + line-height: 34px; + + text-align: inherit; + + text-overflow: ellipsis; + + white-space: nowrap; + + cursor: pointer; + + overflow: hidden; +} + +:host(.option-disabled) { + opacity: 0.4; +} + +:host(.option-disabled) button { + cursor: default; +} diff --git a/core/src/components/picker-column-option/picker-column-option.tsx b/core/src/components/picker-column-option/picker-column-option.tsx index b45adb6e2c..56decf2763 100644 --- a/core/src/components/picker-column-option/picker-column-option.tsx +++ b/core/src/components/picker-column-option/picker-column-option.tsx @@ -1,9 +1,17 @@ import type { ComponentInterface } from '@stencil/core'; import { Component, Element, Host, Prop, State, Watch, h } from '@stencil/core'; import { inheritAttributes } from '@utils/helpers'; +import { createColorClasses } from '@utils/theme'; + +import { getIonMode } from '../../global/ionic-global'; +import type { Color } from '../../interface'; @Component({ tag: 'ion-picker-column-option', + styleUrls: { + ios: 'picker-column-option.ios.scss', + md: 'picker-column-option.md.scss', + }, shadow: true, }) export class PickerColumnOption implements ComponentInterface { @@ -29,6 +37,13 @@ export class PickerColumnOption implements ComponentInterface { */ @Prop() value?: any | null; + /** + * The color to use from your application's color palette. + * Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. + * For more information on colors, see [theming](/docs/theming/basics). + */ + @Prop({ reflect: true }) color?: Color = 'primary'; + /** * The aria-label of the option has changed after the * first render and needs to be updated within the component. @@ -50,19 +65,17 @@ export class PickerColumnOption implements ComponentInterface { } render() { - const { value, disabled, ariaLabel } = this; + const { color, value, disabled, ariaLabel } = this; + const mode = getIonMode(this); return ( - - diff --git a/core/src/components/picker-column-option/test/a11y/index.html b/core/src/components/picker-column-option/test/a11y/index.html index 9c19fd0b73..4d8d350ac1 100644 --- a/core/src/components/picker-column-option/test/a11y/index.html +++ b/core/src/components/picker-column-option/test/a11y/index.html @@ -2,7 +2,7 @@ - Picker Column Option - Basic + Picker Column Option - a11y @@ -14,6 +14,9 @@
my option other option + option + option + option
diff --git a/core/src/components/picker-column-option/test/basic/index.html b/core/src/components/picker-column-option/test/basic/index.html index e8d4fdd39d..91c7018612 100644 --- a/core/src/components/picker-column-option/test/basic/index.html +++ b/core/src/components/picker-column-option/test/basic/index.html @@ -46,7 +46,19 @@

Default

- my option + My Option +
+
+

Disabled

+ My Option +
+
+

Active

+ My Option +
+
+

Active / Disabled

+ My Option
diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts new file mode 100644 index 0000000000..f7291831e8 --- /dev/null +++ b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts @@ -0,0 +1,55 @@ +import { expect } from '@playwright/test'; +import { configs, test } from '@utils/test/playwright'; + +configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { + test.describe(title('picker-column-option: rendering'), () => { + test('picker option should not have visual regressions', async ({ page }) => { + await page.setContent( + ` + My Option + `, + config + ); + + const option = page.locator('ion-picker-column-option'); + + await expect(option).toHaveScreenshot(screenshot('picker-column-option')); + }); + test('disabled picker option should not have visual regressions', async ({ page }) => { + await page.setContent( + ` + My Option + `, + config + ); + + const option = page.locator('ion-picker-column-option'); + + await expect(option).toHaveScreenshot(screenshot('disabled-picker-column-option')); + }); + test('active picker option should not have visual regressions', async ({ page }) => { + await page.setContent( + ` + My Option + `, + config + ); + + const option = page.locator('ion-picker-column-option'); + + await expect(option).toHaveScreenshot(screenshot('active-picker-column-option')); + }); + test('disabled active picker option should not have visual regressions', async ({ page }) => { + await page.setContent( + ` + My Option + `, + config + ); + + const option = page.locator('ion-picker-column-option'); + + await expect(option).toHaveScreenshot(screenshot('disabled-active-picker-column-option')); + }); + }); +}); diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..872f0619da Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..41ff9101e0 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..0d04c72e5c Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..af5dfa1273 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..3da9ee990c Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..7395bd0bdd Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/active-picker-column-option-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..1dbd4a7aef Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..605008bbe3 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..f270536965 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..f775d8efde Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..77afbe2d8c Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..1b26fae42d Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-active-picker-column-option-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..1dbd4a7aef Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..605008bbe3 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..f270536965 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..111fc55cc6 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..27505e326f Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..1108102bd5 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/disabled-picker-column-option-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..872f0619da Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..41ff9101e0 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..0d04c72e5c Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Chrome-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..ed2721848f Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Firefox-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..1c3f114304 Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Safari-linux.png b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 0000000000..8cc6764e9b Binary files /dev/null and b/core/src/components/picker-column-option/test/basic/picker-column-option.e2e.ts-snapshots/picker-column-option-md-ltr-Mobile-Safari-linux.png differ diff --git a/packages/angular/src/directives/proxies.ts b/packages/angular/src/directives/proxies.ts index c6e7c3bb3b..fd5b4c9426 100644 --- a/packages/angular/src/directives/proxies.ts +++ b/packages/angular/src/directives/proxies.ts @@ -1476,14 +1476,14 @@ export declare interface IonPickerColumn extends Components.IonPickerColumn { @ProxyCmp({ - inputs: ['disabled', 'value'] + inputs: ['color', 'disabled', 'value'] }) @Component({ selector: 'ion-picker-column-option', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: ['disabled', 'value'], + inputs: ['color', 'disabled', 'value'], }) export class IonPickerColumnOption { protected el: HTMLElement; diff --git a/packages/angular/standalone/src/directives/proxies.ts b/packages/angular/standalone/src/directives/proxies.ts index e9a5b52a5b..575c9b3f96 100644 --- a/packages/angular/standalone/src/directives/proxies.ts +++ b/packages/angular/standalone/src/directives/proxies.ts @@ -1473,14 +1473,14 @@ export declare interface IonPickerColumn extends Components.IonPickerColumn { @ProxyCmp({ defineCustomElementFn: defineIonPickerColumnOption, - inputs: ['disabled', 'value'] + inputs: ['color', 'disabled', 'value'] }) @Component({ selector: 'ion-picker-column-option', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: ['disabled', 'value'], + inputs: ['color', 'disabled', 'value'], standalone: true }) export class IonPickerColumnOption { diff --git a/packages/vue/src/proxies.ts b/packages/vue/src/proxies.ts index 26518e9bfd..2cba1b1408 100644 --- a/packages/vue/src/proxies.ts +++ b/packages/vue/src/proxies.ts @@ -589,7 +589,8 @@ export const IonPickerColumn = /*@__PURE__*/ defineContainer('ion-picker-column-option', defineIonPickerColumnOption, [ 'disabled', - 'value' + 'value', + 'color' ]);