@longline/aqua-ui 1.0.113 → 1.0.114
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)); };
|
|
@@ -199,7 +199,7 @@ var DropdownBase = function (props) {
|
|
|
199
199
|
});
|
|
200
200
|
// Was a matching row found?
|
|
201
201
|
if (idx != -1) {
|
|
202
|
-
handleClick((props.data || [])[idx]);
|
|
202
|
+
handleClick(null, (props.data || [])[idx]);
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
205
|
var selectPreviousItem = function () {
|
|
@@ -278,7 +278,9 @@ var DropdownBase = function (props) {
|
|
|
278
278
|
updateValue(item);
|
|
279
279
|
};
|
|
280
280
|
// An item was clicked. Close Dropdown and call onChange.
|
|
281
|
-
var handleClick = function (item) {
|
|
281
|
+
var handleClick = function (e, item) {
|
|
282
|
+
if (e)
|
|
283
|
+
e.stopPropagation();
|
|
282
284
|
// Is this a multiple-selection dropdown?
|
|
283
285
|
if (props.multiple) {
|
|
284
286
|
var array = value;
|
|
@@ -342,7 +344,7 @@ var DropdownBase = function (props) {
|
|
|
342
344
|
});
|
|
343
345
|
var activeIndex = (props.data || []).indexOf(value);
|
|
344
346
|
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) {
|
|
347
|
+
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
348
|
return (React.createElement(ListCell, { key: index, width: child.props.width, align: child.props.align }, row !== null && child.props.children(row)));
|
|
347
349
|
})));
|
|
348
350
|
});
|