@capacitor/action-sheet 8.1.0 → 8.1.1-dev-2491-20260311T150257.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/android/src/main/java/com/capacitorjs/plugins/actionsheet/ActionSheetPlugin.java +1 -3
- package/dist/docs.json +8 -4
- package/dist/esm/definitions.d.ts +9 -6
- package/dist/esm/definitions.js +2 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js +2 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +4 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +4 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/ActionSheetPlugin/ActionSheetPlugin.swift +10 -13
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -84,20 +84,20 @@ to select.
|
|
|
84
84
|
|
|
85
85
|
#### ShowActionsResult
|
|
86
86
|
|
|
87
|
-
| Prop | Type | Description
|
|
88
|
-
| -------------- | -------------------- |
|
|
89
|
-
| **`index`** | <code>number</code> | The index of the clicked option (Zero-based), or -1 if the
|
|
90
|
-
| **`canceled`** | <code>boolean</code> | True if
|
|
87
|
+
| Prop | Type | Description | Since |
|
|
88
|
+
| -------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
89
|
+
| **`index`** | <code>number</code> | The index of the clicked option (Zero-based), or -1 if the Action Sheet was canceled. On iOS, if there is a button with <a href="#actionsheetbuttonstyle">ActionSheetButtonStyle.Cancel</a>, and user clicks outside the Action Sheet, the index of the Cancel button is returned. | 1.0.0 |
|
|
90
|
+
| **`canceled`** | <code>boolean</code> | True if the Action Sheet was canceled by user; False otherwise. On Web, requires having @ionic/pwa-elements version 3.4.0 or higher. | 8.1.0 |
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
#### ShowActionsOptions
|
|
94
94
|
|
|
95
|
-
| Prop | Type | Description
|
|
96
|
-
| ---------------- | -------------------------------- |
|
|
97
|
-
| **`title`** | <code>string</code> | The title of the Action Sheet.
|
|
98
|
-
| **`message`** | <code>string</code> | A message to show under the title. This option is only supported on iOS.
|
|
99
|
-
| **`options`** | <code>ActionSheetButton[]</code> | Options the user can choose from.
|
|
100
|
-
| **`cancelable`** | <code>boolean</code> | If true,
|
|
95
|
+
| Prop | Type | Description | Default | Since |
|
|
96
|
+
| ---------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
|
|
97
|
+
| **`title`** | <code>string</code> | The title of the Action Sheet. | | 1.0.0 |
|
|
98
|
+
| **`message`** | <code>string</code> | A message to show under the title. This option is only supported on iOS. | | 1.0.0 |
|
|
99
|
+
| **`options`** | <code>ActionSheetButton[]</code> | Options the user can choose from. | | 1.0.0 |
|
|
100
|
+
| **`cancelable`** | <code>boolean</code> | If true, the Action Sheet is canceled when clicked outside; If false, it is not. Not available on iOS 26+ or if there is a button with <a href="#actionsheetbuttonstyle">ActionSheetButtonStyle.Cancel</a>, in those cases, the Action Sheet is always cancelable by clicking outside of it. On Web, requires having @ionic/pwa-elements version 3.4.0 or higher. | <code>false</code> | 8.1.0 |
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
#### ActionSheetButton
|
|
@@ -114,10 +114,10 @@ to select.
|
|
|
114
114
|
|
|
115
115
|
#### ActionSheetButtonStyle
|
|
116
116
|
|
|
117
|
-
| Members | Value | Description
|
|
118
|
-
| ----------------- | -------------------------- |
|
|
119
|
-
| **`Default`** | <code>'DEFAULT'</code> | Default style of the option.
|
|
120
|
-
| **`Destructive`** | <code>'DESTRUCTIVE'</code> | Style to use on destructive options.
|
|
121
|
-
| **`Cancel`** | <code>'CANCEL'</code> | Style to use on the option that cancels the Action Sheet. If used, should be on the latest
|
|
117
|
+
| Members | Value | Description | Since |
|
|
118
|
+
| ----------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
119
|
+
| **`Default`** | <code>'DEFAULT'</code> | Default style of the option. | 1.0.0 |
|
|
120
|
+
| **`Destructive`** | <code>'DESTRUCTIVE'</code> | Style to use on destructive options. | 1.0.0 |
|
|
121
|
+
| **`Cancel`** | <code>'CANCEL'</code> | Style to use on the option that cancels the Action Sheet. If used, should be on the latest available option. On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside. | 1.0.0 |
|
|
122
122
|
|
|
123
123
|
</docgen-api>
|
|
@@ -45,9 +45,7 @@ public class ActionSheetPlugin extends Plugin {
|
|
|
45
45
|
implementation.setOnCancelListener(() -> resolve(call, -1));
|
|
46
46
|
}
|
|
47
47
|
implementation.setOnSelectedListener((index) -> {
|
|
48
|
-
|
|
49
|
-
ret.put("index", index);
|
|
50
|
-
call.resolve(ret);
|
|
48
|
+
resolve(call, index);
|
|
51
49
|
implementation.dismiss();
|
|
52
50
|
});
|
|
53
51
|
implementation.show(getActivity().getSupportFragmentManager(), "capacitorModalsActionSheet");
|
package/dist/docs.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"name": "since"
|
|
49
49
|
}
|
|
50
50
|
],
|
|
51
|
-
"docs": "The index of the clicked option (Zero-based), or -1 if the
|
|
51
|
+
"docs": "The index of the clicked option (Zero-based), or -1 if the Action Sheet was canceled.\n\nOn iOS, if there is a button with ActionSheetButtonStyle.Cancel, and user clicks outside the Action Sheet, the index of the Cancel button is returned.",
|
|
52
52
|
"complexTypes": [],
|
|
53
53
|
"type": "number"
|
|
54
54
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"name": "since"
|
|
61
61
|
}
|
|
62
62
|
],
|
|
63
|
-
"docs": "True if
|
|
63
|
+
"docs": "True if the Action Sheet was canceled by user; False otherwise.\n\nOn Web, requires having @ionic/pwa-elements version 3.4.0 or higher.",
|
|
64
64
|
"complexTypes": [],
|
|
65
65
|
"type": "boolean"
|
|
66
66
|
}
|
|
@@ -114,12 +114,16 @@
|
|
|
114
114
|
{
|
|
115
115
|
"name": "cancelable",
|
|
116
116
|
"tags": [
|
|
117
|
+
{
|
|
118
|
+
"text": "false",
|
|
119
|
+
"name": "default"
|
|
120
|
+
},
|
|
117
121
|
{
|
|
118
122
|
"text": "8.1.0",
|
|
119
123
|
"name": "since"
|
|
120
124
|
}
|
|
121
125
|
],
|
|
122
|
-
"docs": "If true,
|
|
126
|
+
"docs": "If true, the Action Sheet is canceled when clicked outside; If false, it is not.\n\nNot available on iOS 26+ or if there is a button with ActionSheetButtonStyle.Cancel, \nin those cases, the Action Sheet is always cancelable by clicking outside of it.\n\nOn Web, requires having @ionic/pwa-elements version 3.4.0 or higher.",
|
|
123
127
|
"complexTypes": [],
|
|
124
128
|
"type": "boolean | undefined"
|
|
125
129
|
}
|
|
@@ -209,7 +213,7 @@
|
|
|
209
213
|
"name": "since"
|
|
210
214
|
}
|
|
211
215
|
],
|
|
212
|
-
"docs": "Style to use on the option that cancels the Action Sheet.\nIf used, should be on the latest
|
|
216
|
+
"docs": "Style to use on the option that cancels the Action Sheet.\nIf used, should be on the latest available option.\nOn iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside."
|
|
213
217
|
}
|
|
214
218
|
]
|
|
215
219
|
}
|
|
@@ -20,12 +20,14 @@ export interface ShowActionsOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
options: ActionSheetButton[];
|
|
22
22
|
/**
|
|
23
|
-
* If true,
|
|
23
|
+
* If true, the Action Sheet is canceled when clicked outside; If false, it is not.
|
|
24
24
|
*
|
|
25
|
-
* Not available on iOS
|
|
25
|
+
* Not available on iOS 26+ or if there is a button with ActionSheetButtonStyle.Cancel,
|
|
26
|
+
* in those cases, the Action Sheet is always cancelable by clicking outside of it.
|
|
26
27
|
*
|
|
27
28
|
* On Web, requires having @ionic/pwa-elements version 3.4.0 or higher.
|
|
28
29
|
*
|
|
30
|
+
* @default false
|
|
29
31
|
* @since 8.1.0
|
|
30
32
|
*/
|
|
31
33
|
cancelable?: boolean;
|
|
@@ -45,7 +47,8 @@ export declare enum ActionSheetButtonStyle {
|
|
|
45
47
|
Destructive = "DESTRUCTIVE",
|
|
46
48
|
/**
|
|
47
49
|
* Style to use on the option that cancels the Action Sheet.
|
|
48
|
-
* If used, should be on the latest
|
|
50
|
+
* If used, should be on the latest available option.
|
|
51
|
+
* On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside.
|
|
49
52
|
*
|
|
50
53
|
* @since 1.0.0
|
|
51
54
|
*/
|
|
@@ -77,15 +80,15 @@ export interface ActionSheetButton {
|
|
|
77
80
|
}
|
|
78
81
|
export interface ShowActionsResult {
|
|
79
82
|
/**
|
|
80
|
-
* The index of the clicked option (Zero-based), or -1 if the
|
|
83
|
+
* The index of the clicked option (Zero-based), or -1 if the Action Sheet was canceled.
|
|
81
84
|
*
|
|
82
|
-
* On iOS, if there is a button with ActionSheetButtonStyle.Cancel, and user clicks outside the
|
|
85
|
+
* On iOS, if there is a button with ActionSheetButtonStyle.Cancel, and user clicks outside the Action Sheet, the index of the Cancel button is returned.
|
|
83
86
|
*
|
|
84
87
|
* @since 1.0.0
|
|
85
88
|
*/
|
|
86
89
|
index: number;
|
|
87
90
|
/**
|
|
88
|
-
* True if
|
|
91
|
+
* True if the Action Sheet was canceled by user; False otherwise.
|
|
89
92
|
*
|
|
90
93
|
* On Web, requires having @ionic/pwa-elements version 3.4.0 or higher.
|
|
91
94
|
*
|
package/dist/esm/definitions.js
CHANGED
|
@@ -14,7 +14,8 @@ export var ActionSheetButtonStyle;
|
|
|
14
14
|
ActionSheetButtonStyle["Destructive"] = "DESTRUCTIVE";
|
|
15
15
|
/**
|
|
16
16
|
* Style to use on the option that cancels the Action Sheet.
|
|
17
|
-
* If used, should be on the latest
|
|
17
|
+
* If used, should be on the latest available option.
|
|
18
|
+
* On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside.
|
|
18
19
|
*
|
|
19
20
|
* @since 1.0.0
|
|
20
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAN,IAAY,sBAuBX;AAvBD,WAAY,sBAAsB;IAChC;;;;OAIG;IACH,6CAAmB,CAAA;IAEnB;;;;OAIG;IACH,qDAA2B,CAAA;IAE3B;;;;;;OAMG;IACH,2CAAiB,CAAA;AACnB,CAAC,EAvBW,sBAAsB,KAAtB,sBAAsB,QAuBjC;AA4ED;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC","sourcesContent":["export interface ShowActionsOptions {\n /**\n * The title of the Action Sheet.\n *\n * @since 1.0.0\n */\n title?: string;\n\n /**\n * A message to show under the title.\n *\n * This option is only supported on iOS.\n *\n * @since 1.0.0\n */\n message?: string;\n\n /**\n * Options the user can choose from.\n *\n * @since 1.0.0\n */\n options: ActionSheetButton[];\n\n /**\n * If true, the Action Sheet is canceled when clicked outside; If false, it is not.\n *\n * Not available on iOS 26+ or if there is a button with ActionSheetButtonStyle.Cancel, \n * in those cases, the Action Sheet is always cancelable by clicking outside of it.\n *\n * On Web, requires having @ionic/pwa-elements version 3.4.0 or higher.\n *\n * @default false\n * @since 8.1.0\n */\n cancelable?: boolean;\n}\n\nexport enum ActionSheetButtonStyle {\n /**\n * Default style of the option.\n *\n * @since 1.0.0\n */\n Default = 'DEFAULT',\n\n /**\n * Style to use on destructive options.\n *\n * @since 1.0.0\n */\n Destructive = 'DESTRUCTIVE',\n\n /**\n * Style to use on the option that cancels the Action Sheet.\n * If used, should be on the latest available option.\n * On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside.\n *\n * @since 1.0.0\n */\n Cancel = 'CANCEL',\n}\n\nexport interface ActionSheetButton {\n /**\n * The title of the option\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * The style of the option\n *\n * This option is only supported on iOS.\n *\n * @since 1.0.0\n */\n style?: ActionSheetButtonStyle;\n\n /**\n * Icon for the option (ionicon naming convention)\n *\n * This option is only supported on Web.\n *\n * @since 1.0.0\n */\n icon?: string;\n}\n\nexport interface ShowActionsResult {\n /**\n * The index of the clicked option (Zero-based), or -1 if the Action Sheet was canceled.\n *\n * On iOS, if there is a button with ActionSheetButtonStyle.Cancel, and user clicks outside the Action Sheet, the index of the Cancel button is returned.\n *\n * @since 1.0.0\n */\n index: number;\n /**\n * True if the Action Sheet was canceled by user; False otherwise.\n *\n * On Web, requires having @ionic/pwa-elements version 3.4.0 or higher.\n *\n * @since 8.1.0\n */\n canceled: boolean;\n}\n\nexport interface ActionSheetPlugin {\n /**\n * Show an Action Sheet style modal with various options for the user\n * to select.\n *\n * @since 1.0.0\n */\n showActions(options: ShowActionsOptions): Promise<ShowActionsResult>;\n}\n\n/**\n * @deprecated Use `ShowActionsOptions`.\n * @since 1.0.0\n */\nexport type ActionSheetOptions = ShowActionsOptions;\n\n/**\n * @deprecated Use `ShowActionsResult`.\n * @since 1.0.0\n */\nexport type ActionSheetResult = ShowActionsResult;\n\n/**\n * @deprecated Use `ActionSheetButton`.\n * @since 1.0.0\n */\nexport type ActionSheetOption = ActionSheetButton;\n\n/**\n * @deprecated Use `ActionSheetButtonStyle`.\n * @since 1.0.0\n */\nexport const ActionSheetOptionStyle = ActionSheetButtonStyle;\n"]}
|
package/dist/esm/web.js
CHANGED
|
@@ -2,13 +2,14 @@ import { WebPlugin } from '@capacitor/core';
|
|
|
2
2
|
export class ActionSheetWeb extends WebPlugin {
|
|
3
3
|
async showActions(options) {
|
|
4
4
|
return new Promise((resolve, _reject) => {
|
|
5
|
+
var _a;
|
|
5
6
|
let actionSheet = document.querySelector('pwa-action-sheet');
|
|
6
7
|
if (!actionSheet) {
|
|
7
8
|
actionSheet = document.createElement('pwa-action-sheet');
|
|
8
9
|
document.body.appendChild(actionSheet);
|
|
9
10
|
}
|
|
10
11
|
actionSheet.header = options.title;
|
|
11
|
-
actionSheet.cancelable = options.cancelable;
|
|
12
|
+
actionSheet.cancelable = (_a = options.cancelable) !== null && _a !== void 0 ? _a : false;
|
|
12
13
|
actionSheet.options = options.options;
|
|
13
14
|
actionSheet.addEventListener('onSelection', async (e) => {
|
|
14
15
|
const selection = e.detail;
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C,KAAK,CAAC,WAAW,CAAC,OAA2B;QAC3C,OAAO,IAAI,OAAO,CAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C,KAAK,CAAC,WAAW,CAAC,OAA2B;QAC3C,OAAO,IAAI,OAAO,CAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;;YACzD,IAAI,WAAW,GAAQ,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;YAClE,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBACzD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YACzC,CAAC;YACD,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;YACnC,WAAW,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,KAAK,CAAC;YACrD,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YACtC,WAAW,CAAC,gBAAgB,CAAC,aAAa,EAAE,KAAK,EAAE,CAAM,EAAE,EAAE;gBAC3D,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;gBAC3B,OAAO,CAAC;oBACN,KAAK,EAAE,SAAS;oBAChB,QAAQ,EAAE,KAAK;iBAChB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACvB,WAAW,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;oBACpD,OAAO,CAAC;wBACN,KAAK,EAAE,CAAC,CAAC;wBACT,QAAQ,EAAE,IAAI;qBACf,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { ActionSheetPlugin, ShowActionsResult, ShowActionsOptions } from './definitions';\n\nexport class ActionSheetWeb extends WebPlugin implements ActionSheetPlugin {\n async showActions(options: ShowActionsOptions): Promise<ShowActionsResult> {\n return new Promise<ShowActionsResult>((resolve, _reject) => {\n let actionSheet: any = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.title;\n actionSheet.cancelable = options.cancelable ?? false;\n actionSheet.options = options.options;\n actionSheet.addEventListener('onSelection', async (e: any) => {\n const selection = e.detail;\n resolve({\n index: selection,\n canceled: false,\n });\n });\n if (options.cancelable) {\n actionSheet.addEventListener('onCanceled', async () => {\n resolve({\n index: -1,\n canceled: true,\n });\n });\n }\n });\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -18,7 +18,8 @@ exports.ActionSheetButtonStyle = void 0;
|
|
|
18
18
|
ActionSheetButtonStyle["Destructive"] = "DESTRUCTIVE";
|
|
19
19
|
/**
|
|
20
20
|
* Style to use on the option that cancels the Action Sheet.
|
|
21
|
-
* If used, should be on the latest
|
|
21
|
+
* If used, should be on the latest available option.
|
|
22
|
+
* On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside.
|
|
22
23
|
*
|
|
23
24
|
* @since 1.0.0
|
|
24
25
|
*/
|
|
@@ -37,13 +38,14 @@ const ActionSheet = core.registerPlugin('ActionSheet', {
|
|
|
37
38
|
class ActionSheetWeb extends core.WebPlugin {
|
|
38
39
|
async showActions(options) {
|
|
39
40
|
return new Promise((resolve, _reject) => {
|
|
41
|
+
var _a;
|
|
40
42
|
let actionSheet = document.querySelector('pwa-action-sheet');
|
|
41
43
|
if (!actionSheet) {
|
|
42
44
|
actionSheet = document.createElement('pwa-action-sheet');
|
|
43
45
|
document.body.appendChild(actionSheet);
|
|
44
46
|
}
|
|
45
47
|
actionSheet.header = options.title;
|
|
46
|
-
actionSheet.cancelable = options.cancelable;
|
|
48
|
+
actionSheet.cancelable = (_a = options.cancelable) !== null && _a !== void 0 ? _a : false;
|
|
47
49
|
actionSheet.options = options.options;
|
|
48
50
|
actionSheet.addEventListener('onSelection', async (e) => {
|
|
49
51
|
const selection = e.detail;
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ActionSheetButtonStyle;\n(function (ActionSheetButtonStyle) {\n /**\n * Default style of the option.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Default\"] = \"DEFAULT\";\n /**\n * Style to use on destructive options.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Destructive\"] = \"DESTRUCTIVE\";\n /**\n * Style to use on the option that cancels the Action Sheet.\n * If used, should be on the latest
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ActionSheetButtonStyle;\n(function (ActionSheetButtonStyle) {\n /**\n * Default style of the option.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Default\"] = \"DEFAULT\";\n /**\n * Style to use on destructive options.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Destructive\"] = \"DESTRUCTIVE\";\n /**\n * Style to use on the option that cancels the Action Sheet.\n * If used, should be on the latest available option.\n * On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Cancel\"] = \"CANCEL\";\n})(ActionSheetButtonStyle || (ActionSheetButtonStyle = {}));\n/**\n * @deprecated Use `ActionSheetButtonStyle`.\n * @since 1.0.0\n */\nexport const ActionSheetOptionStyle = ActionSheetButtonStyle;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ActionSheet = registerPlugin('ActionSheet', {\n web: () => import('./web').then((m) => new m.ActionSheetWeb()),\n});\nexport * from './definitions';\nexport { ActionSheet };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ActionSheetWeb extends WebPlugin {\n async showActions(options) {\n return new Promise((resolve, _reject) => {\n var _a;\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.title;\n actionSheet.cancelable = (_a = options.cancelable) !== null && _a !== void 0 ? _a : false;\n actionSheet.options = options.options;\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n resolve({\n index: selection,\n canceled: false,\n });\n });\n if (options.cancelable) {\n actionSheet.addEventListener('onCanceled', async () => {\n resolve({\n index: -1,\n canceled: true,\n });\n });\n }\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ActionSheetButtonStyle","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,sBAAsB,EAAE;AACnC;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAsB,CAAC,SAAS,CAAC,GAAG,SAAS;AACjD;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAsB,CAAC,aAAa,CAAC,GAAG,aAAa;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAsB,CAAC,QAAQ,CAAC,GAAG,QAAQ;AAC/C,CAAC,EAAEA,8BAAsB,KAAKA,8BAAsB,GAAG,EAAE,CAAC,CAAC;AAC3D;AACA;AACA;AACA;AACY,MAAC,sBAAsB,GAAGA;;AC1BjC,MAAC,WAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACFM,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK;AACjD,YAAY,IAAI,EAAE;AAClB,YAAY,IAAI,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC;AACxE,YAAY,IAAI,CAAC,WAAW,EAAE;AAC9B,gBAAgB,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC;AACxE,gBAAgB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AACtD,YAAY;AACZ,YAAY,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK;AAC9C,YAAY,WAAW,CAAC,UAAU,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,UAAU,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,KAAK;AACrG,YAAY,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO;AACjD,YAAY,WAAW,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK;AACrE,gBAAgB,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM;AAC1C,gBAAgB,OAAO,CAAC;AACxB,oBAAoB,KAAK,EAAE,SAAS;AACpC,oBAAoB,QAAQ,EAAE,KAAK;AACnC,iBAAiB,CAAC;AAClB,YAAY,CAAC,CAAC;AACd,YAAY,IAAI,OAAO,CAAC,UAAU,EAAE;AACpC,gBAAgB,WAAW,CAAC,gBAAgB,CAAC,YAAY,EAAE,YAAY;AACvE,oBAAoB,OAAO,CAAC;AAC5B,wBAAwB,KAAK,EAAE,EAAE;AACjC,wBAAwB,QAAQ,EAAE,IAAI;AACtC,qBAAqB,CAAC;AACtB,gBAAgB,CAAC,CAAC;AAClB,YAAY;AACZ,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -17,7 +17,8 @@ var capacitorActionSheet = (function (exports, core) {
|
|
|
17
17
|
ActionSheetButtonStyle["Destructive"] = "DESTRUCTIVE";
|
|
18
18
|
/**
|
|
19
19
|
* Style to use on the option that cancels the Action Sheet.
|
|
20
|
-
* If used, should be on the latest
|
|
20
|
+
* If used, should be on the latest available option.
|
|
21
|
+
* On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside.
|
|
21
22
|
*
|
|
22
23
|
* @since 1.0.0
|
|
23
24
|
*/
|
|
@@ -36,13 +37,14 @@ var capacitorActionSheet = (function (exports, core) {
|
|
|
36
37
|
class ActionSheetWeb extends core.WebPlugin {
|
|
37
38
|
async showActions(options) {
|
|
38
39
|
return new Promise((resolve, _reject) => {
|
|
40
|
+
var _a;
|
|
39
41
|
let actionSheet = document.querySelector('pwa-action-sheet');
|
|
40
42
|
if (!actionSheet) {
|
|
41
43
|
actionSheet = document.createElement('pwa-action-sheet');
|
|
42
44
|
document.body.appendChild(actionSheet);
|
|
43
45
|
}
|
|
44
46
|
actionSheet.header = options.title;
|
|
45
|
-
actionSheet.cancelable = options.cancelable;
|
|
47
|
+
actionSheet.cancelable = (_a = options.cancelable) !== null && _a !== void 0 ? _a : false;
|
|
46
48
|
actionSheet.options = options.options;
|
|
47
49
|
actionSheet.addEventListener('onSelection', async (e) => {
|
|
48
50
|
const selection = e.detail;
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ActionSheetButtonStyle;\n(function (ActionSheetButtonStyle) {\n /**\n * Default style of the option.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Default\"] = \"DEFAULT\";\n /**\n * Style to use on destructive options.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Destructive\"] = \"DESTRUCTIVE\";\n /**\n * Style to use on the option that cancels the Action Sheet.\n * If used, should be on the latest
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ActionSheetButtonStyle;\n(function (ActionSheetButtonStyle) {\n /**\n * Default style of the option.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Default\"] = \"DEFAULT\";\n /**\n * Style to use on destructive options.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Destructive\"] = \"DESTRUCTIVE\";\n /**\n * Style to use on the option that cancels the Action Sheet.\n * If used, should be on the latest available option.\n * On iOS 26+ is not displayed, the Action Sheet is cancelable by tapping outside.\n *\n * @since 1.0.0\n */\n ActionSheetButtonStyle[\"Cancel\"] = \"CANCEL\";\n})(ActionSheetButtonStyle || (ActionSheetButtonStyle = {}));\n/**\n * @deprecated Use `ActionSheetButtonStyle`.\n * @since 1.0.0\n */\nexport const ActionSheetOptionStyle = ActionSheetButtonStyle;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ActionSheet = registerPlugin('ActionSheet', {\n web: () => import('./web').then((m) => new m.ActionSheetWeb()),\n});\nexport * from './definitions';\nexport { ActionSheet };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ActionSheetWeb extends WebPlugin {\n async showActions(options) {\n return new Promise((resolve, _reject) => {\n var _a;\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.title;\n actionSheet.cancelable = (_a = options.cancelable) !== null && _a !== void 0 ? _a : false;\n actionSheet.options = options.options;\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n resolve({\n index: selection,\n canceled: false,\n });\n });\n if (options.cancelable) {\n actionSheet.addEventListener('onCanceled', async () => {\n resolve({\n index: -1,\n canceled: true,\n });\n });\n }\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ActionSheetButtonStyle","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,sBAAsB,EAAE;IACnC;IACA;IACA;IACA;IACA;IACA,IAAI,sBAAsB,CAAC,SAAS,CAAC,GAAG,SAAS;IACjD;IACA;IACA;IACA;IACA;IACA,IAAI,sBAAsB,CAAC,aAAa,CAAC,GAAG,aAAa;IACzD;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,sBAAsB,CAAC,QAAQ,CAAC,GAAG,QAAQ;IAC/C,CAAC,EAAEA,8BAAsB,KAAKA,8BAAsB,GAAG,EAAE,CAAC,CAAC;IAC3D;IACA;IACA;IACA;AACY,UAAC,sBAAsB,GAAGA;;AC1BjC,UAAC,WAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK;IACjD,YAAY,IAAI,EAAE;IAClB,YAAY,IAAI,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC;IACxE,YAAY,IAAI,CAAC,WAAW,EAAE;IAC9B,gBAAgB,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC;IACxE,gBAAgB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IACtD,YAAY;IACZ,YAAY,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK;IAC9C,YAAY,WAAW,CAAC,UAAU,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,UAAU,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,KAAK;IACrG,YAAY,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO;IACjD,YAAY,WAAW,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK;IACrE,gBAAgB,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM;IAC1C,gBAAgB,OAAO,CAAC;IACxB,oBAAoB,KAAK,EAAE,SAAS;IACpC,oBAAoB,QAAQ,EAAE,KAAK;IACnC,iBAAiB,CAAC;IAClB,YAAY,CAAC,CAAC;IACd,YAAY,IAAI,OAAO,CAAC,UAAU,EAAE;IACpC,gBAAgB,WAAW,CAAC,gBAAgB,CAAC,YAAY,EAAE,YAAY;IACvE,oBAAoB,OAAO,CAAC;IAC5B,wBAAwB,KAAK,EAAE,EAAE;IACjC,wBAAwB,QAAQ,EAAE,IAAI;IACtC,qBAAqB,CAAC;IACtB,gBAAgB,CAAC,CAAC;IAClB,YAAY;IACZ,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;;"}
|
|
@@ -33,14 +33,10 @@ public class ActionSheetPlugin: CAPPlugin, CAPBridgedPlugin, UIAdaptivePresentat
|
|
|
33
33
|
buttonStyle = .cancel
|
|
34
34
|
}
|
|
35
35
|
let action = UIAlertAction(title: title, style: buttonStyle, handler: { [weak self] (_) in
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"index": index,
|
|
41
|
-
"canceled": false
|
|
42
|
-
])
|
|
43
|
-
}
|
|
36
|
+
call.resolve([
|
|
37
|
+
"index": index,
|
|
38
|
+
"canceled": buttonStyle == .cancel
|
|
39
|
+
])
|
|
44
40
|
self?.currentCall = nil
|
|
45
41
|
})
|
|
46
42
|
alertActions.append(action)
|
|
@@ -51,18 +47,19 @@ public class ActionSheetPlugin: CAPPlugin, CAPBridgedPlugin, UIAdaptivePresentat
|
|
|
51
47
|
self?.setCenteredPopover(alertController)
|
|
52
48
|
self?.bridge?.viewController?.present(alertController, animated: true) {
|
|
53
49
|
if !hasCancellableButton {
|
|
54
|
-
self?.
|
|
50
|
+
self?.setupCancelationListeners(alertController, call)
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
|
|
61
|
-
private func
|
|
57
|
+
private func setupCancelationListeners(_ alertController: UIAlertController, _ call: CAPPluginCall) {
|
|
58
|
+
let cancelable = call.getBool("cancelable", false)
|
|
62
59
|
if #available(iOS 26, *) {
|
|
63
60
|
self.currentCall = call
|
|
64
61
|
alertController.presentationController?.delegate = self
|
|
65
|
-
} else {
|
|
62
|
+
} else if cancelable {
|
|
66
63
|
// For iOS versions below 26, setting the presentation controller delegate would result in a crash
|
|
67
64
|
// "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The presentation controller of an alert controller presenting as an alert must not have its delegate modified"
|
|
68
65
|
// Hence, the alternative by adding a gesture recognizer (which only works for iOS versions below 26)
|
|
@@ -70,8 +67,8 @@ public class ActionSheetPlugin: CAPPlugin, CAPBridgedPlugin, UIAdaptivePresentat
|
|
|
70
67
|
alertController.dismiss(animated: true, completion: nil)
|
|
71
68
|
call.actionSheetCanceled()
|
|
72
69
|
}
|
|
73
|
-
let
|
|
74
|
-
|
|
70
|
+
let backgroundView = alertController.view.superview?.subviews[0]
|
|
71
|
+
backgroundView?.addGestureRecognizer(gestureRecognizer)
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/action-sheet",
|
|
3
|
-
"version": "8.1.0",
|
|
3
|
+
"version": "8.1.1-dev-2491-20260311T150257.0",
|
|
4
4
|
"description": "The Action Sheet API provides access to native Action Sheets, which come up from the bottom of the screen and display actions a user can take.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -80,6 +80,5 @@
|
|
|
80
80
|
},
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
|
-
}
|
|
84
|
-
"gitHead": "06c97e2f0454fc300cdaabd32c4354adf5e9dac8"
|
|
83
|
+
}
|
|
85
84
|
}
|