@brightleaf/elements
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -18,3 +18,3 @@ "use strict"; | ||
var _elementAttributes = _interopRequireDefault(require("../element-attributes")); | ||
var _elementAttributes = _interopRequireWildcard(require("../element-attributes")); | ||
@@ -44,3 +44,3 @@ var _propTypes2 = require("../utils/prop-types"); | ||
var clean = _elementAttributes.default['*'].concat(_elementAttributes.default[Element] || []).reduce(function (objs, current) { | ||
var clean = _elementAttributes.default['*'].concat(_elementAttributes.default[Element] || []).concat(_elementAttributes.ariaAttributes).reduce(function (objs, current) { | ||
if (props[current]) { | ||
@@ -47,0 +47,0 @@ objs[current] = props[current]; |
@@ -6,3 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = exports.htmlAttributes = void 0; | ||
exports.default = exports.htmlAttributes = exports.ariaAttributes = void 0; | ||
var ariaAttributes = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-dropeffect', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-grabbed', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'role']; | ||
exports.ariaAttributes = ariaAttributes; | ||
var htmlAttributes = ['acceptCharset', 'accessKey', 'allowFullScreen', 'allowTransparency', 'autoComplete', 'autoFocus', 'autoPlay', 'capture', 'cellPadding', 'cellSpacing', 'charSet', 'classID', 'className', 'colSpan', 'contentEditable', 'contextMenu', 'crossOrigin', 'dangerouslySetInnerHTML', 'dateTime', 'dir', 'draggable', 'encType', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'hidden', 'hrefLang', 'htmlFor', 'httpEquiv', 'id', 'inputMode', 'is', 'itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType', 'keyParams', 'keyType', 'lang', 'marginHeight', 'marginWidth', 'maxLength', 'mediaGroup', 'minLength', 'noValidate', 'radioGroup', 'readOnly', 'role', 'rowSpan', 'scoped', 'seamless', 'spellCheck', 'srcDoc', 'srcLang', 'srcSet', 'style', 'suppressContentEditableWarning', 'tabIndex', 'title', 'useMap', 'wmode']; | ||
@@ -9,0 +11,0 @@ exports.htmlAttributes = htmlAttributes; |
@@ -16,2 +16,4 @@ "use strict"; | ||
var _base = require("../base"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -23,2 +25,4 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
@@ -185,18 +189,6 @@ | ||
var children = _ref9.children, | ||
isTransparent = _ref9.isTransparent, | ||
isFixedTop = _ref9.isFixedTop, | ||
isFixedBottom = _ref9.isFixedBottom, | ||
isSpaced = _ref9.isSpaced, | ||
isPrimary = _ref9.isPrimary, | ||
isSuccess = _ref9.isSuccess, | ||
isInfo = _ref9.isInfo, | ||
isWarning = _ref9.isWarning, | ||
isDanger = _ref9.isDanger, | ||
isLink = _ref9.isLink, | ||
isLight = _ref9.isLight, | ||
isWhite = _ref9.isWhite, | ||
isDark = _ref9.isDark, | ||
isBlack = _ref9.isBlack, | ||
isText = _ref9.isText, | ||
className = _ref9.className; | ||
className = _ref9.className, | ||
props = _objectWithoutProperties(_ref9, ["children", "isFixedTop", "isFixedBottom", "className"]); | ||
@@ -210,5 +202,9 @@ // is-transparent is-fixed-top is-fixed-bottom | ||
(0, _react.useEffect)(function () { | ||
if (isFixedTop || isFixedBottom) { | ||
var body = document.body.querySelector('body'); | ||
if (!body) return; | ||
if (isFixedTop) { | ||
var body = document.body; | ||
if (!body) { | ||
return; | ||
} | ||
body.classList.add('has-navbar-fixed-top'); | ||
@@ -219,21 +215,21 @@ return function () { | ||
} | ||
if (isFixedBottom) { | ||
var _body = document.body; | ||
if (!_body) { | ||
return; | ||
} | ||
_body.classList.add('has-navbar-fixed-bottom'); | ||
return function () { | ||
_body.classList.remove('has-navbar-fixed-bottom'); | ||
}; | ||
} | ||
}, [isFixedTop, isFixedBottom]); | ||
var classes = (0, _classnames.default)('navbar', className, _objectSpread({ | ||
'is-transparent': isTransparent, | ||
var classes = (0, _classnames.default)('navbar', className, { | ||
'is-fixed-top': isFixedTop, | ||
'is-fixed-bottom': isFixedBottom, | ||
'is-spaced': isSpaced | ||
}, (0, _modifiers.Colors)({ | ||
isPrimary: isPrimary, | ||
isSuccess: isSuccess, | ||
isInfo: isInfo, | ||
isWarning: isWarning, | ||
isDanger: isDanger, | ||
isLink: isLink, | ||
isLight: isLight, | ||
isWhite: isWhite, | ||
isDark: isDark, | ||
isBlack: isBlack, | ||
isText: isText | ||
}))); | ||
'is-fixed-bottom': isFixedBottom | ||
}); | ||
@@ -259,9 +255,15 @@ var kids = _react.default.Children.map(children, function (child, i) { | ||
return _react.default.createElement("nav", { | ||
var propsToPass = { | ||
isActive: isActive, | ||
isFixedBottom: isFixedBottom, | ||
isFixedTop: isFixedTop | ||
}; | ||
return _react.default.createElement(_base.Base, _extends({ | ||
as: "nav", | ||
className: classes, | ||
role: "navigation", | ||
"aria-label": "main navigation" | ||
}, kids); | ||
}, props, propsToPass), kids); | ||
}; | ||
exports.NavBar = NavBar; |
{ | ||
"name": "@brightleaf/elements", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "React UI elements styled with Bulma CSS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
381643
143
8082