@longline/aqua-ui 1.0.113 → 1.0.115

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.
@@ -9,7 +9,7 @@ interface IProps {
9
9
  /** An `active` row will be highlighted. */
10
10
  active?: boolean;
11
11
  /** Triggered when row is clicked. */
12
- onClick?: () => void;
12
+ onClick?: (e?: React.MouseEvent) => void;
13
13
  }
14
14
  declare const ListRow: (props: IProps) => React.JSX.Element;
15
15
  export { ListRow };
@@ -16,7 +16,7 @@ var __assign = (this && this.__assign) || function () {
16
16
  import * as React from 'react';
17
17
  import styled, { css } from 'styled-components';
18
18
  var ListRowBase = function (props) {
19
- return (React.createElement("div", { className: props.className, onClick: props.onClick }, props.children));
19
+ return (React.createElement("div", { className: props.className, onClick: function (e) { return props.onClick(e); } }, props.children));
20
20
  };
21
21
  var ListRowStyled = styled(ListRowBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-left: 16px;\n padding-right: 16px;\n min-height: 42px;\n user-select: none;\n outline: none;\n color: ", ";\n\n // Entire row is clickable:\n cursor: ", ";\n\n // Cells are flex-aligned:\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n gap: ", "px;\n\n // Background color on hover:\n &:hover {\n background-color: ", ";\n }\n\n // Background color on pressed:\n ", "\n\n ", "\n"], ["\n padding-left: 16px;\n padding-right: 16px;\n min-height: 42px;\n user-select: none;\n outline: none;\n color: ", ";\n\n // Entire row is clickable:\n cursor: ", ";\n\n // Cells are flex-aligned:\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n gap: ", "px;\n\n // Background color on hover:\n &:hover {\n background-color: ", ";\n }\n\n // Background color on pressed:\n ", "\n\n ", "\n"])), function (p) { return p.theme.colors.neutral[30]; }, function (p) { return p.onClick ? 'pointer' : 'auto'; }, function (p) { return p.gap; }, function (p) { return p.theme.colors.neutral[95]; }, function (p) { return p.onClick && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:active {\n background-color: rgb(from ", " r g b / 65%) !important;\n color: ", ";\n }\n "], ["\n &:active {\n background-color: rgb(from ", " r g b / 65%) !important;\n color: ", ";\n }\n "])), function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.active && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: rgb(from ", " r g b / 45%) !important;\n color: ", ";\n "], ["\n background-color: rgb(from ", " r g b / 45%) !important;\n color: ", ";\n "])), function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.neutral[100]; }); });
22
22
  var ListRow = function (props) { return React.createElement(ListRowStyled, __assign({}, props)); };
@@ -73,6 +73,9 @@ var DateInputBase = function (props) {
73
73
  var handleToggle = function () {
74
74
  if (!open) {
75
75
  doOpen();
76
+ // Update popper position.
77
+ if (update)
78
+ update();
76
79
  }
77
80
  else {
78
81
  setOpen(false);
@@ -104,7 +107,7 @@ var DateInputBase = function (props) {
104
107
  },
105
108
  }
106
109
  ]
107
- }), styles = _c.styles, attributes = _c.attributes;
110
+ }), styles = _c.styles, attributes = _c.attributes, update = _c.update;
108
111
  return (React.createElement("div", { tabIndex: -1, className: props.className, onKeyDown: handleKeyDown, ref: wrapperRef },
109
112
  React.createElement(Selector, { value: value, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, error: props.error, clearable: props.clearable, noTabIndex: props.noTabIndex, onChange: handleChange, onClear: (!props.disabled && props.clearable && value != null) ? function () { return handleChange(null); } : null, onCalendar: handleToggle }),
110
113
  createPortal(React.createElement(Body, { ref: bodyRef, value: value, open: open, transparent: props.transparent, nofuture: props.nofuture, onSelect: handleSelect, styles: styles, attributes: attributes }), document.body)));
@@ -134,6 +134,9 @@ var DropdownBase = function (props) {
134
134
  // Open the dropdown.
135
135
  var doOpen = function () {
136
136
  setOpen(true);
137
+ // Update popper.
138
+ if (update)
139
+ update();
137
140
  // If reset on open is specified, then the search query is reset whenever the
138
141
  // dropdown opens or reopens.
139
142
  if (props.resetOnOpen)
@@ -199,7 +202,7 @@ var DropdownBase = function (props) {
199
202
  });
200
203
  // Was a matching row found?
201
204
  if (idx != -1) {
202
- handleClick((props.data || [])[idx]);
205
+ handleClick(null, (props.data || [])[idx]);
203
206
  }
204
207
  };
205
208
  var selectPreviousItem = function () {
@@ -278,7 +281,9 @@ var DropdownBase = function (props) {
278
281
  updateValue(item);
279
282
  };
280
283
  // An item was clicked. Close Dropdown and call onChange.
281
- var handleClick = function (item) {
284
+ var handleClick = function (e, item) {
285
+ if (e)
286
+ e.stopPropagation();
282
287
  // Is this a multiple-selection dropdown?
283
288
  if (props.multiple) {
284
289
  var array = value;
@@ -342,7 +347,7 @@ var DropdownBase = function (props) {
342
347
  });
343
348
  var activeIndex = (props.data || []).indexOf(value);
344
349
  return (props.data || []).map(function (row, index) {
345
- return (React.createElement(ListRow, { active: index == activeIndex, key: index + 1, gap: props.gap, onClick: function () { return handleClick(row); } }, columns.map(function (child, index) {
350
+ return (React.createElement(ListRow, { active: index == activeIndex, key: index + 1, gap: props.gap, onClick: function (e) { return handleClick(e, row); } }, columns.map(function (child, index) {
346
351
  return (React.createElement(ListCell, { key: index, width: child.props.width, align: child.props.align }, row !== null && child.props.children(row)));
347
352
  })));
348
353
  });
@@ -390,7 +395,7 @@ var DropdownBase = function (props) {
390
395
  },
391
396
  sameWidth
392
397
  ]
393
- }), styles = _e.styles, attributes = _e.attributes;
398
+ }), styles = _e.styles, attributes = _e.attributes, update = _e.update;
394
399
  return (React.createElement("div", { className: props.className, tabIndex: props.disabled ? -1 : 0, ref: wrapperRef, onKeyDown: handleKeyDown, onClick: handleClickDropdown },
395
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),
396
401
  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)));
@@ -53,9 +53,12 @@ var FilterBase = function (props) {
53
53
  },
54
54
  }
55
55
  ]
56
- }), styles = _b.styles, attributes = _b.attributes;
56
+ }), styles = _b.styles, attributes = _b.attributes, update = _b.update;
57
57
  var toggleOpen = function () {
58
58
  setOpen(!open);
59
+ // Update popper.
60
+ if (update)
61
+ update();
59
62
  };
60
63
  return (React.createElement("div", { className: props.className },
61
64
  React.createElement(FilterButton, { ref: buttonRef, active: props.active, open: open, onClick: toggleOpen }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.113",
3
+ "version": "1.0.115",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",