@longline/aqua-ui 1.0.115 → 1.0.117

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.
@@ -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 _d = React.useState(null), search = _d[0], setSearch = _d[1];
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 _e = usePopper(wrapperRef.current, bodyRef.current, {
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 = _e.styles, attributes = _e.attributes, update = _e.update;
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, upwards: upwards, transparent: props.transparent, ghost: props.ghost, multiple: props.multiple, onClick: handleSelectorClicked, onClear: (props.clearable && !showPlaceholder) ? handleClear : null, placeholder: showPlaceholder }, label),
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? */
@@ -6,11 +6,16 @@ interface IProps {
6
6
  children?: React.ReactNode;
7
7
  /** Is filter in an active state? Is any filtering current active? */
8
8
  active?: boolean;
9
+ /**
10
+ * Pane width in pixels.
11
+ * @default 250
12
+ */
13
+ width?: number;
9
14
  }
10
15
  /**
11
16
  * A `Filter` is a combination of a filter button and a panel. The panel is
12
17
  * shown as a React portal in order to rise above all other content and not
13
18
  * be clipped.
14
19
  */
15
- declare const Filter: (props: IProps) => React.JSX.Element;
20
+ declare const Filter: ({ width, ...props }: IProps) => React.JSX.Element;
16
21
  export { Filter };
@@ -13,6 +13,17 @@ var __assign = (this && this.__assign) || function () {
13
13
  };
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
+ var __rest = (this && this.__rest) || function (s, e) {
17
+ var t = {};
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
+ t[p] = s[p];
20
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
+ t[p[i]] = s[p[i]];
24
+ }
25
+ return t;
26
+ };
16
27
  import * as React from 'react';
17
28
  import styled from 'styled-components';
18
29
  import { createPortal } from 'react-dom';
@@ -62,21 +73,24 @@ var FilterBase = function (props) {
62
73
  };
63
74
  return (React.createElement("div", { className: props.className },
64
75
  React.createElement(FilterButton, { ref: buttonRef, active: props.active, open: open, onClick: toggleOpen }),
65
- createPortal(React.createElement(Pane, __assign({ "$open": open, style: styles.popper }, attributes.popper, { ref: paneRef }),
76
+ createPortal(React.createElement(Pane, __assign({ "$open": open, "$width": props.width, style: styles.popper }, attributes.popper, { ref: paneRef }),
66
77
  React.createElement(GlassPane, { padded: true, bordered: true }, props.children)), document.body)));
67
78
  };
68
- var Pane = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n min-width: 200px;\n z-index: 2500;\n"], ["\n display: ", ";\n min-width: 200px;\n z-index: 2500;\n"
79
+ var Pane = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"], ["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"
69
80
  /**
70
81
  * A `Filter` is a combination of a filter button and a panel. The panel is
71
82
  * shown as a React portal in order to rise above all other content and not
72
83
  * be clipped.
73
84
  */
74
- ])), function (p) { return p.$open ? 'block' : 'none'; });
85
+ ])), function (p) { return p.$open ? 'block' : 'none'; }, function (p) { return p.$width; });
75
86
  /**
76
87
  * A `Filter` is a combination of a filter button and a panel. The panel is
77
88
  * shown as a React portal in order to rise above all other content and not
78
89
  * be clipped.
79
90
  */
80
- var Filter = function (props) { return React.createElement(FilterBase, __assign({}, props)); };
91
+ var Filter = function (_a) {
92
+ var _b = _a.width, width = _b === void 0 ? 250 : _b, props = __rest(_a, ["width"]);
93
+ return React.createElement(FilterBase, __assign({ width: width }, props));
94
+ };
81
95
  export { Filter };
82
96
  var templateObject_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.115",
3
+ "version": "1.0.117",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",