@elementor/editor-ui 3.33.0-99 → 3.34.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
@@ -32,6 +32,8 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  EditableField: () => EditableField,
34
34
  EllipsisWithTooltip: () => EllipsisWithTooltip,
35
+ Form: () => Form,
36
+ GlobalDialog: () => GlobalDialog,
35
37
  ITEM_HEIGHT: () => ITEM_HEIGHT,
36
38
  InfoAlert: () => InfoAlert,
37
39
  InfoTipCard: () => InfoTipCard,
@@ -41,10 +43,14 @@ __export(index_exports, {
41
43
  PopoverBody: () => PopoverBody,
42
44
  PopoverHeader: () => PopoverHeader,
43
45
  PopoverMenuList: () => PopoverMenuList,
44
- PopoverSearch: () => PopoverSearch,
46
+ SaveChangesDialog: () => SaveChangesDialog,
47
+ SearchField: () => SearchField,
45
48
  StyledMenuList: () => StyledMenuList,
46
49
  ThemeProvider: () => ThemeProvider,
47
50
  WarningInfotip: () => WarningInfotip,
51
+ closeDialog: () => closeDialog,
52
+ openDialog: () => openDialog,
53
+ useDialog: () => useDialog,
48
54
  useEditable: () => useEditable
49
55
  });
50
56
  module.exports = __toCommonJS(index_exports);
@@ -208,7 +214,12 @@ var InfoAlert = (props) => /* @__PURE__ */ React5.createElement(
208
214
  );
209
215
 
210
216
  // src/components/menu-item.tsx
211
- var MenuListItem = ({ children, ...props }) => {
217
+ var MenuListItem = ({
218
+ children,
219
+ menuItemTextProps,
220
+ primaryTypographyProps = { variant: "caption" },
221
+ ...props
222
+ }) => {
212
223
  return /* @__PURE__ */ React6.createElement(
213
224
  import_ui6.MenuItem,
214
225
  {
@@ -222,9 +233,8 @@ var MenuListItem = ({ children, ...props }) => {
222
233
  import_ui6.MenuItemText,
223
234
  {
224
235
  primary: children,
225
- primaryTypographyProps: {
226
- variant: "caption"
227
- }
236
+ primaryTypographyProps,
237
+ ...menuItemTextProps
228
238
  }
229
239
  )
230
240
  );
@@ -269,7 +279,7 @@ var import_react6 = require("react");
269
279
  var React8 = __toESM(require("react"));
270
280
  var import_ui8 = require("@elementor/ui");
271
281
  var WarningInfotip = (0, import_react6.forwardRef)(
272
- ({ children, open, title, text, placement, width, offset }, ref) => {
282
+ ({ children, open, title, text, placement, width, offset, hasError = true }, ref) => {
273
283
  return /* @__PURE__ */ React8.createElement(
274
284
  import_ui8.Infotip,
275
285
  {
@@ -284,22 +294,129 @@ var WarningInfotip = (0, import_react6.forwardRef)(
284
294
  modifiers: offset ? [{ name: "offset", options: { offset } }] : []
285
295
  },
286
296
  arrow: false,
287
- content: /* @__PURE__ */ React8.createElement(import_ui8.Alert, { color: "error", severity: "warning", variant: "standard", size: "small" }, title ? /* @__PURE__ */ React8.createElement(import_ui8.AlertTitle, null, title) : null, text)
297
+ content: /* @__PURE__ */ React8.createElement(
298
+ import_ui8.Alert,
299
+ {
300
+ color: hasError ? "error" : "secondary",
301
+ severity: "warning",
302
+ variant: "standard",
303
+ size: "small"
304
+ },
305
+ title ? /* @__PURE__ */ React8.createElement(import_ui8.AlertTitle, null, title) : null,
306
+ text
307
+ )
288
308
  },
289
309
  children
290
310
  );
291
311
  }
292
312
  );
293
313
 
294
- // src/components/popover/body.tsx
314
+ // src/components/global-dialog/components/global-dialog.tsx
315
+ var import_react7 = require("react");
295
316
  var React9 = __toESM(require("react"));
296
317
  var import_ui9 = require("@elementor/ui");
318
+
319
+ // src/components/global-dialog/subscribers.ts
320
+ var currentDialogState = null;
321
+ var stateSubscribers = /* @__PURE__ */ new Set();
322
+ var subscribeToDialogState = (callback) => {
323
+ stateSubscribers.add(callback);
324
+ callback(currentDialogState);
325
+ return () => stateSubscribers.delete(callback);
326
+ };
327
+ var notifySubscribers = () => {
328
+ stateSubscribers.forEach((callback) => callback(currentDialogState));
329
+ };
330
+ var openDialog = ({ component }) => {
331
+ currentDialogState = { component };
332
+ notifySubscribers();
333
+ };
334
+ var closeDialog = () => {
335
+ currentDialogState = null;
336
+ notifySubscribers();
337
+ };
338
+
339
+ // src/components/global-dialog/components/global-dialog.tsx
340
+ var GlobalDialog = () => {
341
+ const [content, setContent] = (0, import_react7.useState)(null);
342
+ (0, import_react7.useEffect)(() => {
343
+ const unsubscribe = subscribeToDialogState(setContent);
344
+ return () => {
345
+ unsubscribe();
346
+ };
347
+ }, []);
348
+ if (!content) {
349
+ return null;
350
+ }
351
+ return /* @__PURE__ */ React9.createElement(ThemeProvider, null, /* @__PURE__ */ React9.createElement(import_ui9.Dialog, { role: "dialog", open: true, onClose: closeDialog, maxWidth: "sm", fullWidth: true }, content.component));
352
+ };
353
+
354
+ // src/components/search-field.tsx
355
+ var React10 = __toESM(require("react"));
356
+ var import_react8 = require("react");
357
+ var import_icons2 = require("@elementor/icons");
358
+ var import_ui10 = require("@elementor/ui");
359
+ var import_i18n2 = require("@wordpress/i18n");
360
+ var SIZE = "tiny";
361
+ var SearchField = ({ value, onSearch, placeholder, id, sx }) => {
362
+ const inputRef = (0, import_react8.useRef)(null);
363
+ const handleClear = () => {
364
+ onSearch("");
365
+ inputRef.current?.focus();
366
+ };
367
+ const handleInputChange = (event) => {
368
+ onSearch(event.target.value);
369
+ };
370
+ return /* @__PURE__ */ React10.createElement(import_ui10.Box, { sx: { px: 2, pb: 1.5, ...sx } }, /* @__PURE__ */ React10.createElement(
371
+ import_ui10.TextField,
372
+ {
373
+ autoFocus: true,
374
+ fullWidth: true,
375
+ id,
376
+ size: SIZE,
377
+ value,
378
+ inputRef,
379
+ onChange: handleInputChange,
380
+ placeholder,
381
+ InputProps: {
382
+ startAdornment: /* @__PURE__ */ React10.createElement(import_ui10.InputAdornment, { position: "start" }, /* @__PURE__ */ React10.createElement(import_icons2.SearchIcon, { fontSize: SIZE })),
383
+ endAdornment: value && /* @__PURE__ */ React10.createElement(import_ui10.IconButton, { size: SIZE, onClick: handleClear, "aria-label": (0, import_i18n2.__)("Clear", "elementor") }, /* @__PURE__ */ React10.createElement(import_icons2.XIcon, { color: "action", fontSize: SIZE }))
384
+ }
385
+ }
386
+ ));
387
+ };
388
+
389
+ // src/components/form.tsx
390
+ var React11 = __toESM(require("react"));
391
+ var import_react9 = require("react");
392
+ var Form = ({ children, onSubmit }) => {
393
+ const formRef = (0, import_react9.useRef)(null);
394
+ const handleSubmit = (e) => {
395
+ e.preventDefault();
396
+ onSubmit?.();
397
+ };
398
+ const handleKeyDown = (e) => {
399
+ const { target } = e;
400
+ if (e.key === "Enter" && target instanceof HTMLInputElement && target.type !== "submit") {
401
+ e.preventDefault();
402
+ formRef.current?.requestSubmit();
403
+ }
404
+ };
405
+ return (
406
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
407
+ /* @__PURE__ */ React11.createElement("form", { onSubmit: handleSubmit, ref: formRef, onKeyDown: handleKeyDown }, children)
408
+ );
409
+ };
410
+
411
+ // src/components/popover/body.tsx
412
+ var React12 = __toESM(require("react"));
413
+ var import_ui11 = require("@elementor/ui");
297
414
  var SECTION_PADDING_INLINE = 32;
298
415
  var DEFAULT_POPOVER_HEIGHT = 348;
299
416
  var FALLBACK_POPOVER_WIDTH = 220;
300
- var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width }) => {
301
- return /* @__PURE__ */ React9.createElement(
302
- import_ui9.Box,
417
+ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
418
+ return /* @__PURE__ */ React12.createElement(
419
+ import_ui11.Box,
303
420
  {
304
421
  display: "flex",
305
422
  flexDirection: "column",
@@ -308,16 +425,17 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width }) => {
308
425
  overflow: "hidden",
309
426
  width: `${width ? width - SECTION_PADDING_INLINE : FALLBACK_POPOVER_WIDTH}px`,
310
427
  maxWidth: 496
311
- }
428
+ },
429
+ id
312
430
  },
313
431
  children
314
432
  );
315
433
  };
316
434
 
317
435
  // src/components/popover/header.tsx
318
- var React10 = __toESM(require("react"));
319
- var import_ui10 = require("@elementor/ui");
320
- var SIZE = "tiny";
436
+ var React13 = __toESM(require("react"));
437
+ var import_ui12 = require("@elementor/ui");
438
+ var SIZE2 = "tiny";
321
439
  var PopoverHeader = ({ title, onClose, icon, actions }) => {
322
440
  const paddingAndSizing = {
323
441
  pl: 2,
@@ -325,23 +443,23 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
325
443
  py: 1.5,
326
444
  maxHeight: 36
327
445
  };
328
- return /* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React10.createElement(import_ui10.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React10.createElement(import_ui10.CloseButton, { slotProps: { icon: { fontSize: SIZE } }, sx: { ml: "auto" }, onClick: onClose })));
446
+ return /* @__PURE__ */ React13.createElement(import_ui12.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React13.createElement(import_ui12.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React13.createElement(import_ui12.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React13.createElement(import_ui12.CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
329
447
  };
330
448
 
331
449
  // src/components/popover/menu-list.tsx
332
- var React11 = __toESM(require("react"));
333
- var import_react9 = require("react");
334
- var import_ui11 = require("@elementor/ui");
450
+ var React14 = __toESM(require("react"));
451
+ var import_react12 = require("react");
452
+ var import_ui13 = require("@elementor/ui");
335
453
  var import_react_virtual = require("@tanstack/react-virtual");
336
454
 
337
455
  // src/hooks/use-scroll-to-selected.ts
338
- var import_react7 = require("react");
456
+ var import_react10 = require("react");
339
457
  var useScrollToSelected = ({
340
458
  selectedValue,
341
459
  items,
342
460
  virtualizer
343
461
  }) => {
344
- (0, import_react7.useEffect)(() => {
462
+ (0, import_react10.useEffect)(() => {
345
463
  if (!selectedValue || items.length === 0) {
346
464
  return;
347
465
  }
@@ -353,10 +471,10 @@ var useScrollToSelected = ({
353
471
  };
354
472
 
355
473
  // src/hooks/use-scroll-top.ts
356
- var import_react8 = require("react");
474
+ var import_react11 = require("react");
357
475
  var useScrollTop = ({ containerRef }) => {
358
- const [scrollTop, setScrollTop] = (0, import_react8.useState)(0);
359
- (0, import_react8.useEffect)(() => {
476
+ const [scrollTop, setScrollTop] = (0, import_react11.useState)(0);
477
+ (0, import_react11.useEffect)(() => {
360
478
  const container = containerRef.current;
361
479
  if (!container) {
362
480
  return;
@@ -395,10 +513,10 @@ var PopoverMenuList = ({
395
513
  noResultsComponent,
396
514
  menuListTemplate: CustomMenuList
397
515
  }) => {
398
- const containerRef = (0, import_react9.useRef)(null);
516
+ const containerRef = (0, import_react12.useRef)(null);
399
517
  const scrollTop = useScrollTop({ containerRef });
400
518
  const MenuListComponent = CustomMenuList || StyledMenuList;
401
- const stickyIndices = (0, import_react9.useMemo)(
519
+ const stickyIndices = (0, import_react12.useMemo)(
402
520
  () => items.reduce((categoryIndices, item, index) => {
403
521
  if (item.type === "category") {
404
522
  categoryIndices.push(index);
@@ -429,14 +547,15 @@ var PopoverMenuList = ({
429
547
  onChange
430
548
  });
431
549
  useScrollToSelected({ selectedValue, items, virtualizer });
432
- return /* @__PURE__ */ React11.createElement(import_ui11.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React11.createElement(
550
+ const virtualItems = virtualizer.getVirtualItems();
551
+ return /* @__PURE__ */ React14.createElement(import_ui13.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React14.createElement(
433
552
  MenuListComponent,
434
553
  {
435
554
  role: "listbox",
436
555
  style: { height: `${virtualizer.getTotalSize()}px` },
437
556
  "data-testid": dataTestId
438
557
  },
439
- virtualizer.getVirtualItems().map((virtualRow) => {
558
+ virtualItems.map((virtualRow) => {
440
559
  const item = items[virtualRow.index];
441
560
  const isLast = virtualRow.index === items.length - 1;
442
561
  const isFirst = items[0]?.type === "category" ? virtualRow.index === 1 : virtualRow.index === 0;
@@ -447,8 +566,8 @@ var PopoverMenuList = ({
447
566
  }
448
567
  if (item.type === "category") {
449
568
  const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
450
- return /* @__PURE__ */ React11.createElement(
451
- import_ui11.MenuSubheader,
569
+ return /* @__PURE__ */ React14.createElement(
570
+ import_ui13.MenuSubheader,
452
571
  {
453
572
  key: virtualRow.key,
454
573
  style: shouldStick ? {} : menuSubHeaderAbsoluteStyling(virtualRow.start),
@@ -457,13 +576,15 @@ var PopoverMenuList = ({
457
576
  item.label || item.value
458
577
  );
459
578
  }
460
- return /* @__PURE__ */ React11.createElement(
461
- "li",
579
+ const isDisabled = item.disabled;
580
+ return /* @__PURE__ */ React14.createElement(
581
+ import_ui13.ListItem,
462
582
  {
463
583
  key: virtualRow.key,
464
584
  role: "option",
465
585
  "aria-selected": isSelected,
466
- onClick: (e) => {
586
+ "aria-disabled": isDisabled,
587
+ onClick: isDisabled ? void 0 : (e) => {
467
588
  if (e.target.closest("button")) {
468
589
  return;
469
590
  }
@@ -471,7 +592,7 @@ var PopoverMenuList = ({
471
592
  onClose();
472
593
  },
473
594
  onKeyDown: (event) => {
474
- if (event.key === "Enter") {
595
+ if (event.key === "Enter" && !isDisabled) {
475
596
  onSelect(item.value);
476
597
  onClose();
477
598
  }
@@ -485,7 +606,7 @@ var PopoverMenuList = ({
485
606
  }
486
607
  },
487
608
  tabIndex: isSelected ? 0 : tabIndexFallback,
488
- style: {
609
+ sx: {
489
610
  transform: `translateY(${virtualRow.start + MENU_LIST_PADDING_TOP}px)`,
490
611
  ...itemStyle ? itemStyle(item) : {}
491
612
  }
@@ -495,7 +616,7 @@ var PopoverMenuList = ({
495
616
  })
496
617
  ));
497
618
  };
498
- var StyledMenuList = (0, import_ui11.styled)(import_ui11.MenuList)(({ theme }) => ({
619
+ var StyledMenuList = (0, import_ui13.styled)(import_ui13.MenuList)(({ theme }) => ({
499
620
  "& > li": {
500
621
  height: ITEM_HEIGHT,
501
622
  width: "100%",
@@ -512,6 +633,9 @@ var StyledMenuList = (0, import_ui11.styled)(import_ui11.MenuList)(({ theme }) =
512
633
  '&[aria-selected="true"]': {
513
634
  backgroundColor: theme.palette.action.selected
514
635
  },
636
+ '&[aria-disabled="true"]': {
637
+ color: theme.palette.text.disabled
638
+ },
515
639
  cursor: "pointer",
516
640
  textOverflow: "ellipsis",
517
641
  position: "absolute",
@@ -522,58 +646,66 @@ var StyledMenuList = (0, import_ui11.styled)(import_ui11.MenuList)(({ theme }) =
522
646
  position: "relative"
523
647
  }));
524
648
 
525
- // src/components/popover/search.tsx
526
- var React12 = __toESM(require("react"));
527
- var import_react10 = require("react");
528
- var import_icons2 = require("@elementor/icons");
529
- var import_ui12 = require("@elementor/ui");
530
- var import_i18n2 = require("@wordpress/i18n");
531
- var SIZE2 = "tiny";
532
- var PopoverSearch = ({ value, onSearch, placeholder }) => {
533
- const inputRef = (0, import_react10.useRef)(null);
534
- const handleClear = () => {
535
- onSearch("");
536
- inputRef.current?.focus();
537
- };
538
- const handleInputChange = (event) => {
539
- onSearch(event.target.value);
649
+ // src/components/save-changes-dialog.tsx
650
+ var React15 = __toESM(require("react"));
651
+ var import_react13 = require("react");
652
+ var import_icons3 = require("@elementor/icons");
653
+ var import_ui14 = require("@elementor/ui");
654
+ var TITLE_ID = "save-changes-dialog";
655
+ var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React15.createElement(import_ui14.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
656
+ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React15.createElement(
657
+ import_ui14.DialogTitle,
658
+ {
659
+ id: TITLE_ID,
660
+ display: "flex",
661
+ alignItems: "center",
662
+ gap: 1,
663
+ sx: { lineHeight: 1, justifyContent: "space-between" }
664
+ },
665
+ /* @__PURE__ */ React15.createElement(import_ui14.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React15.createElement(import_icons3.AlertTriangleFilledIcon, { color: "secondary" }), children),
666
+ onClose && /* @__PURE__ */ React15.createElement(import_ui14.IconButton, { onClick: onClose, size: "small" }, /* @__PURE__ */ React15.createElement(import_icons3.XIcon, null))
667
+ );
668
+ var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React15.createElement(import_ui14.DialogContent, null, children);
669
+ var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React15.createElement(import_ui14.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
670
+ var SaveChangesDialogActions = ({ actions }) => {
671
+ const [isConfirming, setIsConfirming] = (0, import_react13.useState)(false);
672
+ const { cancel, confirm, discard } = actions;
673
+ const onConfirm = async () => {
674
+ setIsConfirming(true);
675
+ await confirm.action();
676
+ setIsConfirming(false);
540
677
  };
541
- return /* @__PURE__ */ React12.createElement(import_ui12.Box, { sx: { px: 2, pb: 1.5 } }, /* @__PURE__ */ React12.createElement(
542
- import_ui12.TextField,
543
- {
544
- autoFocus: true,
545
- fullWidth: true,
546
- size: SIZE2,
547
- value,
548
- inputRef,
549
- onChange: handleInputChange,
550
- placeholder,
551
- InputProps: {
552
- startAdornment: /* @__PURE__ */ React12.createElement(import_ui12.InputAdornment, { position: "start" }, /* @__PURE__ */ React12.createElement(import_icons2.SearchIcon, { fontSize: SIZE2 })),
553
- endAdornment: value && /* @__PURE__ */ React12.createElement(import_ui12.IconButton, { size: SIZE2, onClick: handleClear, "aria-label": (0, import_i18n2.__)("Clear", "elementor") }, /* @__PURE__ */ React12.createElement(import_icons2.XIcon, { color: "action", fontSize: SIZE2 }))
554
- }
555
- }
556
- ));
678
+ return /* @__PURE__ */ React15.createElement(import_ui14.DialogActions, null, cancel && /* @__PURE__ */ React15.createElement(import_ui14.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React15.createElement(import_ui14.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React15.createElement(import_ui14.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
679
+ };
680
+ SaveChangesDialog.Title = SaveChangesDialogTitle;
681
+ SaveChangesDialog.Content = SaveChangesDialogContent;
682
+ SaveChangesDialog.ContentText = SaveChangesDialogContentText;
683
+ SaveChangesDialog.Actions = SaveChangesDialogActions;
684
+ var useDialog = () => {
685
+ const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
686
+ const open = () => setIsOpen(true);
687
+ const close = () => setIsOpen(false);
688
+ return { isOpen, open, close };
557
689
  };
558
690
 
559
691
  // src/hooks/use-editable.ts
560
- var import_react11 = require("react");
692
+ var import_react14 = require("react");
561
693
  var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
562
- const [isEditing, setIsEditing] = (0, import_react11.useState)(false);
563
- const [error, setError] = (0, import_react11.useState)(null);
694
+ const [isEditing, setIsEditing] = (0, import_react14.useState)(false);
695
+ const [error, setError] = (0, import_react14.useState)(null);
564
696
  const ref = useSelection(isEditing);
565
697
  const isDirty = (newValue) => newValue !== value;
566
698
  const openEditMode = () => {
567
699
  setIsEditing(true);
568
700
  };
569
701
  const closeEditMode = () => {
570
- ref.current?.blur();
571
702
  setError(null);
572
703
  onError?.(null);
573
704
  setIsEditing(false);
574
705
  };
575
706
  const submit = (newValue) => {
576
707
  if (!isDirty(newValue)) {
708
+ closeEditMode();
577
709
  return;
578
710
  }
579
711
  if (!error) {
@@ -599,7 +731,9 @@ var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
599
731
  }
600
732
  if (["Enter"].includes(event.key)) {
601
733
  event.preventDefault();
602
- return submit(event.target.innerText);
734
+ if (!error) {
735
+ ref.current?.blur();
736
+ }
603
737
  }
604
738
  };
605
739
  const handleClick = (event) => {
@@ -608,11 +742,18 @@ var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
608
742
  }
609
743
  onClick?.(event);
610
744
  };
745
+ const handleBlur = () => {
746
+ if (error) {
747
+ closeEditMode();
748
+ return;
749
+ }
750
+ submit(ref.current.innerText);
751
+ };
611
752
  const listeners = {
612
753
  onClick: handleClick,
613
754
  onKeyDown: handleKeyDown,
614
755
  onInput: onChange,
615
- onBlur: closeEditMode
756
+ onBlur: handleBlur
616
757
  };
617
758
  const attributes = {
618
759
  value,
@@ -633,8 +774,8 @@ var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
633
774
  };
634
775
  };
635
776
  var useSelection = (isEditing) => {
636
- const ref = (0, import_react11.useRef)(null);
637
- (0, import_react11.useEffect)(() => {
777
+ const ref = (0, import_react14.useRef)(null);
778
+ (0, import_react14.useEffect)(() => {
638
779
  if (isEditing) {
639
780
  selectAll(ref.current);
640
781
  }
@@ -655,6 +796,8 @@ var selectAll = (el) => {
655
796
  0 && (module.exports = {
656
797
  EditableField,
657
798
  EllipsisWithTooltip,
799
+ Form,
800
+ GlobalDialog,
658
801
  ITEM_HEIGHT,
659
802
  InfoAlert,
660
803
  InfoTipCard,
@@ -664,10 +807,14 @@ var selectAll = (el) => {
664
807
  PopoverBody,
665
808
  PopoverHeader,
666
809
  PopoverMenuList,
667
- PopoverSearch,
810
+ SaveChangesDialog,
811
+ SearchField,
668
812
  StyledMenuList,
669
813
  ThemeProvider,
670
814
  WarningInfotip,
815
+ closeDialog,
816
+ openDialog,
817
+ useDialog,
671
818
  useEditable
672
819
  });
673
820
  //# sourceMappingURL=index.js.map