Skip to content
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

fix(action-sheet, alert, toast): button roles autocomplete with available options #27940

Merged
merged 7 commits into from Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/action-sheet-interface.ts
@@ -1,4 +1,4 @@
import type { AnimationBuilder, Mode } from '../../interface';
import type { AnimationBuilder, LiteralUnion, Mode } from '../../interface';

export interface ActionSheetOptions {
header?: string;
Expand All @@ -19,7 +19,7 @@ export interface ActionSheetOptions {

export interface ActionSheetButton<T = any> {
text?: string;
role?: 'cancel' | 'destructive' | 'selected' | string;
role?: LiteralUnion<'cancel' | 'destructive' | 'selected', string>;
icon?: string;
cssClass?: string | string[];
id?: string;
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/alert/alert-interface.ts
@@ -1,4 +1,4 @@
import type { AnimationBuilder, Mode, TextFieldTypes } from '../../interface';
import type { AnimationBuilder, LiteralUnion, Mode, TextFieldTypes } from '../../interface';
import type { IonicSafeString } from '../../utils/sanitization';

export interface AlertOptions {
Expand Down Expand Up @@ -45,7 +45,7 @@ type AlertButtonOverlayHandler = boolean | void | { [key: string]: any };

export interface AlertButton {
text: string;
role?: 'cancel' | 'destructive' | string;
role?: LiteralUnion<'cancel' | 'destructive', string>;
cssClass?: string | string[];
id?: string;
htmlAttributes?: { [key: string]: any };
Expand Down
3 changes: 2 additions & 1 deletion core/src/components/toast/toast-interface.ts
@@ -1,3 +1,4 @@
import { LiteralUnion } from 'prettier';
import type { AnimationBuilder, Color, Mode } from '../../interface';
import type { IonicSafeString } from '../../utils/sanitization';

Expand Down Expand Up @@ -29,7 +30,7 @@ export interface ToastButton {
text?: string;
icon?: string;
side?: 'start' | 'end';
role?: 'cancel' | string;
role?: LiteralUnion<'cancel', string>;
cssClass?: string | string[];
htmlAttributes?: { [key: string]: any };
handler?: () => boolean | void | Promise<boolean | void>;
Expand Down
2 changes: 1 addition & 1 deletion core/src/interface.d.ts
Expand Up @@ -129,7 +129,7 @@ export type PredefinedColors =
| 'medium'
| 'dark';

type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
export type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);

export type Color = LiteralUnion<PredefinedColors, string>;
export type Mode = 'ios' | 'md';
Expand Down