@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.
- package/dist/bundled/v2/components/OrModal/OrModal.js +1 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
- package/dist/bundled/v2/components/OrSelectV3/OrSelect.vue.d.ts +7 -7
- package/dist/bundled/v2/components/OrTabsV3/OrTabs.js +20 -2
- package/dist/bundled/v2/components/OrTabsV3/OrTabs.vue.d.ts +13 -0
- package/dist/bundled/v2/{useFocusTrap-2df16342.js → useFocusTrap-2354d4f3.js} +120 -307
- package/dist/bundled/v3/components/OrCode/OrCode.js +1 -1
- package/dist/bundled/v3/components/OrCode/constants.js +1 -1
- package/dist/bundled/v3/components/OrCode/index.js +1 -1
- package/dist/bundled/v3/components/OrCode/lang.js +1 -1
- package/dist/bundled/v3/components/OrCode/libs.js +1 -1
- package/dist/bundled/v3/components/OrCode/theme.js +1 -1
- package/dist/bundled/v3/components/{OrCode-f7708644.js → OrCode-46b1b8aa.js} +1 -1
- package/dist/bundled/v3/components/OrCodeV3/OrCode.js +1 -1
- package/dist/bundled/v3/components/OrCodeV3/index.js +2 -2
- package/dist/bundled/v3/components/OrCodeV3/libs.js +1 -1
- package/dist/bundled/v3/components/OrCodeV3/props.js +1 -1
- package/dist/bundled/v3/components/OrCodeV3/styles.js +1 -1
- package/dist/bundled/v3/components/{OrCodeV3-6dbd233d.js → OrCodeV3-d8e1ec2f.js} +7 -7
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +1 -1
- package/dist/bundled/v3/components/OrConfirm/index.js +1 -1
- package/dist/bundled/v3/components/{OrConfirm-66387c1f.js → OrConfirm-f95a3ce6.js} +1 -1
- package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +1 -1
- package/dist/bundled/v3/components/OrConfirmV3/index.js +1 -1
- package/dist/bundled/v3/components/OrConfirmV3/props.js +1 -1
- package/dist/bundled/v3/components/OrConfirmV3/styles.js +1 -1
- package/dist/bundled/v3/components/{OrConfirmV3-0a0d83f0.js → OrConfirmV3-26accd85.js} +1 -1
- package/dist/bundled/v3/components/OrModal/OrModal.js +1 -1
- package/dist/bundled/v3/components/OrModal/constants.js +1 -1
- package/dist/bundled/v3/components/OrModal/index.js +1 -1
- package/dist/bundled/v3/components/{OrModal-70fa6d2d.js → OrModal-3aad4d27.js} +120 -307
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +2 -2
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +2 -2
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +2 -2
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
- package/dist/bundled/v3/components/{OrRichTextEditorV3-51a86e18.js → OrRichTextEditorV3-243f2ed9.js} +2 -2
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +4 -4
- package/dist/bundled/v3/components/OrTabsV3/OrTabs.js +1 -1
- package/dist/bundled/v3/components/OrTabsV3/OrTabs.vue.d.ts +10 -0
- package/dist/bundled/v3/components/OrTabsV3/index.js +1 -1
- package/dist/bundled/v3/components/OrTabsV3/props.js +1 -1
- package/dist/bundled/v3/components/OrTabsV3/styles.js +1 -1
- package/dist/bundled/v3/components/{OrTabsV3-b1db1d5a.js → OrTabsV3-d1028c81.js} +15 -3
- package/dist/bundled/v3/components/index.js +7 -7
- package/dist/bundled/v3/index.js +7 -7
- package/dist/esm/v2/{OrTabs-4935a772.js → OrTabs-b8df5b2e.js} +20 -2
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +7 -7
- package/dist/esm/v2/components/or-tabs-v3/OrTabs.vue.d.ts +13 -0
- package/dist/esm/v2/components/or-tabs-v3/index.js +1 -1
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/{OrTabs-c1a7955f.js → OrTabs-cd217d74.js} +15 -3
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +4 -4
- package/dist/esm/v3/components/or-tabs-v3/OrTabs.vue.d.ts +10 -0
- package/dist/esm/v3/components/or-tabs-v3/index.js +1 -1
- package/dist/esm/v3/index.js +1 -1
- package/package.json +6 -6
- package/src/components/or-select-v3/OrSelect.vue +3 -3
- package/src/components/or-tabs-v3/OrTabs.vue +19 -1
|
@@ -584,7 +584,7 @@ var isFocusable = function isFocusable(node, options) {
|
|
|
584
584
|
};
|
|
585
585
|
|
|
586
586
|
/*!
|
|
587
|
-
* focus-trap 7.
|
|
587
|
+
* focus-trap 7.2.0
|
|
588
588
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
589
589
|
*/
|
|
590
590
|
function ownKeys(object, enumerableOnly) {
|
|
@@ -667,10 +667,10 @@ var isSelectableInput = function isSelectableInput(node) {
|
|
|
667
667
|
return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
|
|
668
668
|
};
|
|
669
669
|
var isEscapeEvent = function isEscapeEvent(e) {
|
|
670
|
-
return
|
|
670
|
+
return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
|
|
671
671
|
};
|
|
672
672
|
var isTabEvent = function isTabEvent(e) {
|
|
673
|
-
return
|
|
673
|
+
return e.key === 'Tab' || e.keyCode === 9;
|
|
674
674
|
};
|
|
675
675
|
|
|
676
676
|
// checks for TAB by default
|
|
@@ -754,11 +754,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
754
754
|
// container: HTMLElement,
|
|
755
755
|
// tabbableNodes: Array<HTMLElement>, // empty if none
|
|
756
756
|
// focusableNodes: Array<HTMLElement>, // empty if none
|
|
757
|
-
//
|
|
758
|
-
//
|
|
759
|
-
// lastTabbableNode: HTMLElement|undefined,
|
|
760
|
-
// firstDomTabbableNode: HTMLElement|undefined,
|
|
761
|
-
// lastDomTabbableNode: HTMLElement|undefined,
|
|
757
|
+
// firstTabbableNode: HTMLElement|null,
|
|
758
|
+
// lastTabbableNode: HTMLElement|null,
|
|
762
759
|
// nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
|
|
763
760
|
// }>}
|
|
764
761
|
containerGroups: [],
|
|
@@ -775,9 +772,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
775
772
|
paused: false,
|
|
776
773
|
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
777
774
|
// has been delayed during activation
|
|
778
|
-
delayInitialFocusTimer: undefined
|
|
779
|
-
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
780
|
-
recentNavEvent: undefined
|
|
775
|
+
delayInitialFocusTimer: undefined
|
|
781
776
|
};
|
|
782
777
|
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
|
|
783
778
|
|
|
@@ -796,27 +791,23 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
796
791
|
/**
|
|
797
792
|
* Finds the index of the container that contains the element.
|
|
798
793
|
* @param {HTMLElement} element
|
|
799
|
-
* @param {Event} [event] If available, and `element` isn't directly found in any container,
|
|
800
|
-
* the event's composed path is used to see if includes any known trap containers in the
|
|
801
|
-
* case where the element is inside a Shadow DOM.
|
|
802
794
|
* @returns {number} Index of the container in either `state.containers` or
|
|
803
795
|
* `state.containerGroups` (the order/length of these lists are the same); -1
|
|
804
796
|
* if the element isn't found.
|
|
805
797
|
*/
|
|
806
|
-
var findContainerIndex = function findContainerIndex(element
|
|
807
|
-
var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
|
|
798
|
+
var findContainerIndex = function findContainerIndex(element) {
|
|
808
799
|
// NOTE: search `containerGroups` because it's possible a group contains no tabbable
|
|
809
800
|
// nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
|
|
810
801
|
// and we still need to find the element in there
|
|
811
802
|
return state.containerGroups.findIndex(function (_ref) {
|
|
812
803
|
var container = _ref.container,
|
|
813
804
|
tabbableNodes = _ref.tabbableNodes;
|
|
814
|
-
return container.contains(element) ||
|
|
805
|
+
return container.contains(element) ||
|
|
815
806
|
// fall back to explicit tabbable search which will take into consideration any
|
|
816
807
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
817
808
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
818
809
|
// look inside web components even if open)
|
|
819
|
-
|
|
810
|
+
tabbableNodes.find(function (node) {
|
|
820
811
|
return node === element;
|
|
821
812
|
});
|
|
822
813
|
});
|
|
@@ -872,8 +863,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
872
863
|
if (node === false) {
|
|
873
864
|
return false;
|
|
874
865
|
}
|
|
875
|
-
if (node === undefined
|
|
876
|
-
// option not specified
|
|
866
|
+
if (node === undefined) {
|
|
867
|
+
// option not specified: use fallback options
|
|
877
868
|
if (findContainerIndex(doc.activeElement) >= 0) {
|
|
878
869
|
node = doc.activeElement;
|
|
879
870
|
} else {
|
|
@@ -894,41 +885,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
894
885
|
var tabbableNodes = tabbable(container, config.tabbableOptions);
|
|
895
886
|
|
|
896
887
|
// NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
|
|
897
|
-
// are a superset of tabbable nodes
|
|
898
|
-
// are focusable but not tabbable
|
|
888
|
+
// are a superset of tabbable nodes
|
|
899
889
|
var focusableNodes = focusable(container, config.tabbableOptions);
|
|
900
|
-
var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : undefined;
|
|
901
|
-
var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : undefined;
|
|
902
|
-
var firstDomTabbableNode = focusableNodes.find(function (node) {
|
|
903
|
-
return isTabbable(node);
|
|
904
|
-
});
|
|
905
|
-
var lastDomTabbableNode = focusableNodes.slice().reverse().find(function (node) {
|
|
906
|
-
return isTabbable(node);
|
|
907
|
-
});
|
|
908
|
-
var posTabIndexesFound = !!tabbableNodes.find(function (node) {
|
|
909
|
-
return getTabIndex(node) > 0;
|
|
910
|
-
});
|
|
911
890
|
return {
|
|
912
891
|
container: container,
|
|
913
892
|
tabbableNodes: tabbableNodes,
|
|
914
893
|
focusableNodes: focusableNodes,
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
/** First tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
918
|
-
firstTabbableNode: firstTabbableNode,
|
|
919
|
-
/** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
920
|
-
lastTabbableNode: lastTabbableNode,
|
|
921
|
-
// NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
|
|
922
|
-
// would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
923
|
-
// because that API doesn't work with Shadow DOM as well as it should (@see
|
|
924
|
-
// https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
|
|
925
|
-
// to address an edge case related to positive tabindex support, this seems like a much easier,
|
|
926
|
-
// "close enough most of the time" alternative for positive tabindexes which should generally
|
|
927
|
-
// be avoided anyway...
|
|
928
|
-
/** First tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
929
|
-
firstDomTabbableNode: firstDomTabbableNode,
|
|
930
|
-
/** Last tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
931
|
-
lastDomTabbableNode: lastDomTabbableNode,
|
|
894
|
+
firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
|
|
895
|
+
lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
|
|
932
896
|
/**
|
|
933
897
|
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
934
898
|
* in this container, if any.
|
|
@@ -939,24 +903,30 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
939
903
|
*/
|
|
940
904
|
nextTabbableNode: function nextTabbableNode(node) {
|
|
941
905
|
var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
942
|
-
|
|
906
|
+
// NOTE: If tabindex is positive (in order to manipulate the tab order separate
|
|
907
|
+
// from the DOM order), this __will not work__ because the list of focusableNodes,
|
|
908
|
+
// while it contains tabbable nodes, does not sort its nodes in any order other
|
|
909
|
+
// than DOM order, because it can't: Where would you place focusable (but not
|
|
910
|
+
// tabbable) nodes in that order? They have no order, because they aren't tabbale...
|
|
911
|
+
// Support for positive tabindex is already broken and hard to manage (possibly
|
|
912
|
+
// not supportable, TBD), so this isn't going to make things worse than they
|
|
913
|
+
// already are, and at least makes things better for the majority of cases where
|
|
914
|
+
// tabindex is either 0/unset or negative.
|
|
915
|
+
// FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
|
|
916
|
+
var nodeIdx = focusableNodes.findIndex(function (n) {
|
|
917
|
+
return n === node;
|
|
918
|
+
});
|
|
943
919
|
if (nodeIdx < 0) {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
// basic DOM order
|
|
950
|
-
if (forward) {
|
|
951
|
-
return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function (el) {
|
|
952
|
-
return isTabbable(el);
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function (el) {
|
|
956
|
-
return isTabbable(el);
|
|
920
|
+
return undefined;
|
|
921
|
+
}
|
|
922
|
+
if (forward) {
|
|
923
|
+
return focusableNodes.slice(nodeIdx + 1).find(function (n) {
|
|
924
|
+
return isTabbable(n, config.tabbableOptions);
|
|
957
925
|
});
|
|
958
926
|
}
|
|
959
|
-
return
|
|
927
|
+
return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
|
|
928
|
+
return isTabbable(n, config.tabbableOptions);
|
|
929
|
+
});
|
|
960
930
|
}
|
|
961
931
|
};
|
|
962
932
|
});
|
|
@@ -969,19 +939,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
969
939
|
) {
|
|
970
940
|
throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
|
|
971
941
|
}
|
|
972
|
-
|
|
973
|
-
// NOTE: Positive tabindexes are only properly supported in single-container traps because
|
|
974
|
-
// doing it across multiple containers where tabindexes could be all over the place
|
|
975
|
-
// would require Tabbable to support multiple containers, would require additional
|
|
976
|
-
// specialized Shadow DOM support, and would require Tabbable's multi-container support
|
|
977
|
-
// to look at those containers in document position order rather than user-provided
|
|
978
|
-
// order (as they are treated in Focus-trap, for legacy reasons). See discussion on
|
|
979
|
-
// https://github.com/focus-trap/focus-trap/issues/375 for more details.
|
|
980
|
-
if (state.containerGroups.find(function (g) {
|
|
981
|
-
return g.posTabIndexesFound;
|
|
982
|
-
}) && state.containerGroups.length > 1) {
|
|
983
|
-
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.");
|
|
984
|
-
}
|
|
985
942
|
};
|
|
986
943
|
var tryFocus = function tryFocus(node) {
|
|
987
944
|
if (node === false) {
|
|
@@ -997,7 +954,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
997
954
|
node.focus({
|
|
998
955
|
preventScroll: !!config.preventScroll
|
|
999
956
|
});
|
|
1000
|
-
// NOTE: focus() API does not trigger focusIn event so set MRU node manually
|
|
1001
957
|
state.mostRecentlyFocusedNode = node;
|
|
1002
958
|
if (isSelectableInput(node)) {
|
|
1003
959
|
node.select();
|
|
@@ -1008,30 +964,76 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1008
964
|
return node ? node : node === false ? false : previousActiveElement;
|
|
1009
965
|
};
|
|
1010
966
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
967
|
+
// This needs to be done on mousedown and touchstart instead of click
|
|
968
|
+
// so that it precedes the focus event.
|
|
969
|
+
var checkPointerDown = function checkPointerDown(e) {
|
|
970
|
+
var target = getActualTarget(e);
|
|
971
|
+
if (findContainerIndex(target) >= 0) {
|
|
972
|
+
// allow the click since it ocurred inside the trap
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
|
976
|
+
// immediately deactivate the trap
|
|
977
|
+
trap.deactivate({
|
|
978
|
+
// if, on deactivation, we should return focus to the node originally-focused
|
|
979
|
+
// when the trap was activated (or the configured `setReturnFocus` node),
|
|
980
|
+
// then assume it's also OK to return focus to the outside node that was
|
|
981
|
+
// just clicked, causing deactivation, as long as that node is focusable;
|
|
982
|
+
// if it isn't focusable, then return focus to the original node focused
|
|
983
|
+
// on activation (or the configured `setReturnFocus` node)
|
|
984
|
+
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
985
|
+
// which will result in the outside click setting focus to the node
|
|
986
|
+
// that was clicked, whether it's focusable or not; by setting
|
|
987
|
+
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
988
|
+
// on activation (or the configured `setReturnFocus` node)
|
|
989
|
+
returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
|
|
990
|
+
});
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
// This is needed for mobile devices.
|
|
995
|
+
// (If we'll only let `click` events through,
|
|
996
|
+
// then on mobile they will be blocked anyways if `touchstart` is blocked.)
|
|
997
|
+
if (valueOrHandler(config.allowOutsideClick, e)) {
|
|
998
|
+
// allow the click outside the trap to take place
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// otherwise, prevent the click
|
|
1003
|
+
e.preventDefault();
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// In case focus escapes the trap for some strange reason, pull it back in.
|
|
1007
|
+
var checkFocusIn = function checkFocusIn(e) {
|
|
1008
|
+
var target = getActualTarget(e);
|
|
1009
|
+
var targetContained = findContainerIndex(target) >= 0;
|
|
1010
|
+
|
|
1011
|
+
// In Firefox when you Tab out of an iframe the Document is briefly focused.
|
|
1012
|
+
if (targetContained || target instanceof Document) {
|
|
1013
|
+
if (targetContained) {
|
|
1014
|
+
state.mostRecentlyFocusedNode = target;
|
|
1015
|
+
}
|
|
1016
|
+
} else {
|
|
1017
|
+
// escaped! pull it back in to where it just left
|
|
1018
|
+
e.stopImmediatePropagation();
|
|
1019
|
+
tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
// Hijack key nav events on the first and last focusable nodes of the trap,
|
|
1024
|
+
// in order to prevent focus from escaping. If it escapes for even a
|
|
1025
|
+
// moment it can end up scrolling the page and causing confusion so we
|
|
1026
|
+
// kind of need to capture the action at the keydown phase.
|
|
1027
|
+
var checkKeyNav = function checkKeyNav(event) {
|
|
1028
|
+
var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1029
|
+
var target = getActualTarget(event);
|
|
1028
1030
|
updateTabbableNodes();
|
|
1029
1031
|
var destinationNode = null;
|
|
1030
1032
|
if (state.tabbableGroups.length > 0) {
|
|
1031
1033
|
// make sure the target is actually contained in a group
|
|
1032
1034
|
// NOTE: the target may also be the container itself if it's focusable
|
|
1033
1035
|
// with tabIndex='-1' and was given initial focus
|
|
1034
|
-
var containerIndex = findContainerIndex(target
|
|
1036
|
+
var containerIndex = findContainerIndex(target);
|
|
1035
1037
|
var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
|
|
1036
1038
|
if (containerIndex < 0) {
|
|
1037
1039
|
// target not found in any group: quite possible focus has escaped the trap,
|
|
@@ -1047,8 +1049,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1047
1049
|
// REVERSE
|
|
1048
1050
|
|
|
1049
1051
|
// is the target the first tabbable node in a group?
|
|
1050
|
-
var startOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
1051
|
-
var firstTabbableNode =
|
|
1052
|
+
var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
|
|
1053
|
+
var firstTabbableNode = _ref2.firstTabbableNode;
|
|
1052
1054
|
return target === firstTabbableNode;
|
|
1053
1055
|
});
|
|
1054
1056
|
if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
|
|
@@ -1066,7 +1068,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1066
1068
|
// the LAST group if it's the first tabbable node of the FIRST group)
|
|
1067
1069
|
var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
|
|
1068
1070
|
var destinationGroup = state.tabbableGroups[destinationGroupIndex];
|
|
1069
|
-
destinationNode =
|
|
1071
|
+
destinationNode = destinationGroup.lastTabbableNode;
|
|
1070
1072
|
} else if (!isTabEvent(event)) {
|
|
1071
1073
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
1072
1074
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -1076,8 +1078,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1076
1078
|
// FORWARD
|
|
1077
1079
|
|
|
1078
1080
|
// is the target the last tabbable node in a group?
|
|
1079
|
-
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
1080
|
-
var lastTabbableNode =
|
|
1081
|
+
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
|
|
1082
|
+
var lastTabbableNode = _ref3.lastTabbableNode;
|
|
1081
1083
|
return target === lastTabbableNode;
|
|
1082
1084
|
});
|
|
1083
1085
|
if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
|
|
@@ -1095,7 +1097,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1095
1097
|
// group if it's the last tabbable node of the LAST group)
|
|
1096
1098
|
var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
|
|
1097
1099
|
var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
|
|
1098
|
-
destinationNode =
|
|
1100
|
+
destinationNode = _destinationGroup.firstTabbableNode;
|
|
1099
1101
|
} else if (!isTabEvent(event)) {
|
|
1100
1102
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
1101
1103
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -1107,153 +1109,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1107
1109
|
// NOTE: the fallbackFocus option does not support returning false to opt-out
|
|
1108
1110
|
destinationNode = getNodeForOption('fallbackFocus');
|
|
1109
1111
|
}
|
|
1110
|
-
return destinationNode;
|
|
1111
|
-
};
|
|
1112
|
-
|
|
1113
|
-
// This needs to be done on mousedown and touchstart instead of click
|
|
1114
|
-
// so that it precedes the focus event.
|
|
1115
|
-
var checkPointerDown = function checkPointerDown(e) {
|
|
1116
|
-
var target = getActualTarget(e);
|
|
1117
|
-
if (findContainerIndex(target, e) >= 0) {
|
|
1118
|
-
// allow the click since it ocurred inside the trap
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
|
1122
|
-
// immediately deactivate the trap
|
|
1123
|
-
trap.deactivate({
|
|
1124
|
-
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
1125
|
-
// which will result in the outside click setting focus to the node
|
|
1126
|
-
// that was clicked (and if not focusable, to "nothing"); by setting
|
|
1127
|
-
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
1128
|
-
// on activation (or the configured `setReturnFocus` node), whether the
|
|
1129
|
-
// outside click was on a focusable node or not
|
|
1130
|
-
returnFocus: config.returnFocusOnDeactivate
|
|
1131
|
-
});
|
|
1132
|
-
return;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
// This is needed for mobile devices.
|
|
1136
|
-
// (If we'll only let `click` events through,
|
|
1137
|
-
// then on mobile they will be blocked anyways if `touchstart` is blocked.)
|
|
1138
|
-
if (valueOrHandler(config.allowOutsideClick, e)) {
|
|
1139
|
-
// allow the click outside the trap to take place
|
|
1140
|
-
return;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
// otherwise, prevent the click
|
|
1144
|
-
e.preventDefault();
|
|
1145
|
-
};
|
|
1146
|
-
|
|
1147
|
-
// In case focus escapes the trap for some strange reason, pull it back in.
|
|
1148
|
-
// NOTE: the focusIn event is NOT cancelable, so if focus escapes, it may cause unexpected
|
|
1149
|
-
// scrolling if the node that got focused was out of view; there's nothing we can do to
|
|
1150
|
-
// prevent that from happening by the time we discover that focus escaped
|
|
1151
|
-
var checkFocusIn = function checkFocusIn(event) {
|
|
1152
|
-
var target = getActualTarget(event);
|
|
1153
|
-
var targetContained = findContainerIndex(target, event) >= 0;
|
|
1154
|
-
|
|
1155
|
-
// In Firefox when you Tab out of an iframe the Document is briefly focused.
|
|
1156
|
-
if (targetContained || target instanceof Document) {
|
|
1157
|
-
if (targetContained) {
|
|
1158
|
-
state.mostRecentlyFocusedNode = target;
|
|
1159
|
-
}
|
|
1160
|
-
} else {
|
|
1161
|
-
// escaped! pull it back in to where it just left
|
|
1162
|
-
event.stopImmediatePropagation();
|
|
1163
|
-
|
|
1164
|
-
// focus will escape if the MRU node had a positive tab index and user tried to nav forward;
|
|
1165
|
-
// it will also escape if the MRU node had a 0 tab index and user tried to nav backward
|
|
1166
|
-
// toward a node with a positive tab index
|
|
1167
|
-
var nextNode; // next node to focus, if we find one
|
|
1168
|
-
var navAcrossContainers = true;
|
|
1169
|
-
if (state.mostRecentlyFocusedNode) {
|
|
1170
|
-
if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
|
|
1171
|
-
// MRU container index must be >=0 otherwise we wouldn't have it as an MRU node...
|
|
1172
|
-
var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
|
|
1173
|
-
// there MAY not be any tabbable nodes in the container if there are at least 2 containers
|
|
1174
|
-
// and the MRU node is focusable but not tabbable (focus-trap requires at least 1 container
|
|
1175
|
-
// with at least one tabbable node in order to function, so this could be the other container
|
|
1176
|
-
// with nothing tabbable in it)
|
|
1177
|
-
var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
|
|
1178
|
-
if (tabbableNodes.length > 0) {
|
|
1179
|
-
// MRU tab index MAY not be found if the MRU node is focusable but not tabbable
|
|
1180
|
-
var mruTabIdx = tabbableNodes.findIndex(function (node) {
|
|
1181
|
-
return node === state.mostRecentlyFocusedNode;
|
|
1182
|
-
});
|
|
1183
|
-
if (mruTabIdx >= 0) {
|
|
1184
|
-
if (config.isKeyForward(state.recentNavEvent)) {
|
|
1185
|
-
if (mruTabIdx + 1 < tabbableNodes.length) {
|
|
1186
|
-
nextNode = tabbableNodes[mruTabIdx + 1];
|
|
1187
|
-
navAcrossContainers = false;
|
|
1188
|
-
}
|
|
1189
|
-
// else, don't wrap within the container as focus should move to next/previous
|
|
1190
|
-
// container
|
|
1191
|
-
} else {
|
|
1192
|
-
if (mruTabIdx - 1 >= 0) {
|
|
1193
|
-
nextNode = tabbableNodes[mruTabIdx - 1];
|
|
1194
|
-
navAcrossContainers = false;
|
|
1195
|
-
}
|
|
1196
|
-
// else, don't wrap within the container as focus should move to next/previous
|
|
1197
|
-
// container
|
|
1198
|
-
}
|
|
1199
|
-
// else, don't find in container order without considering direction too
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
// else, no tabbable nodes in that container (which means we must have at least one other
|
|
1203
|
-
// container with at least one tabbable node in it, otherwise focus-trap would've thrown
|
|
1204
|
-
// an error the last time updateTabbableNodes() was run): find next node among all known
|
|
1205
|
-
// containers
|
|
1206
|
-
} else {
|
|
1207
|
-
// check to see if there's at least one tabbable node with a positive tab index inside
|
|
1208
|
-
// the trap because focus seems to escape when navigating backward from a tabbable node
|
|
1209
|
-
// with tabindex=0 when this is the case (instead of wrapping to the tabbable node with
|
|
1210
|
-
// the greatest positive tab index like it should)
|
|
1211
|
-
if (!state.containerGroups.some(function (g) {
|
|
1212
|
-
return g.tabbableNodes.some(function (n) {
|
|
1213
|
-
return getTabIndex(n) > 0;
|
|
1214
|
-
});
|
|
1215
|
-
})) {
|
|
1216
|
-
// no containers with tabbable nodes with positive tab indexes which means the focus
|
|
1217
|
-
// escaped for some other reason and we should just execute the fallback to the
|
|
1218
|
-
// MRU node or initial focus node, if any
|
|
1219
|
-
navAcrossContainers = false;
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
} else {
|
|
1223
|
-
// no MRU node means we're likely in some initial condition when the trap has just
|
|
1224
|
-
// been activated and initial focus hasn't been given yet, in which case we should
|
|
1225
|
-
// fall through to trying to focus the initial focus node, which is what should
|
|
1226
|
-
// happen below at this point in the logic
|
|
1227
|
-
navAcrossContainers = false;
|
|
1228
|
-
}
|
|
1229
|
-
if (navAcrossContainers) {
|
|
1230
|
-
nextNode = findNextNavNode({
|
|
1231
|
-
// move FROM the MRU node, not event-related node (which will be the node that is
|
|
1232
|
-
// outside the trap causing the focus escape we're trying to fix)
|
|
1233
|
-
target: state.mostRecentlyFocusedNode,
|
|
1234
|
-
isBackward: config.isKeyBackward(state.recentNavEvent)
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
if (nextNode) {
|
|
1238
|
-
tryFocus(nextNode);
|
|
1239
|
-
} else {
|
|
1240
|
-
tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
state.recentNavEvent = undefined; // clear
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
|
-
// Hijack key nav events on the first and last focusable nodes of the trap,
|
|
1247
|
-
// in order to prevent focus from escaping. If it escapes for even a
|
|
1248
|
-
// moment it can end up scrolling the page and causing confusion so we
|
|
1249
|
-
// kind of need to capture the action at the keydown phase.
|
|
1250
|
-
var checkKeyNav = function checkKeyNav(event) {
|
|
1251
|
-
var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1252
|
-
state.recentNavEvent = event;
|
|
1253
|
-
var destinationNode = findNextNavNode({
|
|
1254
|
-
event: event,
|
|
1255
|
-
isBackward: isBackward
|
|
1256
|
-
});
|
|
1257
1112
|
if (destinationNode) {
|
|
1258
1113
|
if (isTabEvent(event)) {
|
|
1259
1114
|
// since tab natively moves focus, we wouldn't have a destination node unless we
|
|
@@ -1279,7 +1134,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1279
1134
|
};
|
|
1280
1135
|
var checkClick = function checkClick(e) {
|
|
1281
1136
|
var target = getActualTarget(e);
|
|
1282
|
-
if (findContainerIndex(target
|
|
1137
|
+
if (findContainerIndex(target) >= 0) {
|
|
1283
1138
|
return;
|
|
1284
1139
|
}
|
|
1285
1140
|
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
|
@@ -1340,43 +1195,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1340
1195
|
return trap;
|
|
1341
1196
|
};
|
|
1342
1197
|
|
|
1343
|
-
//
|
|
1344
|
-
// MUTATION OBSERVER
|
|
1345
|
-
//
|
|
1346
|
-
|
|
1347
|
-
var checkDomRemoval = function checkDomRemoval(mutations) {
|
|
1348
|
-
var isFocusedNodeRemoved = mutations.some(function (mutation) {
|
|
1349
|
-
var removedNodes = Array.from(mutation.removedNodes);
|
|
1350
|
-
return removedNodes.some(function (node) {
|
|
1351
|
-
return node === state.mostRecentlyFocusedNode;
|
|
1352
|
-
});
|
|
1353
|
-
});
|
|
1354
|
-
|
|
1355
|
-
// If the currently focused is removed then browsers will move focus to the
|
|
1356
|
-
// <body> element. If this happens, try to move focus back into the trap.
|
|
1357
|
-
if (isFocusedNodeRemoved) {
|
|
1358
|
-
tryFocus(getInitialFocusNode());
|
|
1359
|
-
}
|
|
1360
|
-
};
|
|
1361
|
-
|
|
1362
|
-
// Use MutationObserver - if supported - to detect if focused node is removed
|
|
1363
|
-
// from the DOM.
|
|
1364
|
-
var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined;
|
|
1365
|
-
var updateObservedNodes = function updateObservedNodes() {
|
|
1366
|
-
if (!mutationObserver) {
|
|
1367
|
-
return;
|
|
1368
|
-
}
|
|
1369
|
-
mutationObserver.disconnect();
|
|
1370
|
-
if (state.active && !state.paused) {
|
|
1371
|
-
state.containers.map(function (container) {
|
|
1372
|
-
mutationObserver.observe(container, {
|
|
1373
|
-
subtree: true,
|
|
1374
|
-
childList: true
|
|
1375
|
-
});
|
|
1376
|
-
});
|
|
1377
|
-
}
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
1198
|
//
|
|
1381
1199
|
// TRAP DEFINITION
|
|
1382
1200
|
//
|
|
@@ -1401,14 +1219,17 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1401
1219
|
state.active = true;
|
|
1402
1220
|
state.paused = false;
|
|
1403
1221
|
state.nodeFocusedBeforeActivation = doc.activeElement;
|
|
1404
|
-
|
|
1222
|
+
if (onActivate) {
|
|
1223
|
+
onActivate();
|
|
1224
|
+
}
|
|
1405
1225
|
var finishActivation = function finishActivation() {
|
|
1406
1226
|
if (checkCanFocusTrap) {
|
|
1407
1227
|
updateTabbableNodes();
|
|
1408
1228
|
}
|
|
1409
1229
|
addListeners();
|
|
1410
|
-
|
|
1411
|
-
|
|
1230
|
+
if (onPostActivate) {
|
|
1231
|
+
onPostActivate();
|
|
1232
|
+
}
|
|
1412
1233
|
};
|
|
1413
1234
|
if (checkCanFocusTrap) {
|
|
1414
1235
|
checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
|
|
@@ -1431,19 +1252,22 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1431
1252
|
removeListeners();
|
|
1432
1253
|
state.active = false;
|
|
1433
1254
|
state.paused = false;
|
|
1434
|
-
updateObservedNodes();
|
|
1435
1255
|
activeFocusTraps.deactivateTrap(trapStack, trap);
|
|
1436
1256
|
var onDeactivate = getOption(options, 'onDeactivate');
|
|
1437
1257
|
var onPostDeactivate = getOption(options, 'onPostDeactivate');
|
|
1438
1258
|
var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
|
|
1439
1259
|
var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
|
|
1440
|
-
|
|
1260
|
+
if (onDeactivate) {
|
|
1261
|
+
onDeactivate();
|
|
1262
|
+
}
|
|
1441
1263
|
var finishDeactivation = function finishDeactivation() {
|
|
1442
1264
|
delay(function () {
|
|
1443
1265
|
if (returnFocus) {
|
|
1444
1266
|
tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
|
1445
1267
|
}
|
|
1446
|
-
|
|
1268
|
+
if (onPostDeactivate) {
|
|
1269
|
+
onPostDeactivate();
|
|
1270
|
+
}
|
|
1447
1271
|
});
|
|
1448
1272
|
};
|
|
1449
1273
|
if (returnFocus && checkCanReturnFocus) {
|
|
@@ -1453,31 +1277,21 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1453
1277
|
finishDeactivation();
|
|
1454
1278
|
return this;
|
|
1455
1279
|
},
|
|
1456
|
-
pause: function pause(
|
|
1280
|
+
pause: function pause() {
|
|
1457
1281
|
if (state.paused || !state.active) {
|
|
1458
1282
|
return this;
|
|
1459
1283
|
}
|
|
1460
|
-
var onPause = getOption(pauseOptions, 'onPause');
|
|
1461
|
-
var onPostPause = getOption(pauseOptions, 'onPostPause');
|
|
1462
1284
|
state.paused = true;
|
|
1463
|
-
onPause === null || onPause === void 0 ? void 0 : onPause();
|
|
1464
1285
|
removeListeners();
|
|
1465
|
-
updateObservedNodes();
|
|
1466
|
-
onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
|
|
1467
1286
|
return this;
|
|
1468
1287
|
},
|
|
1469
|
-
unpause: function unpause(
|
|
1288
|
+
unpause: function unpause() {
|
|
1470
1289
|
if (!state.paused || !state.active) {
|
|
1471
1290
|
return this;
|
|
1472
1291
|
}
|
|
1473
|
-
var onUnpause = getOption(unpauseOptions, 'onUnpause');
|
|
1474
|
-
var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
|
|
1475
1292
|
state.paused = false;
|
|
1476
|
-
onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
|
|
1477
1293
|
updateTabbableNodes();
|
|
1478
1294
|
addListeners();
|
|
1479
|
-
updateObservedNodes();
|
|
1480
|
-
onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
|
|
1481
1295
|
return this;
|
|
1482
1296
|
},
|
|
1483
1297
|
updateContainerElements: function updateContainerElements(containerElements) {
|
|
@@ -1488,7 +1302,6 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1488
1302
|
if (state.active) {
|
|
1489
1303
|
updateTabbableNodes();
|
|
1490
1304
|
}
|
|
1491
|
-
updateObservedNodes();
|
|
1492
1305
|
return this;
|
|
1493
1306
|
}
|
|
1494
1307
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { s as default } from '../OrRichTextEditorV3-
|
|
1
|
+
export { s as default } from '../OrRichTextEditorV3-243f2ed9.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditorV3-
|
|
1
|
+
export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditorV3-243f2ed9.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as Formats } from '../OrRichTextEditorV3-
|
|
1
|
+
export { F as Formats } from '../OrRichTextEditorV3-243f2ed9.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { E as EditorContainer, f as EditorInput, b as Toolbar, c as ToolbarButton, e as ToolbarButtonFocused, T as ToolbarContainer } from '../OrRichTextEditorV3-
|
|
1
|
+
export { E as EditorContainer, f as EditorInput, b as Toolbar, c as ToolbarButton, e as ToolbarButtonFocused, T as ToolbarContainer } from '../OrRichTextEditorV3-243f2ed9.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { i as default } from '../../../OrRichTextEditorV3-
|
|
2
|
-
import '../../../OrCode-
|
|
1
|
+
export { i as default } from '../../../OrRichTextEditorV3-243f2ed9.js';
|
|
2
|
+
import '../../../OrCode-46b1b8aa.js';
|