kempo 2.13.1 → 2.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kempo",
3
- "version": "2.13.1",
3
+ "version": "2.14.0",
4
4
  "type": "module",
5
5
  "description": "A web component library",
6
6
  "exports": {
@@ -266,12 +266,6 @@ export default class Dialog extends Component {
266
266
  $dialog.open();
267
267
  return $dialog;
268
268
  }
269
- static alert(message = '', callback, options = {}){
270
- return Dialog.create(message, {
271
- closeCallback: callback,
272
- ...options
273
- });
274
- }
275
269
  static confirm(text, responseCallback, options = {
276
270
  title: 'Confirm'
277
271
  }){
@@ -294,18 +288,41 @@ export default class Dialog extends Component {
294
288
  }
295
289
  });
296
290
  }
291
+ static alert(text, responseCallback, options = {
292
+ title: 'Alert'
293
+ }){
294
+ return Dialog.create(`
295
+ <h5 slot="title" class="pyh px m0">${options.title}</h5>
296
+ <p class="p">${text}</p>
297
+ `, {
298
+ closeCallback: responseCallback,
299
+ cancelText: 'Ok',
300
+ ...options,
301
+ });
302
+ }
297
303
  static error(text, responseCallback, options = {
298
304
  title: 'Error'
299
305
  }){
300
- const $dialog = Dialog.create(`
306
+ return Dialog.create(`
301
307
  <h5 slot="title" class="pyh px m0 tc-danger">${options.title}</h5>
302
308
  <p class="p">${text}</p>
303
309
  `, {
310
+ closeCallback: responseCallback,
311
+ cancelText: 'Ok',
304
312
  ...options,
313
+ });
314
+ }
315
+ static success(text, responseCallback, options = {
316
+ title: 'Success'
317
+ }){
318
+ return Dialog.create(`
319
+ <h5 slot="title" class="pyh px m0 tc-success">${options.title}</h5>
320
+ <p class="p">${text}</p>
321
+ `, {
322
+ closeCallback: responseCallback,
305
323
  cancelText: 'Ok',
324
+ ...options,
306
325
  });
307
- onEvent($dialog, 'close', responseCallback);
308
- return $dialog;
309
326
  }
310
327
  }
311
328
  window.customElements.define('k-dialog', Dialog);