@longline/aqua-ui 1.0.115 → 1.0.116
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/inputs/Dropdown/Body.js
CHANGED
|
@@ -17,7 +17,7 @@ import * as React from 'react';
|
|
|
17
17
|
import styled, { css } from 'styled-components';
|
|
18
18
|
import { List } from '../../containers/List';
|
|
19
19
|
var BodyBase = React.forwardRef(function (props, ref) {
|
|
20
|
-
return (React.createElement("div", __assign({ style: props.styles.popper }, props.attributes.popper, { className: "".concat(props.className), tabIndex: -1, ref: ref }),
|
|
20
|
+
return (React.createElement("div", __assign({ style: props.styles.popper }, props.attributes.popper, { className: "".concat(props.className), tabIndex: -1, ref: ref, onMouseDown: function (e) { return e.stopPropagation(); } }),
|
|
21
21
|
React.createElement(List, { tall: props.tall, maxItems: props.maxItems, contract: true, onSearch: props.onSearch }, props.children)));
|
|
22
22
|
});
|
|
23
23
|
var Body = styled(BodyBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n z-index: 9999 !important;\n outline: none;\n box-sizing: border-box;\n visibility: ", ";\n font: ", ";\n\n // Width:\n ", "\n \n transition: opacity ", "ms ease-in-out,\n max-height 0ms linear ", "ms;\n max-height: 0;\n opacity: 0;\n ", "\n"], ["\n z-index: 9999 !important;\n outline: none;\n box-sizing: border-box;\n visibility: ", ";\n font: ", ";\n\n // Width:\n ", "\n \n transition: opacity ", "ms ease-in-out,\n max-height 0ms linear ", "ms;\n max-height: 0;\n opacity: 0;\n ", "\n"])), function (p) { return p.open ? 'visible' : 'hidden'; }, function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.minBodyWidth && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n min-width: ", "px;\n "], ["\n min-width: ", "px;\n "])), p.minBodyWidth); }, function (p) { return p.theme.animation.duration * 0; }, function (p) { return p.theme.animation.duration * 0; }, function (p) { return p.open && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n transition: opacity ", "ms ease-in,\n max-height 0ms linear;\n max-height: 1000px;\n opacity: 1;\n "], ["\n transition: opacity ", "ms ease-in,\n max-height 0ms linear;\n max-height: 1000px;\n opacity: 1;\n "])), function (p) { return p.theme.animation.duration; }); });
|
|
@@ -105,11 +105,8 @@ var DropdownBase = function (props) {
|
|
|
105
105
|
var bodyRef = React.useRef(null);
|
|
106
106
|
// Is dropdown currently open?
|
|
107
107
|
var _b = React.useState(false), open = _b[0], setOpen = _b[1];
|
|
108
|
-
// Does the Dropdown open upwards? This happens when it is on the lower half
|
|
109
|
-
// of the viewport.
|
|
110
|
-
var _c = React.useState(false), upwards = _c[0], setUpwards = _c[1];
|
|
111
108
|
// Current search query.
|
|
112
|
-
var
|
|
109
|
+
var _c = React.useState(null), search = _c[0], setSearch = _c[1];
|
|
113
110
|
// A mousedown event listener is attached to the document. When the document
|
|
114
111
|
// is clicked anywhere but this Dropdown, the Dropdown closes.
|
|
115
112
|
React.useEffect(function () {
|
|
@@ -384,7 +381,7 @@ var DropdownBase = function (props) {
|
|
|
384
381
|
wrapperRef.current.children[0].click();
|
|
385
382
|
};
|
|
386
383
|
var children = getBodyChildren();
|
|
387
|
-
var
|
|
384
|
+
var _d = usePopper(wrapperRef.current, bodyRef.current, {
|
|
388
385
|
placement: props.direction == 'down' ? 'bottom' : 'top',
|
|
389
386
|
modifiers: [
|
|
390
387
|
{
|
|
@@ -395,9 +392,9 @@ var DropdownBase = function (props) {
|
|
|
395
392
|
},
|
|
396
393
|
sameWidth
|
|
397
394
|
]
|
|
398
|
-
}), styles =
|
|
395
|
+
}), styles = _d.styles, attributes = _d.attributes, update = _d.update;
|
|
399
396
|
return (React.createElement("div", { className: props.className, tabIndex: props.disabled ? -1 : 0, ref: wrapperRef, onKeyDown: handleKeyDown, onClick: handleClickDropdown },
|
|
400
|
-
React.createElement(Selector, { open: open, error: props.error, disabled: props.disabled,
|
|
397
|
+
React.createElement(Selector, { open: open, error: props.error, disabled: props.disabled, transparent: props.transparent, ghost: props.ghost, multiple: props.multiple, onClick: handleSelectorClicked, onClear: (props.clearable && !showPlaceholder) ? handleClear : null, placeholder: showPlaceholder }, label),
|
|
401
398
|
createPortal(React.createElement(Body, { ref: bodyRef, open: open, transparent: props.transparent, maxItems: props.maxItems, onSearch: props.onSearch ? handleSearch : null, search: search, tall: props.tall, minBodyWidth: props.minBodyWidth, styles: styles, attributes: attributes }, children), document.body)));
|
|
402
399
|
};
|
|
403
400
|
var DropdownStyled = styled(DropdownBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n // Dropdown has a minimum width. \n width: 250px;\n // A fluid Dropdown occupies full horizontal width. \n ", " \n outline: none;\n user-select: none;\n font: ", ";\n color: ", ";\n"], ["\n position: relative;\n // Dropdown has a minimum width. \n width: 250px;\n // A fluid Dropdown occupies full horizontal width. \n ", " \n outline: none;\n user-select: none;\n font: ", ";\n color: ", ";\n"
|
|
@@ -8,8 +8,6 @@ interface IProps {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
/** Is the Dropdown currently open? */
|
|
10
10
|
open: boolean;
|
|
11
|
-
/** A Dropbox can open upwards, which affects its styles. */
|
|
12
|
-
upwards: boolean;
|
|
13
11
|
/** Is the Dropdown transparent, i.e. without a border? */
|
|
14
12
|
transparent?: boolean;
|
|
15
13
|
/** Is the Dropdown ghosted? */
|