@onereach/ui-components 8.19.2 → 8.19.3-beta.3976.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/{useFocusTrap-2354d4f3.js → useFocusTrap-2df16342.js} +307 -120
- 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-46b1b8aa.js → OrCode-f7708644.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-d8e1ec2f.js → OrCodeV3-6dbd233d.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-f95a3ce6.js → OrConfirm-66387c1f.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-26accd85.js → OrConfirmV3-0a0d83f0.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-3aad4d27.js → OrModal-70fa6d2d.js} +307 -120
- 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-46b9246b.js → OrRichTextEditorV3-f3786714.js} +2 -2
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +4 -4
- package/dist/bundled/v3/components/index.js +6 -6
- package/dist/bundled/v3/index.js +6 -6
- package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +7 -7
- package/dist/esm/v2/components/or-textarea/OrTextarea.vue.d.ts +2 -2
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +4 -4
- package/package.json +6 -6
- package/src/components/or-select-v3/OrSelect.vue +3 -3
|
@@ -584,7 +584,7 @@ var isFocusable = function isFocusable(node, options) {
|
|
|
584
584
|
};
|
|
585
585
|
|
|
586
586
|
/*!
|
|
587
|
-
* focus-trap 7.2
|
|
587
|
+
* focus-trap 7.5.2
|
|
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 e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
|
|
670
|
+
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;
|
|
671
671
|
};
|
|
672
672
|
var isTabEvent = function isTabEvent(e) {
|
|
673
|
-
return e.key === 'Tab' || e.keyCode === 9;
|
|
673
|
+
return (e === null || e === void 0 ? void 0 : e.key) === 'Tab' || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
|
|
674
674
|
};
|
|
675
675
|
|
|
676
676
|
// checks for TAB by default
|
|
@@ -754,8 +754,11 @@ 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
|
-
//
|
|
757
|
+
// posTabIndexesFound: boolean,
|
|
758
|
+
// firstTabbableNode: HTMLElement|undefined,
|
|
759
|
+
// lastTabbableNode: HTMLElement|undefined,
|
|
760
|
+
// firstDomTabbableNode: HTMLElement|undefined,
|
|
761
|
+
// lastDomTabbableNode: HTMLElement|undefined,
|
|
759
762
|
// nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
|
|
760
763
|
// }>}
|
|
761
764
|
containerGroups: [],
|
|
@@ -772,7 +775,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
772
775
|
paused: false,
|
|
773
776
|
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
774
777
|
// has been delayed during activation
|
|
775
|
-
delayInitialFocusTimer: undefined
|
|
778
|
+
delayInitialFocusTimer: undefined,
|
|
779
|
+
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
780
|
+
recentNavEvent: undefined
|
|
776
781
|
};
|
|
777
782
|
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
|
|
778
783
|
|
|
@@ -791,23 +796,27 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
791
796
|
/**
|
|
792
797
|
* Finds the index of the container that contains the element.
|
|
793
798
|
* @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.
|
|
794
802
|
* @returns {number} Index of the container in either `state.containers` or
|
|
795
803
|
* `state.containerGroups` (the order/length of these lists are the same); -1
|
|
796
804
|
* if the element isn't found.
|
|
797
805
|
*/
|
|
798
|
-
var findContainerIndex = function findContainerIndex(element) {
|
|
806
|
+
var findContainerIndex = function findContainerIndex(element, event) {
|
|
807
|
+
var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
|
|
799
808
|
// NOTE: search `containerGroups` because it's possible a group contains no tabbable
|
|
800
809
|
// nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
|
|
801
810
|
// and we still need to find the element in there
|
|
802
811
|
return state.containerGroups.findIndex(function (_ref) {
|
|
803
812
|
var container = _ref.container,
|
|
804
813
|
tabbableNodes = _ref.tabbableNodes;
|
|
805
|
-
return container.contains(element) ||
|
|
814
|
+
return container.contains(element) || (
|
|
806
815
|
// fall back to explicit tabbable search which will take into consideration any
|
|
807
816
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
808
817
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
809
818
|
// look inside web components even if open)
|
|
810
|
-
tabbableNodes.find(function (node) {
|
|
819
|
+
composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) {
|
|
811
820
|
return node === element;
|
|
812
821
|
});
|
|
813
822
|
});
|
|
@@ -863,8 +872,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
863
872
|
if (node === false) {
|
|
864
873
|
return false;
|
|
865
874
|
}
|
|
866
|
-
if (node === undefined) {
|
|
867
|
-
// option not specified: use fallback options
|
|
875
|
+
if (node === undefined || !isFocusable(node, config.tabbableOptions)) {
|
|
876
|
+
// option not specified nor focusable: use fallback options
|
|
868
877
|
if (findContainerIndex(doc.activeElement) >= 0) {
|
|
869
878
|
node = doc.activeElement;
|
|
870
879
|
} else {
|
|
@@ -885,14 +894,41 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
885
894
|
var tabbableNodes = tabbable(container, config.tabbableOptions);
|
|
886
895
|
|
|
887
896
|
// NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
|
|
888
|
-
// are a superset of tabbable nodes
|
|
897
|
+
// are a superset of tabbable nodes since nodes with negative `tabindex` attributes
|
|
898
|
+
// are focusable but not tabbable
|
|
889
899
|
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
|
+
});
|
|
890
911
|
return {
|
|
891
912
|
container: container,
|
|
892
913
|
tabbableNodes: tabbableNodes,
|
|
893
914
|
focusableNodes: focusableNodes,
|
|
894
|
-
|
|
895
|
-
|
|
915
|
+
/** True if at least one node with positive `tabindex` was found in this container. */
|
|
916
|
+
posTabIndexesFound: posTabIndexesFound,
|
|
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,
|
|
896
932
|
/**
|
|
897
933
|
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
898
934
|
* in this container, if any.
|
|
@@ -903,30 +939,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
903
939
|
*/
|
|
904
940
|
nextTabbableNode: function nextTabbableNode(node) {
|
|
905
941
|
var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
906
|
-
|
|
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
|
-
});
|
|
942
|
+
var nodeIdx = tabbableNodes.indexOf(node);
|
|
919
943
|
if (nodeIdx < 0) {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
944
|
+
// either not tabbable nor focusable, or was focused but not tabbable (negative tabindex):
|
|
945
|
+
// since `node` should at least have been focusable, we assume that's the case and mimic
|
|
946
|
+
// what browsers do, which is set focus to the next node in __document position order__,
|
|
947
|
+
// regardless of positive tabindexes, if any -- and for reasons explained in the NOTE
|
|
948
|
+
// above related to `firstDomTabbable` and `lastDomTabbable` properties, we fall back to
|
|
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);
|
|
925
957
|
});
|
|
926
958
|
}
|
|
927
|
-
return
|
|
928
|
-
return isTabbable(n, config.tabbableOptions);
|
|
929
|
-
});
|
|
959
|
+
return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
|
|
930
960
|
}
|
|
931
961
|
};
|
|
932
962
|
});
|
|
@@ -939,6 +969,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
939
969
|
) {
|
|
940
970
|
throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
|
|
941
971
|
}
|
|
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
|
+
}
|
|
942
985
|
};
|
|
943
986
|
var tryFocus = function tryFocus(node) {
|
|
944
987
|
if (node === false) {
|
|
@@ -954,6 +997,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
954
997
|
node.focus({
|
|
955
998
|
preventScroll: !!config.preventScroll
|
|
956
999
|
});
|
|
1000
|
+
// NOTE: focus() API does not trigger focusIn event so set MRU node manually
|
|
957
1001
|
state.mostRecentlyFocusedNode = node;
|
|
958
1002
|
if (isSelectableInput(node)) {
|
|
959
1003
|
node.select();
|
|
@@ -964,76 +1008,30 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
964
1008
|
return node ? node : node === false ? false : previousActiveElement;
|
|
965
1009
|
};
|
|
966
1010
|
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
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);
|
|
1011
|
+
/**
|
|
1012
|
+
* Finds the next node (in either direction) where focus should move according to a
|
|
1013
|
+
* keyboard focus-in event.
|
|
1014
|
+
* @param {Object} params
|
|
1015
|
+
* @param {Node} [params.target] Known target __from which__ to navigate, if any.
|
|
1016
|
+
* @param {KeyboardEvent|FocusEvent} [params.event] Event to use if `target` isn't known (event
|
|
1017
|
+
* will be used to determine the `target`). Ignored if `target` is specified.
|
|
1018
|
+
* @param {boolean} [params.isBackward] True if focus should move backward.
|
|
1019
|
+
* @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be
|
|
1020
|
+
* determined given the current state of the trap.
|
|
1021
|
+
*/
|
|
1022
|
+
var findNextNavNode = function findNextNavNode(_ref2) {
|
|
1023
|
+
var target = _ref2.target,
|
|
1024
|
+
event = _ref2.event,
|
|
1025
|
+
_ref2$isBackward = _ref2.isBackward,
|
|
1026
|
+
isBackward = _ref2$isBackward === void 0 ? false : _ref2$isBackward;
|
|
1027
|
+
target = target || getActualTarget(event);
|
|
1030
1028
|
updateTabbableNodes();
|
|
1031
1029
|
var destinationNode = null;
|
|
1032
1030
|
if (state.tabbableGroups.length > 0) {
|
|
1033
1031
|
// make sure the target is actually contained in a group
|
|
1034
1032
|
// NOTE: the target may also be the container itself if it's focusable
|
|
1035
1033
|
// with tabIndex='-1' and was given initial focus
|
|
1036
|
-
var containerIndex = findContainerIndex(target);
|
|
1034
|
+
var containerIndex = findContainerIndex(target, event);
|
|
1037
1035
|
var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
|
|
1038
1036
|
if (containerIndex < 0) {
|
|
1039
1037
|
// target not found in any group: quite possible focus has escaped the trap,
|
|
@@ -1049,8 +1047,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1049
1047
|
// REVERSE
|
|
1050
1048
|
|
|
1051
1049
|
// is the target the first tabbable node in a group?
|
|
1052
|
-
var startOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
1053
|
-
var firstTabbableNode =
|
|
1050
|
+
var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
|
|
1051
|
+
var firstTabbableNode = _ref3.firstTabbableNode;
|
|
1054
1052
|
return target === firstTabbableNode;
|
|
1055
1053
|
});
|
|
1056
1054
|
if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
|
|
@@ -1068,7 +1066,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1068
1066
|
// the LAST group if it's the first tabbable node of the FIRST group)
|
|
1069
1067
|
var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
|
|
1070
1068
|
var destinationGroup = state.tabbableGroups[destinationGroupIndex];
|
|
1071
|
-
destinationNode = destinationGroup.lastTabbableNode;
|
|
1069
|
+
destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
|
|
1072
1070
|
} else if (!isTabEvent(event)) {
|
|
1073
1071
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
1074
1072
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -1078,8 +1076,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1078
1076
|
// FORWARD
|
|
1079
1077
|
|
|
1080
1078
|
// is the target the last tabbable node in a group?
|
|
1081
|
-
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (
|
|
1082
|
-
var lastTabbableNode =
|
|
1079
|
+
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
|
|
1080
|
+
var lastTabbableNode = _ref4.lastTabbableNode;
|
|
1083
1081
|
return target === lastTabbableNode;
|
|
1084
1082
|
});
|
|
1085
1083
|
if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
|
|
@@ -1097,7 +1095,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1097
1095
|
// group if it's the last tabbable node of the LAST group)
|
|
1098
1096
|
var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
|
|
1099
1097
|
var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
|
|
1100
|
-
destinationNode = _destinationGroup.firstTabbableNode;
|
|
1098
|
+
destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
|
|
1101
1099
|
} else if (!isTabEvent(event)) {
|
|
1102
1100
|
// user must have customized the nav keys so we have to move focus manually _within_
|
|
1103
1101
|
// the active group: do this based on the order determined by tabbable()
|
|
@@ -1109,6 +1107,153 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1109
1107
|
// NOTE: the fallbackFocus option does not support returning false to opt-out
|
|
1110
1108
|
destinationNode = getNodeForOption('fallbackFocus');
|
|
1111
1109
|
}
|
|
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
|
+
});
|
|
1112
1257
|
if (destinationNode) {
|
|
1113
1258
|
if (isTabEvent(event)) {
|
|
1114
1259
|
// since tab natively moves focus, we wouldn't have a destination node unless we
|
|
@@ -1134,7 +1279,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1134
1279
|
};
|
|
1135
1280
|
var checkClick = function checkClick(e) {
|
|
1136
1281
|
var target = getActualTarget(e);
|
|
1137
|
-
if (findContainerIndex(target) >= 0) {
|
|
1282
|
+
if (findContainerIndex(target, e) >= 0) {
|
|
1138
1283
|
return;
|
|
1139
1284
|
}
|
|
1140
1285
|
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
|
@@ -1195,6 +1340,43 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1195
1340
|
return trap;
|
|
1196
1341
|
};
|
|
1197
1342
|
|
|
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
|
+
|
|
1198
1380
|
//
|
|
1199
1381
|
// TRAP DEFINITION
|
|
1200
1382
|
//
|
|
@@ -1219,17 +1401,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1219
1401
|
state.active = true;
|
|
1220
1402
|
state.paused = false;
|
|
1221
1403
|
state.nodeFocusedBeforeActivation = doc.activeElement;
|
|
1222
|
-
|
|
1223
|
-
onActivate();
|
|
1224
|
-
}
|
|
1404
|
+
onActivate === null || onActivate === void 0 ? void 0 : onActivate();
|
|
1225
1405
|
var finishActivation = function finishActivation() {
|
|
1226
1406
|
if (checkCanFocusTrap) {
|
|
1227
1407
|
updateTabbableNodes();
|
|
1228
1408
|
}
|
|
1229
1409
|
addListeners();
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
}
|
|
1410
|
+
updateObservedNodes();
|
|
1411
|
+
onPostActivate === null || onPostActivate === void 0 ? void 0 : onPostActivate();
|
|
1233
1412
|
};
|
|
1234
1413
|
if (checkCanFocusTrap) {
|
|
1235
1414
|
checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
|
|
@@ -1252,22 +1431,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1252
1431
|
removeListeners();
|
|
1253
1432
|
state.active = false;
|
|
1254
1433
|
state.paused = false;
|
|
1434
|
+
updateObservedNodes();
|
|
1255
1435
|
activeFocusTraps.deactivateTrap(trapStack, trap);
|
|
1256
1436
|
var onDeactivate = getOption(options, 'onDeactivate');
|
|
1257
1437
|
var onPostDeactivate = getOption(options, 'onPostDeactivate');
|
|
1258
1438
|
var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
|
|
1259
1439
|
var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
|
|
1260
|
-
|
|
1261
|
-
onDeactivate();
|
|
1262
|
-
}
|
|
1440
|
+
onDeactivate === null || onDeactivate === void 0 ? void 0 : onDeactivate();
|
|
1263
1441
|
var finishDeactivation = function finishDeactivation() {
|
|
1264
1442
|
delay(function () {
|
|
1265
1443
|
if (returnFocus) {
|
|
1266
1444
|
tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
|
1267
1445
|
}
|
|
1268
|
-
|
|
1269
|
-
onPostDeactivate();
|
|
1270
|
-
}
|
|
1446
|
+
onPostDeactivate === null || onPostDeactivate === void 0 ? void 0 : onPostDeactivate();
|
|
1271
1447
|
});
|
|
1272
1448
|
};
|
|
1273
1449
|
if (returnFocus && checkCanReturnFocus) {
|
|
@@ -1277,21 +1453,31 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1277
1453
|
finishDeactivation();
|
|
1278
1454
|
return this;
|
|
1279
1455
|
},
|
|
1280
|
-
pause: function pause() {
|
|
1456
|
+
pause: function pause(pauseOptions) {
|
|
1281
1457
|
if (state.paused || !state.active) {
|
|
1282
1458
|
return this;
|
|
1283
1459
|
}
|
|
1460
|
+
var onPause = getOption(pauseOptions, 'onPause');
|
|
1461
|
+
var onPostPause = getOption(pauseOptions, 'onPostPause');
|
|
1284
1462
|
state.paused = true;
|
|
1463
|
+
onPause === null || onPause === void 0 ? void 0 : onPause();
|
|
1285
1464
|
removeListeners();
|
|
1465
|
+
updateObservedNodes();
|
|
1466
|
+
onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
|
|
1286
1467
|
return this;
|
|
1287
1468
|
},
|
|
1288
|
-
unpause: function unpause() {
|
|
1469
|
+
unpause: function unpause(unpauseOptions) {
|
|
1289
1470
|
if (!state.paused || !state.active) {
|
|
1290
1471
|
return this;
|
|
1291
1472
|
}
|
|
1473
|
+
var onUnpause = getOption(unpauseOptions, 'onUnpause');
|
|
1474
|
+
var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
|
|
1292
1475
|
state.paused = false;
|
|
1476
|
+
onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
|
|
1293
1477
|
updateTabbableNodes();
|
|
1294
1478
|
addListeners();
|
|
1479
|
+
updateObservedNodes();
|
|
1480
|
+
onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
|
|
1295
1481
|
return this;
|
|
1296
1482
|
},
|
|
1297
1483
|
updateContainerElements: function updateContainerElements(containerElements) {
|
|
@@ -1302,6 +1488,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1302
1488
|
if (state.active) {
|
|
1303
1489
|
updateTabbableNodes();
|
|
1304
1490
|
}
|
|
1491
|
+
updateObservedNodes();
|
|
1305
1492
|
return this;
|
|
1306
1493
|
}
|
|
1307
1494
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { s as default } from '../OrRichTextEditorV3-
|
|
1
|
+
export { s as default } from '../OrRichTextEditorV3-f3786714.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditorV3-
|
|
1
|
+
export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditorV3-f3786714.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as Formats } from '../OrRichTextEditorV3-
|
|
1
|
+
export { F as Formats } from '../OrRichTextEditorV3-f3786714.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-f3786714.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { i as default } from '../../../OrRichTextEditorV3-
|
|
2
|
-
import '../../../OrCode-
|
|
1
|
+
export { i as default } from '../../../OrRichTextEditorV3-f3786714.js';
|
|
2
|
+
import '../../../OrCode-f7708644.js';
|