| 40 | scoped: true, |
| 41 | }) |
| 42 | export class ActionSheet implements ComponentInterface, OverlayInterface { |
| 43 | private readonly delegateController = createDelegateController(this); |
| 44 | private readonly lockController = createLockController(); |
| 45 | private readonly triggerController = createTriggerController(); |
| 46 | private wrapperEl?: HTMLElement; |
| 47 | private groupEl?: HTMLElement; |
| 48 | private gesture?: Gesture; |
| 49 | private hasRadioButtons = false; |
| 50 | |
| 51 | presented = false; |
| 52 | lastFocus?: HTMLElement; |
| 53 | animation?: any; |
| 54 | |
| 55 | /** |
| 56 | * The ID of the currently active/selected radio button. |
| 57 | * Used for keyboard navigation and ARIA attributes. |
| 58 | */ |
| 59 | @State() activeRadioId?: string; |
| 60 | |
| 61 | @Element() el!: HTMLIonActionSheetElement; |
| 62 | |
| 63 | /** @internal */ |
| 64 | @Prop() overlayIndex!: number; |
| 65 | |
| 66 | /** @internal */ |
| 67 | @Prop() delegate?: FrameworkDelegate; |
| 68 | |
| 69 | /** @internal */ |
| 70 | @Prop() hasController = false; |
| 71 | |
| 72 | /** |
| 73 | * If `true`, the keyboard will be automatically dismissed when the overlay is presented. |
| 74 | */ |
| 75 | @Prop() keyboardClose = true; |
| 76 | |
| 77 | /** |
| 78 | * Animation to use when the action sheet is presented. |
| 79 | */ |
| 80 | @Prop() enterAnimation?: AnimationBuilder; |
| 81 | |
| 82 | /** |
| 83 | * Animation to use when the action sheet is dismissed. |
| 84 | */ |
| 85 | @Prop() leaveAnimation?: AnimationBuilder; |
| 86 | |
| 87 | /** |
| 88 | * An array of buttons for the action sheet. |
| 89 | */ |
| 90 | @Prop() buttons: (ActionSheetButton | string)[] = []; |
| 91 | @Watch('buttons') |
| 92 | buttonsChanged() { |
| 93 | const radioButtons = this.getRadioButtons(); |
| 94 | this.hasRadioButtons = radioButtons.length > 0; |
| 95 | |
| 96 | // Initialize activeRadioId when buttons change |
| 97 | if (this.hasRadioButtons) { |
| 98 | const checkedButton = radioButtons.find((b) => b.htmlAttributes?.['aria-checked'] === 'true'); |
| 99 |
nothing calls this directly
no test coverage detected