@arch-ui/dropdown
Advanced tools
Comparing version 0.0.9 to 0.0.10
# @arch-ui/dropdown | ||
## 0.0.10 | ||
### Patch Changes | ||
- [`946a52fd`](https://github.com/keystonejs/keystone/commit/946a52fd7057bb73f4ffd465ef51498172926866) [#1995](https://github.com/keystonejs/keystone/pull/1995) Thanks [@Vultraz](https://github.com/Vultraz)! - Updated `react` and `react-dom` to 16.12.0. | ||
- Updated dependencies [[`946a52fd`](https://github.com/keystonejs/keystone/commit/946a52fd7057bb73f4ffd465ef51498172926866)]: | ||
- @arch-ui/modal-utils@1.0.4 | ||
## 0.0.9 | ||
@@ -4,0 +12,0 @@ |
@@ -21,3 +21,3 @@ 'use strict'; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -130,6 +130,2 @@ const ItemElement = props => { | ||
_defineProperty(this, "menu", void 0); | ||
_defineProperty(this, "lastHover", void 0); | ||
_defineProperty(this, "state", { | ||
@@ -136,0 +132,0 @@ leftOffset: 0, |
@@ -27,5 +27,5 @@ "use strict"; | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(source, !0).forEach((function(key) { | ||
i % 2 ? ownKeys(Object(source), !0).forEach((function(key) { | ||
_defineProperty(target, key, source[key]); | ||
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(source).forEach((function(key) { | ||
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach((function(key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -117,4 +117,3 @@ })); | ||
constructor() { | ||
super(...arguments), _defineProperty(this, "menu", void 0), _defineProperty(this, "lastHover", void 0), | ||
_defineProperty(this, "state", { | ||
super(...arguments), _defineProperty(this, "state", { | ||
leftOffset: 0, | ||
@@ -121,0 +120,0 @@ topOffset: 0 |
@@ -1,4 +0,4 @@ | ||
import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties'; | ||
import _extends from '@babel/runtime/helpers/extends'; | ||
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty'; | ||
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties'; | ||
import _extends from '@babel/runtime/helpers/esm/extends'; | ||
import { Component } from 'react'; | ||
@@ -15,3 +15,3 @@ import { Link } from 'react-router-dom'; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -124,6 +124,2 @@ const ItemElement = props => { | ||
_defineProperty(this, "menu", void 0); | ||
_defineProperty(this, "lastHover", void 0); | ||
_defineProperty(this, "state", { | ||
@@ -130,0 +126,0 @@ leftOffset: 0, |
{ | ||
"name": "@arch-ui/dropdown", | ||
"description": "Dropdown UI as used in @keystonejs Admin UI.", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"author": "Jed Watson", | ||
@@ -9,11 +9,11 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6" | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0" | ||
}, | ||
"devDependencies": { | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6" | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0" | ||
}, | ||
"dependencies": { | ||
"@arch-ui/modal-utils": "^1.0.3", | ||
"@arch-ui/modal-utils": "^1.0.4", | ||
"@arch-ui/theme": "^0.0.5", | ||
@@ -20,0 +20,0 @@ "@babel/runtime": "^7.4.3", |
@@ -1,5 +0,4 @@ | ||
// @flow | ||
/** @jsx jsx */ | ||
import { Component, type Node as ReactNode, type Element } from 'react'; | ||
import { Component } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
@@ -12,3 +11,3 @@ import { createPortal } from 'react-dom'; | ||
import { FocusTrap } from 'react-focus-marshal'; | ||
import { withModalHandlers, slideDown, type ModalHandlerProps } from '@arch-ui/modal-utils'; | ||
import { withModalHandlers, slideDown } from '@arch-ui/modal-utils'; | ||
@@ -83,27 +82,3 @@ const ItemElement = props => { | ||
type ItemType = { | ||
content: ReactNode, | ||
href?: string, | ||
icon?: Element<*>, | ||
isDisabled: boolean, | ||
onClick?: (*) => void, | ||
to?: string, | ||
}; | ||
type ClickArgs = { onClick?: ({ event: MouseEvent, data: Object }) => void }; | ||
type Props = ModalHandlerProps & { | ||
align: 'left' | 'right', | ||
getModalRef: HTMLElement => void, | ||
items: Array<ItemType>, | ||
mouseCoords: { clientX: number, clientY: number }, | ||
selectClosesMenu: boolean, | ||
style: Object, | ||
targetNode: HTMLElement, | ||
}; | ||
type State = { | ||
leftOffset: number, | ||
topOffset: number, | ||
}; | ||
function focus(el: ?HTMLElement) { | ||
function focus(el) { | ||
if (el && el instanceof HTMLElement && typeof el.focus === 'function') { | ||
@@ -114,5 +89,3 @@ el.focus(); | ||
class Dropdown extends Component<Props, State> { | ||
menu: HTMLElement; | ||
lastHover: HTMLElement; | ||
class Dropdown extends Component { | ||
state = { leftOffset: 0, topOffset: 0 }; | ||
@@ -132,3 +105,3 @@ static defaultProps = { | ||
handleItemClick = ({ onClick, ...data }: ClickArgs) => (event: MouseEvent) => { | ||
handleItemClick = ({ onClick, ...data }) => event => { | ||
const { close, selectClosesMenu } = this.props; | ||
@@ -138,3 +111,3 @@ if (selectClosesMenu) close(event); | ||
}; | ||
handleKeyDown = (event: KeyboardEvent) => { | ||
handleKeyDown = event => { | ||
const { key, target } = event; | ||
@@ -159,6 +132,6 @@ | ||
const firstItem = ((this.menu.firstChild: any): HTMLElement); | ||
const lastItem = ((this.menu.lastChild: any): HTMLElement); | ||
const previousItem = ((target.previousSibling: any): HTMLElement); | ||
const nextItem = ((target.nextSibling: any): HTMLElement); | ||
const firstItem = this.menu.firstChild; | ||
const lastItem = this.menu.lastChild; | ||
const previousItem = target.previousSibling; | ||
const nextItem = target.nextSibling; | ||
@@ -175,3 +148,3 @@ // typical item traversal | ||
}; | ||
handleMouseEnter = ({ target }: MouseEvent) => { | ||
handleMouseEnter = ({ target }) => { | ||
if (target instanceof HTMLElement) { | ||
@@ -178,0 +151,0 @@ this.lastHover = target; |
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
36540
8
975
+ Addedresolve@1.22.10(transitive)
- Removedresolve@1.22.9(transitive)
Updated@arch-ui/modal-utils@^1.0.4