capacitor-extended-dialog 0.0.10 → 0.0.12

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 CHANGED
@@ -9,6 +9,13 @@ npm install capacitor-extended-dialog
9
9
  npx cap sync
10
10
  ```
11
11
 
12
+ ## Android sheet behavior
13
+
14
+ - In `mode: 'basic'`, native Android sheets open between 50% and 80% of screen height.
15
+ - Dragging up continuously increases available body space while keeping header content at the top and actions pinned to the bottom.
16
+ - If sheet content exceeds the 80% initial cap, the body area becomes internally scrollable.
17
+ - In `mode: 'fullscreen'`, the same top-content/bottom-actions layout is preserved with a scrollable body area for overflow.
18
+
12
19
  ## API
13
20
 
14
21
  <docgen-index>
@@ -19,6 +26,7 @@ npx cap sync
19
26
  * [`singleSelect(...)`](#singleselect)
20
27
  * [`multiSelect(...)`](#multiselect)
21
28
  * [`sheet(...)`](#sheet)
29
+ * [`messageSheet(...)`](#messagesheet)
22
30
  * [Interfaces](#interfaces)
23
31
  * [Type Aliases](#type-aliases)
24
32
 
@@ -129,6 +137,23 @@ Show a sheet dialog with a header, title, and structured data rows.
129
137
  --------------------
130
138
 
131
139
 
140
+ ### messageSheet(...)
141
+
142
+ ```typescript
143
+ messageSheet(options: MessageSheetOptions) => any
144
+ ```
145
+
146
+ Show a message sheet dialog with an optional header logo, title, and message.
147
+
148
+ | Param | Type | Description |
149
+ | ------------- | ------------------------------------------------------------------- | -------------------------------------- |
150
+ | **`options`** | <code><a href="#messagesheetoptions">MessageSheetOptions</a></code> | - Message sheet configuration options. |
151
+
152
+ **Returns:** <code>any</code>
153
+
154
+ --------------------
155
+
156
+
132
157
  ### Interfaces
133
158
 
134
159
 
@@ -245,6 +270,25 @@ Show a sheet dialog with a header, title, and structured data rows.
245
270
  | **`confirmed`** | <code>boolean</code> | True if confirmed, false if cancelled |
246
271
 
247
272
 
273
+ #### MessageSheetOptions
274
+
275
+ | Prop | Type | Description |
276
+ | ------------------------ | ------------------------------------------------- | -------------------------------------------------------- |
277
+ | **`headerLogo`** | <code>string</code> | Header logo - supports base64 data URL or HTTP/HTTPS URL |
278
+ | **`title`** | <code>string</code> | Sheet title |
279
+ | **`message`** | <code>string</code> | Message body displayed in the sheet |
280
+ | **`confirmButtonTitle`** | <code>string</code> | Confirm button title |
281
+ | **`cancelButtonTitle`** | <code>string</code> | Cancel button title |
282
+ | **`mode`** | <code><a href="#dialogmode">DialogMode</a></code> | Dialog mode |
283
+
284
+
285
+ #### MessageSheetResult
286
+
287
+ | Prop | Type | Description |
288
+ | --------------- | -------------------- | ------------------------------------- |
289
+ | **`confirmed`** | <code>boolean</code> | True if confirmed, false if cancelled |
290
+
291
+
248
292
  ### Type Aliases
249
293
 
250
294
 
@@ -17,6 +17,7 @@ public class DialogStyleOptions {
17
17
  private static final String KEY_MESSAGE_FONT_SIZE = "messageFontSize";
18
18
  private static final String KEY_BUTTON_FONT_SIZE = "buttonFontSize";
19
19
  private static final String KEY_CONTENT_BUTTON_SPACING = "contentButtonSpacing";
20
+ private static final String KEY_HEADER_LOGO_CORNER_RADIUS = "headerLogoCornerRadius";
20
21
 
21
22
  private Integer buttonColor;
22
23
  private Integer cancelButtonColor;
@@ -27,6 +28,7 @@ public class DialogStyleOptions {
27
28
  private Float messageFontSize;
28
29
  private Float buttonFontSize;
29
30
  private Float contentButtonSpacing;
31
+ private Float headerLogoCornerRadius;
30
32
 
31
33
  public DialogStyleOptions() {}
32
34
 
@@ -121,6 +123,15 @@ public class DialogStyleOptions {
121
123
  this.contentButtonSpacing = parseSpacing(size);
122
124
  }
123
125
 
126
+ public Float getHeaderLogoCornerRadius() {
127
+ return headerLogoCornerRadius;
128
+ }
129
+
130
+ public void setHeaderLogoCornerRadius(Double radius) {
131
+ // Allow any value: positive for custom radius, 0 for square, -1 for circle
132
+ this.headerLogoCornerRadius = radius != null ? radius.floatValue() : null;
133
+ }
134
+
124
135
  public boolean hasStyles() {
125
136
  return (
126
137
  buttonColor != null ||
@@ -131,7 +142,8 @@ public class DialogStyleOptions {
131
142
  titleFontSize != null ||
132
143
  messageFontSize != null ||
133
144
  buttonFontSize != null ||
134
- contentButtonSpacing != null
145
+ contentButtonSpacing != null ||
146
+ headerLogoCornerRadius != null
135
147
  );
136
148
  }
137
149
 
@@ -145,6 +157,7 @@ public class DialogStyleOptions {
145
157
  if (messageFontSize != null) bundle.putFloat(KEY_MESSAGE_FONT_SIZE, messageFontSize);
146
158
  if (buttonFontSize != null) bundle.putFloat(KEY_BUTTON_FONT_SIZE, buttonFontSize);
147
159
  if (contentButtonSpacing != null) bundle.putFloat(KEY_CONTENT_BUTTON_SPACING, contentButtonSpacing);
160
+ if (headerLogoCornerRadius != null) bundle.putFloat(KEY_HEADER_LOGO_CORNER_RADIUS, headerLogoCornerRadius);
148
161
  }
149
162
 
150
163
  public static DialogStyleOptions readFromBundle(Bundle bundle) {
@@ -158,6 +171,7 @@ public class DialogStyleOptions {
158
171
  options.messageFontSize = bundle.containsKey(KEY_MESSAGE_FONT_SIZE) ? bundle.getFloat(KEY_MESSAGE_FONT_SIZE) : null;
159
172
  options.buttonFontSize = bundle.containsKey(KEY_BUTTON_FONT_SIZE) ? bundle.getFloat(KEY_BUTTON_FONT_SIZE) : null;
160
173
  options.contentButtonSpacing = bundle.containsKey(KEY_CONTENT_BUTTON_SPACING) ? bundle.getFloat(KEY_CONTENT_BUTTON_SPACING) : null;
174
+ options.headerLogoCornerRadius = bundle.containsKey(KEY_HEADER_LOGO_CORNER_RADIUS) ? bundle.getFloat(KEY_HEADER_LOGO_CORNER_RADIUS) : null;
161
175
  return options;
162
176
  }
163
177
  }
@@ -771,4 +771,35 @@ public class ExtendedDialog {
771
771
  fragment.show(fragmentActivity.getSupportFragmentManager(), "bottom_sheet");
772
772
  });
773
773
  }
774
+
775
+ public void showMessageSheet(
776
+ Activity activity,
777
+ String title,
778
+ String message,
779
+ String headerLogo,
780
+ String confirmButtonTitle,
781
+ String cancelButtonTitle,
782
+ boolean fullscreen,
783
+ DialogStyleOptions styleOptions,
784
+ SheetCallback callback
785
+ ) {
786
+ if (!(activity instanceof FragmentActivity)) {
787
+ callback.onResult(false);
788
+ return;
789
+ }
790
+ FragmentActivity fragmentActivity = (FragmentActivity) activity;
791
+ fragmentActivity.runOnUiThread(() -> {
792
+ SheetBottomDialogFragment fragment = SheetBottomDialogFragment.newMessageInstance(
793
+ title,
794
+ headerLogo,
795
+ message,
796
+ confirmButtonTitle != null ? confirmButtonTitle : "Confirm",
797
+ cancelButtonTitle != null ? cancelButtonTitle : "Cancel",
798
+ fullscreen,
799
+ styleOptions
800
+ );
801
+ fragment.setSheetCallback(callback);
802
+ fragment.show(fragmentActivity.getSupportFragmentManager(), "message_sheet");
803
+ });
804
+ }
774
805
  }
@@ -26,6 +26,7 @@ public class ExtendedDialogPlugin extends Plugin {
26
26
  styleOptions.setMessageFontSize(call.getDouble("messageFontSize"));
27
27
  styleOptions.setButtonFontSize(call.getDouble("buttonFontSize"));
28
28
  styleOptions.setContentButtonSpacing(call.getDouble("contentButtonSpacing"));
29
+ styleOptions.setHeaderLogoCornerRadius(call.getDouble("headerLogoCornerRadius"));
29
30
  return styleOptions;
30
31
  }
31
32
 
@@ -250,4 +251,42 @@ public class ExtendedDialogPlugin extends Plugin {
250
251
  call.reject("Invalid rows format");
251
252
  }
252
253
  }
254
+
255
+ @PluginMethod
256
+ public void messageSheet(PluginCall call) {
257
+ String title = call.getString("title");
258
+ String message = call.getString("message");
259
+ String headerLogo = call.getString("headerLogo");
260
+ String confirmButtonTitle = call.getString("confirmButtonTitle");
261
+ String cancelButtonTitle = call.getString("cancelButtonTitle");
262
+ String mode = call.getString("mode", "basic");
263
+ boolean fullscreen = "fullscreen".equals(mode);
264
+ DialogStyleOptions styleOptions = extractStyleOptions(call);
265
+
266
+ if (title == null) {
267
+ call.reject("title is required");
268
+ return;
269
+ }
270
+
271
+ if (message == null) {
272
+ call.reject("message is required");
273
+ return;
274
+ }
275
+
276
+ implementation.showMessageSheet(
277
+ getActivity(),
278
+ title,
279
+ message,
280
+ headerLogo,
281
+ confirmButtonTitle,
282
+ cancelButtonTitle,
283
+ fullscreen,
284
+ styleOptions,
285
+ (confirmed) -> {
286
+ JSObject result = new JSObject();
287
+ result.put("confirmed", confirmed);
288
+ call.resolve(result);
289
+ }
290
+ );
291
+ }
253
292
  }