@bpmn-io/properties-panel 3.35.0 → 3.36.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.
@@ -1532,3 +1532,9 @@ textarea.bio-properties-panel-input {
1532
1532
  .bio-properties-panel-feel-popup .cm-gutters .cm-lineNumbers .cm-gutterElement {
1533
1533
  text-align: center;
1534
1534
  }
1535
+
1536
+ /* Checkbox Group */
1537
+ .bio-properties-panel-checkbox-group .bio-properties-panel-checkbox-group-entries > .bio-properties-panel-entry {
1538
+ margin: 0;
1539
+ padding: 0;
1540
+ }
package/dist/index.esm.js CHANGED
@@ -1687,6 +1687,73 @@ function prefixId$8(id) {
1687
1687
  return `bio-properties-panel-${id}`;
1688
1688
  }
1689
1689
 
1690
+ /**
1691
+ * @param {Object} props
1692
+ * @param {Object} props.element
1693
+ * @param {String} props.id
1694
+ * @param {String} props.label
1695
+ * @param {Array<{label: String, value: *}>} props.options
1696
+ * @param {Function} props.getValue
1697
+ * @param {Function} props.setValue
1698
+ * @param {String} [props.description]
1699
+ * @param {string|import('preact').Component} [props.tooltip]
1700
+ * @param {boolean} [props.disabled]
1701
+ * @param {Function} [props.onFocus]
1702
+ * @param {Function} [props.onBlur]
1703
+ */
1704
+ function CheckboxGroup(props) {
1705
+ const {
1706
+ element,
1707
+ id,
1708
+ label,
1709
+ description,
1710
+ tooltip,
1711
+ options = [],
1712
+ getValue,
1713
+ setValue,
1714
+ disabled,
1715
+ onFocus,
1716
+ onBlur
1717
+ } = props;
1718
+ const value = getValue(element) || [];
1719
+ const handleOptionChange = (optionValue, checked) => {
1720
+ const newValue = checked ? [...value, optionValue] : value.filter(v => v !== optionValue);
1721
+ setValue(newValue);
1722
+ };
1723
+ return jsxs("div", {
1724
+ class: "bio-properties-panel-entry bio-properties-panel-checkbox-group",
1725
+ "data-entry-id": id,
1726
+ children: [jsx("div", {
1727
+ class: "bio-properties-panel-group-header",
1728
+ children: jsx("p", {
1729
+ class: "bio-properties-panel-label",
1730
+ children: jsx(TooltipWrapper, {
1731
+ value: tooltip,
1732
+ forId: id,
1733
+ element: element,
1734
+ children: label
1735
+ })
1736
+ })
1737
+ }), jsx("div", {
1738
+ class: "bio-properties-panel-checkbox-group-entries",
1739
+ children: options.map(option => jsx(CheckboxEntry, {
1740
+ id: `${id}-${option.value}`,
1741
+ label: option.label,
1742
+ setValue: checked => handleOptionChange(option.value, checked),
1743
+ getValue: () => value.includes(option.value),
1744
+ disabled: disabled,
1745
+ onFocus: onFocus,
1746
+ onBlur: onBlur,
1747
+ element: element
1748
+ }, option.value))
1749
+ }), jsx(Description, {
1750
+ forId: id,
1751
+ element: element,
1752
+ value: description
1753
+ })]
1754
+ });
1755
+ }
1756
+
1690
1757
  /**
1691
1758
  * Button to open popups.
1692
1759
  *
@@ -2340,7 +2407,6 @@ function FeelTextfield(props) {
2340
2407
  const [localValue, setLocalValue] = useState(value);
2341
2408
  const editorRef = useShowEntryEvent(id);
2342
2409
  const containerRef = useRef();
2343
- const isTogglingFromPasteRef = useRef(false);
2344
2410
  const onInput = useCallback(newValue => {
2345
2411
  // we don't commit empty FEEL expressions,
2346
2412
  // but instead serialize them as <undefined>
@@ -2383,6 +2449,9 @@ function FeelTextfield(props) {
2383
2449
  if (feelActive) {
2384
2450
  newValue = '=' + newValue;
2385
2451
  }
2452
+ if (newValue === localValue) {
2453
+ return;
2454
+ }
2386
2455
  setLocalValue(newValue);
2387
2456
  if (useDebounce) {
2388
2457
  handleInput(newValue);
@@ -2395,11 +2464,6 @@ function FeelTextfield(props) {
2395
2464
  }
2396
2465
  };
2397
2466
  const handleOnBlur = e => {
2398
- // Ignore blur when toggling from paste to avoid interference
2399
- if (isTogglingFromPasteRef.current) {
2400
- isTogglingFromPasteRef.current = false;
2401
- return;
2402
- }
2403
2467
  handleInput.cancel?.();
2404
2468
  if (e.target.type === 'checkbox') {
2405
2469
  onInput(e.target.checked);
@@ -2499,7 +2563,6 @@ function FeelTextfield(props) {
2499
2563
  setLocalValue(trimmedValue);
2500
2564
  handleInput(trimmedValue);
2501
2565
  if (!feelActive && isString(trimmedValue) && trimmedValue.startsWith('=')) {
2502
- isTogglingFromPasteRef.current = true;
2503
2566
  setFocus(trimmedValue.length - 1);
2504
2567
  }
2505
2568
  event.preventDefault();
@@ -4696,5 +4759,5 @@ var index = {
4696
4759
  feelPopupRenderer: ['type', FeelPopupRenderer]
4697
4760
  };
4698
4761
 
4699
- export { ArrowIcon, CheckboxEntry, CloseIcon, CollapsibleEntry, CreateIcon, index$1 as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DragIcon, DropdownButton, ErrorsContext, EventContext, ExternalLinkIcon, FeelCheckboxEntry, FeelEntry, FeelIcon$1 as FeelIcon, FeelLanguageContext, FeelNumberEntry, index as FeelPopupModule, FeelTemplatingEntry, FeelTextAreaEntry, FeelToggleSwitchEntry, Group, Header, HeaderButton, LaunchIcon, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, OpenPopupIcon, Placeholder, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TemplatingEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, TooltipContext, TooltipWrapper as TooltipEntry, isEdited$8 as isCheckboxEntryEdited, isEdited$5 as isFeelEntryEdited, isEdited$6 as isNumberFieldEntryEdited, isEdited$3 as isSelectEntryEdited, isEdited$2 as isSimpleEntryEdited, isEdited$4 as isTemplatingEntryEdited, isEdited$1 as isTextAreaEntryEdited, isEdited as isTextFieldEntryEdited, isEdited$7 as isToggleSwitchEntryEdited, useDebounce, useDescriptionContext, useElementVisible, useError, useErrors, useEvent, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver, useTooltipContext };
4762
+ export { ArrowIcon, CheckboxEntry, CheckboxGroup, CloseIcon, CollapsibleEntry, CreateIcon, index$1 as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DragIcon, DropdownButton, ErrorsContext, EventContext, ExternalLinkIcon, FeelCheckboxEntry, FeelEntry, FeelIcon$1 as FeelIcon, FeelLanguageContext, FeelNumberEntry, index as FeelPopupModule, FeelTemplatingEntry, FeelTextAreaEntry, FeelToggleSwitchEntry, Group, Header, HeaderButton, LaunchIcon, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, OpenPopupIcon, Placeholder, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TemplatingEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, TooltipContext, TooltipWrapper as TooltipEntry, isEdited$8 as isCheckboxEntryEdited, isEdited$5 as isFeelEntryEdited, isEdited$6 as isNumberFieldEntryEdited, isEdited$3 as isSelectEntryEdited, isEdited$2 as isSimpleEntryEdited, isEdited$4 as isTemplatingEntryEdited, isEdited$1 as isTextAreaEntryEdited, isEdited as isTextFieldEntryEdited, isEdited$7 as isToggleSwitchEntryEdited, useDebounce, useDescriptionContext, useElementVisible, useError, useErrors, useEvent, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver, useTooltipContext };
4700
4763
  //# sourceMappingURL=index.esm.js.map