@bpmn-io/properties-panel 0.22.0 → 0.24.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/dist/index.js CHANGED
@@ -1192,7 +1192,9 @@ function Checkbox(props) {
1192
1192
  label,
1193
1193
  onChange,
1194
1194
  disabled,
1195
- value = false
1195
+ value = false,
1196
+ onFocus,
1197
+ onBlur
1196
1198
  } = props;
1197
1199
  const [localValue, setLocalValue] = hooks.useState(value);
1198
1200
 
@@ -1221,6 +1223,8 @@ function Checkbox(props) {
1221
1223
  ref: ref,
1222
1224
  id: prefixId$7(id),
1223
1225
  name: id,
1226
+ onFocus: onFocus,
1227
+ onBlur: onBlur,
1224
1228
  type: "checkbox",
1225
1229
  class: "bio-properties-panel-input",
1226
1230
  onChange: handleChange,
@@ -1241,6 +1245,8 @@ function Checkbox(props) {
1241
1245
  * @param {String} props.label
1242
1246
  * @param {Function} props.getValue
1243
1247
  * @param {Function} props.setValue
1248
+ * @param {Function} props.onFocus
1249
+ * @param {Function} props.onBlur
1244
1250
  * @param {boolean} [props.disabled]
1245
1251
  */
1246
1252
 
@@ -1253,7 +1259,9 @@ function CheckboxEntry(props) {
1253
1259
  label,
1254
1260
  getValue,
1255
1261
  setValue,
1256
- disabled
1262
+ disabled,
1263
+ onFocus,
1264
+ onBlur
1257
1265
  } = props;
1258
1266
  const value = getValue(element);
1259
1267
  const error = useError(id);
@@ -1265,6 +1273,8 @@ function CheckboxEntry(props) {
1265
1273
  id: id,
1266
1274
  label: label,
1267
1275
  onChange: setValue,
1276
+ onFocus: onFocus,
1277
+ onBlur: onBlur,
1268
1278
  value: value
1269
1279
  }, element), error && jsxRuntime.jsx("div", {
1270
1280
  class: "bio-properties-panel-error",
@@ -1447,6 +1457,7 @@ function FeelTextfield(props) {
1447
1457
  feel,
1448
1458
  value = '',
1449
1459
  disabled = false,
1460
+ variables,
1450
1461
  OptionalComponent = OptionalFeelInput
1451
1462
  } = props;
1452
1463
  const [localValue, _setLocalValue] = hooks.useState(value);
@@ -1457,7 +1468,7 @@ function FeelTextfield(props) {
1457
1468
  const [focus, _setFocus] = hooks.useState(undefined);
1458
1469
 
1459
1470
  const setFocus = (offset = 0) => {
1460
- const hasFocus = containerRef.current.contains(document.activeElement); // Keep carret position if it is already focused, otherwise focus at the end
1471
+ const hasFocus = containerRef.current.contains(document.activeElement); // Keep caret position if it is already focused, otherwise focus at the end
1461
1472
 
1462
1473
  const position = hasFocus ? document.activeElement.selectionStart : Infinity;
1463
1474
 
@@ -1603,7 +1614,7 @@ function FeelTextfield(props) {
1603
1614
  },
1604
1615
  onLint: handleLint,
1605
1616
  value: feelOnlyValue,
1606
- variables: props.variables,
1617
+ variables: variables,
1607
1618
  ref: editorRef
1608
1619
  }) : jsxRuntime.jsx(OptionalComponent, { ...props,
1609
1620
  onInput: handleLocalInput,
@@ -1619,7 +1630,9 @@ const OptionalFeelInput = compat.forwardRef((props, ref) => {
1619
1630
  id,
1620
1631
  disabled,
1621
1632
  onInput,
1622
- value
1633
+ value,
1634
+ onFocus,
1635
+ onBlur
1623
1636
  } = props;
1624
1637
  const inputRef = hooks.useRef(); // To be consistent with the FEEL editor, set focus at start of input
1625
1638
  // this ensures clean editing experience when switching with the keyboard
@@ -1653,8 +1666,8 @@ const OptionalFeelInput = compat.forwardRef((props, ref) => {
1653
1666
  disabled: disabled,
1654
1667
  class: "bio-properties-panel-input",
1655
1668
  onInput: e => onInput(e.target.value),
1656
- onFocus: props.onFocus,
1657
- onBlur: props.onBlur,
1669
+ onFocus: onFocus,
1670
+ onBlur: onBlur,
1658
1671
  value: value || ''
1659
1672
  });
1660
1673
  });
@@ -1663,7 +1676,9 @@ const OptionalFeelTextArea = compat.forwardRef((props, ref) => {
1663
1676
  id,
1664
1677
  disabled,
1665
1678
  onInput,
1666
- value
1679
+ value,
1680
+ onFocus,
1681
+ onBlur
1667
1682
  } = props;
1668
1683
  const inputRef = hooks.useRef(); // To be consistent with the FEEL editor, set focus at start of input
1669
1684
  // this ensures clean editing experience when switching with the keyboard
@@ -1690,8 +1705,8 @@ const OptionalFeelTextArea = compat.forwardRef((props, ref) => {
1690
1705
  disabled: disabled,
1691
1706
  class: "bio-properties-panel-input",
1692
1707
  onInput: e => onInput(e.target.value),
1693
- onFocus: props.onFocus,
1694
- onBlur: props.onBlur,
1708
+ onFocus: onFocus,
1709
+ onBlur: onBlur,
1695
1710
  value: value || ''
1696
1711
  });
1697
1712
  });
@@ -1720,7 +1735,11 @@ function FeelEntry(props) {
1720
1735
  getValue,
1721
1736
  setValue,
1722
1737
  validate,
1723
- show = noop
1738
+ show = noop,
1739
+ example,
1740
+ variables,
1741
+ onFocus,
1742
+ onBlur
1724
1743
  } = props;
1725
1744
  const [cachedInvalidValue, setCachedInvalidValue] = hooks.useState(null);
1726
1745
  const [validationError, setValidationError] = hooks.useState(null);
@@ -1760,7 +1779,7 @@ function FeelEntry(props) {
1760
1779
  }
1761
1780
 
1762
1781
  const temporaryError = useError(id);
1763
- const error = temporaryError || validationError || localError;
1782
+ const error = localError || temporaryError || validationError;
1764
1783
  return jsxRuntime.jsxs("div", {
1765
1784
  class: classnames__default["default"](props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''),
1766
1785
  "data-entry-id": id,
@@ -1772,10 +1791,12 @@ function FeelEntry(props) {
1772
1791
  label: label,
1773
1792
  onInput: onInput,
1774
1793
  onError: onError,
1775
- example: props.example,
1794
+ onFocus: onFocus,
1795
+ onBlur: onBlur,
1796
+ example: example,
1776
1797
  show: show,
1777
1798
  value: value,
1778
- variables: props.variables,
1799
+ variables: variables,
1779
1800
  OptionalComponent: props.OptionalComponent
1780
1801
  }, element), error && jsxRuntime.jsx("div", {
1781
1802
  class: "bio-properties-panel-error",
@@ -1797,6 +1818,8 @@ function FeelEntry(props) {
1797
1818
  * @param {String} props.label
1798
1819
  * @param {Function} props.getValue
1799
1820
  * @param {Function} props.setValue
1821
+ * @param {Function} props.onFocus
1822
+ * @param {Function} props.onBlur
1800
1823
  * @param {Function} props.validate
1801
1824
  */
1802
1825
 
@@ -2013,7 +2036,9 @@ function NumberField(props) {
2013
2036
  min,
2014
2037
  onInput,
2015
2038
  step,
2016
- value = ''
2039
+ value = '',
2040
+ onFocus,
2041
+ onBlur
2017
2042
  } = props;
2018
2043
  const [localValue, setLocalValue] = hooks.useState(value);
2019
2044
  const handleInputCallback = hooks.useMemo(() => {
@@ -2058,6 +2083,8 @@ function NumberField(props) {
2058
2083
  max: max,
2059
2084
  min: min,
2060
2085
  onInput: handleInput,
2086
+ onFocus: onFocus,
2087
+ onBlur: onBlur,
2061
2088
  step: step,
2062
2089
  value: localValue
2063
2090
  })]
@@ -2075,6 +2102,8 @@ function NumberField(props) {
2075
2102
  * @param {String} props.max
2076
2103
  * @param {String} props.min
2077
2104
  * @param {Function} props.setValue
2105
+ * @param {Function} props.onFocus
2106
+ * @param {Function} props.onBlur
2078
2107
  * @param {String} props.step
2079
2108
  */
2080
2109
 
@@ -2091,7 +2120,9 @@ function NumberFieldEntry(props) {
2091
2120
  max,
2092
2121
  min,
2093
2122
  setValue,
2094
- step
2123
+ step,
2124
+ onFocus,
2125
+ onBlur
2095
2126
  } = props;
2096
2127
  const value = getValue(element);
2097
2128
  return jsxRuntime.jsxs("div", {
@@ -2103,6 +2134,8 @@ function NumberFieldEntry(props) {
2103
2134
  id: id,
2104
2135
  label: label,
2105
2136
  onInput: setValue,
2137
+ onFocus: onFocus,
2138
+ onBlur: onBlur,
2106
2139
  max: max,
2107
2140
  min: min,
2108
2141
  step: step,
@@ -2129,7 +2162,9 @@ function Select(props) {
2129
2162
  onChange,
2130
2163
  options = [],
2131
2164
  value,
2132
- disabled
2165
+ disabled,
2166
+ onFocus,
2167
+ onBlur
2133
2168
  } = props;
2134
2169
  const ref = useShowEntryEvent(id);
2135
2170
  const [localValue, setLocalValue] = hooks.useState(value);
@@ -2164,6 +2199,8 @@ function Select(props) {
2164
2199
  name: id,
2165
2200
  class: "bio-properties-panel-input",
2166
2201
  onInput: handleChange,
2202
+ onFocus: onFocus,
2203
+ onBlur: onBlur,
2167
2204
  value: localValue,
2168
2205
  disabled: disabled,
2169
2206
  children: options.map((option, idx) => {
@@ -2184,6 +2221,8 @@ function Select(props) {
2184
2221
  * @param {string} props.label
2185
2222
  * @param {Function} props.getValue
2186
2223
  * @param {Function} props.setValue
2224
+ * @param {Function} props.onFocus
2225
+ * @param {Function} props.onBlur
2187
2226
  * @param {Function} props.getOptions
2188
2227
  * @param {boolean} [props.disabled]
2189
2228
  */
@@ -2198,7 +2237,9 @@ function SelectEntry(props) {
2198
2237
  getValue,
2199
2238
  setValue,
2200
2239
  getOptions,
2201
- disabled
2240
+ disabled,
2241
+ onFocus,
2242
+ onBlur
2202
2243
  } = props;
2203
2244
  const value = getValue(element);
2204
2245
  const options = getOptions(element);
@@ -2211,6 +2252,8 @@ function SelectEntry(props) {
2211
2252
  label: label,
2212
2253
  value: value,
2213
2254
  onChange: setValue,
2255
+ onFocus: onFocus,
2256
+ onBlur: onBlur,
2214
2257
  options: options,
2215
2258
  disabled: disabled
2216
2259
  }, element), error && jsxRuntime.jsx("div", {
@@ -2297,7 +2340,9 @@ function TextArea(props) {
2297
2340
  onInput,
2298
2341
  value = '',
2299
2342
  disabled,
2300
- monospace
2343
+ monospace,
2344
+ onFocus,
2345
+ onBlur
2301
2346
  } = props;
2302
2347
  const [localValue, setLocalValue] = hooks.useState(value);
2303
2348
  const ref = useShowEntryEvent(id);
@@ -2332,8 +2377,8 @@ function TextArea(props) {
2332
2377
  spellCheck: "false",
2333
2378
  class: classnames__default["default"]('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : ''),
2334
2379
  onInput: handleInput,
2335
- onFocus: props.onFocus,
2336
- onBlur: props.onBlur,
2380
+ onFocus: onFocus,
2381
+ onBlur: onBlur,
2337
2382
  rows: rows,
2338
2383
  value: localValue,
2339
2384
  disabled: disabled
@@ -2349,6 +2394,8 @@ function TextArea(props) {
2349
2394
  * @param {string} props.label
2350
2395
  * @param {Function} props.getValue
2351
2396
  * @param {Function} props.setValue
2397
+ * @param {Function} props.onFocus
2398
+ * @param {Function} props.onBlur
2352
2399
  * @param {number} props.rows
2353
2400
  * @param {boolean} props.monospace
2354
2401
  * @param {boolean} [props.disabled]
@@ -2366,7 +2413,9 @@ function TextAreaEntry(props) {
2366
2413
  setValue,
2367
2414
  rows,
2368
2415
  monospace,
2369
- disabled
2416
+ disabled,
2417
+ onFocus,
2418
+ onBlur
2370
2419
  } = props;
2371
2420
  const value = getValue(element);
2372
2421
  const error = useError(id);
@@ -2378,6 +2427,8 @@ function TextAreaEntry(props) {
2378
2427
  label: label,
2379
2428
  value: value,
2380
2429
  onInput: setValue,
2430
+ onFocus: onFocus,
2431
+ onBlur: onBlur,
2381
2432
  rows: rows,
2382
2433
  debounce: debounce,
2383
2434
  monospace: monospace,
@@ -2407,6 +2458,8 @@ function Textfield(props) {
2407
2458
  id,
2408
2459
  label,
2409
2460
  onInput,
2461
+ onFocus,
2462
+ onBlur,
2410
2463
  value = ''
2411
2464
  } = props;
2412
2465
  const [localValue, setLocalValue] = hooks.useState(value || '');
@@ -2445,8 +2498,8 @@ function Textfield(props) {
2445
2498
  disabled: disabled,
2446
2499
  class: "bio-properties-panel-input",
2447
2500
  onInput: handleInput,
2448
- onFocus: props.onFocus,
2449
- onBlur: props.onBlur,
2501
+ onFocus: onFocus,
2502
+ onBlur: onBlur,
2450
2503
  value: localValue
2451
2504
  })]
2452
2505
  });
@@ -2461,6 +2514,8 @@ function Textfield(props) {
2461
2514
  * @param {String} props.label
2462
2515
  * @param {Function} props.getValue
2463
2516
  * @param {Function} props.setValue
2517
+ * @param {Function} props.onFocus
2518
+ * @param {Function} props.onBlur
2464
2519
  * @param {Function} props.validate
2465
2520
  */
2466
2521
 
@@ -2475,7 +2530,9 @@ function TextfieldEntry(props) {
2475
2530
  label,
2476
2531
  getValue,
2477
2532
  setValue,
2478
- validate
2533
+ validate,
2534
+ onFocus,
2535
+ onBlur
2479
2536
  } = props;
2480
2537
  const [cachedInvalidValue, setCachedInvalidValue] = hooks.useState(null);
2481
2538
  const globalError = useError(id);
@@ -2519,6 +2576,8 @@ function TextfieldEntry(props) {
2519
2576
  id: id,
2520
2577
  label: label,
2521
2578
  onInput: onInput,
2579
+ onFocus: onFocus,
2580
+ onBlur: onBlur,
2522
2581
  value: value
2523
2582
  }, element), error && jsxRuntime.jsx("div", {
2524
2583
  class: "bio-properties-panel-error",
@@ -2544,7 +2603,9 @@ function ToggleSwitch(props) {
2544
2603
  label,
2545
2604
  onInput,
2546
2605
  value,
2547
- switcherLabel
2606
+ switcherLabel,
2607
+ onFocus,
2608
+ onBlur
2548
2609
  } = props;
2549
2610
  const [localValue, setLocalValue] = hooks.useState(value);
2550
2611
 
@@ -2578,9 +2639,11 @@ function ToggleSwitch(props) {
2578
2639
  id: prefixId(id),
2579
2640
  class: "bio-properties-panel-input",
2580
2641
  type: "checkbox",
2642
+ onFocus: onFocus,
2643
+ onBlur: onBlur,
2581
2644
  name: id,
2582
2645
  onInput: handleInput,
2583
- checked: localValue
2646
+ checked: !!localValue
2584
2647
  }), jsxRuntime.jsx("span", {
2585
2648
  class: "bio-properties-panel-toggle-switch__slider"
2586
2649
  })]
@@ -2600,6 +2663,8 @@ function ToggleSwitch(props) {
2600
2663
  * @param {String} props.switcherLabel
2601
2664
  * @param {Function} props.getValue
2602
2665
  * @param {Function} props.setValue
2666
+ * @param {Function} props.onFocus
2667
+ * @param {Function} props.onBlur
2603
2668
  */
2604
2669
 
2605
2670
 
@@ -2611,7 +2676,9 @@ function ToggleSwitchEntry(props) {
2611
2676
  label,
2612
2677
  switcherLabel,
2613
2678
  getValue,
2614
- setValue
2679
+ setValue,
2680
+ onFocus,
2681
+ onBlur
2615
2682
  } = props;
2616
2683
  const value = getValue(element);
2617
2684
  return jsxRuntime.jsxs("div", {
@@ -2622,6 +2689,8 @@ function ToggleSwitchEntry(props) {
2622
2689
  label: label,
2623
2690
  value: value,
2624
2691
  onInput: setValue,
2692
+ onFocus: onFocus,
2693
+ onBlur: onBlur,
2625
2694
  switcherLabel: switcherLabel
2626
2695
  }), jsxRuntime.jsx(Description, {
2627
2696
  forId: id,