@bpmn-io/properties-panel 0.10.1 → 0.10.2

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/dist/index.js CHANGED
@@ -14,14 +14,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
14
14
 
15
15
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
16
16
 
17
- /**
18
- * @typedef { { getElementLabel: Function, getTypeLabel: Function, getElementIcon: Function } } HeaderProvider
17
+ /**
18
+ * @typedef { { getElementLabel: Function, getTypeLabel: Function, getElementIcon: Function } } HeaderProvider
19
19
  */
20
20
 
21
- /**
22
- * @param {Object} props
23
- * @param {Object} props.element,
24
- * @param {HeaderProvider} props.headerProvider
21
+ /**
22
+ * @param {Object} props
23
+ * @param {Object} props.element,
24
+ * @param {HeaderProvider} props.headerProvider
25
25
  */
26
26
  function Header(props) {
27
27
  const {
@@ -60,11 +60,11 @@ function Header(props) {
60
60
  });
61
61
  }
62
62
 
63
- /**
64
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
65
- * state on updates.
66
- *
67
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
63
+ /**
64
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
65
+ * state on updates.
66
+ *
67
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
68
68
  */
69
69
 
70
70
  function usePrevious(value) {
@@ -76,24 +76,24 @@ function usePrevious(value) {
76
76
  }
77
77
 
78
78
  const KEY_LENGTH = 6;
79
- /**
80
- * Create a persistent key factory for plain objects without id.
81
- *
82
- * @example
83
- * ```jsx
84
- * function List({ objects }) {
85
- * const getKey = useKeyFactory();
86
- * return (<ol>{
87
- * objects.map(obj => {
88
- * const key = getKey(obj);
89
- * return <li key={key}>obj.name</li>
90
- * })
91
- * }</ol>);
92
- * }
93
- * ```
94
- *
95
- * @param {any[]} dependencies
96
- * @returns {(element: object) => string}
79
+ /**
80
+ * Create a persistent key factory for plain objects without id.
81
+ *
82
+ * @example
83
+ * ```jsx
84
+ * function List({ objects }) {
85
+ * const getKey = useKeyFactory();
86
+ * return (<ol>{
87
+ * objects.map(obj => {
88
+ * const key = getKey(obj);
89
+ * return <li key={key}>obj.name</li>
90
+ * })
91
+ * }</ol>);
92
+ * }
93
+ * ```
94
+ *
95
+ * @param {any[]} dependencies
96
+ * @returns {(element: object) => string}
97
97
  */
98
98
 
99
99
  function useKeyFactory(dependencies = []) {
@@ -125,20 +125,20 @@ const LayoutContext = preact.createContext({
125
125
  setLayoutForKey: () => {}
126
126
  });
127
127
 
128
- /**
129
- * Creates a state that persists in the global LayoutContext.
130
- *
131
- * @example
132
- * ```jsx
133
- * function Group(props) {
134
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
135
- * }
136
- * ```
137
- *
138
- * @param {(string|number)[]} path
139
- * @param {any} [defaultValue]
140
- *
141
- * @returns {[ any, Function ]}
128
+ /**
129
+ * Creates a state that persists in the global LayoutContext.
130
+ *
131
+ * @example
132
+ * ```jsx
133
+ * function Group(props) {
134
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
135
+ * }
136
+ * ```
137
+ *
138
+ * @param {(string|number)[]} path
139
+ * @param {any} [defaultValue]
140
+ *
141
+ * @returns {[ any, Function ]}
142
142
  */
143
143
 
144
144
  function useLayoutState(path, defaultValue) {
@@ -159,20 +159,20 @@ function useLayoutState(path, defaultValue) {
159
159
  return [value, setState];
160
160
  }
161
161
 
162
- /**
163
- * Accesses the global DescriptionContext and returns a description for a given id and element.
164
- *
165
- * @example
166
- * ```jsx
167
- * function TextField(props) {
168
- * const description = useDescriptionContext('input1', element);
169
- * }
170
- * ```
171
- *
172
- * @param {string} id
173
- * @param {djs.model.Base} element
174
- *
175
- * @returns {string}
162
+ /**
163
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
164
+ *
165
+ * @example
166
+ * ```jsx
167
+ * function TextField(props) {
168
+ * const description = useDescriptionContext('input1', element);
169
+ * }
170
+ * ```
171
+ *
172
+ * @param {string} id
173
+ * @param {djs.model.Base} element
174
+ *
175
+ * @returns {string}
176
176
  */
177
177
 
178
178
  function useDescriptionContext(id, element) {
@@ -294,64 +294,64 @@ const DEFAULT_LAYOUT = {
294
294
  open: true
295
295
  };
296
296
  const DEFAULT_DESCRIPTION = {};
297
- /**
298
- * @typedef { {
299
- * component: import('preact').ComponentChild,
300
- * id: String,
301
- * isEdited?: Function
302
- * } } EntryDefinition
303
- *
304
- * @typedef { {
305
- * autoFocusEntry: String,
306
- * autoOpen?: Boolean,
307
- * entries: Array<EntryDefinition>,
308
- * id: String,
309
- * label: String,
310
- * remove: (event: MouseEvent) => void
311
- * } } ListItemDefinition
312
- *
313
- * @typedef { {
314
- * add: (event: MouseEvent) => void,
315
- * component: import('preact').Component,
316
- * element: Object,
317
- * id: String,
318
- * items: Array<ListItemDefinition>,
319
- * label: String,
320
- * shouldSort?: Boolean,
321
- * shouldOpen?: Boolean
322
- * } } ListGroupDefinition
323
- *
324
- * @typedef { {
325
- * component?: import('preact').Component,
326
- * entries: Array<EntryDefinition>,
327
- * id: String,
328
- * label: String
329
- * } } GroupDefinition
330
- *
331
- * @typedef { {
332
- * [id: String]: GetDescriptionFunction
333
- * } } DescriptionConfig
334
- *
335
- * @callback { {
336
- * @param {string} id
337
- * @param {djs.model.base} element
338
- * @returns {string}
339
- * } } GetDescriptionFunction
340
- *
297
+ /**
298
+ * @typedef { {
299
+ * component: import('preact').ComponentChild,
300
+ * id: String,
301
+ * isEdited?: Function
302
+ * } } EntryDefinition
303
+ *
304
+ * @typedef { {
305
+ * autoFocusEntry: String,
306
+ * autoOpen?: Boolean,
307
+ * entries: Array<EntryDefinition>,
308
+ * id: String,
309
+ * label: String,
310
+ * remove: (event: MouseEvent) => void
311
+ * } } ListItemDefinition
312
+ *
313
+ * @typedef { {
314
+ * add: (event: MouseEvent) => void,
315
+ * component: import('preact').Component,
316
+ * element: Object,
317
+ * id: String,
318
+ * items: Array<ListItemDefinition>,
319
+ * label: String,
320
+ * shouldSort?: Boolean,
321
+ * shouldOpen?: Boolean
322
+ * } } ListGroupDefinition
323
+ *
324
+ * @typedef { {
325
+ * component?: import('preact').Component,
326
+ * entries: Array<EntryDefinition>,
327
+ * id: String,
328
+ * label: String
329
+ * } } GroupDefinition
330
+ *
331
+ * @typedef { {
332
+ * [id: String]: GetDescriptionFunction
333
+ * } } DescriptionConfig
334
+ *
335
+ * @callback { {
336
+ * @param {string} id
337
+ * @param {djs.model.base} element
338
+ * @returns {string}
339
+ * } } GetDescriptionFunction
340
+ *
341
341
  */
342
342
 
343
- /**
344
- * A basic properties panel component. Describes *how* content will be rendered, accepts
345
- * data from implementor to describe *what* will be rendered.
346
- *
347
- * @param {Object} props
348
- * @param {Object} props.element
349
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
350
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
351
- * @param {Object} [props.layoutConfig]
352
- * @param {Function} [props.layoutChanged]
353
- * @param {DescriptionConfig} [props.descriptionConfig]
354
- * @param {Function} [props.descriptionLoaded]
343
+ /**
344
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
345
+ * data from implementor to describe *what* will be rendered.
346
+ *
347
+ * @param {Object} props
348
+ * @param {Object} props.element
349
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
350
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
351
+ * @param {Object} [props.layoutConfig]
352
+ * @param {Function} [props.layoutChanged]
353
+ * @param {DescriptionConfig} [props.descriptionConfig]
354
+ * @param {Function} [props.descriptionLoaded]
355
355
  */
356
356
 
357
357
  function PropertiesPanel(props) {
@@ -518,17 +518,17 @@ function MenuItem({
518
518
  children: item.entry
519
519
  });
520
520
  }
521
- /**
522
- *
523
- * @param {Array<null | Element>} ignoredElements
524
- * @param {Function} callback
521
+ /**
522
+ *
523
+ * @param {Array<null | Element>} ignoredElements
524
+ * @param {Function} callback
525
525
  */
526
526
 
527
527
 
528
528
  function useGlobalClick(ignoredElements, callback) {
529
529
  hooks.useEffect(() => {
530
- /**
531
- * @param {MouseEvent} event
530
+ /**
531
+ * @param {MouseEvent} event
532
532
  */
533
533
  function listener(event) {
534
534
  if (ignoredElements.some(element => element && element.contains(event.target))) {
@@ -633,8 +633,8 @@ function ListItem(props) {
633
633
  }
634
634
 
635
635
  const noop = () => {};
636
- /**
637
- * @param {import('../PropertiesPanel').ListGroupDefinition} props
636
+ /**
637
+ * @param {import('../PropertiesPanel').ListGroupDefinition} props
638
638
  */
639
639
 
640
640
 
@@ -774,8 +774,8 @@ function ListGroup(props) {
774
774
  });
775
775
  } // helpers ////////////////////
776
776
 
777
- /**
778
- * Sorts given items alphanumeric by label
777
+ /**
778
+ * Sorts given items alphanumeric by label
779
779
  */
780
780
 
781
781
  function sortItems(items) {
@@ -839,15 +839,15 @@ function Checkbox(props) {
839
839
  })]
840
840
  });
841
841
  }
842
- /**
843
- * @param {Object} props
844
- * @param {Object} props.element
845
- * @param {String} props.id
846
- * @param {String} props.description
847
- * @param {String} props.label
848
- * @param {Function} props.getValue
849
- * @param {Function} props.setValue
850
- * @param {boolean} [props.disabled]
842
+ /**
843
+ * @param {Object} props
844
+ * @param {Object} props.element
845
+ * @param {String} props.id
846
+ * @param {String} props.description
847
+ * @param {String} props.label
848
+ * @param {Function} props.getValue
849
+ * @param {Function} props.setValue
850
+ * @param {boolean} [props.disabled]
851
851
  */
852
852
 
853
853
 
@@ -914,8 +914,8 @@ function List(props) {
914
914
  setOpen(false);
915
915
  }
916
916
  }, [open, hasItems]);
917
- /**
918
- * @param {MouseEvent} event
917
+ /**
918
+ * @param {MouseEvent} event
919
919
  */
920
920
 
921
921
  function addItem(event) {
@@ -1017,14 +1017,14 @@ function ItemsList(props) {
1017
1017
  })
1018
1018
  });
1019
1019
  }
1020
- /**
1021
- * Place new items in the beginning of the list and sort the rest with provided function.
1022
- *
1023
- * @template Item
1024
- * @param {Item[]} currentItems
1025
- * @param {(a: Item, b: Item) => 0 | 1 | -1} [compareFn] function used to sort items
1026
- * @param {boolean} [shouldReset=false] set to `true` to reset state of the hook
1027
- * @returns {Item[]}
1020
+ /**
1021
+ * Place new items in the beginning of the list and sort the rest with provided function.
1022
+ *
1023
+ * @template Item
1024
+ * @param {Item[]} currentItems
1025
+ * @param {(a: Item, b: Item) => 0 | 1 | -1} [compareFn] function used to sort items
1026
+ * @param {boolean} [shouldReset=false] set to `true` to reset state of the hook
1027
+ * @returns {Item[]}
1028
1028
  */
1029
1029
 
1030
1030
 
@@ -1110,19 +1110,19 @@ function NumberField(props) {
1110
1110
  })]
1111
1111
  });
1112
1112
  }
1113
- /**
1114
- * @param {Object} props
1115
- * @param {Boolean} props.debounce
1116
- * @param {String} props.description
1117
- * @param {Boolean} props.disabled
1118
- * @param {Object} props.element
1119
- * @param {Function} props.getValue
1120
- * @param {String} props.id
1121
- * @param {String} props.label
1122
- * @param {String} props.max
1123
- * @param {String} props.min
1124
- * @param {Function} props.setValue
1125
- * @param {String} props.step
1113
+ /**
1114
+ * @param {Object} props
1115
+ * @param {Boolean} props.debounce
1116
+ * @param {String} props.description
1117
+ * @param {Boolean} props.disabled
1118
+ * @param {Object} props.element
1119
+ * @param {Function} props.getValue
1120
+ * @param {String} props.id
1121
+ * @param {String} props.label
1122
+ * @param {String} props.max
1123
+ * @param {String} props.min
1124
+ * @param {Function} props.setValue
1125
+ * @param {String} props.step
1126
1126
  */
1127
1127
 
1128
1128
 
@@ -1208,16 +1208,16 @@ function Select(props) {
1208
1208
  })]
1209
1209
  });
1210
1210
  }
1211
- /**
1212
- * @param {object} props
1213
- * @param {object} props.element
1214
- * @param {string} props.id
1215
- * @param {string} [props.description]
1216
- * @param {string} props.label
1217
- * @param {Function} props.getValue
1218
- * @param {Function} props.setValue
1219
- * @param {Function} props.getOptions
1220
- * @param {boolean} [props.disabled]
1211
+ /**
1212
+ * @param {object} props
1213
+ * @param {object} props.element
1214
+ * @param {string} props.id
1215
+ * @param {string} [props.description]
1216
+ * @param {string} props.label
1217
+ * @param {Function} props.getValue
1218
+ * @param {Function} props.setValue
1219
+ * @param {Function} props.getOptions
1220
+ * @param {boolean} [props.disabled]
1221
1221
  */
1222
1222
 
1223
1223
 
@@ -1287,6 +1287,7 @@ function Simple(props) {
1287
1287
  disabled: disabled,
1288
1288
  class: "bio-properties-panel-input",
1289
1289
  onInput: handleInput,
1290
+ "aria-label": value || '<empty>',
1290
1291
  onFocus: onFocus,
1291
1292
  onBlur: onBlur,
1292
1293
  value: value || ''
@@ -1337,18 +1338,18 @@ function TextArea(props) {
1337
1338
  })]
1338
1339
  });
1339
1340
  }
1340
- /**
1341
- * @param {object} props
1342
- * @param {object} props.element
1343
- * @param {string} props.id
1344
- * @param {string} props.description
1345
- * @param {boolean} props.debounce
1346
- * @param {string} props.label
1347
- * @param {Function} props.getValue
1348
- * @param {Function} props.setValue
1349
- * @param {number} props.rows
1350
- * @param {boolean} props.monospace
1351
- * @param {boolean} [props.disabled]
1341
+ /**
1342
+ * @param {object} props
1343
+ * @param {object} props.element
1344
+ * @param {string} props.id
1345
+ * @param {string} props.description
1346
+ * @param {boolean} props.debounce
1347
+ * @param {string} props.label
1348
+ * @param {Function} props.getValue
1349
+ * @param {Function} props.setValue
1350
+ * @param {number} props.rows
1351
+ * @param {boolean} props.monospace
1352
+ * @param {boolean} [props.disabled]
1352
1353
  */
1353
1354
 
1354
1355
 
@@ -1428,17 +1429,17 @@ function Textfield(props) {
1428
1429
  })]
1429
1430
  });
1430
1431
  }
1431
- /**
1432
- * @param {Object} props
1433
- * @param {Object} props.element
1434
- * @param {String} props.id
1435
- * @param {String} props.description
1436
- * @param {Boolean} props.debounce
1437
- * @param {Boolean} props.disabled
1438
- * @param {String} props.label
1439
- * @param {Function} props.getValue
1440
- * @param {Function} props.setValue
1441
- * @param {Function} props.validate
1432
+ /**
1433
+ * @param {Object} props
1434
+ * @param {Object} props.element
1435
+ * @param {String} props.id
1436
+ * @param {String} props.description
1437
+ * @param {Boolean} props.debounce
1438
+ * @param {Boolean} props.disabled
1439
+ * @param {String} props.label
1440
+ * @param {Function} props.getValue
1441
+ * @param {Function} props.setValue
1442
+ * @param {Function} props.validate
1442
1443
  */
1443
1444
 
1444
1445
 
@@ -1549,15 +1550,15 @@ function ToggleSwitch(props) {
1549
1550
  })]
1550
1551
  });
1551
1552
  }
1552
- /**
1553
- * @param {Object} props
1554
- * @param {Object} props.element
1555
- * @param {String} props.id
1556
- * @param {String} props.description
1557
- * @param {String} props.label
1558
- * @param {String} props.switcherLabel
1559
- * @param {Function} props.getValue
1560
- * @param {Function} props.setValue
1553
+ /**
1554
+ * @param {Object} props
1555
+ * @param {Object} props.element
1556
+ * @param {String} props.id
1557
+ * @param {String} props.description
1558
+ * @param {String} props.label
1559
+ * @param {String} props.switcherLabel
1560
+ * @param {Function} props.getValue
1561
+ * @param {Function} props.setValue
1561
1562
  */
1562
1563
 
1563
1564