@zextras/carbonio-shell-ui 3.4.1 → 3.4.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.
Files changed (16) hide show
  1. package/dist/CHANGELOG.md +2 -0
  2. package/dist/PKGBUILD +7 -7
  3. package/dist/commit +1 -1
  4. package/dist/component.json +3 -3
  5. package/dist/index.html +1 -1
  6. package/dist/{src_boot_bootstrapper_tsx-node_modules_moment_locale_sync_recursive_.ce7f43a1.chunk.js → src_boot_bootstrapper_tsx-node_modules_moment_locale_sync_recursive_.529f12e8.chunk.js} +6 -6
  7. package/dist/{src_boot_bootstrapper_tsx-node_modules_moment_locale_sync_recursive_.ce7f43a1.chunk.js.map → src_boot_bootstrapper_tsx-node_modules_moment_locale_sync_recursive_.529f12e8.chunk.js.map} +1 -1
  8. package/dist/{src_workers_folder_ts.6cf5e29d.chunk.js → src_workers_folder_ts.d0a1da65.chunk.js} +2 -2
  9. package/dist/{src_workers_folder_ts.6cf5e29d.chunk.js.map → src_workers_folder_ts.d0a1da65.chunk.js.map} +1 -1
  10. package/dist/{style.2543faa6.css → style.c0f92a24.css} +29 -29
  11. package/dist/{style.2543faa6.css.map → style.c0f92a24.css.map} +1 -1
  12. package/dist/{vendors-node_modules_tinymce_skins_ui_oxide_skin_min_css-node_modules_reduxjs_toolkit_dist_re-3b2651.de183bda.chunk.js → vendors-node_modules_tinymce_skins_ui_oxide_skin_min_css-node_modules_reduxjs_toolkit_dist_re-3b2651.4d179dee.chunk.js} +275 -355
  13. package/dist/{vendors-node_modules_tinymce_skins_ui_oxide_skin_min_css-node_modules_reduxjs_toolkit_dist_re-3b2651.de183bda.chunk.js.map → vendors-node_modules_tinymce_skins_ui_oxide_skin_min_css-node_modules_reduxjs_toolkit_dist_re-3b2651.4d179dee.chunk.js.map} +1 -1
  14. package/dist/zapp-shell.bundle.js +2 -2
  15. package/dist/zapp-shell.bundle.js.map +1 -1
  16. package/package.json +2 -2
@@ -20655,27 +20655,6 @@ const Spinner = /*#__PURE__*/React__namespace.default.forwardRef(function Spinne
20655
20655
  }, rest));
20656
20656
  });
20657
20657
 
20658
- /**
20659
- * This method returns `undefined`.
20660
- *
20661
- * @static
20662
- * @memberOf _
20663
- * @since 2.3.0
20664
- * @category Util
20665
- * @example
20666
- *
20667
- * _.times(2, _.noop);
20668
- * // => [undefined, undefined]
20669
- */
20670
-
20671
- function noop$1() {
20672
- // No operation performed.
20673
- }
20674
-
20675
- var noop_1 = noop$1;
20676
-
20677
- var _noop = /*@__PURE__*/getDefaultExportFromCjs(noop_1);
20678
-
20679
20658
  /**
20680
20659
  * A specialized version of `_.forEach` for arrays without support for
20681
20660
  * iteratee shorthands.
@@ -20840,167 +20819,176 @@ var _map = /*@__PURE__*/getDefaultExportFromCjs(map_1);
20840
20819
 
20841
20820
  function getFocusableElement(focusedElement, direction) {
20842
20821
  const siblingElement = focusedElement[direction];
20843
- if (!(siblingElement instanceof HTMLElement)) {
20822
+ if (!siblingElement) {
20844
20823
  return null;
20845
20824
  }
20846
20825
  if (siblingElement.tabIndex >= 0) {
20847
- return siblingElement;
20826
+ return focusedElement[direction];
20848
20827
  }
20849
20828
  return getFocusableElement(siblingElement, direction);
20850
20829
  }
20851
- function handleArrowUp(ref) {
20852
- if (ref?.current) {
20853
- const focusedElement = ref.current.querySelector('[tabindex]:focus');
20854
- if (focusedElement) {
20855
- const prevEl = getFocusableElement(focusedElement, 'previousElementSibling');
20856
- if (prevEl) {
20857
- prevEl.focus();
20830
+ function getKeyboardPreset(type, callback) {
20831
+ let ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
20832
+ let keys = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
20833
+ let modifier = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
20834
+ function handleArrowUp() {
20835
+ if (ref?.current) {
20836
+ const focusedElement = ref.current.querySelector('[tabindex]:focus');
20837
+ if (focusedElement) {
20838
+ const prevEl = getFocusableElement(focusedElement, 'previousElementSibling');
20839
+ if (prevEl) {
20840
+ prevEl.focus();
20841
+ } else {
20842
+ const lastChild = ref.current.querySelector('[tabindex]:last-child');
20843
+ lastChild && lastChild.focus();
20844
+ }
20858
20845
  } else {
20859
- const lastChild = ref.current.querySelector('[tabindex]:last-child');
20860
- lastChild && lastChild.focus();
20846
+ const firstChild = ref.current.querySelector('[tabindex]:first-child');
20847
+ firstChild && firstChild.focus();
20861
20848
  }
20862
- } else {
20863
- const firstChild = ref.current.querySelector('[tabindex]:first-child');
20864
- firstChild && firstChild.focus();
20865
20849
  }
20866
20850
  }
20867
- }
20868
- function handleArrowDown(ref) {
20869
- if (ref?.current) {
20870
- const focusedElement = ref.current.querySelector('[tabindex]:focus');
20871
- if (focusedElement) {
20872
- const nextEl = getFocusableElement(focusedElement, 'nextElementSibling');
20873
- if (nextEl) {
20874
- nextEl.focus();
20851
+ function handleArrowDown() {
20852
+ if (ref?.current) {
20853
+ const focusedElement = ref.current.querySelector('[tabindex]:focus');
20854
+ if (focusedElement) {
20855
+ const nextEl = getFocusableElement(focusedElement, 'nextElementSibling');
20856
+ if (nextEl) {
20857
+ nextEl.focus();
20858
+ } else {
20859
+ const firstChild = ref.current.querySelector('[tabindex]:first-child');
20860
+ firstChild && firstChild.focus();
20861
+ }
20875
20862
  } else {
20876
20863
  const firstChild = ref.current.querySelector('[tabindex]:first-child');
20877
20864
  firstChild && firstChild.focus();
20878
20865
  }
20879
- } else {
20880
- const firstChild = ref.current.querySelector('[tabindex]:first-child');
20881
- firstChild && firstChild.focus();
20882
20866
  }
20883
20867
  }
20884
- }
20885
- function handleEscape(ref) {
20886
- if (ref?.current) {
20887
- const focusedElement = ref.current.querySelector('[tabindex]:focus');
20888
- if (focusedElement) {
20889
- focusedElement.blur();
20868
+ function handleEscape() {
20869
+ if (ref?.current) {
20870
+ const focusedElement = ref.current.querySelector('[tabindex]:focus');
20871
+ if (focusedElement) {
20872
+ focusedElement.blur();
20873
+ }
20890
20874
  }
20891
20875
  }
20892
- }
20893
- const findFirstChildWithClick = element => {
20894
- let result = element;
20895
- while (!result?.onclick && result !== null) {
20896
- result = result.firstElementChild;
20897
- }
20898
- return result;
20899
- };
20900
- const handleEnter = ref => {
20901
- if (ref?.current) {
20902
- const focusedElement = ref.current.querySelector('[tabindex]:focus');
20903
- if (focusedElement) {
20904
- const firstChild = findFirstChildWithClick(focusedElement);
20905
- if (firstChild) {
20906
- firstChild.click();
20876
+ const findFirstChildWithClick = element => {
20877
+ let result = element;
20878
+ while (!result?.onclick && result !== null) {
20879
+ result = result.firstElementChild;
20880
+ }
20881
+ return result;
20882
+ };
20883
+ const handleEnter = () => {
20884
+ if (ref?.current) {
20885
+ const focusedElement = ref.current.querySelector('[tabindex]:focus');
20886
+ if (focusedElement) {
20887
+ const firstChild = findFirstChildWithClick(focusedElement);
20888
+ if (firstChild) {
20889
+ firstChild.click();
20890
+ }
20907
20891
  }
20908
20892
  }
20893
+ };
20894
+ function handleCtrlArrowUp() {
20895
+ if (ref?.current) {
20896
+ const firstChild = ref.current.querySelector('[tabindex]:first-child');
20897
+ firstChild && firstChild.focus();
20898
+ }
20909
20899
  }
20910
- };
20911
- function handleCtrlArrowUp(ref) {
20912
- if (ref?.current) {
20913
- const firstChild = ref.current.querySelector('[tabindex]:first-child');
20914
- firstChild && firstChild.focus();
20915
- }
20916
- }
20917
- function handleCtrlArrowDown(ref) {
20918
- if (ref?.current) {
20919
- const lastChild = ref.current.querySelector('[tabindex]:last-child');
20920
- lastChild && lastChild.focus();
20900
+ function handleCtrlArrowDown() {
20901
+ if (ref?.current) {
20902
+ const lastChild = ref.current.querySelector('[tabindex]:last-child');
20903
+ lastChild && lastChild.focus();
20904
+ }
20921
20905
  }
20922
- }
20923
- function getListItemKeyboardPreset(callback, modifier) {
20924
- return [{
20925
- type: 'keypress',
20926
- callback,
20927
- keys: ['Enter', 'NumpadEnter'],
20928
- modifier
20929
- }];
20930
- }
20931
- function getButtonKeyboardPreset(callback, modifier) {
20932
- return [{
20933
- type: 'keyup',
20934
- callback,
20935
- keys: ['Space'],
20936
- modifier
20937
- }, {
20938
- type: 'keypress',
20939
- callback: e => e.preventDefault(),
20940
- keys: ['Space'],
20941
- modifier
20942
- }, {
20943
- type: 'keypress',
20944
- callback,
20945
- keys: ['Enter', 'NumpadEnter'],
20946
- modifier
20947
- }];
20948
- }
20949
- function getListKeyboardPreset(ref, modifier) {
20950
- return [{
20951
- type: 'keydown',
20952
- callback: () => handleArrowUp(ref),
20953
- keys: ['ArrowUp'],
20954
- modifier
20955
- }, {
20956
- type: 'keydown',
20957
- callback: () => handleArrowDown(ref),
20958
- keys: ['ArrowDown'],
20959
- modifier
20960
- }, {
20961
- type: 'keydown',
20962
- callback: () => handleCtrlArrowUp(ref),
20963
- keys: ['ArrowUp'],
20964
- modifier: true
20965
- }, {
20966
- type: 'keydown',
20967
- callback: () => handleCtrlArrowDown(ref),
20968
- keys: ['ArrowDown'],
20969
- modifier: true
20970
- }, {
20971
- type: 'keydown',
20972
- callback: () => handleEscape(ref),
20973
- keys: ['Escape'],
20974
- modifier
20975
- }, {
20976
- type: 'keydown',
20977
- callback: () => handleEnter(ref),
20978
- keys: ['Enter', 'NumpadEnter'],
20979
- modifier
20980
- }];
20981
- }
20982
- function getKeyboardPreset(type) {
20983
- let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _noop;
20984
- let ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
20985
- let keys = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
20986
- let modifier = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
20906
+ const eventsArray = [];
20987
20907
  switch (type) {
20988
20908
  case 'listItem':
20989
- return getListItemKeyboardPreset(callback, modifier);
20909
+ {
20910
+ eventsArray.push({
20911
+ type: 'keypress',
20912
+ callback,
20913
+ keys: ['Enter', 'NumpadEnter'],
20914
+ modifier
20915
+ });
20916
+ break;
20917
+ }
20990
20918
  case 'button':
20991
- return getButtonKeyboardPreset(callback, modifier);
20919
+ {
20920
+ eventsArray.push({
20921
+ type: 'keyup',
20922
+ callback,
20923
+ keys: ['Space'],
20924
+ modifier
20925
+ });
20926
+ eventsArray.push({
20927
+ type: 'keypress',
20928
+ callback: e => e.preventDefault(),
20929
+ keys: ['Space'],
20930
+ modifier
20931
+ });
20932
+ eventsArray.push({
20933
+ type: 'keypress',
20934
+ callback,
20935
+ keys: ['Enter', 'NumpadEnter'],
20936
+ modifier
20937
+ });
20938
+ break;
20939
+ }
20992
20940
  case 'list':
20993
- return getListKeyboardPreset(ref, modifier);
20941
+ {
20942
+ eventsArray.push({
20943
+ type: 'keydown',
20944
+ callback: handleArrowUp,
20945
+ keys: ['ArrowUp'],
20946
+ modifier
20947
+ });
20948
+ eventsArray.push({
20949
+ type: 'keydown',
20950
+ callback: handleArrowDown,
20951
+ keys: ['ArrowDown'],
20952
+ modifier
20953
+ });
20954
+ eventsArray.push({
20955
+ type: 'keydown',
20956
+ callback: handleCtrlArrowUp,
20957
+ keys: ['ArrowUp'],
20958
+ modifier: true
20959
+ });
20960
+ eventsArray.push({
20961
+ type: 'keydown',
20962
+ callback: handleCtrlArrowDown,
20963
+ keys: ['ArrowDown'],
20964
+ modifier: true
20965
+ });
20966
+ eventsArray.push({
20967
+ type: 'keydown',
20968
+ callback: handleEscape,
20969
+ keys: ['Escape'],
20970
+ modifier
20971
+ });
20972
+ eventsArray.push({
20973
+ type: 'keydown',
20974
+ callback: handleEnter,
20975
+ keys: ['Enter', 'NumpadEnter'],
20976
+ modifier
20977
+ });
20978
+ break;
20979
+ }
20994
20980
  case 'chipInputKeys':
20995
- return [{
20996
- type: 'keypress',
20997
- callback,
20998
- keys,
20999
- modifier
21000
- }];
21001
- default:
21002
- return [];
20981
+ {
20982
+ eventsArray.push({
20983
+ type: 'keypress',
20984
+ callback,
20985
+ keys,
20986
+ modifier
20987
+ });
20988
+ break;
20989
+ }
21003
20990
  }
20991
+ return eventsArray;
21004
20992
  }
21005
20993
 
21006
20994
  /**
@@ -21011,7 +20999,6 @@ function getKeyboardPreset(type) {
21011
20999
  * to an array with an empty key (`['']`), or not provide an event at all.
21012
21000
  */
21013
21001
  function useKeyboard(ref, events) {
21014
- let registerListener = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
21015
21002
  const keyEvents = React.useMemo(() => _map(events, _ref => {
21016
21003
  let {
21017
21004
  keys,
@@ -21029,12 +21016,12 @@ function useKeyboard(ref, events) {
21029
21016
  };
21030
21017
  }), [events]);
21031
21018
  React.useEffect(() => {
21032
- const refSave = ref.current;
21033
- if (refSave && registerListener) {
21019
+ if (ref.current) {
21034
21020
  _forEach(keyEvents, (keyEvent, index) => {
21035
- refSave.addEventListener(events[index].type, keyEvent);
21021
+ ref.current && ref.current.addEventListener(events[index].type, keyEvent);
21036
21022
  });
21037
21023
  }
21024
+ const refSave = ref.current;
21038
21025
  return () => {
21039
21026
  if (refSave) {
21040
21027
  _forEach(keyEvents, (keyEvent, index) => {
@@ -21042,7 +21029,8 @@ function useKeyboard(ref, events) {
21042
21029
  });
21043
21030
  }
21044
21031
  };
21045
- }, [events, keyEvents, ref, registerListener]);
21032
+ // eslint-disable-next-line react-hooks/exhaustive-deps
21033
+ }, [events, keyEvents, ref, ref.current]);
21046
21034
  }
21047
21035
 
21048
21036
  const StyledIcon = styled__default.default(Icon).withConfig({
@@ -21284,7 +21272,6 @@ const Button$1 = /*#__PURE__*/React__namespace.default.forwardRef(function Butto
21284
21272
  buttonRef = null,
21285
21273
  ...rest
21286
21274
  } = _ref22;
21287
- const gridRef = useCombinedRefs(ref);
21288
21275
  const innerButtonRef = useCombinedRefs(buttonRef);
21289
21276
  const clickHandler = React.useCallback(e => {
21290
21277
  if (!disabled && onClick && !e.defaultPrevented) {
@@ -21303,22 +21290,11 @@ const Button$1 = /*#__PURE__*/React__namespace.default.forwardRef(function Butto
21303
21290
  type,
21304
21291
  ...rest
21305
21292
  }), [type, rest]);
21306
- const setFocusOnPrimaryButton = React.useCallback(() => {
21307
- innerButtonRef.current?.focus();
21308
- }, [innerButtonRef]);
21309
- React.useEffect(() => {
21310
- const gridElement = gridRef.current;
21311
- gridElement?.addEventListener('focus', setFocusOnPrimaryButton);
21312
- return () => {
21313
- gridElement?.removeEventListener('focus', setFocusOnPrimaryButton);
21314
- };
21315
- }, [gridRef, setFocusOnPrimaryButton]);
21316
21293
  return /*#__PURE__*/React__namespace.default.createElement(StyledGrid, {
21317
21294
  width: width,
21318
21295
  minWidth: minWidth,
21319
21296
  padding: SIZES$2[size].padding,
21320
- ref: gridRef,
21321
- tabIndex: -1
21297
+ ref: ref
21322
21298
  }, /*#__PURE__*/React__namespace.default.createElement(StyledButton, _extends({}, rest, {
21323
21299
  backgroundColor: colors.backgroundColor,
21324
21300
  color: colors.color,
@@ -22155,6 +22131,27 @@ function arrayIncludesWith$1(array, value, comparator) {
22155
22131
 
22156
22132
  var _arrayIncludesWith = arrayIncludesWith$1;
22157
22133
 
22134
+ /**
22135
+ * This method returns `undefined`.
22136
+ *
22137
+ * @static
22138
+ * @memberOf _
22139
+ * @since 2.3.0
22140
+ * @category Util
22141
+ * @example
22142
+ *
22143
+ * _.times(2, _.noop);
22144
+ * // => [undefined, undefined]
22145
+ */
22146
+
22147
+ function noop$1() {
22148
+ // No operation performed.
22149
+ }
22150
+
22151
+ var noop_1 = noop$1;
22152
+
22153
+ var _noop = /*@__PURE__*/getDefaultExportFromCjs(noop_1);
22154
+
22158
22155
  var Set$1 = _Set,
22159
22156
  noop = noop_1,
22160
22157
  setToArray$1 = _setToArray;
@@ -23422,10 +23419,6 @@ function usePrevious(value) {
23422
23419
  const INPUT_BACKGROUND_COLOR = 'gray5';
23423
23420
  const INPUT_DIVIDER_COLOR = 'gray3';
23424
23421
  const TIMERS = {
23425
- DROPDOWN: {
23426
- IS_OPEN: 1,
23427
- CLOSE_NESTED: 500
23428
- },
23429
23422
  MODAL: {
23430
23423
  DELAY_OPEN: 1
23431
23424
  }
@@ -23786,37 +23779,6 @@ var some_1 = some;
23786
23779
 
23787
23780
  var _some = /*@__PURE__*/getDefaultExportFromCjs(some_1);
23788
23781
 
23789
- /**
23790
- * Gets the first element of `array`.
23791
- *
23792
- * @static
23793
- * @memberOf _
23794
- * @since 0.1.0
23795
- * @alias first
23796
- * @category Array
23797
- * @param {Array} array The array to query.
23798
- * @returns {*} Returns the first element of `array`.
23799
- * @example
23800
- *
23801
- * _.head([1, 2, 3]);
23802
- * // => 1
23803
- *
23804
- * _.head([]);
23805
- * // => undefined
23806
- */
23807
-
23808
- function head(array) {
23809
- return (array && array.length) ? array[0] : undefined;
23810
- }
23811
-
23812
- var head_1 = head;
23813
-
23814
- var _head = /*@__PURE__*/getDefaultExportFromCjs(head_1);
23815
-
23816
- var first = head_1;
23817
-
23818
- var _first = /*@__PURE__*/getDefaultExportFromCjs(first);
23819
-
23820
23782
  const ContainerEl$2 = styled__default.default(Container).withConfig({
23821
23783
  displayName: "Dropdown__ContainerEl",
23822
23784
  componentId: "sc-1jmq2vf-0"
@@ -23906,8 +23868,7 @@ function PopperListItem(_ref3) {
23906
23868
  tabIndex: disabled ? -1 : 0,
23907
23869
  $disabled: disabled,
23908
23870
  $selectedBackgroundColor: selected ? selectedBackgroundColor : undefined,
23909
- background: selected && selectedBackgroundColor ? selectedBackgroundColor : undefined,
23910
- "data-testid": 'dropdown-item'
23871
+ background: selected && selectedBackgroundColor ? selectedBackgroundColor : undefined
23911
23872
  }, rest), customComponent || /*#__PURE__*/React__namespace.default.createElement(ListItemContent, {
23912
23873
  icon: icon,
23913
23874
  label: label,
@@ -23925,6 +23886,7 @@ function NestListItem(_ref4) {
23925
23886
  label,
23926
23887
  onClick,
23927
23888
  selected,
23889
+ open,
23928
23890
  customComponent,
23929
23891
  disabled = false,
23930
23892
  items,
@@ -23933,101 +23895,13 @@ function NestListItem(_ref4) {
23933
23895
  itemTextSize,
23934
23896
  itemPaddingBetween,
23935
23897
  keepOpen,
23936
- dropdownListRef = null,
23898
+ dropdownListRef,
23937
23899
  tooltipLabel,
23938
- onOpen,
23939
- onClose,
23940
23900
  ...rest
23941
23901
  } = _ref4;
23942
- const [open, setOpen] = React.useState(false);
23943
23902
  const itemRef = React.useRef(null);
23944
- const innerDropdownListRef = useCombinedRefs(dropdownListRef);
23945
- const closeNestedDropdownTimeoutRef = React.useRef();
23946
- React.useEffect(() => () => {
23947
- if (closeNestedDropdownTimeoutRef.current !== undefined) {
23948
- clearTimeout(closeNestedDropdownTimeoutRef.current);
23949
- }
23950
- }, []);
23951
- const openNestedDropdown = React.useCallback(() => {
23952
- if (closeNestedDropdownTimeoutRef.current !== undefined) {
23953
- clearTimeout(closeNestedDropdownTimeoutRef.current);
23954
- closeNestedDropdownTimeoutRef.current = undefined;
23955
- }
23956
- setOpen(true);
23957
- onOpen?.();
23958
- }, [onOpen]);
23959
- const closeNestedDropdown = React.useCallback(() => {
23960
- if (closeNestedDropdownTimeoutRef.current !== undefined) {
23961
- clearTimeout(closeNestedDropdownTimeoutRef.current);
23962
- closeNestedDropdownTimeoutRef.current = undefined;
23963
- }
23964
- setOpen(false);
23965
- onClose?.();
23966
- itemRef.current?.focus({
23967
- preventScroll: true
23968
- });
23969
- }, [onClose]);
23970
- const itemKeyEvents = React.useMemo(() => {
23971
- const presets = [{
23972
- type: 'keydown',
23973
- callback: openNestedDropdown,
23974
- keys: ['ArrowRight']
23975
- }];
23976
- if (onClick) {
23977
- presets.push(...getKeyboardPreset('listItem', onClick));
23978
- }
23979
- return presets;
23980
- }, [onClick, openNestedDropdown]);
23981
- useKeyboard(itemRef, itemKeyEvents);
23982
- const dropdownKeyEvents = React.useMemo(() => [{
23983
- type: 'keydown',
23984
- callback: closeNestedDropdown,
23985
- keys: ['Escape']
23986
- }, {
23987
- type: 'keydown',
23988
- callback: closeNestedDropdown,
23989
- keys: ['ArrowLeft']
23990
- }], [closeNestedDropdown]);
23991
- const [registerNestedListener, setRegisterNestedListener] = React.useState(open);
23992
- React.useEffect(() => {
23993
- let timeout;
23994
- if (open) {
23995
- timeout = setTimeout(() => {
23996
- setRegisterNestedListener(true);
23997
- }, TIMERS.DROPDOWN.IS_OPEN);
23998
- }
23999
- return () => {
24000
- setRegisterNestedListener(false);
24001
- if (timeout) {
24002
- clearTimeout(timeout);
24003
- }
24004
- };
24005
- }, [open]);
24006
- useKeyboard(innerDropdownListRef, dropdownKeyEvents, registerNestedListener);
24007
- const closeOnMouseLeave = React.useCallback(event => {
24008
- if (event.target instanceof Node) {
24009
- const eventIsOnTrigger = itemRef.current?.contains(event.target);
24010
- const eventIsOnDropdown = innerDropdownListRef.current?.contains(event.target);
24011
- if (!eventIsOnDropdown && !eventIsOnTrigger) {
24012
- if (closeNestedDropdownTimeoutRef.current === undefined) {
24013
- closeNestedDropdownTimeoutRef.current = setTimeout(() => {
24014
- closeNestedDropdown();
24015
- }, TIMERS.DROPDOWN.CLOSE_NESTED);
24016
- }
24017
- } else if (closeNestedDropdownTimeoutRef.current !== undefined) {
24018
- clearTimeout(closeNestedDropdownTimeoutRef.current);
24019
- closeNestedDropdownTimeoutRef.current = undefined;
24020
- }
24021
- }
24022
- }, [closeNestedDropdown, innerDropdownListRef]);
24023
- React.useEffect(() => {
24024
- if (open) {
24025
- window.addEventListener('mouseover', closeOnMouseLeave);
24026
- }
24027
- return () => {
24028
- window.removeEventListener('mouseover', closeOnMouseLeave);
24029
- };
24030
- }, [closeOnMouseLeave, open]);
23903
+ const keyEvents = React.useMemo(() => onClick && getKeyboardPreset('listItem', onClick) || [], [onClick]);
23904
+ useKeyboard(itemRef, keyEvents);
24031
23905
  return /*#__PURE__*/React__namespace.default.createElement(ContainerEl$2, _extends({
24032
23906
  "data-keep-open": keepOpen,
24033
23907
  ref: itemRef,
@@ -24040,9 +23914,7 @@ function NestListItem(_ref4) {
24040
23914
  onClick: disabled ? undefined : onClick,
24041
23915
  tabIndex: disabled ? undefined : 0,
24042
23916
  $disabled: disabled,
24043
- $selectedBackgroundColor: selected ? selectedBackgroundColor : undefined,
24044
- "data-testid": 'dropdown-item',
24045
- onMouseEnter: openNestedDropdown
23917
+ $selectedBackgroundColor: selected ? selectedBackgroundColor : undefined
24046
23918
  }, rest), /*#__PURE__*/React__namespace.default.createElement(Dropdown, {
24047
23919
  display: "block",
24048
23920
  items: items,
@@ -24052,7 +23924,7 @@ function NestListItem(_ref4) {
24052
23924
  itemIconSize: itemIconSize,
24053
23925
  itemTextSize: itemTextSize,
24054
23926
  itemPaddingBetween: itemPaddingBetween,
24055
- dropdownListRef: innerDropdownListRef
23927
+ dropdownListRef: dropdownListRef
24056
23928
  }, /*#__PURE__*/React__namespace.default.createElement(Container, {
24057
23929
  orientation: "horizontal",
24058
23930
  mainAlignment: "space-between",
@@ -24147,14 +24019,14 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24147
24019
  onOpen,
24148
24020
  onClose,
24149
24021
  children,
24150
- triggerRef = null,
24022
+ triggerRef = /*#__PURE__*/React.createRef(),
24151
24023
  disablePortal = false,
24152
24024
  preventDefault = true,
24153
24025
  selectedBackgroundColor,
24154
24026
  itemIconSize = 'medium',
24155
24027
  itemTextSize = 'medium',
24156
24028
  itemPaddingBetween = 'small',
24157
- dropdownListRef = null,
24029
+ dropdownListRef = /*#__PURE__*/React.createRef(),
24158
24030
  ...rest
24159
24031
  } = _ref14;
24160
24032
  const {
@@ -24168,24 +24040,29 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24168
24040
  const startSentinelRef = React.useRef(null);
24169
24041
  const endSentinelRef = React.useRef(null);
24170
24042
  const [position, setPosition] = React.useState(null);
24043
+ const [currentHover, setCurrentHover] = React.useState(null);
24044
+ const openPopperTimoutRef = React.useRef();
24171
24045
  const nestedDropdownsRef = React.useRef([]);
24046
+ React.useEffect(
24047
+ // clear timers on unmount
24048
+ () => () => {
24049
+ openPopperTimoutRef.current && clearTimeout(openPopperTimoutRef.current);
24050
+ }, []);
24172
24051
  React.useEffect(() => {
24173
24052
  setOpen(forceOpen);
24174
- openRef.current = forceOpen;
24175
24053
  }, [forceOpen]);
24176
24054
  const openPopper = React.useCallback(() => {
24177
24055
  setOpen(true);
24178
- openRef.current = true;
24179
- onOpen?.();
24056
+ onOpen && onOpen();
24180
24057
  }, [onOpen]);
24181
24058
  const closePopper = React.useCallback(e => {
24182
- e?.stopPropagation();
24059
+ e && e.stopPropagation();
24183
24060
  setOpen(forceOpen);
24184
- openRef.current = forceOpen;
24185
- !disableRestoreFocus && innerTriggerRef.current?.focus();
24186
- onClose?.();
24061
+ setCurrentHover(null);
24062
+ !disableRestoreFocus && innerTriggerRef.current && innerTriggerRef.current.focus();
24063
+ onClose && onClose();
24187
24064
  }, [disableRestoreFocus, forceOpen, innerTriggerRef, onClose]);
24188
- const toggleOpen = React.useCallback(e => {
24065
+ const handleClick = React.useCallback(e => {
24189
24066
  if (openRef.current) {
24190
24067
  e.preventDefault();
24191
24068
  closePopper();
@@ -24194,10 +24071,12 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24194
24071
  openPopper();
24195
24072
  }
24196
24073
  }, [closePopper, disabled, openPopper]);
24074
+
24075
+ // TODO: it probably makes sense to merge this callback and the handleClick
24197
24076
  const handleLeftClick = React.useCallback(e => {
24198
- children.props.onClick?.(e);
24199
- toggleOpen(e);
24200
- }, [children.props, toggleOpen]);
24077
+ children.props.onClick && children.props.onClick(e);
24078
+ handleClick(e);
24079
+ }, [children.props, handleClick]);
24201
24080
  const handleRightClick = React.useCallback(e => {
24202
24081
  e.preventDefault();
24203
24082
  const virtualElement = {
@@ -24210,13 +24089,16 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24210
24089
  left: e.clientX,
24211
24090
  x: e.clientX,
24212
24091
  y: e.clientY,
24213
- toJSON: () => ''
24092
+ toJSON: () => 'TODO' // TODO: check what this should return
24214
24093
  })
24215
24094
  };
24095
+
24216
24096
  setPosition(virtualElement);
24217
- if (!disabled && !openRef.current) {
24218
- openPopper();
24219
- }
24097
+ openPopperTimoutRef.current = setTimeout(() => {
24098
+ if (!disabled && !openRef.current) {
24099
+ openPopper();
24100
+ }
24101
+ }, 1);
24220
24102
  }, [disabled, openPopper]);
24221
24103
  const clickOutsidePopper = React.useCallback(e => {
24222
24104
  const clickedOnDropdown = dropdownRef.current && (e.target === dropdownRef.current || dropdownRef.current.contains(e.target));
@@ -24229,24 +24111,31 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24229
24111
  }
24230
24112
  }, [closePopper, contextMenu, dropdownRef, innerTriggerRef]);
24231
24113
  const onStartSentinelFocus = React.useCallback(() => {
24232
- const lastChild = popperItemsRef.current?.querySelector('[tabindex]:last-child');
24233
- lastChild?.focus();
24114
+ const lastChild = popperItemsRef.current && popperItemsRef.current.querySelector('div[tabindex]:last-child');
24115
+ lastChild && lastChild.focus();
24234
24116
  }, []);
24235
24117
  const onEndSentinelFocus = React.useCallback(() => {
24236
- const firstChild = popperItemsRef.current?.querySelector('[tabindex]:first-child');
24237
- firstChild?.focus();
24118
+ const lastChild = popperItemsRef.current && popperItemsRef.current.querySelector('div[tabindex]:first-child');
24119
+ lastChild && lastChild.focus();
24238
24120
  }, []);
24239
- const triggerEvents = React.useMemo(() => handleTriggerEvents ? getKeyboardPreset('button', toggleOpen) : [], [toggleOpen, handleTriggerEvents]);
24121
+ const triggerEvents = React.useMemo(() => handleTriggerEvents ? getKeyboardPreset('button', handleClick) : [], [handleClick, handleTriggerEvents]);
24240
24122
  useKeyboard(innerTriggerRef, triggerEvents);
24241
- const listEvents = React.useMemo(() => getKeyboardPreset('list', undefined, popperItemsRef), [popperItemsRef]);
24242
- useKeyboard(popperItemsRef, listEvents, open);
24123
+
24124
+ // We need to add 'open' as dependency because we want to reattach these events each time we open the dropdown
24125
+ const listEvents = React.useMemo(() => getKeyboardPreset('list', () => undefined, popperItemsRef),
24126
+ // eslint-disable-next-line react-hooks/exhaustive-deps
24127
+ [open, popperItemsRef]);
24128
+ useKeyboard(popperItemsRef, listEvents);
24129
+ // We need to add 'open' as dependency because we want to reattach these events each time we open the dropdown
24243
24130
  const escapeEvent = React.useMemo(() => [{
24244
24131
  type: 'keydown',
24245
24132
  callback: closePopper,
24246
24133
  keys: ['Escape'],
24247
24134
  modifier: false
24248
- }], [closePopper]);
24249
- useKeyboard(dropdownRef, escapeEvent, open);
24135
+ }],
24136
+ // eslint-disable-next-line react-hooks/exhaustive-deps
24137
+ [open, closePopper]);
24138
+ useKeyboard(dropdownRef, escapeEvent);
24250
24139
  React.useLayoutEffect(() => {
24251
24140
  let popperInstance;
24252
24141
  if (open) {
@@ -24266,29 +24155,27 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24266
24155
  let timeout;
24267
24156
  if (!disableAutoFocus && open) {
24268
24157
  timeout = setTimeout(() => {
24269
- const selectedItems = dropdownRef.current?.querySelectorAll('.zapp-selected');
24270
- if (selectedItems && selectedItems.length > 0) {
24271
- selectedItems[0].focus();
24272
- } else {
24273
- const firstElement = _first(popperItemsRef.current?.children);
24274
- if (firstElement instanceof HTMLElement) {
24275
- firstElement.focus();
24276
- }
24277
- }
24278
- }, TIMERS.DROPDOWN.IS_OPEN);
24158
+ const selectedItems = dropdownRef.current ? dropdownRef.current.querySelectorAll('.zapp-selected') : [];
24159
+ selectedItems.length > 0 ? selectedItems[0].focus() : popperItemsRef.current && popperItemsRef.current.children[0] && popperItemsRef.current.children[0] instanceof HTMLElement && popperItemsRef.current.children[0].focus();
24160
+ }, 1);
24279
24161
  }
24280
24162
  return () => {
24281
24163
  timeout && clearTimeout(timeout);
24282
24164
  };
24283
24165
  }, [disableAutoFocus, dropdownRef, open]);
24284
24166
  React.useEffect(() => {
24167
+ openRef.current = open;
24168
+ let timeout;
24285
24169
  if (open) {
24286
- windowObj.document.addEventListener('click', clickOutsidePopper, true);
24287
- contextMenu && windowObj.document.addEventListener('contextmenu', clickOutsidePopper, true);
24170
+ timeout = setTimeout(() => {
24171
+ windowObj.document.addEventListener('click', clickOutsidePopper, true);
24172
+ contextMenu && windowObj.document.addEventListener('contextmenu', clickOutsidePopper, true);
24173
+ }, 1);
24288
24174
  }
24289
24175
  return () => {
24290
24176
  windowObj.document.removeEventListener('click', clickOutsidePopper, true);
24291
24177
  windowObj.document.removeEventListener('contextmenu', clickOutsidePopper, true);
24178
+ timeout && clearTimeout(timeout);
24292
24179
  };
24293
24180
  }, [open, closePopper, clickOutsidePopper, contextMenu, windowObj.document]);
24294
24181
  React.useEffect(() => {
@@ -24296,23 +24183,24 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24296
24183
  const startSentinelRefElement = startSentinelRef.current;
24297
24184
  const endSentinelRefElement = endSentinelRef.current;
24298
24185
  if (open && !disableAutoFocus) {
24299
- popperItemRefElement?.focus({
24186
+ popperItemRefElement && popperItemRefElement.focus({
24300
24187
  preventScroll: true
24301
24188
  });
24302
- startSentinelRefElement?.addEventListener('focus', onStartSentinelFocus);
24303
- endSentinelRefElement?.addEventListener('focus', onEndSentinelFocus);
24189
+ startSentinelRefElement && startSentinelRefElement.addEventListener('focus', onStartSentinelFocus);
24190
+ endSentinelRefElement && endSentinelRefElement.addEventListener('focus', onEndSentinelFocus);
24304
24191
  }
24305
24192
  return () => {
24306
- startSentinelRefElement?.removeEventListener('focus', onStartSentinelFocus);
24307
- endSentinelRefElement?.removeEventListener('focus', onEndSentinelFocus);
24193
+ startSentinelRefElement && startSentinelRefElement.removeEventListener('focus', onStartSentinelFocus);
24194
+ endSentinelRefElement && endSentinelRefElement.removeEventListener('focus', onEndSentinelFocus);
24308
24195
  };
24309
24196
  }, [open, startSentinelRef, endSentinelRef, onStartSentinelFocus, onEndSentinelFocus, disableAutoFocus]);
24310
24197
  const listItemClickHandler = React.useCallback((onClick, keepOpen) => event => {
24311
- onClick?.(event);
24312
- if (!multiple && !keepOpen) {
24313
- closePopper();
24314
- }
24198
+ onClick && onClick(event);
24199
+ !multiple && !keepOpen && closePopper();
24315
24200
  }, [closePopper, multiple]);
24201
+ const listItemMouseEnterHandler = React.useCallback(id => () => {
24202
+ setCurrentHover(id);
24203
+ }, []);
24316
24204
  const popperListItems = React.useMemo(() => {
24317
24205
  nestedDropdownsRef.current = [];
24318
24206
  if (items) {
@@ -24340,10 +24228,12 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24340
24228
  onClick: listItemClickHandler(onClick, keepOpen),
24341
24229
  keepOpen: keepOpen,
24342
24230
  selected: selected,
24231
+ open: currentHover === id,
24343
24232
  key: id,
24344
24233
  customComponent: customComponent,
24345
24234
  disabled: itemDisabled,
24346
24235
  items: subItems,
24236
+ onMouseEnter: listItemMouseEnterHandler(id),
24347
24237
  selectedBackgroundColor: selectedBackgroundColor,
24348
24238
  itemIconSize: itemIconSize,
24349
24239
  itemTextSize: itemTextSize,
@@ -24358,6 +24248,7 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24358
24248
  key: id,
24359
24249
  customComponent: customComponent,
24360
24250
  disabled: itemDisabled,
24251
+ onMouseEnter: listItemMouseEnterHandler(id),
24361
24252
  selectedBackgroundColor: selectedBackgroundColor,
24362
24253
  itemIconSize: itemIconSize,
24363
24254
  itemTextSize: itemTextSize,
@@ -24366,7 +24257,7 @@ const Dropdown = /*#__PURE__*/React__namespace.default.forwardRef(function Dropd
24366
24257
  });
24367
24258
  }
24368
24259
  return null;
24369
- }, [items, listItemClickHandler, selectedBackgroundColor, itemIconSize, itemTextSize, itemPaddingBetween]);
24260
+ }, [items, listItemClickHandler, currentHover, listItemMouseEnterHandler, selectedBackgroundColor, itemIconSize, itemTextSize, itemPaddingBetween]);
24370
24261
  const popperListPreventDefaultHandler = React.useCallback(event => {
24371
24262
  preventDefault && event.preventDefault();
24372
24263
  }, [preventDefault]);
@@ -35290,6 +35181,33 @@ var last_1 = last;
35290
35181
 
35291
35182
  var _last = /*@__PURE__*/getDefaultExportFromCjs(last_1);
35292
35183
 
35184
+ /**
35185
+ * Gets the first element of `array`.
35186
+ *
35187
+ * @static
35188
+ * @memberOf _
35189
+ * @since 0.1.0
35190
+ * @alias first
35191
+ * @category Array
35192
+ * @param {Array} array The array to query.
35193
+ * @returns {*} Returns the first element of `array`.
35194
+ * @example
35195
+ *
35196
+ * _.head([1, 2, 3]);
35197
+ * // => 1
35198
+ *
35199
+ * _.head([]);
35200
+ * // => undefined
35201
+ */
35202
+
35203
+ function head(array) {
35204
+ return (array && array.length) ? array[0] : undefined;
35205
+ }
35206
+
35207
+ var head_1 = head;
35208
+
35209
+ var _head = /*@__PURE__*/getDefaultExportFromCjs(head_1);
35210
+
35293
35211
  var baseSlice = _baseSlice,
35294
35212
  toInteger = toInteger_1;
35295
35213
 
@@ -35709,7 +35627,8 @@ const List = /*#__PURE__*/React__namespace.default.forwardRef(function ListFn(_r
35709
35627
  } = _ref6;
35710
35628
  const selecting = React.useMemo(() => _some(selected, i => !!i), [selected]);
35711
35629
  const listRef = React.useRef(null);
35712
- const keyEvents = React.useMemo(() => keyboardShortcutsIsDisabled ? [] : getKeyboardPreset('list', undefined, listRef), [listRef, keyboardShortcutsIsDisabled]);
35630
+ const useKeyboardShortcuts = () => undefined;
35631
+ const keyEvents = React.useMemo(() => keyboardShortcutsIsDisabled ? [] : getKeyboardPreset('list', useKeyboardShortcuts, listRef), [listRef, keyboardShortcutsIsDisabled]);
35713
35632
  useKeyboard(listRef, keyEvents);
35714
35633
  return /*#__PURE__*/React__namespace.default.createElement("div", {
35715
35634
  ref: listRef,
@@ -35780,7 +35699,8 @@ const ListV2 = /*#__PURE__*/React__namespace.default.forwardRef(function ListV2F
35780
35699
  ...rest
35781
35700
  } = _ref3;
35782
35701
  const listRef = useCombinedRefs(ref);
35783
- const keyEvents = React.useMemo(() => keyboardShortcutsIsDisabled ? [] : getKeyboardPreset('list', undefined, listRef), [listRef, keyboardShortcutsIsDisabled]);
35702
+ const useKeyboardShortcuts = () => undefined;
35703
+ const keyEvents = React.useMemo(() => keyboardShortcutsIsDisabled ? [] : getKeyboardPreset('list', useKeyboardShortcuts, listRef), [listRef, keyboardShortcutsIsDisabled]);
35784
35704
  useKeyboard(listRef, keyEvents);
35785
35705
  const listItems = React.useMemo(() => children.map(child => /*#__PURE__*/React__namespace.default.cloneElement(child, {
35786
35706
  listRef,
@@ -212962,4 +212882,4 @@ var vanilla = (createState) => {
212962
212882
  /***/ })
212963
212883
 
212964
212884
  }]);
212965
- //# sourceMappingURL=vendors-node_modules_tinymce_skins_ui_oxide_skin_min_css-node_modules_reduxjs_toolkit_dist_re-3b2651.de183bda.chunk.js.map
212885
+ //# sourceMappingURL=vendors-node_modules_tinymce_skins_ui_oxide_skin_min_css-node_modules_reduxjs_toolkit_dist_re-3b2651.4d179dee.chunk.js.map