react-overlays
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -1,2 +0,2 @@ | ||
export declare function ariaHidden(show: boolean, node: Element | null | undefined): void; | ||
export declare function ariaHidden(hide: boolean, node: Element | null | undefined): void; | ||
interface SiblingExclusions { | ||
@@ -3,0 +3,0 @@ dialog: Element; |
@@ -23,6 +23,6 @@ "use strict"; | ||
function ariaHidden(show, node) { | ||
function ariaHidden(hide, node) { | ||
if (!node) return; | ||
if (show) { | ||
if (hide) { | ||
node.setAttribute('aria-hidden', 'true'); | ||
@@ -29,0 +29,0 @@ } else { |
@@ -33,2 +33,36 @@ "use strict"; | ||
var ariaDescribedByModifier = { | ||
name: 'ariaDescribedBy', | ||
enabled: true, | ||
phase: 'afterWrite', | ||
effect: function effect(_ref) { | ||
var state = _ref.state; | ||
return function () { | ||
var _state$elements = state.elements, | ||
reference = _state$elements.reference, | ||
popper = _state$elements.popper; | ||
if ('removeAttribute' in reference) { | ||
var ids = (reference.getAttribute('aria-describedby') || '').split(',').filter(function (id) { | ||
return id.trim() !== popper.id; | ||
}); | ||
if (!ids.length) reference.removeAttribute('aria-describedby');else reference.setAttribute('aria-describedby', ids.join(',')); | ||
} | ||
}; | ||
}, | ||
fn: function fn(_ref2) { | ||
var _popper$getAttribute; | ||
var state = _ref2.state; | ||
var _state$elements2 = state.elements, | ||
popper = _state$elements2.popper, | ||
reference = _state$elements2.reference; | ||
var role = (_popper$getAttribute = popper.getAttribute('role')) == null ? void 0 : _popper$getAttribute.toLowerCase(); | ||
if (popper.id && role === 'tooltip' && 'setAttribute' in reference) { | ||
var ids = reference.getAttribute('aria-describedby'); | ||
reference.setAttribute('aria-describedby', ids ? ids + "," + popper.id : popper.id); | ||
} | ||
} | ||
}; | ||
var EMPTY_MODIFIERS = []; | ||
@@ -53,12 +87,12 @@ /** | ||
function usePopper(referenceElement, popperElement, _temp) { | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$enabled = _ref.enabled, | ||
enabled = _ref$enabled === void 0 ? true : _ref$enabled, | ||
_ref$placement = _ref.placement, | ||
placement = _ref$placement === void 0 ? 'bottom' : _ref$placement, | ||
_ref$strategy = _ref.strategy, | ||
strategy = _ref$strategy === void 0 ? 'absolute' : _ref$strategy, | ||
_ref$modifiers = _ref.modifiers, | ||
modifiers = _ref$modifiers === void 0 ? EMPTY_MODIFIERS : _ref$modifiers, | ||
config = (0, _objectWithoutPropertiesLoose2["default"])(_ref, ["enabled", "placement", "strategy", "modifiers"]); | ||
var _ref3 = _temp === void 0 ? {} : _temp, | ||
_ref3$enabled = _ref3.enabled, | ||
enabled = _ref3$enabled === void 0 ? true : _ref3$enabled, | ||
_ref3$placement = _ref3.placement, | ||
placement = _ref3$placement === void 0 ? 'bottom' : _ref3$placement, | ||
_ref3$strategy = _ref3.strategy, | ||
strategy = _ref3$strategy === void 0 ? 'absolute' : _ref3$strategy, | ||
_ref3$modifiers = _ref3.modifiers, | ||
modifiers = _ref3$modifiers === void 0 ? EMPTY_MODIFIERS : _ref3$modifiers, | ||
config = (0, _objectWithoutPropertiesLoose2["default"])(_ref3, ["enabled", "placement", "strategy", "modifiers"]); | ||
@@ -96,4 +130,4 @@ var popperInstanceRef = (0, _react.useRef)(); | ||
requires: ['computeStyles'], | ||
fn: function fn(_ref2) { | ||
var state = _ref2.state; | ||
fn: function fn(_ref4) { | ||
var state = _ref4.state; | ||
var styles = {}; | ||
@@ -133,3 +167,3 @@ var attributes = {}; | ||
strategy: strategy, | ||
modifiers: [].concat(modifiers, [updateModifier]) | ||
modifiers: [].concat(modifiers, [ariaDescribedByModifier, updateModifier]) | ||
})); | ||
@@ -136,0 +170,0 @@ return function () { |
@@ -1,2 +0,2 @@ | ||
export declare function ariaHidden(show: boolean, node: Element | null | undefined): void; | ||
export declare function ariaHidden(hide: boolean, node: Element | null | undefined): void; | ||
interface SiblingExclusions { | ||
@@ -3,0 +3,0 @@ dialog: Element; |
@@ -17,6 +17,6 @@ var BLACKLIST = ['template', 'script', 'style']; | ||
export function ariaHidden(show, node) { | ||
export function ariaHidden(hide, node) { | ||
if (!node) return; | ||
if (show) { | ||
if (hide) { | ||
node.setAttribute('aria-hidden', 'true'); | ||
@@ -23,0 +23,0 @@ } else { |
@@ -22,2 +22,36 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
var ariaDescribedByModifier = { | ||
name: 'ariaDescribedBy', | ||
enabled: true, | ||
phase: 'afterWrite', | ||
effect: function effect(_ref) { | ||
var state = _ref.state; | ||
return function () { | ||
var _state$elements = state.elements, | ||
reference = _state$elements.reference, | ||
popper = _state$elements.popper; | ||
if ('removeAttribute' in reference) { | ||
var ids = (reference.getAttribute('aria-describedby') || '').split(',').filter(function (id) { | ||
return id.trim() !== popper.id; | ||
}); | ||
if (!ids.length) reference.removeAttribute('aria-describedby');else reference.setAttribute('aria-describedby', ids.join(',')); | ||
} | ||
}; | ||
}, | ||
fn: function fn(_ref2) { | ||
var _popper$getAttribute; | ||
var state = _ref2.state; | ||
var _state$elements2 = state.elements, | ||
popper = _state$elements2.popper, | ||
reference = _state$elements2.reference; | ||
var role = (_popper$getAttribute = popper.getAttribute('role')) == null ? void 0 : _popper$getAttribute.toLowerCase(); | ||
if (popper.id && role === 'tooltip' && 'setAttribute' in reference) { | ||
var ids = reference.getAttribute('aria-describedby'); | ||
reference.setAttribute('aria-describedby', ids ? ids + "," + popper.id : popper.id); | ||
} | ||
} | ||
}; | ||
var EMPTY_MODIFIERS = []; | ||
@@ -42,12 +76,12 @@ /** | ||
function usePopper(referenceElement, popperElement, _temp) { | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$enabled = _ref.enabled, | ||
enabled = _ref$enabled === void 0 ? true : _ref$enabled, | ||
_ref$placement = _ref.placement, | ||
placement = _ref$placement === void 0 ? 'bottom' : _ref$placement, | ||
_ref$strategy = _ref.strategy, | ||
strategy = _ref$strategy === void 0 ? 'absolute' : _ref$strategy, | ||
_ref$modifiers = _ref.modifiers, | ||
modifiers = _ref$modifiers === void 0 ? EMPTY_MODIFIERS : _ref$modifiers, | ||
config = _objectWithoutPropertiesLoose(_ref, ["enabled", "placement", "strategy", "modifiers"]); | ||
var _ref3 = _temp === void 0 ? {} : _temp, | ||
_ref3$enabled = _ref3.enabled, | ||
enabled = _ref3$enabled === void 0 ? true : _ref3$enabled, | ||
_ref3$placement = _ref3.placement, | ||
placement = _ref3$placement === void 0 ? 'bottom' : _ref3$placement, | ||
_ref3$strategy = _ref3.strategy, | ||
strategy = _ref3$strategy === void 0 ? 'absolute' : _ref3$strategy, | ||
_ref3$modifiers = _ref3.modifiers, | ||
modifiers = _ref3$modifiers === void 0 ? EMPTY_MODIFIERS : _ref3$modifiers, | ||
config = _objectWithoutPropertiesLoose(_ref3, ["enabled", "placement", "strategy", "modifiers"]); | ||
@@ -85,4 +119,4 @@ var popperInstanceRef = useRef(); | ||
requires: ['computeStyles'], | ||
fn: function fn(_ref2) { | ||
var state = _ref2.state; | ||
fn: function fn(_ref4) { | ||
var state = _ref4.state; | ||
var styles = {}; | ||
@@ -122,3 +156,3 @@ var attributes = {}; | ||
strategy: strategy, | ||
modifiers: [].concat(modifiers, [updateModifier]) | ||
modifiers: [].concat(modifiers, [ariaDescribedByModifier, updateModifier]) | ||
})); | ||
@@ -125,0 +159,0 @@ return function () { |
{ | ||
"name": "react-overlays", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Utilities for creating robust overlay components", | ||
@@ -5,0 +5,0 @@ "author": { |
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
236939
5816