@bpmn-io/properties-panel 3.20.0 → 3.21.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.
@@ -1334,6 +1334,31 @@ textarea.bio-properties-panel-input {
1334
1334
  text-transform: capitalize;
1335
1335
  }
1336
1336
 
1337
+ .bio-properties-panel-popup .bio-properties-panel-popup__close {
1338
+ margin: -12px;
1339
+ margin-left: 12px;
1340
+ width: 40px;
1341
+ height: 40px;
1342
+ border: none;
1343
+ background-color: var(--popup-header-background-color);
1344
+ }
1345
+
1346
+ .bio-properties-panel-popup .bio-properties-panel-popup__close:hover,
1347
+ .bio-properties-panel-popup .bio-properties-panel-popup__close:focus-visible {
1348
+ background-color: var(--popup-background-color);
1349
+ }
1350
+
1351
+ .bio-properties-panel-popup .bio-properties-panel-popup__close:focus-visible {
1352
+ outline-offset: -2px;
1353
+ }
1354
+
1355
+ .bio-properties-panel-popup .bio-properties-panel-popup__close svg {
1356
+ width: 16px;
1357
+ height: 16px;
1358
+ fill: currentColor;
1359
+ margin-top: 2px;
1360
+ }
1361
+
1337
1362
  .bio-properties-panel-popup .bio-properties-panel-popup__header .bio-properties-panel-popup__drag-handle svg {
1338
1363
  margin-left: -4px;
1339
1364
  }
package/dist/index.esm.js CHANGED
@@ -152,6 +152,21 @@ PopupIcon.defaultProps = {
152
152
  height: "16",
153
153
  viewBox: "0 0 32 32"
154
154
  };
155
+ var CloseIcon = function CloseIcon(props) {
156
+ return jsx("svg", {
157
+ ...props,
158
+ children: jsx("path", {
159
+ fillRule: "evenodd",
160
+ d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
161
+ fill: "currentColor"
162
+ })
163
+ });
164
+ };
165
+ CloseIcon.defaultProps = {
166
+ xmlns: "http://www.w3.org/2000/svg",
167
+ width: "16",
168
+ height: "16"
169
+ };
155
170
 
156
171
  function Header(props) {
157
172
  const {
@@ -896,7 +911,8 @@ const CodeEditor$1 = forwardRef((props, ref) => {
896
911
  tooltipContainer,
897
912
  enableGutters,
898
913
  hostLanguage,
899
- singleLine
914
+ singleLine,
915
+ lineWrap: true
900
916
  });
901
917
  setEditor(editor);
902
918
  return () => {
@@ -933,7 +949,7 @@ const CodeEditor$1 = forwardRef((props, ref) => {
933
949
  title: "Open pop-up editor",
934
950
  class: "bio-properties-panel-open-feel-popup",
935
951
  onClick: () => onPopupOpen('feelers'),
936
- children: jsx(ExternalLinkIcon, {})
952
+ children: jsx(PopupIcon, {})
937
953
  })]
938
954
  });
939
955
  });
@@ -1303,6 +1319,9 @@ function Title(props) {
1303
1319
  draggable,
1304
1320
  emit = () => {},
1305
1321
  title,
1322
+ showCloseButton = false,
1323
+ closeButtonTooltip = 'Close popup',
1324
+ onClose,
1306
1325
  ...rest
1307
1326
  } = props;
1308
1327
 
@@ -1373,7 +1392,12 @@ function Title(props) {
1373
1392
  }), jsx("div", {
1374
1393
  class: "bio-properties-panel-popup__title",
1375
1394
  children: title
1376
- }), children]
1395
+ }), children, showCloseButton && jsx("button", {
1396
+ title: closeButtonTooltip,
1397
+ class: "bio-properties-panel-popup__close",
1398
+ onClick: onClose,
1399
+ children: jsx(CloseIcon, {})
1400
+ })]
1377
1401
  });
1378
1402
  }
1379
1403
  function Body(props) {
@@ -1591,6 +1615,9 @@ function FeelPopupComponent(props) {
1591
1615
  children: [jsxs(Popup.Title, {
1592
1616
  title: title,
1593
1617
  emit: emit,
1618
+ showCloseButton: true,
1619
+ closeButtonTooltip: "Save and close",
1620
+ onClose: onClose,
1594
1621
  draggable: true,
1595
1622
  children: [type === 'feel' && jsxs("a", {
1596
1623
  href: "https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/",
@@ -1632,14 +1659,6 @@ function FeelPopupComponent(props) {
1632
1659
  tooltipContainer: tooltipContainer
1633
1660
  })]
1634
1661
  })
1635
- }), jsx(Popup.Footer, {
1636
- children: jsx("button", {
1637
- type: "button",
1638
- onClick: () => onClose(),
1639
- title: "Close pop-up editor",
1640
- class: "bio-properties-panel-feel-popup__close-btn",
1641
- children: "Close"
1642
- })
1643
1662
  })]
1644
1663
  });
1645
1664
  }
@@ -3029,6 +3048,28 @@ function HeaderButton(props) {
3029
3048
  });
3030
3049
  }
3031
3050
 
3051
+ /**
3052
+ * @typedef { {
3053
+ * [key: string]: string;
3054
+ * } } TranslateReplacements
3055
+ */
3056
+
3057
+ /**
3058
+ * A simple translation stub to be used for multi-language support.
3059
+ * Can be easily replaced with a more sophisticated solution.
3060
+ *
3061
+ * @param {string} template to interpolate
3062
+ * @param {TranslateReplacements} [replacements] a map with substitutes
3063
+ *
3064
+ * @return {string} the translated string
3065
+ */
3066
+ function translateFallback(template, replacements) {
3067
+ replacements = replacements || {};
3068
+ return template.replace(/{([^}]+)}/g, function (_, key) {
3069
+ return replacements[key] || '{' + key + '}';
3070
+ });
3071
+ }
3072
+
3032
3073
  function CollapsibleEntry(props) {
3033
3074
  const {
3034
3075
  element,
@@ -3036,7 +3077,8 @@ function CollapsibleEntry(props) {
3036
3077
  id,
3037
3078
  label,
3038
3079
  open: shouldOpen,
3039
- remove
3080
+ remove,
3081
+ translate = translateFallback
3040
3082
  } = props;
3041
3083
  const [open, setOpen] = useState(shouldOpen);
3042
3084
  const toggleOpen = () => setOpen(!open);
@@ -3052,9 +3094,7 @@ function CollapsibleEntry(props) {
3052
3094
  }
3053
3095
  }, [onShow, setOpen])
3054
3096
  };
3055
-
3056
- // todo(pinussilvestrus): translate once we have a translate mechanism for the core
3057
- const placeholderLabel = '<empty>';
3097
+ const placeholderLabel = translate('<empty>');
3058
3098
  return jsxs("div", {
3059
3099
  "data-entry-id": id,
3060
3100
  class: classnames('bio-properties-panel-collapsible-entry', open ? 'open' : ''),
@@ -3067,14 +3107,14 @@ function CollapsibleEntry(props) {
3067
3107
  children: label || placeholderLabel
3068
3108
  }), jsx("button", {
3069
3109
  type: "button",
3070
- title: "Toggle list item",
3110
+ title: translate('Toggle list item'),
3071
3111
  class: "bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",
3072
3112
  children: jsx(ArrowIcon, {
3073
3113
  class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
3074
3114
  })
3075
3115
  }), remove ? jsx("button", {
3076
3116
  type: "button",
3077
- title: "Delete item",
3117
+ title: translate('Delete item'),
3078
3118
  class: "bio-properties-panel-remove-entry",
3079
3119
  onClick: remove,
3080
3120
  children: jsx(DeleteIcon, {})
@@ -3102,7 +3142,8 @@ function CollapsibleEntry(props) {
3102
3142
  function ListItem(props) {
3103
3143
  const {
3104
3144
  autoFocusEntry,
3105
- autoOpen
3145
+ autoOpen,
3146
+ translate = translateFallback
3106
3147
  } = props;
3107
3148
 
3108
3149
  // focus specified entry on auto open
@@ -3124,7 +3165,8 @@ function ListItem(props) {
3124
3165
  class: "bio-properties-panel-list-item",
3125
3166
  children: jsx(CollapsibleEntry, {
3126
3167
  ...props,
3127
- open: autoOpen
3168
+ open: autoOpen,
3169
+ translate: translate
3128
3170
  })
3129
3171
  });
3130
3172
  }
@@ -3141,7 +3183,8 @@ function ListGroup(props) {
3141
3183
  id,
3142
3184
  items,
3143
3185
  label,
3144
- shouldOpen = true
3186
+ shouldOpen = true,
3187
+ translate = translateFallback
3145
3188
  } = props;
3146
3189
  useEffect(() => {
3147
3190
  if (props.shouldSort != undefined) {
@@ -3243,20 +3286,22 @@ function ListGroup(props) {
3243
3286
  class: "bio-properties-panel-group-header-buttons",
3244
3287
  children: [add ? jsxs("button", {
3245
3288
  type: "button",
3246
- title: "Create new list item",
3289
+ title: translate('Create new list item'),
3247
3290
  class: "bio-properties-panel-group-header-button bio-properties-panel-add-entry",
3248
3291
  onClick: handleAddClick,
3249
3292
  children: [jsx(CreateIcon, {}), !hasItems ? jsx("span", {
3250
3293
  class: "bio-properties-panel-add-entry-label",
3251
- children: "Create"
3294
+ children: translate('Create')
3252
3295
  }) : null]
3253
3296
  }) : null, hasItems ? jsx("div", {
3254
- title: `List contains ${items.length} item${items.length != 1 ? 's' : ''}`,
3297
+ title: translate(`List contains {numOfItems} item${items.length != 1 ? 's' : ''}`, {
3298
+ numOfItems: items.length
3299
+ }),
3255
3300
  class: classnames('bio-properties-panel-list-badge', hasError ? 'bio-properties-panel-list-badge--error' : ''),
3256
3301
  children: items.length
3257
3302
  }) : null, hasItems ? jsx("button", {
3258
3303
  type: "button",
3259
- title: "Toggle section",
3304
+ title: translate('Toggle section'),
3260
3305
  class: "bio-properties-panel-group-header-button bio-properties-panel-arrow",
3261
3306
  children: jsx(ArrowIcon, {
3262
3307
  class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
@@ -3283,7 +3328,8 @@ function ListGroup(props) {
3283
3328
  autoOpen: autoOpen,
3284
3329
  element: element,
3285
3330
  index: index,
3286
- key: id
3331
+ key: id,
3332
+ translate: translate
3287
3333
  });
3288
3334
  })
3289
3335
  })
@@ -4286,5 +4332,5 @@ var index = {
4286
4332
  feelPopup: ['type', FeelPopupModule]
4287
4333
  };
4288
4334
 
4289
- export { ArrowIcon, CheckboxEntry, CollapsibleEntry, CreateIcon, index$1 as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DragIcon, DropdownButton, ErrorsContext, EventContext, ExternalLinkIcon, FeelCheckboxEntry, FeelEntry, FeelIcon$1 as FeelIcon, FeelNumberEntry, index as FeelPopupModule, FeelTemplatingEntry, FeelTextAreaEntry, FeelToggleSwitchEntry, Group, Header, HeaderButton, HelpIcon, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, Placeholder, Popup, PopupIcon, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TemplatingEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, TooltipContext, TooltipWrapper as TooltipEntry, isEdited$5 as isCheckboxEntryEdited, isEdited$6 as isFeelEntryEdited, isEdited$7 as isNumberFieldEntryEdited, isEdited$3 as isSelectEntryEdited, isEdited$2 as isSimpleEntryEdited, isEdited$4 as isTemplatingEntryEdited, isEdited$1 as isTextAreaEntryEdited, isEdited as isTextFieldEntryEdited, isEdited$8 as isToggleSwitchEntryEdited, useDescriptionContext, useError, useErrors, useEvent, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver, useTooltipContext };
4335
+ 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, FeelNumberEntry, index as FeelPopupModule, FeelTemplatingEntry, FeelTextAreaEntry, FeelToggleSwitchEntry, Group, Header, HeaderButton, HelpIcon, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, Placeholder, Popup, PopupIcon, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TemplatingEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, TooltipContext, TooltipWrapper as TooltipEntry, isEdited$5 as isCheckboxEntryEdited, isEdited$6 as isFeelEntryEdited, isEdited$7 as isNumberFieldEntryEdited, isEdited$3 as isSelectEntryEdited, isEdited$2 as isSimpleEntryEdited, isEdited$4 as isTemplatingEntryEdited, isEdited$1 as isTextAreaEntryEdited, isEdited as isTextFieldEntryEdited, isEdited$8 as isToggleSwitchEntryEdited, useDescriptionContext, useError, useErrors, useEvent, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver, useTooltipContext };
4290
4336
  //# sourceMappingURL=index.esm.js.map