capacitor-extended-dialog 0.0.1

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.
Files changed (30) hide show
  1. package/CapacitorExtendedDialog.podspec +17 -0
  2. package/Package.swift +28 -0
  3. package/README.md +190 -0
  4. package/android/build.gradle +59 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/com/albermonte/extendeddialog/DialogStyleOptions.java +99 -0
  7. package/android/src/main/java/com/albermonte/extendeddialog/ExtendedDialog.java +734 -0
  8. package/android/src/main/java/com/albermonte/extendeddialog/ExtendedDialogPlugin.java +207 -0
  9. package/android/src/main/java/com/albermonte/extendeddialog/FullScreenDialogFragment.java +589 -0
  10. package/android/src/main/res/.gitkeep +0 -0
  11. package/android/src/main/res/values/themes.xml +34 -0
  12. package/dist/docs.json +384 -0
  13. package/dist/esm/definitions.d.ts +101 -0
  14. package/dist/esm/definitions.js +2 -0
  15. package/dist/esm/definitions.js.map +1 -0
  16. package/dist/esm/index.d.ts +4 -0
  17. package/dist/esm/index.js +7 -0
  18. package/dist/esm/index.js.map +1 -0
  19. package/dist/esm/web.d.ts +14 -0
  20. package/dist/esm/web.js +193 -0
  21. package/dist/esm/web.js.map +1 -0
  22. package/dist/plugin.cjs.js +207 -0
  23. package/dist/plugin.cjs.js.map +1 -0
  24. package/dist/plugin.js +210 -0
  25. package/dist/plugin.js.map +1 -0
  26. package/ios/Sources/ExtendedDialogPlugin/ExtendedDialog.swift +497 -0
  27. package/ios/Sources/ExtendedDialogPlugin/ExtendedDialogPlugin.swift +177 -0
  28. package/ios/Sources/ExtendedDialogPlugin/FullScreenDialogViewController.swift +506 -0
  29. package/ios/Tests/ExtendedDialogPluginTests/ExtendedDialogPluginTests.swift +15 -0
  30. package/package.json +80 -0
package/dist/docs.json ADDED
@@ -0,0 +1,384 @@
1
+ {
2
+ "api": {
3
+ "name": "ExtendedDialogPlugin",
4
+ "slug": "extendeddialogplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "alert",
10
+ "signature": "(options: AlertOptions) => any",
11
+ "parameters": [
12
+ {
13
+ "name": "options",
14
+ "docs": "",
15
+ "type": "AlertOptions"
16
+ }
17
+ ],
18
+ "returns": "any",
19
+ "tags": [],
20
+ "docs": "",
21
+ "complexTypes": [
22
+ "AlertOptions"
23
+ ],
24
+ "slug": "alert"
25
+ },
26
+ {
27
+ "name": "confirm",
28
+ "signature": "(options: ConfirmOptions) => any",
29
+ "parameters": [
30
+ {
31
+ "name": "options",
32
+ "docs": "",
33
+ "type": "ConfirmOptions"
34
+ }
35
+ ],
36
+ "returns": "any",
37
+ "tags": [],
38
+ "docs": "",
39
+ "complexTypes": [
40
+ "ConfirmOptions",
41
+ "ConfirmResult"
42
+ ],
43
+ "slug": "confirm"
44
+ },
45
+ {
46
+ "name": "prompt",
47
+ "signature": "(options: PromptOptions) => any",
48
+ "parameters": [
49
+ {
50
+ "name": "options",
51
+ "docs": "",
52
+ "type": "PromptOptions"
53
+ }
54
+ ],
55
+ "returns": "any",
56
+ "tags": [],
57
+ "docs": "",
58
+ "complexTypes": [
59
+ "PromptOptions",
60
+ "PromptResult"
61
+ ],
62
+ "slug": "prompt"
63
+ },
64
+ {
65
+ "name": "singleSelect",
66
+ "signature": "(options: SingleSelectOptions) => any",
67
+ "parameters": [
68
+ {
69
+ "name": "options",
70
+ "docs": "",
71
+ "type": "SingleSelectOptions"
72
+ }
73
+ ],
74
+ "returns": "any",
75
+ "tags": [],
76
+ "docs": "",
77
+ "complexTypes": [
78
+ "SingleSelectOptions",
79
+ "SingleSelectResult"
80
+ ],
81
+ "slug": "singleselect"
82
+ },
83
+ {
84
+ "name": "multiSelect",
85
+ "signature": "(options: MultiSelectOptions) => any",
86
+ "parameters": [
87
+ {
88
+ "name": "options",
89
+ "docs": "",
90
+ "type": "MultiSelectOptions"
91
+ }
92
+ ],
93
+ "returns": "any",
94
+ "tags": [],
95
+ "docs": "",
96
+ "complexTypes": [
97
+ "MultiSelectOptions",
98
+ "MultiSelectResult"
99
+ ],
100
+ "slug": "multiselect"
101
+ }
102
+ ],
103
+ "properties": []
104
+ },
105
+ "interfaces": [
106
+ {
107
+ "name": "AlertOptions",
108
+ "slug": "alertoptions",
109
+ "docs": "",
110
+ "tags": [],
111
+ "methods": [],
112
+ "properties": [
113
+ {
114
+ "name": "buttonTitle",
115
+ "tags": [],
116
+ "docs": "",
117
+ "complexTypes": [],
118
+ "type": "string | undefined"
119
+ }
120
+ ]
121
+ },
122
+ {
123
+ "name": "ConfirmOptions",
124
+ "slug": "confirmoptions",
125
+ "docs": "",
126
+ "tags": [],
127
+ "methods": [],
128
+ "properties": [
129
+ {
130
+ "name": "okButtonTitle",
131
+ "tags": [],
132
+ "docs": "",
133
+ "complexTypes": [],
134
+ "type": "string | undefined"
135
+ },
136
+ {
137
+ "name": "cancelButtonTitle",
138
+ "tags": [],
139
+ "docs": "",
140
+ "complexTypes": [],
141
+ "type": "string | undefined"
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ "name": "ConfirmResult",
147
+ "slug": "confirmresult",
148
+ "docs": "",
149
+ "tags": [],
150
+ "methods": [],
151
+ "properties": [
152
+ {
153
+ "name": "value",
154
+ "tags": [],
155
+ "docs": "",
156
+ "complexTypes": [],
157
+ "type": "boolean"
158
+ }
159
+ ]
160
+ },
161
+ {
162
+ "name": "PromptOptions",
163
+ "slug": "promptoptions",
164
+ "docs": "",
165
+ "tags": [],
166
+ "methods": [],
167
+ "properties": [
168
+ {
169
+ "name": "okButtonTitle",
170
+ "tags": [],
171
+ "docs": "",
172
+ "complexTypes": [],
173
+ "type": "string | undefined"
174
+ },
175
+ {
176
+ "name": "cancelButtonTitle",
177
+ "tags": [],
178
+ "docs": "",
179
+ "complexTypes": [],
180
+ "type": "string | undefined"
181
+ },
182
+ {
183
+ "name": "inputPlaceholder",
184
+ "tags": [],
185
+ "docs": "",
186
+ "complexTypes": [],
187
+ "type": "string | undefined"
188
+ },
189
+ {
190
+ "name": "inputText",
191
+ "tags": [],
192
+ "docs": "",
193
+ "complexTypes": [],
194
+ "type": "string | undefined"
195
+ },
196
+ {
197
+ "name": "focusInput",
198
+ "tags": [
199
+ {
200
+ "text": "false",
201
+ "name": "default"
202
+ }
203
+ ],
204
+ "docs": "Whether to automatically focus the input field and open the keyboard when the dialog appears.\n\nNote: On iOS, basic (non-fullscreen) dialogs always auto-focus the input field due to\nUIAlertController's built-in behavior. This option only takes effect on iOS when using\nfullscreen mode (`mode: 'fullscreen'`). On Android and web, this works for all modes.",
205
+ "complexTypes": [],
206
+ "type": "boolean | undefined"
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "name": "PromptResult",
212
+ "slug": "promptresult",
213
+ "docs": "",
214
+ "tags": [],
215
+ "methods": [],
216
+ "properties": [
217
+ {
218
+ "name": "value",
219
+ "tags": [],
220
+ "docs": "",
221
+ "complexTypes": [],
222
+ "type": "string"
223
+ },
224
+ {
225
+ "name": "cancelled",
226
+ "tags": [],
227
+ "docs": "",
228
+ "complexTypes": [],
229
+ "type": "boolean"
230
+ }
231
+ ]
232
+ },
233
+ {
234
+ "name": "SingleSelectOptions",
235
+ "slug": "singleselectoptions",
236
+ "docs": "",
237
+ "tags": [],
238
+ "methods": [],
239
+ "properties": [
240
+ {
241
+ "name": "options",
242
+ "tags": [],
243
+ "docs": "",
244
+ "complexTypes": [
245
+ "SelectOption"
246
+ ],
247
+ "type": "{}"
248
+ },
249
+ {
250
+ "name": "selectedValue",
251
+ "tags": [],
252
+ "docs": "",
253
+ "complexTypes": [],
254
+ "type": "string | undefined"
255
+ },
256
+ {
257
+ "name": "okButtonTitle",
258
+ "tags": [],
259
+ "docs": "",
260
+ "complexTypes": [],
261
+ "type": "string | undefined"
262
+ },
263
+ {
264
+ "name": "cancelButtonTitle",
265
+ "tags": [],
266
+ "docs": "",
267
+ "complexTypes": [],
268
+ "type": "string | undefined"
269
+ }
270
+ ]
271
+ },
272
+ {
273
+ "name": "SelectOption",
274
+ "slug": "selectoption",
275
+ "docs": "",
276
+ "tags": [],
277
+ "methods": [],
278
+ "properties": [
279
+ {
280
+ "name": "label",
281
+ "tags": [],
282
+ "docs": "",
283
+ "complexTypes": [],
284
+ "type": "string"
285
+ },
286
+ {
287
+ "name": "value",
288
+ "tags": [],
289
+ "docs": "",
290
+ "complexTypes": [],
291
+ "type": "string"
292
+ }
293
+ ]
294
+ },
295
+ {
296
+ "name": "SingleSelectResult",
297
+ "slug": "singleselectresult",
298
+ "docs": "",
299
+ "tags": [],
300
+ "methods": [],
301
+ "properties": [
302
+ {
303
+ "name": "value",
304
+ "tags": [],
305
+ "docs": "",
306
+ "complexTypes": [],
307
+ "type": "string | null"
308
+ },
309
+ {
310
+ "name": "cancelled",
311
+ "tags": [],
312
+ "docs": "",
313
+ "complexTypes": [],
314
+ "type": "boolean"
315
+ }
316
+ ]
317
+ },
318
+ {
319
+ "name": "MultiSelectOptions",
320
+ "slug": "multiselectoptions",
321
+ "docs": "",
322
+ "tags": [],
323
+ "methods": [],
324
+ "properties": [
325
+ {
326
+ "name": "options",
327
+ "tags": [],
328
+ "docs": "",
329
+ "complexTypes": [
330
+ "SelectOption"
331
+ ],
332
+ "type": "{}"
333
+ },
334
+ {
335
+ "name": "selectedValues",
336
+ "tags": [],
337
+ "docs": "",
338
+ "complexTypes": [],
339
+ "type": "{} | undefined"
340
+ },
341
+ {
342
+ "name": "okButtonTitle",
343
+ "tags": [],
344
+ "docs": "",
345
+ "complexTypes": [],
346
+ "type": "string | undefined"
347
+ },
348
+ {
349
+ "name": "cancelButtonTitle",
350
+ "tags": [],
351
+ "docs": "",
352
+ "complexTypes": [],
353
+ "type": "string | undefined"
354
+ }
355
+ ]
356
+ },
357
+ {
358
+ "name": "MultiSelectResult",
359
+ "slug": "multiselectresult",
360
+ "docs": "",
361
+ "tags": [],
362
+ "methods": [],
363
+ "properties": [
364
+ {
365
+ "name": "values",
366
+ "tags": [],
367
+ "docs": "",
368
+ "complexTypes": [],
369
+ "type": "{}"
370
+ },
371
+ {
372
+ "name": "cancelled",
373
+ "tags": [],
374
+ "docs": "",
375
+ "complexTypes": [],
376
+ "type": "boolean"
377
+ }
378
+ ]
379
+ }
380
+ ],
381
+ "enums": [],
382
+ "typeAliases": [],
383
+ "pluginConfigs": []
384
+ }
@@ -0,0 +1,101 @@
1
+ export declare type DialogMode = 'basic' | 'fullscreen';
2
+ export interface DialogStyleOptions {
3
+ /**
4
+ * Color for the OK/primary button (hex format, e.g., "#FF5722")
5
+ */
6
+ buttonColor?: string;
7
+ /**
8
+ * Color for the cancel button (hex format, e.g., "#757575")
9
+ */
10
+ cancelButtonColor?: string;
11
+ /**
12
+ * Color for the title text (hex format, e.g., "#000000")
13
+ */
14
+ titleColor?: string;
15
+ /**
16
+ * Color for the message text (hex format, e.g., "#666666")
17
+ */
18
+ messageColor?: string;
19
+ /**
20
+ * Background color of the dialog (hex format, e.g., "#FFFFFF")
21
+ */
22
+ backgroundColor?: string;
23
+ /**
24
+ * Font size for the title text in sp/pt (e.g., 20)
25
+ */
26
+ titleFontSize?: number;
27
+ /**
28
+ * Font size for the message text in sp/pt (e.g., 16)
29
+ */
30
+ messageFontSize?: number;
31
+ /**
32
+ * Font size for the button text in sp/pt (e.g., 14)
33
+ */
34
+ buttonFontSize?: number;
35
+ }
36
+ export interface BaseDialogOptions extends DialogStyleOptions {
37
+ title?: string;
38
+ message: string;
39
+ mode?: DialogMode;
40
+ }
41
+ export interface AlertOptions extends BaseDialogOptions {
42
+ buttonTitle?: string;
43
+ }
44
+ export interface ConfirmOptions extends BaseDialogOptions {
45
+ okButtonTitle?: string;
46
+ cancelButtonTitle?: string;
47
+ }
48
+ export interface PromptOptions extends BaseDialogOptions {
49
+ okButtonTitle?: string;
50
+ cancelButtonTitle?: string;
51
+ inputPlaceholder?: string;
52
+ inputText?: string;
53
+ /**
54
+ * Whether to automatically focus the input field and open the keyboard when the dialog appears.
55
+ *
56
+ * Note: On iOS, basic (non-fullscreen) dialogs always auto-focus the input field due to
57
+ * UIAlertController's built-in behavior. This option only takes effect on iOS when using
58
+ * fullscreen mode (`mode: 'fullscreen'`). On Android and web, this works for all modes.
59
+ *
60
+ * @default false
61
+ */
62
+ focusInput?: boolean;
63
+ }
64
+ export interface SelectOption {
65
+ label: string;
66
+ value: string;
67
+ }
68
+ export interface SingleSelectOptions extends BaseDialogOptions {
69
+ options: SelectOption[];
70
+ selectedValue?: string;
71
+ okButtonTitle?: string;
72
+ cancelButtonTitle?: string;
73
+ }
74
+ export interface MultiSelectOptions extends BaseDialogOptions {
75
+ options: SelectOption[];
76
+ selectedValues?: string[];
77
+ okButtonTitle?: string;
78
+ cancelButtonTitle?: string;
79
+ }
80
+ export interface ConfirmResult {
81
+ value: boolean;
82
+ }
83
+ export interface PromptResult {
84
+ value: string;
85
+ cancelled: boolean;
86
+ }
87
+ export interface SingleSelectResult {
88
+ value: string | null;
89
+ cancelled: boolean;
90
+ }
91
+ export interface MultiSelectResult {
92
+ values: string[];
93
+ cancelled: boolean;
94
+ }
95
+ export interface ExtendedDialogPlugin {
96
+ alert(options: AlertOptions): Promise<void>;
97
+ confirm(options: ConfirmOptions): Promise<ConfirmResult>;
98
+ prompt(options: PromptOptions): Promise<PromptResult>;
99
+ singleSelect(options: SingleSelectOptions): Promise<SingleSelectResult>;
100
+ multiSelect(options: MultiSelectOptions): Promise<MultiSelectResult>;
101
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type DialogMode = 'basic' | 'fullscreen';\n\nexport interface DialogStyleOptions {\n /**\n * Color for the OK/primary button (hex format, e.g., \"#FF5722\")\n */\n buttonColor?: string;\n /**\n * Color for the cancel button (hex format, e.g., \"#757575\")\n */\n cancelButtonColor?: string;\n /**\n * Color for the title text (hex format, e.g., \"#000000\")\n */\n titleColor?: string;\n /**\n * Color for the message text (hex format, e.g., \"#666666\")\n */\n messageColor?: string;\n /**\n * Background color of the dialog (hex format, e.g., \"#FFFFFF\")\n */\n backgroundColor?: string;\n /**\n * Font size for the title text in sp/pt (e.g., 20)\n */\n titleFontSize?: number;\n /**\n * Font size for the message text in sp/pt (e.g., 16)\n */\n messageFontSize?: number;\n /**\n * Font size for the button text in sp/pt (e.g., 14)\n */\n buttonFontSize?: number;\n}\n\nexport interface BaseDialogOptions extends DialogStyleOptions {\n title?: string;\n message: string;\n mode?: DialogMode; // default: 'basic'\n}\n\nexport interface AlertOptions extends BaseDialogOptions {\n buttonTitle?: string; // default: \"OK\"\n}\n\nexport interface ConfirmOptions extends BaseDialogOptions {\n okButtonTitle?: string; // default: \"OK\"\n cancelButtonTitle?: string; // default: \"Cancel\"\n}\n\nexport interface PromptOptions extends BaseDialogOptions {\n okButtonTitle?: string;\n cancelButtonTitle?: string;\n inputPlaceholder?: string;\n inputText?: string; // pre-filled value\n /**\n * Whether to automatically focus the input field and open the keyboard when the dialog appears.\n *\n * Note: On iOS, basic (non-fullscreen) dialogs always auto-focus the input field due to\n * UIAlertController's built-in behavior. This option only takes effect on iOS when using\n * fullscreen mode (`mode: 'fullscreen'`). On Android and web, this works for all modes.\n *\n * @default false\n */\n focusInput?: boolean;\n}\n\nexport interface SelectOption {\n label: string;\n value: string;\n}\n\nexport interface SingleSelectOptions extends BaseDialogOptions {\n options: SelectOption[];\n selectedValue?: string;\n okButtonTitle?: string;\n cancelButtonTitle?: string;\n}\n\nexport interface MultiSelectOptions extends BaseDialogOptions {\n options: SelectOption[];\n selectedValues?: string[];\n okButtonTitle?: string;\n cancelButtonTitle?: string;\n}\n\n// Results\nexport interface ConfirmResult {\n value: boolean;\n}\n\nexport interface PromptResult {\n value: string;\n cancelled: boolean;\n}\n\nexport interface SingleSelectResult {\n value: string | null;\n cancelled: boolean;\n}\n\nexport interface MultiSelectResult {\n values: string[];\n cancelled: boolean;\n}\n\nexport interface ExtendedDialogPlugin {\n alert(options: AlertOptions): Promise<void>;\n confirm(options: ConfirmOptions): Promise<ConfirmResult>;\n prompt(options: PromptOptions): Promise<PromptResult>;\n singleSelect(options: SingleSelectOptions): Promise<SingleSelectResult>;\n multiSelect(options: MultiSelectOptions): Promise<MultiSelectResult>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { ExtendedDialogPlugin } from './definitions';
2
+ declare const ExtendedDialog: ExtendedDialogPlugin;
3
+ export * from './definitions';
4
+ export { ExtendedDialog };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const ExtendedDialog = registerPlugin('ExtendedDialog', {
3
+ web: () => import('./web').then((m) => new m.ExtendedDialogWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { ExtendedDialog };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,cAAc,GAAG,cAAc,CAAuB,gBAAgB,EAAE;IAC5E,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;CAClE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { ExtendedDialogPlugin } from './definitions';\n\nconst ExtendedDialog = registerPlugin<ExtendedDialogPlugin>('ExtendedDialog', {\n web: () => import('./web').then((m) => new m.ExtendedDialogWeb()),\n});\n\nexport * from './definitions';\nexport { ExtendedDialog };\n"]}
@@ -0,0 +1,14 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { ExtendedDialogPlugin, AlertOptions, ConfirmOptions, ConfirmResult, PromptOptions, PromptResult, SingleSelectOptions, SingleSelectResult, MultiSelectOptions, MultiSelectResult } from './definitions';
3
+ export declare class ExtendedDialogWeb extends WebPlugin implements ExtendedDialogPlugin {
4
+ alert(options: AlertOptions): Promise<void>;
5
+ confirm(options: ConfirmOptions): Promise<ConfirmResult>;
6
+ prompt(options: PromptOptions): Promise<PromptResult>;
7
+ singleSelect(options: SingleSelectOptions): Promise<SingleSelectResult>;
8
+ multiSelect(options: MultiSelectOptions): Promise<MultiSelectResult>;
9
+ private createOverlay;
10
+ private createDialogContainer;
11
+ private createButtonContainer;
12
+ private createButton;
13
+ private removeOverlay;
14
+ }