goblin-magic 1.0.14 → 1.3.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": "goblin-magic",
3
- "version": "1.0.14",
3
+ "version": "1.3.0",
4
4
  "description": "goblin-magic",
5
5
  "author": "Epsitec SA",
6
6
  "contributors": [
@@ -613,13 +613,18 @@ class MagicNavigation extends Elf {
613
613
  /**
614
614
  * @param {id} parentId
615
615
  * @param {string} prompt
616
- * @param {string} [advice]
617
- * @param {string} [okLabel]
618
- * @param {string} [cancelLabel]
619
- * @param {string} [initialValue]
620
- * @returns {Promise<any>}
616
+ * @param {object} [options]
617
+ * @param {string} [options.advice]
618
+ * @param {string} [options.okLabel]
619
+ * @param {string} [options.cancelLabel]
620
+ * @param {string} [options.initialValue]
621
+ * @returns {Promise<string>}
621
622
  */
622
- async prompt(parentId, prompt, advice, okLabel, cancelLabel, initialValue) {
623
+ async prompt(
624
+ parentId,
625
+ prompt,
626
+ {advice, okLabel, cancelLabel, initialValue} = {}
627
+ ) {
623
628
  const dialogId = await this.openDialog(
624
629
  {
625
630
  widget: 'PromptDialog',
@@ -1,5 +1,6 @@
1
1
  export default function styles() {
2
2
  const numberField = {
3
+ 'flexGrow': 1,
3
4
  '&[class]' /* increase specificity */: {
4
5
  width: '90px',
5
6
  },
@@ -65,6 +65,10 @@ export default function styles() {
65
65
  },
66
66
  };
67
67
 
68
+ const menuDiv = {
69
+ padding: '6px 8px',
70
+ };
71
+
68
72
  const menuDialog = {
69
73
  '::backdrop': {
70
74
  backgroundColor: 'transparent',
@@ -146,6 +150,7 @@ export default function styles() {
146
150
  menuItem,
147
151
  menuItemRight,
148
152
  menuTitle,
153
+ menuDiv,
149
154
  menuDialog,
150
155
  menuPosition,
151
156
  menuContent,
@@ -96,6 +96,25 @@ class MenuTitle extends Widget {
96
96
  }
97
97
  }
98
98
 
99
+ class MenuDiv extends Widget {
100
+ constructor() {
101
+ super(...arguments);
102
+ this.styles = styles;
103
+ }
104
+
105
+ render() {
106
+ const {className = '', children, ...props} = this.props;
107
+ return (
108
+ <div
109
+ {...props}
110
+ className={this.styles.classNames.menuDiv + ' ' + className}
111
+ >
112
+ {children}
113
+ </div>
114
+ );
115
+ }
116
+ }
117
+
99
118
  class Submenu extends Widget {
100
119
  constructor() {
101
120
  super(...arguments);
@@ -532,6 +551,7 @@ export default class Menu extends Widget {
532
551
  }
533
552
 
534
553
  close() {
554
+ this.props.onClose?.();
535
555
  this.setState({open: false});
536
556
  }
537
557
 
@@ -583,6 +603,7 @@ export default class Menu extends Widget {
583
603
  static Content = MenuContent;
584
604
  static Item = MenuItem;
585
605
  static Title = MenuTitle;
606
+ static Div = MenuDiv;
586
607
  static Submenu = Submenu;
587
608
  static Hr = MenuHr;
588
609
  static Button = MenuButton;