@clayui/shared
Advanced tools
Comparing version 3.77.0 to 3.78.0
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
declare function delegate(element: HTMLElement, eventName: keyof GlobalEventHandlersEventMap, selector: string, callback: (event: any) => void): { | ||
declare function delegate(element: HTMLElement, eventName: keyof GlobalEventHandlersEventMap, selector: string, callback: (event: any) => void, capture?: boolean): { | ||
dispose(): void; | ||
@@ -8,0 +8,0 @@ }; |
@@ -17,3 +17,3 @@ "use strict"; | ||
function delegate(element, eventName, selector, callback) { | ||
function delegate(element, eventName, selector, callback, capture) { | ||
var eventHandler = function eventHandler(event) { | ||
@@ -37,6 +37,6 @@ var defaultPrevented = event.defaultPrevented, | ||
element.addEventListener(eventName, eventHandler); | ||
element.addEventListener(eventName, eventHandler, capture); | ||
return { | ||
dispose: function dispose() { | ||
element.removeEventListener(eventName, eventHandler); | ||
element.removeEventListener(eventName, eventHandler, capture); | ||
} | ||
@@ -43,0 +43,0 @@ }; |
@@ -91,12 +91,10 @@ "use strict"; | ||
ref: function ref(r) { | ||
if (r) { | ||
elRef.current = r; | ||
var _ref2 = child.ref; | ||
elRef.current = r; | ||
var ref = child.ref; | ||
if (_ref2) { | ||
if (_typeof(_ref2) === 'object') { | ||
_ref2.current = r; | ||
} else if (typeof _ref2 === 'function') { | ||
_ref2(r); | ||
} | ||
if (ref) { | ||
if (_typeof(ref) === 'object') { | ||
ref.current = r; | ||
} else if (typeof ref === 'function') { | ||
ref(r); | ||
} | ||
@@ -103,0 +101,0 @@ } |
@@ -22,3 +22,4 @@ /** | ||
export { MouseSafeArea } from './MouseSafeArea'; | ||
export { useInteractionFocus } from './useInteractionFocus'; | ||
export type { IBaseProps as IPortalBaseProps } from './Portal'; | ||
export type { InternalDispatch } from './useInternalState'; |
@@ -97,2 +97,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "useInteractionFocus", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useInteractionFocus.useInteractionFocus; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useInternalState", { | ||
@@ -143,2 +149,4 @@ enumerable: true, | ||
var _useInteractionFocus = require("./useInteractionFocus"); | ||
/** | ||
@@ -145,0 +153,0 @@ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com> |
@@ -69,3 +69,7 @@ "use strict"; | ||
return Array.from(document.querySelectorAll(FOCUSABLE_ELEMENTS.join(','))).filter(function (element) { | ||
return isFocusable(element); | ||
if (isFocusable(element)) { | ||
return window.getComputedStyle(element).visibility !== 'hidden'; | ||
} | ||
return false; | ||
}); | ||
@@ -135,5 +139,9 @@ } // https://github.com/facebook/react/pull/15849#diff-39a673d38713257d5fe7d90aac2acb5aR107 | ||
var getFocusableElementsInScope = function getFocusableElementsInScope(fiberNode) { | ||
var _fiberNode$alternate; | ||
var focusableElements = []; | ||
var child = fiberNode.child; | ||
var _ref2 = (_fiberNode$alternate = fiberNode.alternate) !== null && _fiberNode$alternate !== void 0 ? _fiberNode$alternate : fiberNode, | ||
child = _ref2.child; | ||
if (child !== null) { | ||
@@ -140,0 +148,0 @@ collectFocusableElements(child, focusableElements); |
{ | ||
"name": "@clayui/shared", | ||
"version": "3.77.0", | ||
"version": "3.78.0", | ||
"description": "ClayShared component", | ||
@@ -44,3 +44,3 @@ "license": "BSD-3-Clause", | ||
], | ||
"gitHead": "edd3cfe3a397c48057632f76945b2ae9be1bfa58" | ||
"gitHead": "128788059d168c956b392363054933db34c67cab" | ||
} |
@@ -14,3 +14,4 @@ /** | ||
selector: string, | ||
callback: (event: any) => void | ||
callback: (event: any) => void, | ||
capture?: boolean | ||
) { | ||
@@ -42,7 +43,11 @@ const eventHandler = (event: { | ||
element.addEventListener(eventName, eventHandler as any); | ||
element.addEventListener(eventName, eventHandler as any, capture); | ||
return { | ||
dispose() { | ||
element.removeEventListener(eventName, eventHandler as any); | ||
element.removeEventListener( | ||
eventName, | ||
eventHandler as any, | ||
capture | ||
); | ||
}, | ||
@@ -49,0 +54,0 @@ }; |
@@ -91,3 +91,9 @@ /** | ||
document.querySelectorAll(FOCUSABLE_ELEMENTS.join(',')) | ||
).filter((element) => isFocusable(element)); | ||
).filter((element) => { | ||
if (isFocusable(element)) { | ||
return window.getComputedStyle(element).visibility !== 'hidden'; | ||
} | ||
return false; | ||
}); | ||
} | ||
@@ -158,3 +164,3 @@ | ||
const focusableElements: Array<any> = []; | ||
const {child} = fiberNode; | ||
const {child} = fiberNode.alternate ?? fiberNode; | ||
@@ -161,0 +167,0 @@ if (child !== null) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104334
2952
59
2858