Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / misc / dialog / dialog.jquery-ui.es6.js
1 /**
2  * @file
3  * Adds default classes to buttons for styling purposes.
4  */
5
6 (function($) {
7   $.widget('ui.dialog', $.ui.dialog, {
8     options: {
9       buttonClass: 'button',
10       buttonPrimaryClass: 'button--primary',
11     },
12     _createButtons() {
13       const opts = this.options;
14       let primaryIndex;
15       let index;
16       const il = opts.buttons.length;
17       for (index = 0; index < il; index++) {
18         if (
19           opts.buttons[index].primary &&
20           opts.buttons[index].primary === true
21         ) {
22           primaryIndex = index;
23           delete opts.buttons[index].primary;
24           break;
25         }
26       }
27       this._super();
28       const $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
29       if (typeof primaryIndex !== 'undefined') {
30         $buttons.eq(index).addClass(opts.buttonPrimaryClass);
31       }
32     },
33   });
34 })(jQuery);