@onereach/ui-components 8.18.3-beta.3946.0 → 8.18.3

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 (65) hide show
  1. package/dist/bundled/v2/components/OrModal/OrModal.js +1 -1
  2. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  3. package/dist/bundled/v2/components/OrSelectV3/OrSelect.vue.d.ts +7 -7
  4. package/dist/bundled/v2/components/OrTabsV3/OrTabs.js +20 -2
  5. package/dist/bundled/v2/components/OrTabsV3/OrTabs.vue.d.ts +13 -0
  6. package/dist/bundled/v2/{useFocusTrap-2df16342.js → useFocusTrap-2354d4f3.js} +120 -307
  7. package/dist/bundled/v3/components/OrCode/OrCode.js +1 -1
  8. package/dist/bundled/v3/components/OrCode/constants.js +1 -1
  9. package/dist/bundled/v3/components/OrCode/index.js +1 -1
  10. package/dist/bundled/v3/components/OrCode/lang.js +1 -1
  11. package/dist/bundled/v3/components/OrCode/libs.js +1 -1
  12. package/dist/bundled/v3/components/OrCode/theme.js +1 -1
  13. package/dist/bundled/v3/components/{OrCode-f7708644.js → OrCode-46b1b8aa.js} +1 -1
  14. package/dist/bundled/v3/components/OrCodeV3/OrCode.js +1 -1
  15. package/dist/bundled/v3/components/OrCodeV3/index.js +2 -2
  16. package/dist/bundled/v3/components/OrCodeV3/libs.js +1 -1
  17. package/dist/bundled/v3/components/OrCodeV3/props.js +1 -1
  18. package/dist/bundled/v3/components/OrCodeV3/styles.js +1 -1
  19. package/dist/bundled/v3/components/{OrCodeV3-6dbd233d.js → OrCodeV3-d8e1ec2f.js} +7 -7
  20. package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +1 -1
  21. package/dist/bundled/v3/components/OrConfirm/index.js +1 -1
  22. package/dist/bundled/v3/components/{OrConfirm-66387c1f.js → OrConfirm-f95a3ce6.js} +1 -1
  23. package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +1 -1
  24. package/dist/bundled/v3/components/OrConfirmV3/index.js +1 -1
  25. package/dist/bundled/v3/components/OrConfirmV3/props.js +1 -1
  26. package/dist/bundled/v3/components/OrConfirmV3/styles.js +1 -1
  27. package/dist/bundled/v3/components/{OrConfirmV3-0a0d83f0.js → OrConfirmV3-26accd85.js} +1 -1
  28. package/dist/bundled/v3/components/OrModal/OrModal.js +1 -1
  29. package/dist/bundled/v3/components/OrModal/constants.js +1 -1
  30. package/dist/bundled/v3/components/OrModal/index.js +1 -1
  31. package/dist/bundled/v3/components/{OrModal-70fa6d2d.js → OrModal-3aad4d27.js} +120 -307
  32. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  33. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
  34. package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
  35. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
  36. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +2 -2
  37. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +2 -2
  38. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
  39. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +2 -2
  40. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  41. package/dist/bundled/v3/components/{OrRichTextEditorV3-51a86e18.js → OrRichTextEditorV3-243f2ed9.js} +2 -2
  42. package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +4 -4
  43. package/dist/bundled/v3/components/OrTabsV3/OrTabs.js +1 -1
  44. package/dist/bundled/v3/components/OrTabsV3/OrTabs.vue.d.ts +10 -0
  45. package/dist/bundled/v3/components/OrTabsV3/index.js +1 -1
  46. package/dist/bundled/v3/components/OrTabsV3/props.js +1 -1
  47. package/dist/bundled/v3/components/OrTabsV3/styles.js +1 -1
  48. package/dist/bundled/v3/components/{OrTabsV3-b1db1d5a.js → OrTabsV3-d1028c81.js} +15 -3
  49. package/dist/bundled/v3/components/index.js +7 -7
  50. package/dist/bundled/v3/index.js +7 -7
  51. package/dist/esm/v2/{OrTabs-4935a772.js → OrTabs-b8df5b2e.js} +20 -2
  52. package/dist/esm/v2/components/index.js +1 -1
  53. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +7 -7
  54. package/dist/esm/v2/components/or-tabs-v3/OrTabs.vue.d.ts +13 -0
  55. package/dist/esm/v2/components/or-tabs-v3/index.js +1 -1
  56. package/dist/esm/v2/index.js +1 -1
  57. package/dist/esm/v3/{OrTabs-c1a7955f.js → OrTabs-cd217d74.js} +15 -3
  58. package/dist/esm/v3/components/index.js +1 -1
  59. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +4 -4
  60. package/dist/esm/v3/components/or-tabs-v3/OrTabs.vue.d.ts +10 -0
  61. package/dist/esm/v3/components/or-tabs-v3/index.js +1 -1
  62. package/dist/esm/v3/index.js +1 -1
  63. package/package.json +6 -6
  64. package/src/components/or-select-v3/OrSelect.vue +3 -3
  65. package/src/components/or-tabs-v3/OrTabs.vue +19 -1
@@ -572,7 +572,7 @@ var isFocusable = function isFocusable(node, options) {
572
572
  };
573
573
 
574
574
  /*!
575
- * focus-trap 7.5.2
575
+ * focus-trap 7.2.0
576
576
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
577
577
  */
578
578
  function ownKeys(object, enumerableOnly) {
@@ -655,10 +655,10 @@ var isSelectableInput = function isSelectableInput(node) {
655
655
  return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
656
656
  };
657
657
  var isEscapeEvent = function isEscapeEvent(e) {
658
- return (e === null || e === void 0 ? void 0 : e.key) === 'Escape' || (e === null || e === void 0 ? void 0 : e.key) === 'Esc' || (e === null || e === void 0 ? void 0 : e.keyCode) === 27;
658
+ return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
659
659
  };
660
660
  var isTabEvent = function isTabEvent(e) {
661
- return (e === null || e === void 0 ? void 0 : e.key) === 'Tab' || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
661
+ return e.key === 'Tab' || e.keyCode === 9;
662
662
  };
663
663
 
664
664
  // checks for TAB by default
@@ -742,11 +742,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
742
742
  // container: HTMLElement,
743
743
  // tabbableNodes: Array<HTMLElement>, // empty if none
744
744
  // focusableNodes: Array<HTMLElement>, // empty if none
745
- // posTabIndexesFound: boolean,
746
- // firstTabbableNode: HTMLElement|undefined,
747
- // lastTabbableNode: HTMLElement|undefined,
748
- // firstDomTabbableNode: HTMLElement|undefined,
749
- // lastDomTabbableNode: HTMLElement|undefined,
745
+ // firstTabbableNode: HTMLElement|null,
746
+ // lastTabbableNode: HTMLElement|null,
750
747
  // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
751
748
  // }>}
752
749
  containerGroups: [],
@@ -763,9 +760,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
763
760
  paused: false,
764
761
  // timer ID for when delayInitialFocus is true and initial focus in this trap
765
762
  // has been delayed during activation
766
- delayInitialFocusTimer: undefined,
767
- // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
768
- recentNavEvent: undefined
763
+ delayInitialFocusTimer: undefined
769
764
  };
770
765
  var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
771
766
 
@@ -784,27 +779,23 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
784
779
  /**
785
780
  * Finds the index of the container that contains the element.
786
781
  * @param {HTMLElement} element
787
- * @param {Event} [event] If available, and `element` isn't directly found in any container,
788
- * the event's composed path is used to see if includes any known trap containers in the
789
- * case where the element is inside a Shadow DOM.
790
782
  * @returns {number} Index of the container in either `state.containers` or
791
783
  * `state.containerGroups` (the order/length of these lists are the same); -1
792
784
  * if the element isn't found.
793
785
  */
794
- var findContainerIndex = function findContainerIndex(element, event) {
795
- var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
786
+ var findContainerIndex = function findContainerIndex(element) {
796
787
  // NOTE: search `containerGroups` because it's possible a group contains no tabbable
797
788
  // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
798
789
  // and we still need to find the element in there
799
790
  return state.containerGroups.findIndex(function (_ref) {
800
791
  var container = _ref.container,
801
792
  tabbableNodes = _ref.tabbableNodes;
802
- return container.contains(element) || (
793
+ return container.contains(element) ||
803
794
  // fall back to explicit tabbable search which will take into consideration any
804
795
  // web components if the `tabbableOptions.getShadowRoot` option was used for
805
796
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
806
797
  // look inside web components even if open)
807
- composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) {
798
+ tabbableNodes.find(function (node) {
808
799
  return node === element;
809
800
  });
810
801
  });
@@ -860,8 +851,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
860
851
  if (node === false) {
861
852
  return false;
862
853
  }
863
- if (node === undefined || !isFocusable(node, config.tabbableOptions)) {
864
- // option not specified nor focusable: use fallback options
854
+ if (node === undefined) {
855
+ // option not specified: use fallback options
865
856
  if (findContainerIndex(doc.activeElement) >= 0) {
866
857
  node = doc.activeElement;
867
858
  } else {
@@ -882,41 +873,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
882
873
  var tabbableNodes = tabbable(container, config.tabbableOptions);
883
874
 
884
875
  // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
885
- // are a superset of tabbable nodes since nodes with negative `tabindex` attributes
886
- // are focusable but not tabbable
876
+ // are a superset of tabbable nodes
887
877
  var focusableNodes = focusable(container, config.tabbableOptions);
888
- var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : undefined;
889
- var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : undefined;
890
- var firstDomTabbableNode = focusableNodes.find(function (node) {
891
- return isTabbable(node);
892
- });
893
- var lastDomTabbableNode = focusableNodes.slice().reverse().find(function (node) {
894
- return isTabbable(node);
895
- });
896
- var posTabIndexesFound = !!tabbableNodes.find(function (node) {
897
- return getTabIndex(node) > 0;
898
- });
899
878
  return {
900
879
  container: container,
901
880
  tabbableNodes: tabbableNodes,
902
881
  focusableNodes: focusableNodes,
903
- /** True if at least one node with positive `tabindex` was found in this container. */
904
- posTabIndexesFound: posTabIndexesFound,
905
- /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
906
- firstTabbableNode: firstTabbableNode,
907
- /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
908
- lastTabbableNode: lastTabbableNode,
909
- // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
910
- // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
911
- // because that API doesn't work with Shadow DOM as well as it should (@see
912
- // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
913
- // to address an edge case related to positive tabindex support, this seems like a much easier,
914
- // "close enough most of the time" alternative for positive tabindexes which should generally
915
- // be avoided anyway...
916
- /** First tabbable node in container, __DOM__ order; `undefined` if none. */
917
- firstDomTabbableNode: firstDomTabbableNode,
918
- /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
919
- lastDomTabbableNode: lastDomTabbableNode,
882
+ firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
883
+ lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
920
884
  /**
921
885
  * Finds the __tabbable__ node that follows the given node in the specified direction,
922
886
  * in this container, if any.
@@ -927,24 +891,30 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
927
891
  */
928
892
  nextTabbableNode: function nextTabbableNode(node) {
929
893
  var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
930
- var nodeIdx = tabbableNodes.indexOf(node);
894
+ // NOTE: If tabindex is positive (in order to manipulate the tab order separate
895
+ // from the DOM order), this __will not work__ because the list of focusableNodes,
896
+ // while it contains tabbable nodes, does not sort its nodes in any order other
897
+ // than DOM order, because it can't: Where would you place focusable (but not
898
+ // tabbable) nodes in that order? They have no order, because they aren't tabbale...
899
+ // Support for positive tabindex is already broken and hard to manage (possibly
900
+ // not supportable, TBD), so this isn't going to make things worse than they
901
+ // already are, and at least makes things better for the majority of cases where
902
+ // tabindex is either 0/unset or negative.
903
+ // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
904
+ var nodeIdx = focusableNodes.findIndex(function (n) {
905
+ return n === node;
906
+ });
931
907
  if (nodeIdx < 0) {
932
- // either not tabbable nor focusable, or was focused but not tabbable (negative tabindex):
933
- // since `node` should at least have been focusable, we assume that's the case and mimic
934
- // what browsers do, which is set focus to the next node in __document position order__,
935
- // regardless of positive tabindexes, if any -- and for reasons explained in the NOTE
936
- // above related to `firstDomTabbable` and `lastDomTabbable` properties, we fall back to
937
- // basic DOM order
938
- if (forward) {
939
- return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function (el) {
940
- return isTabbable(el);
941
- });
942
- }
943
- return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function (el) {
944
- return isTabbable(el);
908
+ return undefined;
909
+ }
910
+ if (forward) {
911
+ return focusableNodes.slice(nodeIdx + 1).find(function (n) {
912
+ return isTabbable(n, config.tabbableOptions);
945
913
  });
946
914
  }
947
- return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
915
+ return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
916
+ return isTabbable(n, config.tabbableOptions);
917
+ });
948
918
  }
949
919
  };
950
920
  });
@@ -957,19 +927,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
957
927
  ) {
958
928
  throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
959
929
  }
960
-
961
- // NOTE: Positive tabindexes are only properly supported in single-container traps because
962
- // doing it across multiple containers where tabindexes could be all over the place
963
- // would require Tabbable to support multiple containers, would require additional
964
- // specialized Shadow DOM support, and would require Tabbable's multi-container support
965
- // to look at those containers in document position order rather than user-provided
966
- // order (as they are treated in Focus-trap, for legacy reasons). See discussion on
967
- // https://github.com/focus-trap/focus-trap/issues/375 for more details.
968
- if (state.containerGroups.find(function (g) {
969
- return g.posTabIndexesFound;
970
- }) && state.containerGroups.length > 1) {
971
- throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
972
- }
973
930
  };
974
931
  var tryFocus = function tryFocus(node) {
975
932
  if (node === false) {
@@ -985,7 +942,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
985
942
  node.focus({
986
943
  preventScroll: !!config.preventScroll
987
944
  });
988
- // NOTE: focus() API does not trigger focusIn event so set MRU node manually
989
945
  state.mostRecentlyFocusedNode = node;
990
946
  if (isSelectableInput(node)) {
991
947
  node.select();
@@ -996,30 +952,76 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
996
952
  return node ? node : node === false ? false : previousActiveElement;
997
953
  };
998
954
 
999
- /**
1000
- * Finds the next node (in either direction) where focus should move according to a
1001
- * keyboard focus-in event.
1002
- * @param {Object} params
1003
- * @param {Node} [params.target] Known target __from which__ to navigate, if any.
1004
- * @param {KeyboardEvent|FocusEvent} [params.event] Event to use if `target` isn't known (event
1005
- * will be used to determine the `target`). Ignored if `target` is specified.
1006
- * @param {boolean} [params.isBackward] True if focus should move backward.
1007
- * @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be
1008
- * determined given the current state of the trap.
1009
- */
1010
- var findNextNavNode = function findNextNavNode(_ref2) {
1011
- var target = _ref2.target,
1012
- event = _ref2.event,
1013
- _ref2$isBackward = _ref2.isBackward,
1014
- isBackward = _ref2$isBackward === void 0 ? false : _ref2$isBackward;
1015
- target = target || getActualTarget(event);
955
+ // This needs to be done on mousedown and touchstart instead of click
956
+ // so that it precedes the focus event.
957
+ var checkPointerDown = function checkPointerDown(e) {
958
+ var target = getActualTarget(e);
959
+ if (findContainerIndex(target) >= 0) {
960
+ // allow the click since it ocurred inside the trap
961
+ return;
962
+ }
963
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
964
+ // immediately deactivate the trap
965
+ trap.deactivate({
966
+ // if, on deactivation, we should return focus to the node originally-focused
967
+ // when the trap was activated (or the configured `setReturnFocus` node),
968
+ // then assume it's also OK to return focus to the outside node that was
969
+ // just clicked, causing deactivation, as long as that node is focusable;
970
+ // if it isn't focusable, then return focus to the original node focused
971
+ // on activation (or the configured `setReturnFocus` node)
972
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
973
+ // which will result in the outside click setting focus to the node
974
+ // that was clicked, whether it's focusable or not; by setting
975
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
976
+ // on activation (or the configured `setReturnFocus` node)
977
+ returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
978
+ });
979
+ return;
980
+ }
981
+
982
+ // This is needed for mobile devices.
983
+ // (If we'll only let `click` events through,
984
+ // then on mobile they will be blocked anyways if `touchstart` is blocked.)
985
+ if (valueOrHandler(config.allowOutsideClick, e)) {
986
+ // allow the click outside the trap to take place
987
+ return;
988
+ }
989
+
990
+ // otherwise, prevent the click
991
+ e.preventDefault();
992
+ };
993
+
994
+ // In case focus escapes the trap for some strange reason, pull it back in.
995
+ var checkFocusIn = function checkFocusIn(e) {
996
+ var target = getActualTarget(e);
997
+ var targetContained = findContainerIndex(target) >= 0;
998
+
999
+ // In Firefox when you Tab out of an iframe the Document is briefly focused.
1000
+ if (targetContained || target instanceof Document) {
1001
+ if (targetContained) {
1002
+ state.mostRecentlyFocusedNode = target;
1003
+ }
1004
+ } else {
1005
+ // escaped! pull it back in to where it just left
1006
+ e.stopImmediatePropagation();
1007
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
1008
+ }
1009
+ };
1010
+
1011
+ // Hijack key nav events on the first and last focusable nodes of the trap,
1012
+ // in order to prevent focus from escaping. If it escapes for even a
1013
+ // moment it can end up scrolling the page and causing confusion so we
1014
+ // kind of need to capture the action at the keydown phase.
1015
+ var checkKeyNav = function checkKeyNav(event) {
1016
+ var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1017
+ var target = getActualTarget(event);
1016
1018
  updateTabbableNodes();
1017
1019
  var destinationNode = null;
1018
1020
  if (state.tabbableGroups.length > 0) {
1019
1021
  // make sure the target is actually contained in a group
1020
1022
  // NOTE: the target may also be the container itself if it's focusable
1021
1023
  // with tabIndex='-1' and was given initial focus
1022
- var containerIndex = findContainerIndex(target, event);
1024
+ var containerIndex = findContainerIndex(target);
1023
1025
  var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
1024
1026
  if (containerIndex < 0) {
1025
1027
  // target not found in any group: quite possible focus has escaped the trap,
@@ -1035,8 +1037,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1035
1037
  // REVERSE
1036
1038
 
1037
1039
  // is the target the first tabbable node in a group?
1038
- var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
1039
- var firstTabbableNode = _ref3.firstTabbableNode;
1040
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
1041
+ var firstTabbableNode = _ref2.firstTabbableNode;
1040
1042
  return target === firstTabbableNode;
1041
1043
  });
1042
1044
  if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
@@ -1054,7 +1056,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1054
1056
  // the LAST group if it's the first tabbable node of the FIRST group)
1055
1057
  var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
1056
1058
  var destinationGroup = state.tabbableGroups[destinationGroupIndex];
1057
- destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
1059
+ destinationNode = destinationGroup.lastTabbableNode;
1058
1060
  } else if (!isTabEvent(event)) {
1059
1061
  // user must have customized the nav keys so we have to move focus manually _within_
1060
1062
  // the active group: do this based on the order determined by tabbable()
@@ -1064,8 +1066,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1064
1066
  // FORWARD
1065
1067
 
1066
1068
  // is the target the last tabbable node in a group?
1067
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
1068
- var lastTabbableNode = _ref4.lastTabbableNode;
1069
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
1070
+ var lastTabbableNode = _ref3.lastTabbableNode;
1069
1071
  return target === lastTabbableNode;
1070
1072
  });
1071
1073
  if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
@@ -1083,7 +1085,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1083
1085
  // group if it's the last tabbable node of the LAST group)
1084
1086
  var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
1085
1087
  var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
1086
- destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
1088
+ destinationNode = _destinationGroup.firstTabbableNode;
1087
1089
  } else if (!isTabEvent(event)) {
1088
1090
  // user must have customized the nav keys so we have to move focus manually _within_
1089
1091
  // the active group: do this based on the order determined by tabbable()
@@ -1095,153 +1097,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1095
1097
  // NOTE: the fallbackFocus option does not support returning false to opt-out
1096
1098
  destinationNode = getNodeForOption('fallbackFocus');
1097
1099
  }
1098
- return destinationNode;
1099
- };
1100
-
1101
- // This needs to be done on mousedown and touchstart instead of click
1102
- // so that it precedes the focus event.
1103
- var checkPointerDown = function checkPointerDown(e) {
1104
- var target = getActualTarget(e);
1105
- if (findContainerIndex(target, e) >= 0) {
1106
- // allow the click since it ocurred inside the trap
1107
- return;
1108
- }
1109
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
1110
- // immediately deactivate the trap
1111
- trap.deactivate({
1112
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
1113
- // which will result in the outside click setting focus to the node
1114
- // that was clicked (and if not focusable, to "nothing"); by setting
1115
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
1116
- // on activation (or the configured `setReturnFocus` node), whether the
1117
- // outside click was on a focusable node or not
1118
- returnFocus: config.returnFocusOnDeactivate
1119
- });
1120
- return;
1121
- }
1122
-
1123
- // This is needed for mobile devices.
1124
- // (If we'll only let `click` events through,
1125
- // then on mobile they will be blocked anyways if `touchstart` is blocked.)
1126
- if (valueOrHandler(config.allowOutsideClick, e)) {
1127
- // allow the click outside the trap to take place
1128
- return;
1129
- }
1130
-
1131
- // otherwise, prevent the click
1132
- e.preventDefault();
1133
- };
1134
-
1135
- // In case focus escapes the trap for some strange reason, pull it back in.
1136
- // NOTE: the focusIn event is NOT cancelable, so if focus escapes, it may cause unexpected
1137
- // scrolling if the node that got focused was out of view; there's nothing we can do to
1138
- // prevent that from happening by the time we discover that focus escaped
1139
- var checkFocusIn = function checkFocusIn(event) {
1140
- var target = getActualTarget(event);
1141
- var targetContained = findContainerIndex(target, event) >= 0;
1142
-
1143
- // In Firefox when you Tab out of an iframe the Document is briefly focused.
1144
- if (targetContained || target instanceof Document) {
1145
- if (targetContained) {
1146
- state.mostRecentlyFocusedNode = target;
1147
- }
1148
- } else {
1149
- // escaped! pull it back in to where it just left
1150
- event.stopImmediatePropagation();
1151
-
1152
- // focus will escape if the MRU node had a positive tab index and user tried to nav forward;
1153
- // it will also escape if the MRU node had a 0 tab index and user tried to nav backward
1154
- // toward a node with a positive tab index
1155
- var nextNode; // next node to focus, if we find one
1156
- var navAcrossContainers = true;
1157
- if (state.mostRecentlyFocusedNode) {
1158
- if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
1159
- // MRU container index must be >=0 otherwise we wouldn't have it as an MRU node...
1160
- var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
1161
- // there MAY not be any tabbable nodes in the container if there are at least 2 containers
1162
- // and the MRU node is focusable but not tabbable (focus-trap requires at least 1 container
1163
- // with at least one tabbable node in order to function, so this could be the other container
1164
- // with nothing tabbable in it)
1165
- var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
1166
- if (tabbableNodes.length > 0) {
1167
- // MRU tab index MAY not be found if the MRU node is focusable but not tabbable
1168
- var mruTabIdx = tabbableNodes.findIndex(function (node) {
1169
- return node === state.mostRecentlyFocusedNode;
1170
- });
1171
- if (mruTabIdx >= 0) {
1172
- if (config.isKeyForward(state.recentNavEvent)) {
1173
- if (mruTabIdx + 1 < tabbableNodes.length) {
1174
- nextNode = tabbableNodes[mruTabIdx + 1];
1175
- navAcrossContainers = false;
1176
- }
1177
- // else, don't wrap within the container as focus should move to next/previous
1178
- // container
1179
- } else {
1180
- if (mruTabIdx - 1 >= 0) {
1181
- nextNode = tabbableNodes[mruTabIdx - 1];
1182
- navAcrossContainers = false;
1183
- }
1184
- // else, don't wrap within the container as focus should move to next/previous
1185
- // container
1186
- }
1187
- // else, don't find in container order without considering direction too
1188
- }
1189
- }
1190
- // else, no tabbable nodes in that container (which means we must have at least one other
1191
- // container with at least one tabbable node in it, otherwise focus-trap would've thrown
1192
- // an error the last time updateTabbableNodes() was run): find next node among all known
1193
- // containers
1194
- } else {
1195
- // check to see if there's at least one tabbable node with a positive tab index inside
1196
- // the trap because focus seems to escape when navigating backward from a tabbable node
1197
- // with tabindex=0 when this is the case (instead of wrapping to the tabbable node with
1198
- // the greatest positive tab index like it should)
1199
- if (!state.containerGroups.some(function (g) {
1200
- return g.tabbableNodes.some(function (n) {
1201
- return getTabIndex(n) > 0;
1202
- });
1203
- })) {
1204
- // no containers with tabbable nodes with positive tab indexes which means the focus
1205
- // escaped for some other reason and we should just execute the fallback to the
1206
- // MRU node or initial focus node, if any
1207
- navAcrossContainers = false;
1208
- }
1209
- }
1210
- } else {
1211
- // no MRU node means we're likely in some initial condition when the trap has just
1212
- // been activated and initial focus hasn't been given yet, in which case we should
1213
- // fall through to trying to focus the initial focus node, which is what should
1214
- // happen below at this point in the logic
1215
- navAcrossContainers = false;
1216
- }
1217
- if (navAcrossContainers) {
1218
- nextNode = findNextNavNode({
1219
- // move FROM the MRU node, not event-related node (which will be the node that is
1220
- // outside the trap causing the focus escape we're trying to fix)
1221
- target: state.mostRecentlyFocusedNode,
1222
- isBackward: config.isKeyBackward(state.recentNavEvent)
1223
- });
1224
- }
1225
- if (nextNode) {
1226
- tryFocus(nextNode);
1227
- } else {
1228
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
1229
- }
1230
- }
1231
- state.recentNavEvent = undefined; // clear
1232
- };
1233
-
1234
- // Hijack key nav events on the first and last focusable nodes of the trap,
1235
- // in order to prevent focus from escaping. If it escapes for even a
1236
- // moment it can end up scrolling the page and causing confusion so we
1237
- // kind of need to capture the action at the keydown phase.
1238
- var checkKeyNav = function checkKeyNav(event) {
1239
- var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1240
- state.recentNavEvent = event;
1241
- var destinationNode = findNextNavNode({
1242
- event: event,
1243
- isBackward: isBackward
1244
- });
1245
1100
  if (destinationNode) {
1246
1101
  if (isTabEvent(event)) {
1247
1102
  // since tab natively moves focus, we wouldn't have a destination node unless we
@@ -1267,7 +1122,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1267
1122
  };
1268
1123
  var checkClick = function checkClick(e) {
1269
1124
  var target = getActualTarget(e);
1270
- if (findContainerIndex(target, e) >= 0) {
1125
+ if (findContainerIndex(target) >= 0) {
1271
1126
  return;
1272
1127
  }
1273
1128
  if (valueOrHandler(config.clickOutsideDeactivates, e)) {
@@ -1328,43 +1183,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1328
1183
  return trap;
1329
1184
  };
1330
1185
 
1331
- //
1332
- // MUTATION OBSERVER
1333
- //
1334
-
1335
- var checkDomRemoval = function checkDomRemoval(mutations) {
1336
- var isFocusedNodeRemoved = mutations.some(function (mutation) {
1337
- var removedNodes = Array.from(mutation.removedNodes);
1338
- return removedNodes.some(function (node) {
1339
- return node === state.mostRecentlyFocusedNode;
1340
- });
1341
- });
1342
-
1343
- // If the currently focused is removed then browsers will move focus to the
1344
- // <body> element. If this happens, try to move focus back into the trap.
1345
- if (isFocusedNodeRemoved) {
1346
- tryFocus(getInitialFocusNode());
1347
- }
1348
- };
1349
-
1350
- // Use MutationObserver - if supported - to detect if focused node is removed
1351
- // from the DOM.
1352
- var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined;
1353
- var updateObservedNodes = function updateObservedNodes() {
1354
- if (!mutationObserver) {
1355
- return;
1356
- }
1357
- mutationObserver.disconnect();
1358
- if (state.active && !state.paused) {
1359
- state.containers.map(function (container) {
1360
- mutationObserver.observe(container, {
1361
- subtree: true,
1362
- childList: true
1363
- });
1364
- });
1365
- }
1366
- };
1367
-
1368
1186
  //
1369
1187
  // TRAP DEFINITION
1370
1188
  //
@@ -1389,14 +1207,17 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1389
1207
  state.active = true;
1390
1208
  state.paused = false;
1391
1209
  state.nodeFocusedBeforeActivation = doc.activeElement;
1392
- onActivate === null || onActivate === void 0 ? void 0 : onActivate();
1210
+ if (onActivate) {
1211
+ onActivate();
1212
+ }
1393
1213
  var finishActivation = function finishActivation() {
1394
1214
  if (checkCanFocusTrap) {
1395
1215
  updateTabbableNodes();
1396
1216
  }
1397
1217
  addListeners();
1398
- updateObservedNodes();
1399
- onPostActivate === null || onPostActivate === void 0 ? void 0 : onPostActivate();
1218
+ if (onPostActivate) {
1219
+ onPostActivate();
1220
+ }
1400
1221
  };
1401
1222
  if (checkCanFocusTrap) {
1402
1223
  checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
@@ -1419,19 +1240,22 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1419
1240
  removeListeners();
1420
1241
  state.active = false;
1421
1242
  state.paused = false;
1422
- updateObservedNodes();
1423
1243
  activeFocusTraps.deactivateTrap(trapStack, trap);
1424
1244
  var onDeactivate = getOption(options, 'onDeactivate');
1425
1245
  var onPostDeactivate = getOption(options, 'onPostDeactivate');
1426
1246
  var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
1427
1247
  var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
1428
- onDeactivate === null || onDeactivate === void 0 ? void 0 : onDeactivate();
1248
+ if (onDeactivate) {
1249
+ onDeactivate();
1250
+ }
1429
1251
  var finishDeactivation = function finishDeactivation() {
1430
1252
  delay(function () {
1431
1253
  if (returnFocus) {
1432
1254
  tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
1433
1255
  }
1434
- onPostDeactivate === null || onPostDeactivate === void 0 ? void 0 : onPostDeactivate();
1256
+ if (onPostDeactivate) {
1257
+ onPostDeactivate();
1258
+ }
1435
1259
  });
1436
1260
  };
1437
1261
  if (returnFocus && checkCanReturnFocus) {
@@ -1441,31 +1265,21 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1441
1265
  finishDeactivation();
1442
1266
  return this;
1443
1267
  },
1444
- pause: function pause(pauseOptions) {
1268
+ pause: function pause() {
1445
1269
  if (state.paused || !state.active) {
1446
1270
  return this;
1447
1271
  }
1448
- var onPause = getOption(pauseOptions, 'onPause');
1449
- var onPostPause = getOption(pauseOptions, 'onPostPause');
1450
1272
  state.paused = true;
1451
- onPause === null || onPause === void 0 ? void 0 : onPause();
1452
1273
  removeListeners();
1453
- updateObservedNodes();
1454
- onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
1455
1274
  return this;
1456
1275
  },
1457
- unpause: function unpause(unpauseOptions) {
1276
+ unpause: function unpause() {
1458
1277
  if (!state.paused || !state.active) {
1459
1278
  return this;
1460
1279
  }
1461
- var onUnpause = getOption(unpauseOptions, 'onUnpause');
1462
- var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
1463
1280
  state.paused = false;
1464
- onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
1465
1281
  updateTabbableNodes();
1466
1282
  addListeners();
1467
- updateObservedNodes();
1468
- onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
1469
1283
  return this;
1470
1284
  },
1471
1285
  updateContainerElements: function updateContainerElements(containerElements) {
@@ -1476,7 +1290,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1476
1290
  if (state.active) {
1477
1291
  updateTabbableNodes();
1478
1292
  }
1479
- updateObservedNodes();
1480
1293
  return this;
1481
1294
  }
1482
1295
  };
@@ -1 +1 @@
1
- export { q as default } from '../OrCode-f7708644.js';
1
+ export { q as default } from '../OrCode-46b1b8aa.js';
@@ -1 +1 @@
1
- export { O as OrCodeLanguages } from '../OrCode-f7708644.js';
1
+ export { O as OrCodeLanguages } from '../OrCode-46b1b8aa.js';
@@ -1 +1 @@
1
- export { q as OrCode, O as OrCodeLanguages, b as basicSetup, h as html, j as javascript, d as json, e as jsonParseLinter, c as lintGutter, l as linter } from '../OrCode-f7708644.js';
1
+ export { q as OrCode, O as OrCodeLanguages, b as basicSetup, h as html, j as javascript, d as json, e as jsonParseLinter, c as lintGutter, l as linter } from '../OrCode-46b1b8aa.js';
@@ -1 +1 @@
1
- export { r as CSS, u as HTML, J as JS, v as JSON, M as MD, T as TS, w as default } from '../OrCode-f7708644.js';
1
+ export { r as CSS, u as HTML, J as JS, v as JSON, M as MD, T as TS, w as default } from '../OrCode-46b1b8aa.js';
@@ -1 +1 @@
1
- export { b as basicSetup, h as html, j as javascript, d as json, e as jsonParseLinter, c as lintGutter, l as linter } from '../OrCode-f7708644.js';
1
+ export { b as basicSetup, h as html, j as javascript, d as json, e as jsonParseLinter, c as lintGutter, l as linter } from '../OrCode-46b1b8aa.js';
@@ -1 +1 @@
1
- export { x as color, A as default, z as orCodeHighlightStyle, y as orCodeTheme } from '../OrCode-f7708644.js';
1
+ export { x as color, A as default, z as orCodeHighlightStyle, y as orCodeTheme } from '../OrCode-46b1b8aa.js';