@longline/aqua-ui 1.0.339 → 1.0.340
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/containers/Anchor/Anchor.d.ts +5 -0
- package/containers/Anchor/Anchor.js +20 -8
- package/containers/Dock/Dock.d.ts +5 -0
- package/containers/Dock/Dock.js +1 -1
- package/containers/Dock/Dockable.d.ts +5 -0
- package/containers/Dock/Dockable.js +20 -12
- package/containers/DragBar/DragBar.d.ts +5 -0
- package/containers/DragBar/DragBar.js +16 -5
- package/containers/Form/Field.d.ts +0 -3
- package/containers/Form/Field.js +3 -6
- package/containers/Form/Form.js +5 -36
- package/containers/Form/Validation.d.ts +1 -1
- package/containers/Form/Validation.js +6 -6
- package/containers/Form/context/FormContext.d.ts +1 -2
- package/containers/Form/context/useForm.d.ts +1 -1
- package/containers/Form/elements/BoxWrapper.js +2 -0
- package/containers/GlassPane/GlassPane.d.ts +7 -2
- package/containers/GlassPane/GlassPane.js +3 -3
- package/containers/InfoBox/InfoBox.d.ts +5 -0
- package/containers/InfoBox/InfoBox.js +1 -1
- package/containers/List/List.d.ts +5 -0
- package/containers/List/List.js +1 -1
- package/containers/List/ListCell.d.ts +5 -0
- package/containers/List/ListCell.js +1 -1
- package/containers/List/ListRow.d.ts +7 -2
- package/containers/List/ListRow.js +1 -1
- package/containers/Message/Error.d.ts +2 -0
- package/containers/Message/Error.js +1 -1
- package/containers/Message/Message.d.ts +5 -0
- package/containers/Message/Message.js +1 -1
- package/containers/Message/NoData.d.ts +2 -0
- package/containers/Message/NoData.js +1 -1
- package/containers/Message/NoFilteredData.d.ts +2 -0
- package/containers/Message/NoFilteredData.js +1 -1
- package/containers/Openable/Openable.d.ts +5 -0
- package/containers/Openable/Openable.js +8 -8
- package/containers/PublicRoute/PublicRoute.d.ts +9 -1
- package/containers/PublicRoute/PublicRoute.js +3 -7
- package/containers/Tabs/Pane.d.ts +5 -0
- package/containers/Tabs/Pane.js +3 -3
- package/containers/Tabs/Tabs.d.ts +5 -0
- package/containers/Tabs/Tabs.js +3 -3
- package/controls/Chip/Chip.d.ts +15 -3
- package/controls/Chip/Chip.js +7 -6
- package/controls/CircularProgress/CircularProgress.d.ts +11 -0
- package/controls/CircularProgress/CircularProgress.js +19 -11
- package/controls/Dropzone/Dropzone.d.ts +11 -1
- package/controls/Dropzone/Dropzone.js +18 -7
- package/controls/Fab/Fab.d.ts +14 -6
- package/controls/Fab/Fab.js +7 -20
- package/controls/Ghost/Ghost.js +3 -3
- package/controls/Gradient/Gradient.d.ts +5 -0
- package/controls/Gradient/Gradient.js +7 -4
- package/controls/Histogram/Histogram.d.ts +8 -2
- package/controls/Histogram/Histogram.js +9 -9
- package/controls/Histogram/HistogramBar.d.ts +2 -2
- package/controls/Icon/Icon.d.ts +10 -4
- package/controls/Icon/Icon.js +23 -6
- package/controls/Key/Key.d.ts +5 -0
- package/controls/Key/Key.js +2 -5
- package/controls/LinearChart/LinearChart.d.ts +9 -0
- package/controls/LinearChart/LinearChart.js +11 -6
- package/controls/ListButton/ListButton.d.ts +46 -3
- package/controls/ListButton/ListButton.js +70 -9
- package/controls/ListView/ColumnsManager/ColumnDraggable.js +11 -5
- package/controls/ListView/ColumnsManager/SourceColumns.js +1 -1
- package/controls/ListView/IListViewProps.d.ts +9 -2
- package/controls/ListView/ListView.js +13 -12
- package/controls/ListView/defaults.d.ts +3 -0
- package/controls/ListView/defaults.js +6 -0
- package/controls/ListView/elements/Body.d.ts +1 -1
- package/controls/ListView/elements/Body.js +23 -12
- package/controls/ListView/elements/Ghost.js +3 -2
- package/controls/ListView/elements/Header.js +3 -2
- package/controls/ListView/elements/HeaderCell.js +3 -3
- package/controls/ListView/elements/Table.js +16 -10
- package/controls/Mouse/Mouse.d.ts +6 -4
- package/controls/Mouse/Mouse.js +15 -8
- package/controls/PrimaryButton/PrimaryButton.d.ts +9 -3
- package/controls/PrimaryButton/PrimaryButton.js +5 -5
- package/controls/Progress/Progress.d.ts +9 -0
- package/controls/Progress/Progress.js +12 -8
- package/controls/SecondaryButton/SecondaryButton.d.ts +8 -3
- package/controls/SecondaryButton/SecondaryButton.js +1 -1
- package/controls/SpeechRecognizer/EditorRegistry.js +1 -2
- package/controls/SpeechRecognizer/SpeechRecognizer.d.ts +9 -1
- package/controls/SpeechRecognizer/SpeechRecognizer.js +16 -9
- package/controls/TabBar/TabBar.d.ts +5 -0
- package/controls/TabBar/TabBar.js +14 -6
- package/controls/TabBar/Underliner.js +1 -1
- package/controls/TertiaryButton/TertiaryButton.d.ts +9 -3
- package/controls/TertiaryButton/TertiaryButton.js +5 -3
- package/controls/ToggleButton/ToggleButton.d.ts +8 -2
- package/controls/ToggleButton/ToggleButton.js +1 -1
- package/controls/View/View.d.ts +5 -0
- package/controls/View/View.js +1 -1
- package/formatters/CountryFormatter/CountryFormatter.d.ts +3 -2
- package/formatters/CountryFormatter/CountryUtil.d.ts +3 -3
- package/formatters/DateTimeFormatter/DateTimeFormatter.d.ts +11 -10
- package/formatters/DateTimeFormatter/elements/Custom.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/DistanceDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongDateTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/Month.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortDateTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortTime.d.ts +1 -1
- package/formatters/DivisionFormatter/DivisionFormatter.d.ts +2 -2
- package/formatters/DivisionFormatter/DivisionFormatter.js +1 -1
- package/formatters/DivisionFormatter/DivisionUtil.d.ts +1 -1
- package/formatters/DivisionFormatter/DivisionUtil.js +5 -3
- package/formatters/FilesizeFormatter/FilesizeFormatter.d.ts +3 -3
- package/formatters/GIS/CoordinateFormatter.d.ts +2 -2
- package/formatters/GIS/LatitudeFormatter.d.ts +2 -2
- package/formatters/GIS/LongitudeFormatter.d.ts +2 -2
- package/formatters/HumanFormatter/HumanFormatter.d.ts +3 -3
- package/formatters/NumberFormatter/NumberFormatter.d.ts +3 -3
- package/formatters/PhoneFormatter/PhoneFormatter.d.ts +3 -3
- package/formatters/StringFormatter/StringFormatter.d.ts +3 -3
- package/formatters/StringFormatter/StringFormatter.js +1 -4
- package/helper/DMS.d.ts +1 -1
- package/helper/DMS.js +2 -2
- package/hooks/useOutsideClose/useOutsideClose.js +20 -11
- package/hooks/useSpeechAIRecorder/useSpeechAIRecorder.js +10 -7
- package/index.js +1 -0
- package/inputs/DateInput/Body.d.ts +2 -2
- package/inputs/DateInput/Body.js +11 -7
- package/inputs/DateInput/Calendar.d.ts +1 -1
- package/inputs/DateInput/Calendar.js +3 -5
- package/inputs/DateInput/DateInput.d.ts +11 -3
- package/inputs/DateInput/DateInput.js +11 -3
- package/inputs/DateInput/Day.d.ts +1 -1
- package/inputs/DateInput/InfiniteList.js +6 -3
- package/inputs/DateInput/Navbar.js +3 -2
- package/inputs/DateInput/NumericInput.js +3 -0
- package/inputs/DateInput/Selector.d.ts +1 -1
- package/inputs/DateInput/Selector.js +9 -6
- package/inputs/Dropdown/Body.d.ts +2 -2
- package/inputs/Dropdown/Column.d.ts +1 -1
- package/inputs/Dropdown/Dropdown.d.ts +5 -0
- package/inputs/Dropdown/Dropdown.js +36 -63
- package/inputs/Dropdown/Pill.js +1 -1
- package/inputs/Dropdown/Selection.js +1 -1
- package/inputs/Editor/Editor.d.ts +5 -0
- package/inputs/Editor/Editor.js +16 -6
- package/inputs/Editor/buttons/SpeechAIButton.js +2 -0
- package/inputs/Editor/buttons/TextAIButton.d.ts +0 -13
- package/inputs/Editor/buttons/TextAIButton.js +30 -14
- package/inputs/Editor/buttons/TextAIMenu.js +1 -1
- package/inputs/Editor/menu/MenuBar.d.ts +1 -1
- package/inputs/Editor/menu/MenuBar.js +1 -1
- package/inputs/Editor/menu/MenuButton.js +1 -1
- package/inputs/Input/Clear.js +1 -1
- package/inputs/Input/Input.d.ts +5 -0
- package/inputs/Input/Input.js +8 -6
- package/inputs/Input/InputWrapper.d.ts +2 -0
- package/inputs/Input/InputWrapper.js +1 -1
- package/inputs/Input/Reveal.js +1 -1
- package/inputs/MonthRange/Body.d.ts +1 -1
- package/inputs/MonthRange/Calendar.d.ts +2 -2
- package/inputs/MonthRange/Calendar.js +6 -9
- package/inputs/MonthRange/MonthRange.d.ts +7 -1
- package/inputs/MonthRange/MonthRange.js +14 -6
- package/inputs/MonthRange/Selector.d.ts +1 -1
- package/inputs/MonthRange/Selector.js +12 -11
- package/inputs/PhoneInput/PhoneInput.d.ts +5 -0
- package/inputs/PhoneInput/PhoneInput.js +2 -2
- package/inputs/Selector/Selector.d.ts +5 -0
- package/inputs/Selector/Selector.js +4 -1
- package/inputs/Slider/Slider.d.ts +75 -22
- package/inputs/Slider/Slider.js +104 -22
- package/inputs/Textarea/Textarea.d.ts +5 -5
- package/inputs/Textarea/Textarea.js +3 -2
- package/map/Map/Map.d.ts +2 -2
- package/map/Map/Map.js +20 -14
- package/map/PositionsManager/PositionBox.js +7 -3
- package/map/PositionsManager/PositionsManager.js +33 -13
- package/map/controls/CompassButton/CompassButton.js +1 -1
- package/map/controls/FullscreenButton/FullscreenButton.js +1 -1
- package/map/controls/Geocoder/Geocoder.js +28 -14
- package/map/controls/Geocoder/GeocoderApi.js +2 -0
- package/map/controls/Geocoder/GeocoderSelector.js +1 -1
- package/map/controls/Graticule/Graticule.js +1 -5
- package/map/controls/MapLoader/MapLoader.js +1 -1
- package/map/controls/ScaleControl/ScaleControl.js +1 -1
- package/map/controls/ZoomInButton/ZoomInButton.js +1 -1
- package/map/controls/ZoomOutButton/ZoomOutButton.d.ts +1 -1
- package/map/controls/ZoomOutButton/ZoomOutButton.js +2 -2
- package/map/controls/base/MapButton/MapButton.d.ts +8 -2
- package/map/controls/base/MapButton/MapButton.js +11 -2
- package/map/controls/base/MapControl/MapControl.d.ts +5 -0
- package/map/controls/base/MapControl/MapControl.js +10 -7
- package/map/layers/ClusterLayer/ClusterLayer.d.ts +1 -1
- package/map/layers/ClusterLayer/ClusterLayer.js +7 -3
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer.js +8 -4
- package/map/layers/IdwBlendLayer/IdwBlendLayer.js +9 -4
- package/map/layers/IdwLayer/IdwLayer.d.ts +2 -1
- package/map/layers/IdwLayer/IdwLayer.js +271 -215
- package/map/layers/InterpolationLayer/ContoursFragmentShader.d.ts +1 -1
- package/map/layers/InterpolationLayer/ContoursFragmentShader.js +1 -1
- package/map/layers/InterpolationLayer/InterpolationLayer.d.ts +4 -3
- package/map/layers/InterpolationLayer/InterpolationLayer.js +362 -275
- package/map/layers/ParticlesLayer/ParticlesLayer.d.ts +8 -7
- package/map/layers/ParticlesLayer/ParticlesLayer.js +528 -404
- package/map/markers/ClusterMarker/ClusterMarker.d.ts +6 -1
- package/map/markers/ClusterMarker/ClusterMarker.js +15 -6
- package/map/markers/RiskMarker/RiskMarker.d.ts +5 -1
- package/map/markers/RiskMarker/RiskMarker.js +4 -4
- package/modules/CountryDropdown/CountryDropdown.js +10 -1
- package/modules/Filter/Filter.d.ts +5 -0
- package/modules/Filter/Filter.js +10 -6
- package/modules/Globe/Globe.d.ts +5 -0
- package/modules/Globe/Globe.js +4 -4
- package/modules/MainMenu/Item.d.ts +9 -2
- package/modules/MainMenu/Item.js +8 -5
- package/modules/MainMenu/MainMenu.d.ts +5 -0
- package/modules/MainMenu/MainMenu.js +1 -1
- package/modules/ParticleGlobe/GL.d.ts +1 -1
- package/modules/ParticleGlobe/ParticleGlobe.d.ts +5 -0
- package/modules/ParticleGlobe/ParticleGlobe.js +69 -40
- package/modules/Public/Public.d.ts +5 -0
- package/modules/Public/Public.js +3 -3
- package/package.json +1 -1
- package/services/Auth/Auth.js +13 -7
- package/services/Auth/AuthContext.js +9 -1
- package/services/Dialog/Dialog.d.ts +7 -2
- package/services/Dialog/Dialog.js +7 -6
- package/services/Dialog/DialogWindow.d.ts +3 -1
- package/services/Dialog/DialogWindow.js +1 -1
- package/services/Dialog/XhrDialog.d.ts +1 -1
- package/services/Toast/Toast.js +5 -3
- package/services/Toast/ToastContainer.js +3 -1
- package/services/Toast/ToastContext.d.ts +1 -1
- package/services/Toast/ToastProvider.js +2 -0
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.d.ts +0 -35
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.js +0 -176
- package/modules/Root/Content.d.ts +0 -16
- package/modules/Root/Content.js +0 -25
- package/modules/Root/Overlay.d.ts +0 -23
- package/modules/Root/Overlay.js +0 -33
- package/modules/Root/Root.d.ts +0 -10
- package/modules/Root/Root.js +0 -46
- package/modules/Root/Shader.d.ts +0 -15
- package/modules/Root/Shader.js +0 -24
- package/modules/Root/Sidebar.d.ts +0 -13
- package/modules/Root/Sidebar.js +0 -24
- package/modules/Root/index.d.ts +0 -1
- package/modules/Root/index.js +0 -1
- package/modules/Root/stories/SampleContent.d.ts +0 -7
- package/modules/Root/stories/SampleContent.js +0 -44
|
@@ -129,13 +129,15 @@ interface IListViewProps {
|
|
|
129
129
|
/**
|
|
130
130
|
* Fired when a row is clicked.
|
|
131
131
|
* @param item Clicked item
|
|
132
|
+
* @param e Originating mouse event
|
|
132
133
|
*/
|
|
133
|
-
onClick?: (item: any) => void;
|
|
134
|
+
onClick?: (item: any, e: React.MouseEvent) => void;
|
|
134
135
|
/**
|
|
135
136
|
* Fired when a row is double-clicked.
|
|
136
137
|
* @param item Clicked item
|
|
138
|
+
* @param e Originating mouse event
|
|
137
139
|
*/
|
|
138
|
-
onDoubleClick?: (item: any) => void;
|
|
140
|
+
onDoubleClick?: (item: any, e: React.MouseEvent) => void;
|
|
139
141
|
/**
|
|
140
142
|
* If this callback is provided, items can be checked or unchecked. Items must have
|
|
141
143
|
* a key `checked` when they're checked. If `item` is true, then all items must be checked.
|
|
@@ -144,5 +146,10 @@ interface IListViewProps {
|
|
|
144
146
|
* @param item Item to toggle.
|
|
145
147
|
*/
|
|
146
148
|
onCheck?: (data: any[], item: any | boolean) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Optional inline styles applied to the outer element, for one-off overrides
|
|
151
|
+
* of the default styling.
|
|
152
|
+
*/
|
|
153
|
+
style?: React.CSSProperties;
|
|
147
154
|
}
|
|
148
155
|
export type { IListViewProps };
|
|
@@ -34,6 +34,7 @@ import { Column } from './Column';
|
|
|
34
34
|
import { Table } from './elements/Table';
|
|
35
35
|
import { sortItems } from './elements/sortItems';
|
|
36
36
|
import { Ghost } from './elements/Ghost';
|
|
37
|
+
import { DEFAULT_ROW_HEIGHT, DEFAULT_OVERSCAN } from './defaults';
|
|
37
38
|
function getChildrenOfTypeDeep(children, componentType) {
|
|
38
39
|
var result = [];
|
|
39
40
|
React.Children.forEach(children, function (child) {
|
|
@@ -60,16 +61,16 @@ var getColumns = function (children) {
|
|
|
60
61
|
return getChildrenOfTypeDeep(children, ListView.Column).map(function (c) { return c.props; });
|
|
61
62
|
};
|
|
62
63
|
var ListViewBase = function (props) {
|
|
63
|
-
var _a, _b;
|
|
64
|
+
var _a, _b, _c;
|
|
64
65
|
var children = props.children, otherProps = __rest(props, ["children"]);
|
|
65
|
-
var
|
|
66
|
+
var _d = React.useState(false), columnsMode = _d[0], setColumnsMode = _d[1];
|
|
66
67
|
var originalColumns = getColumns(props.children);
|
|
67
|
-
var
|
|
68
|
+
var _e = React.useState(originalColumns), columns = _e[0], setColumns = _e[1];
|
|
68
69
|
// Find default sort column:
|
|
69
70
|
var sortColumn = (_a = columns.find(function (c) { return c.defaultSort; })) !== null && _a !== void 0 ? _a : columns[0];
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
71
|
+
var _f = React.useState((_b = sortColumn === null || sortColumn === void 0 ? void 0 : sortColumn.sort) !== null && _b !== void 0 ? _b : ''), sort = _f[0], setSort = _f[1];
|
|
72
|
+
var _g = React.useState((_c = sortColumn === null || sortColumn === void 0 ? void 0 : sortColumn.reverse) !== null && _c !== void 0 ? _c : false), reverse = _g[0], setReverse = _g[1];
|
|
73
|
+
var _h = React.useState(null), data = _h[0], setData = _h[1];
|
|
73
74
|
React.useEffect(function () {
|
|
74
75
|
// Don't sort if no data is available yet:
|
|
75
76
|
if (!Array.isArray(props.data))
|
|
@@ -79,20 +80,20 @@ var ListViewBase = function (props) {
|
|
|
79
80
|
if (!sortColumn)
|
|
80
81
|
return;
|
|
81
82
|
setData(sortItems(props.data, sort, reverse, sortColumn.sortValue));
|
|
82
|
-
}, [props.data, sort, reverse]);
|
|
83
|
+
}, [props.data, sort, reverse, columns]);
|
|
83
84
|
// If children change, then update columns state.
|
|
84
85
|
React.useEffect(function () {
|
|
85
86
|
setColumns(getColumns(props.children));
|
|
86
87
|
}, [props.children]);
|
|
87
88
|
// Change sort:
|
|
88
89
|
var handleSort = function (column) {
|
|
89
|
-
var _a;
|
|
90
|
+
var _a, _b;
|
|
90
91
|
if (sort === column.sort) {
|
|
91
92
|
setReverse(!reverse);
|
|
92
93
|
}
|
|
93
94
|
else {
|
|
94
|
-
setSort(column.sort);
|
|
95
|
-
setReverse((
|
|
95
|
+
setSort((_a = column.sort) !== null && _a !== void 0 ? _a : '');
|
|
96
|
+
setReverse((_b = column.reverse) !== null && _b !== void 0 ? _b : false);
|
|
96
97
|
}
|
|
97
98
|
};
|
|
98
99
|
var handleCheck = function (data, item) {
|
|
@@ -120,7 +121,7 @@ var ListViewBase = function (props) {
|
|
|
120
121
|
if (props.ghost) {
|
|
121
122
|
return React.createElement(Ghost, __assign({}, otherProps, { columns: columns }));
|
|
122
123
|
}
|
|
123
|
-
return (React.createElement(Table, __assign({ "data-testid": props['data-testid'] || "ListView" }, otherProps, { data: data, columns: columns, sort: sort, reverse: reverse, onSortClick: handleSort, columnsMode: columnsMode, onOpenColumns: handleColumns, onCheck: props.onCheck ? handleCheck :
|
|
124
|
+
return (React.createElement(Table, __assign({ "data-testid": props['data-testid'] || "ListView" }, otherProps, { data: data, columns: columns, sort: sort, reverse: reverse, onSortClick: handleSort, columnsMode: columnsMode, onOpenColumns: handleColumns, onCheck: props.onCheck ? handleCheck : undefined, onChangeColumns: handleChangeColumns, onCloseColumns: function () { return setColumnsMode(false); }, onResetColumns: handleResetColumns })));
|
|
124
125
|
};
|
|
125
126
|
/**
|
|
126
127
|
* A data table with sorting, column management, virtualization, and row selection.
|
|
@@ -181,7 +182,7 @@ var ListViewBase = function (props) {
|
|
|
181
182
|
* | `children` | Render function: `(item) => ReactNode` |
|
|
182
183
|
*/
|
|
183
184
|
var ListView = function (_a) {
|
|
184
|
-
var _b = _a.data, data = _b === void 0 ? null : _b, _c = _a.dark, dark = _c === void 0 ? false : _c, _d = _a.noheader, noheader = _d === void 0 ? false : _d, _e = _a.hover, hover = _e === void 0 ? false : _e, _f = _a.striped, striped = _f === void 0 ? false : _f, _g = _a.grid, grid = _g === void 0 ? false : _g, _h = _a.total, total = _h === void 0 ? false : _h, _j = _a.singular, singular = _j === void 0 ? "record" : _j, _k = _a.plural, plural = _k === void 0 ? "records" : _k, _l = _a.shadow, shadow = _l === void 0 ? false : _l, _m = _a.ghost, ghost = _m === void 0 ? false : _m, _o = _a.rowHeight, rowHeight = _o === void 0 ?
|
|
185
|
+
var _b = _a.data, data = _b === void 0 ? null : _b, _c = _a.dark, dark = _c === void 0 ? false : _c, _d = _a.noheader, noheader = _d === void 0 ? false : _d, _e = _a.hover, hover = _e === void 0 ? false : _e, _f = _a.striped, striped = _f === void 0 ? false : _f, _g = _a.grid, grid = _g === void 0 ? false : _g, _h = _a.total, total = _h === void 0 ? false : _h, _j = _a.singular, singular = _j === void 0 ? "record" : _j, _k = _a.plural, plural = _k === void 0 ? "records" : _k, _l = _a.shadow, shadow = _l === void 0 ? false : _l, _m = _a.ghost, ghost = _m === void 0 ? false : _m, _o = _a.rowHeight, rowHeight = _o === void 0 ? DEFAULT_ROW_HEIGHT : _o, _p = _a.columnsEditable, columnsEditable = _p === void 0 ? false : _p, _q = _a.expanded, expanded = _q === void 0 ? false : _q, _r = _a.focusActive, focusActive = _r === void 0 ? false : _r, _s = _a.virtual, virtual = _s === void 0 ? false : _s, _t = _a.overscan, overscan = _t === void 0 ? DEFAULT_OVERSCAN : _t, props = __rest(_a, ["data", "dark", "noheader", "hover", "striped", "grid", "total", "singular", "plural", "shadow", "ghost", "rowHeight", "columnsEditable", "expanded", "focusActive", "virtual", "overscan"]);
|
|
185
186
|
return React.createElement(ListViewBase, __assign({ data: data, dark: dark, noheader: noheader, hover: hover, striped: striped, grid: grid, total: total, singular: singular, plural: plural, shadow: shadow, ghost: ghost, rowHeight: rowHeight, columnsEditable: columnsEditable, expanded: expanded, focusActive: focusActive, virtual: virtual, overscan: overscan }, props));
|
|
186
187
|
};
|
|
187
188
|
ListView.displayName = "ListView";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Default values for ListView props that are consumed both by the ListView
|
|
2
|
+
// wrapper and by its child elements (Body, Ghost), so each default lives in
|
|
3
|
+
// exactly one place.
|
|
4
|
+
var DEFAULT_ROW_HEIGHT = 48;
|
|
5
|
+
var DEFAULT_OVERSCAN = 10;
|
|
6
|
+
export { DEFAULT_ROW_HEIGHT, DEFAULT_OVERSCAN };
|
|
@@ -5,7 +5,7 @@ import { IColumnProps } from '../Column';
|
|
|
5
5
|
interface IProps extends IListViewProps {
|
|
6
6
|
columns: IColumnProps[];
|
|
7
7
|
/** Scrolling container */
|
|
8
|
-
container: OverlayScrollbarsComponentRef;
|
|
8
|
+
container: OverlayScrollbarsComponentRef | null;
|
|
9
9
|
}
|
|
10
10
|
declare const Body: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLElement>>;
|
|
11
11
|
export { Body };
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { DEFAULT_ROW_HEIGHT, DEFAULT_OVERSCAN } from '../defaults';
|
|
2
3
|
import { Selector } from '../../../inputs/Selector';
|
|
3
4
|
var Body = React.forwardRef(function (props, ref) {
|
|
5
|
+
var _a, _b;
|
|
4
6
|
// The scrolling container's height is necessary to determine how many
|
|
5
7
|
// rows must be rendered.
|
|
6
|
-
var
|
|
8
|
+
var _c = React.useState(0), height = _c[0], setHeight = _c[1];
|
|
7
9
|
// Current container scrollTop. This is updated by polling it using
|
|
8
10
|
// animation frames.
|
|
9
11
|
var scrollTop = React.useRef(0);
|
|
10
12
|
// This state is only used to trigger renders
|
|
11
|
-
var
|
|
13
|
+
var _d = React.useState(0), setTick = _d[1];
|
|
14
|
+
// Normalized props with defaults applied by the export wrapper.
|
|
15
|
+
var data = Array.isArray(props.data) ? props.data : [];
|
|
16
|
+
var rowHeight = (_a = props.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT;
|
|
17
|
+
var overscan = (_b = props.overscan) !== null && _b !== void 0 ? _b : DEFAULT_OVERSCAN;
|
|
18
|
+
var onClick = props.onClick;
|
|
19
|
+
var onDoubleClick = props.onDoubleClick;
|
|
12
20
|
// Watch resize of scrolling container using ResizeObserver.
|
|
13
21
|
React.useEffect(function () {
|
|
14
22
|
if (!props.container)
|
|
@@ -19,7 +27,9 @@ var Body = React.forwardRef(function (props, ref) {
|
|
|
19
27
|
setHeight(entry.contentRect.height);
|
|
20
28
|
}
|
|
21
29
|
});
|
|
22
|
-
|
|
30
|
+
var element = props.container.getElement();
|
|
31
|
+
if (element)
|
|
32
|
+
observer.observe(element);
|
|
23
33
|
return function () {
|
|
24
34
|
if (observer)
|
|
25
35
|
observer.disconnect();
|
|
@@ -50,10 +60,10 @@ var Body = React.forwardRef(function (props, ref) {
|
|
|
50
60
|
};
|
|
51
61
|
}, [props.container]);
|
|
52
62
|
var getOffsets = function () {
|
|
53
|
-
var totalRows =
|
|
63
|
+
var totalRows = data.length;
|
|
54
64
|
if (props.virtual) {
|
|
55
|
-
var startIndex = Math.max(0, Math.floor(scrollTop.current /
|
|
56
|
-
var endIndex = Math.min(totalRows - 1, Math.floor((scrollTop.current + height) /
|
|
65
|
+
var startIndex = Math.max(0, Math.floor(scrollTop.current / rowHeight) - overscan);
|
|
66
|
+
var endIndex = Math.min(totalRows - 1, Math.floor((scrollTop.current + height) / rowHeight) + overscan);
|
|
57
67
|
return [startIndex, endIndex];
|
|
58
68
|
}
|
|
59
69
|
else {
|
|
@@ -67,7 +77,7 @@ var Body = React.forwardRef(function (props, ref) {
|
|
|
67
77
|
var rows = [];
|
|
68
78
|
var _a = getOffsets(), startIndex = _a[0], endIndex = _a[1];
|
|
69
79
|
var _loop_1 = function (i) {
|
|
70
|
-
var item =
|
|
80
|
+
var item = data[i];
|
|
71
81
|
rows.push(React.createElement("div", { key: i,
|
|
72
82
|
// Set classnames for row and cells; styles are in Table.
|
|
73
83
|
className: [
|
|
@@ -75,13 +85,14 @@ var Body = React.forwardRef(function (props, ref) {
|
|
|
75
85
|
props.active == item ? 'active' : null,
|
|
76
86
|
props.expanded && props.active == item ? 'expanded' : null,
|
|
77
87
|
(props.onClick || props.onDoubleClick) ? 'clickable' : null
|
|
78
|
-
].join(' '), onClick:
|
|
88
|
+
].join(' '), onClick: onClick ? function (e) { return onClick(item, e); } : undefined, onDoubleClick: onDoubleClick ? function (e) { return onDoubleClick(item, e); } : undefined },
|
|
79
89
|
props.onCheck && React.createElement("div", { className: "cell check" },
|
|
80
90
|
React.createElement(Selector, { checked: !!item.checked, onChange: function () {
|
|
81
|
-
|
|
91
|
+
var _a;
|
|
92
|
+
(_a = props.onCheck) === null || _a === void 0 ? void 0 : _a.call(props, data, data[i]);
|
|
82
93
|
} })),
|
|
83
94
|
props.columns.map(function (col, index) {
|
|
84
|
-
return React.createElement("div", { className: "cell ".concat(col.error || item.error ? 'error' : ''), key: index, style: { justifyContent: col.align == 'right' ? 'end' : 'start', paddingLeft: col.paddingLeft ? "".concat(col.paddingLeft, "px") :
|
|
95
|
+
return React.createElement("div", { className: "cell ".concat(col.error || item.error ? 'error' : ''), key: index, style: { justifyContent: col.align == 'right' ? 'end' : 'start', paddingLeft: col.paddingLeft ? "".concat(col.paddingLeft, "px") : undefined, paddingRight: col.paddingRight ? "".concat(col.paddingRight, "px") : undefined } },
|
|
85
96
|
React.createElement("span", { className: "content" },
|
|
86
97
|
" ",
|
|
87
98
|
col.children(item)),
|
|
@@ -98,12 +109,12 @@ var Body = React.forwardRef(function (props, ref) {
|
|
|
98
109
|
_loop_1(i);
|
|
99
110
|
}
|
|
100
111
|
// Here we add an offset above the rows what were actually rendered:
|
|
101
|
-
var offset = startIndex *
|
|
112
|
+
var offset = startIndex * rowHeight;
|
|
102
113
|
return (React.createElement("div", { style: { position: "absolute", width: "100%", top: "".concat(offset, "px") } }, rows));
|
|
103
114
|
};
|
|
104
115
|
return (
|
|
105
116
|
// Wrap the body in an element that is as tall as the number of items
|
|
106
117
|
// in the list.
|
|
107
|
-
React.createElement("div", { style: { position: 'relative', width: '100%', height:
|
|
118
|
+
React.createElement("div", { style: { position: 'relative', width: '100%', height: data.length * rowHeight } }, Array.isArray(props.data) && getRows()));
|
|
108
119
|
});
|
|
109
120
|
export { Body };
|
|
@@ -15,8 +15,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
15
15
|
};
|
|
16
16
|
import * as React from 'react';
|
|
17
17
|
import styled, { css, keyframes } from 'styled-components';
|
|
18
|
+
import { DEFAULT_ROW_HEIGHT } from '../defaults';
|
|
18
19
|
var GhostBase = function (props) {
|
|
19
|
-
return React.createElement("div", { className: props.className },
|
|
20
|
+
return React.createElement("div", { className: props.className, style: props.style },
|
|
20
21
|
React.createElement("div", { className: "mask1" }),
|
|
21
22
|
React.createElement("div", { className: "mask2" }),
|
|
22
23
|
!props.noheader && props.onCheck && React.createElement(Cell, { "$dark": props.dark, "$shadow": props.shadow, "$content": false }),
|
|
@@ -46,7 +47,7 @@ var GhostStyled = styled(GhostBase).attrs(function (p) {
|
|
|
46
47
|
// Postfix an columns management column?
|
|
47
48
|
.concat(p.columnsEditable ? ['48px'] : [])
|
|
48
49
|
.join(" ");
|
|
49
|
-
}, function (p) { return p.rowHeight; }, function (p) { return p.fg; }, function (p) { return p.bg; }, function (p) { return p.fg; }, function (p) { return p.rowHeight - 1; }, function (p) { return p.rowHeight - 1; }, function (p) { return p.rowHeight; }, function (p) { return p.rowHeight * 2; }, Pulse, function (p) { return p.fg; }, function (p) { return p.bg; }, function (p) { return p.fg; }, function (p) { return p.rowHeight * 2 - 1; }, function (p) { return p.rowHeight * 2; }, Pulse2);
|
|
50
|
+
}, function (p) { var _a; return ((_a = p.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT); }, function (p) { return p.fg; }, function (p) { return p.bg; }, function (p) { return p.fg; }, function (p) { var _a; return ((_a = p.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT) - 1; }, function (p) { var _a; return ((_a = p.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT) - 1; }, function (p) { var _a; return ((_a = p.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT); }, function (p) { var _a; return ((_a = p.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT) * 2; }, Pulse, function (p) { return p.fg; }, function (p) { return p.bg; }, function (p) { return p.fg; }, function (p) { var _a; return ((_a = p.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT) * 2 - 1; }, function (p) { var _a; return ((_a = p.rowHeight) !== null && _a !== void 0 ? _a : DEFAULT_ROW_HEIGHT) * 2; }, Pulse2);
|
|
50
51
|
var Ghost = function (props) { return React.createElement(GhostStyled, __assign({}, props)); };
|
|
51
52
|
Ghost.displayName = "Ghost";
|
|
52
53
|
export { Ghost };
|
|
@@ -4,6 +4,7 @@ import { Selector } from '../../../inputs/Selector';
|
|
|
4
4
|
import { SVG } from '../../../svg';
|
|
5
5
|
import { HeaderButton } from './HeaderButton';
|
|
6
6
|
var Header = function (props) {
|
|
7
|
+
var _a;
|
|
7
8
|
// Are ALL items checked?
|
|
8
9
|
var allChecked = Array.isArray(props.data) ? props.data.map(function (x) { return !!x.checked; }).reduce(function (acc, cur) { return acc && !!cur; }, true) == true : false;
|
|
9
10
|
// Are NO items checked?
|
|
@@ -12,10 +13,10 @@ var Header = function (props) {
|
|
|
12
13
|
return (React.createElement("div", { className: "row header" },
|
|
13
14
|
props.onCheck &&
|
|
14
15
|
React.createElement("div", { className: "cell check" },
|
|
15
|
-
React.createElement(Selector, { indeterminate: indeterminate, checked: allChecked, onChange: function () { return props.onCheck(props.data, allChecked ? false : true); } })),
|
|
16
|
+
React.createElement(Selector, { indeterminate: indeterminate, checked: allChecked, onChange: function () { var _a, _b; return (_a = props.onCheck) === null || _a === void 0 ? void 0 : _a.call(props, (_b = props.data) !== null && _b !== void 0 ? _b : [], allChecked ? false : true); } })),
|
|
16
17
|
props.columns.map(function (col, index) { return React.createElement(HeaderCell, { key: index, column: col, sort: props.sort, reverse: props.reverse, dark: props.dark, onSortClick: props.onSortClick }); }),
|
|
17
18
|
props.columnsEditable &&
|
|
18
19
|
React.createElement("div", { className: "cell columns" },
|
|
19
|
-
React.createElement(HeaderButton, { dark: props.dark, url: SVG.Icons.Columns, onClick: props.onOpenColumns }))));
|
|
20
|
+
React.createElement(HeaderButton, { dark: (_a = props.dark) !== null && _a !== void 0 ? _a : false, url: SVG.Icons.Columns, onClick: props.onOpenColumns }))));
|
|
20
21
|
};
|
|
21
22
|
export { Header };
|
|
@@ -24,9 +24,9 @@ var HeaderCellBase = function (props) {
|
|
|
24
24
|
className: "".concat(props.className, " cell ").concat(sorted ? 'sort' : ''), style: {
|
|
25
25
|
// Sortable column has pointer cursor:
|
|
26
26
|
cursor: props.column.sort ? 'pointer' : 'auto',
|
|
27
|
-
paddingLeft: props.column.paddingLeft ? "".concat(props.column.paddingLeft, "px") :
|
|
28
|
-
paddingRight: props.column.paddingRight ? "".concat(props.column.paddingRight, "px") :
|
|
29
|
-
}, onClick: (props.column.sort && props.onSortClick) ? function () { return props.onSortClick(props.column); } :
|
|
27
|
+
paddingLeft: props.column.paddingLeft ? "".concat(props.column.paddingLeft, "px") : undefined,
|
|
28
|
+
paddingRight: props.column.paddingRight ? "".concat(props.column.paddingRight, "px") : undefined,
|
|
29
|
+
}, onClick: (props.column.sort && props.onSortClick) ? function () { return props.onSortClick(props.column); } : undefined },
|
|
30
30
|
React.createElement(Label, null, (_a = props.column.label) !== null && _a !== void 0 ? _a : props.column.name),
|
|
31
31
|
props.column.sort && React.createElement(SortButton, { dark: props.dark, active: sorted,
|
|
32
32
|
// If currently sorted, show sort direction.
|
|
@@ -37,18 +37,19 @@ import { ColumnsManager } from '../ColumnsManager/ColumnsManager';
|
|
|
37
37
|
import { Anchor } from '../../../containers/Anchor';
|
|
38
38
|
var HEADER_HEIGHT = 48;
|
|
39
39
|
var TableBase = function (_a) {
|
|
40
|
+
var _b, _c;
|
|
40
41
|
var className = _a.className, props = __rest(_a, ["className"]);
|
|
41
42
|
var wrapperRef = React.useRef(null);
|
|
42
43
|
var innerRef = React.useRef(null);
|
|
43
44
|
var auxRef = React.useRef(null);
|
|
44
45
|
var activeColumns = props.columns.filter(function (c) { return c.active; });
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
46
|
+
var _d = React.useState(null), activeRef = _d[0], setActiveRef = _d[1];
|
|
47
|
+
var _e = React.useState(0), time = _e[0], setTime = _e[1];
|
|
48
|
+
var _f = React.useState(false), showingNoData = _f[0], setShowingNoData = _f[1];
|
|
48
49
|
// Popper latches on to activeRef. In a virtual list, activeRef can be null,
|
|
49
50
|
// when the active item is out of view. In the case, popper latches on
|
|
50
51
|
// to the list itself (wrapperRef.current).
|
|
51
|
-
var
|
|
52
|
+
var _g = usePopper(activeRef !== null && activeRef !== void 0 ? activeRef : wrapperRef.current, auxRef.current, {
|
|
52
53
|
placement: 'right-start',
|
|
53
54
|
modifiers: [
|
|
54
55
|
{
|
|
@@ -62,13 +63,13 @@ var TableBase = function (_a) {
|
|
|
62
63
|
}, {
|
|
63
64
|
name: 'preventOverflow',
|
|
64
65
|
options: {
|
|
65
|
-
boundary: innerRef.current ?
|
|
66
|
+
boundary: (_c = (_b = innerRef.current) === null || _b === void 0 ? void 0 : _b.getElement()) !== null && _c !== void 0 ? _c : undefined,
|
|
66
67
|
tether: false,
|
|
67
68
|
padding: { top: 0, bottom: 16 }
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
]
|
|
71
|
-
}), styles =
|
|
72
|
+
}), styles = _g.styles, attributes = _g.attributes, update = _g.update;
|
|
72
73
|
React.useEffect(function () {
|
|
73
74
|
if (update)
|
|
74
75
|
update();
|
|
@@ -79,19 +80,24 @@ var TableBase = function (_a) {
|
|
|
79
80
|
// may suddenly run off the screen.
|
|
80
81
|
// When a resize is detected, we reposition the aux.
|
|
81
82
|
React.useEffect(function () {
|
|
83
|
+
var _a;
|
|
82
84
|
var resizeObserver = new ResizeObserver(function () {
|
|
83
85
|
// Update component state so that we can update popper.
|
|
84
86
|
setTime(Math.random());
|
|
85
87
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
if (auxRef.current)
|
|
89
|
+
resizeObserver.observe(auxRef.current);
|
|
90
|
+
var innerElement = (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.getElement();
|
|
91
|
+
if (innerElement)
|
|
92
|
+
resizeObserver.observe(innerElement);
|
|
88
93
|
return function () { return resizeObserver.disconnect(); };
|
|
89
94
|
}, []);
|
|
90
95
|
// If desired, scroll newly selected item into view.
|
|
91
96
|
React.useEffect(function () {
|
|
97
|
+
var _a, _b, _c, _d;
|
|
92
98
|
if (activeRef && props.focusActive) {
|
|
93
99
|
if (props.expanded) {
|
|
94
|
-
activeRef.parentElement.parentElement.nextSibling.childNodes[0].scrollIntoView({ behavior: 'instant' });
|
|
100
|
+
(_d = (_c = (_b = (_a = activeRef.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.nextSibling) === null || _c === void 0 ? void 0 : _c.childNodes[0]) === null || _d === void 0 ? void 0 : _d.scrollIntoView({ behavior: 'instant' });
|
|
95
101
|
}
|
|
96
102
|
else {
|
|
97
103
|
activeRef.scrollIntoView({ behavior: 'instant' });
|
|
@@ -118,7 +124,7 @@ var TableBase = function (_a) {
|
|
|
118
124
|
React.createElement(ColumnsManager, { columns: props.columns, onChange: props.onChangeColumns, onClose: props.onCloseColumns, onReset: props.onResetColumns })),
|
|
119
125
|
showingNoData && React.createElement(NoData, { dark: props.dark, component: props.noData }),
|
|
120
126
|
React.createElement(AuxHolder, __assign({ ref: auxRef, style: __assign({ visibility: (props.active && props.aux && Array.isArray(props.data) && props.data.includes(props.active)) ? 'visible' : 'hidden' }, styles.popper) }, attributes.popper), (props.active && props.aux && Array.isArray(props.data) && props.data.includes(props.active)) && React.cloneElement(props.aux, { value: props.active })),
|
|
121
|
-
React.createElement("div", { className: className, ref: wrapperRef },
|
|
127
|
+
React.createElement("div", { className: className, ref: wrapperRef, style: props.style },
|
|
122
128
|
props.noheader != true && React.createElement(Header, __assign({}, props, { columns: activeColumns, onOpenColumns: props.onOpenColumns })),
|
|
123
129
|
React.createElement(OverlayScrollbarsComponent, { ref: innerRef, defer: true, options: {
|
|
124
130
|
scrollbars: { theme: 'os-theme-light', autoHide: 'leave' }
|
|
@@ -30,6 +30,11 @@ interface IMouseProps extends ITestable {
|
|
|
30
30
|
* If set, the `Mouse` is rendered at the specified `size` (in pixels).
|
|
31
31
|
*/
|
|
32
32
|
size?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Optional inline styles applied to the outer element, for one-off overrides
|
|
35
|
+
* of the default styling.
|
|
36
|
+
*/
|
|
37
|
+
style?: React.CSSProperties;
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* An SVG mouse icon with interactive button highlighting.
|
|
@@ -64,9 +69,6 @@ interface IMouseProps extends ITestable {
|
|
|
64
69
|
* | `accent` | Wheel highlight color (default: theme primary) |
|
|
65
70
|
* | `size` | Height in pixels (max 100px) |
|
|
66
71
|
*/
|
|
67
|
-
declare const Mouse: {
|
|
68
|
-
({ left, right, wheel, ...props }: IMouseProps): React.JSX.Element;
|
|
69
|
-
displayName: string;
|
|
70
|
-
};
|
|
72
|
+
declare const Mouse: React.MemoExoticComponent<({ left, right, wheel, ...props }: IMouseProps) => React.JSX.Element>;
|
|
71
73
|
export { Mouse };
|
|
72
74
|
export type { IMouseProps };
|
package/controls/Mouse/Mouse.js
CHANGED
|
@@ -27,14 +27,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
27
27
|
import * as React from 'react';
|
|
28
28
|
import styled, { css } from 'styled-components';
|
|
29
29
|
var MouseBase = function (props) {
|
|
30
|
-
return (React.createElement("svg", { "data-testid": props['data-testid'] || "Mouse", className: props.className, viewBox: "3 0 22 29", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" // Hide from assistive tech (for non-interactive icons)
|
|
30
|
+
return (React.createElement("svg", { "data-testid": props['data-testid'] || "Mouse", className: props.className, style: props.style, viewBox: "3 0 22 29", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" // Hide from assistive tech (for non-interactive icons)
|
|
31
31
|
, focusable: "false" },
|
|
32
|
-
React.createElement("path", { d: "M14 1.75623C8.69307 1.75623 4.375 6.07429 4.375 11.3812V18.3812C4.375 23.6882 8.69307 28.0062 14 28.0062C19.3069 28.0062 23.625 23.6882 23.625 18.3812V11.3812C23.625 6.07429 19.3069 1.75623 14 1.75623ZM21.875 11.3812V12.2562H16.625V10.5062C16.625 9.36653 15.8911 8.40403 14.875 8.04199V3.55756C18.806 3.99506 21.875 7.33546 21.875 11.3812ZM14 9.63123C14.4834 9.63123 14.875 10.0239 14.875 10.5062V13.1312C14.875 13.6136 14.4834 14.0062 14 14.0062C13.5166 14.0062 13.125 13.6136 13.125 13.1312V10.5062C13.125 10.0239 13.5166 9.63123 14 9.63123ZM6.125 11.3812C6.125 7.33546 9.19403 3.99389 13.125 3.55779V8.04223C12.1089 8.40427 11.375 9.36677 11.375 10.5065V12.2565H6.125V11.3812ZM14 26.2562C9.65767 26.2562 6.125 22.7236 6.125 18.3812V14.0062H11.5358C11.8978 15.0223 12.8603 15.7562 14 15.7562C15.1397 15.7562 16.1022 15.0223 16.4642 14.0062H21.875V18.3812C21.875 22.7236 18.3423 26.2562 14 26.2562Z"
|
|
32
|
+
React.createElement("path", { d: "M14 1.75623C8.69307 1.75623 4.375 6.07429 4.375 11.3812V18.3812C4.375 23.6882 8.69307 28.0062 14 28.0062C19.3069 28.0062 23.625 23.6882 23.625 18.3812V11.3812C23.625 6.07429 19.3069 1.75623 14 1.75623ZM21.875 11.3812V12.2562H16.625V10.5062C16.625 9.36653 15.8911 8.40403 14.875 8.04199V3.55756C18.806 3.99506 21.875 7.33546 21.875 11.3812ZM14 9.63123C14.4834 9.63123 14.875 10.0239 14.875 10.5062V13.1312C14.875 13.6136 14.4834 14.0062 14 14.0062C13.5166 14.0062 13.125 13.6136 13.125 13.1312V10.5062C13.125 10.0239 13.5166 9.63123 14 9.63123ZM6.125 11.3812C6.125 7.33546 9.19403 3.99389 13.125 3.55779V8.04223C12.1089 8.40427 11.375 9.36677 11.375 10.5065V12.2565H6.125V11.3812ZM14 26.2562C9.65767 26.2562 6.125 22.7236 6.125 18.3812V14.0062H11.5358C11.8978 15.0223 12.8603 15.7562 14 15.7562C15.1397 15.7562 16.1022 15.0223 16.4642 14.0062H21.875V18.3812C21.875 22.7236 18.3423 26.2562 14 26.2562Z" }),
|
|
33
33
|
props.left && React.createElement("path", { className: "left", d: "M13.125 3.55798C9.19403 3.99408 6.125 7.33565 6.125 11.3814V12.2567H11.375V10.5067C11.375 9.36696 12.1089 8.40446 13.125 8.04242V3.55798Z" }),
|
|
34
34
|
props.right && React.createElement("path", { className: "right", d: "M21.875 12.2562V11.3812C21.875 7.33539 18.806 3.995 14.875 3.5575V8.04193C15.8911 8.40397 16.625 9.36647 16.625 10.5062V12.2562H21.875Z" }),
|
|
35
35
|
props.wheel && React.createElement("path", { className: "wheel", d: "M15.875 10.5062C15.875 9.47241 15.0365 8.63123 14 8.63123C12.9635 8.63123 12.125 9.47241 12.125 10.5062V13.1312C12.125 14.165 12.9635 15.0062 14 15.0062C15.0365 15.0062 15.875 14.165 15.875 13.1312V10.5062Z" })));
|
|
36
36
|
};
|
|
37
|
-
var MouseStyled = styled(MouseBase)(
|
|
37
|
+
var MouseStyled = styled(MouseBase).attrs(function (p) {
|
|
38
|
+
var _a;
|
|
39
|
+
return ({
|
|
40
|
+
$color: (_a = p.color) !== null && _a !== void 0 ? _a : p.theme.colors.neutral[100]
|
|
41
|
+
});
|
|
42
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n max-height: 100px;\n fill: ", ";\n .left { fill: ", "; }\n .right { fill: ", "; }\n .wheel { fill: ", "; }\n"], ["\n ", "\n max-height: 100px;\n fill: ", ";\n .left { fill: ", "; }\n .right { fill: ", "; }\n .wheel { fill: ", "; }\n"
|
|
38
43
|
/**
|
|
39
44
|
* An SVG mouse icon with interactive button highlighting.
|
|
40
45
|
*
|
|
@@ -68,7 +73,9 @@ var MouseStyled = styled(MouseBase)(templateObject_2 || (templateObject_2 = __ma
|
|
|
68
73
|
* | `accent` | Wheel highlight color (default: theme primary) |
|
|
69
74
|
* | `size` | Height in pixels (max 100px) |
|
|
70
75
|
*/
|
|
71
|
-
|
|
76
|
+
// Component is pure and based solely on props, so it is wrapped in React.memo
|
|
77
|
+
// to avoid unnecessary re-renders.
|
|
78
|
+
])), function (p) { return p.size && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: ", "px;\n "], ["\n height: ", "px;\n "])), p.size); }, function (p) { return p.$color; }, function (p) { return p.$color; }, function (p) { return p.$color; }, function (p) { var _a; return (_a = p.accent) !== null && _a !== void 0 ? _a : p.theme.colors.primary[1]; });
|
|
72
79
|
/**
|
|
73
80
|
* An SVG mouse icon with interactive button highlighting.
|
|
74
81
|
*
|
|
@@ -102,12 +109,12 @@ var MouseStyled = styled(MouseBase)(templateObject_2 || (templateObject_2 = __ma
|
|
|
102
109
|
* | `accent` | Wheel highlight color (default: theme primary) |
|
|
103
110
|
* | `size` | Height in pixels (max 100px) |
|
|
104
111
|
*/
|
|
105
|
-
|
|
112
|
+
// Component is pure and based solely on props, so it is wrapped in React.memo
|
|
113
|
+
// to avoid unnecessary re-renders.
|
|
114
|
+
var Mouse = React.memo(function (_a) {
|
|
106
115
|
var _b = _a.left, left = _b === void 0 ? false : _b, _c = _a.right, right = _c === void 0 ? false : _c, _d = _a.wheel, wheel = _d === void 0 ? false : _d, props = __rest(_a, ["left", "right", "wheel"]);
|
|
107
|
-
// Component is pure and based solely on props. Wrapping it with React.memo
|
|
108
|
-
// helps avoid unnecessary re-renders:
|
|
109
116
|
return React.createElement(MouseStyled, __assign({ left: left, right: right, wheel: wheel }, props));
|
|
110
|
-
};
|
|
117
|
+
});
|
|
111
118
|
Mouse.displayName = "Mouse";
|
|
112
119
|
export { Mouse };
|
|
113
120
|
var templateObject_1, templateObject_2;
|
|
@@ -40,10 +40,16 @@ interface IPrimaryButtonProps extends ITestable {
|
|
|
40
40
|
*/
|
|
41
41
|
icon?: string | IIconProps;
|
|
42
42
|
/**
|
|
43
|
-
* Fired when the button is clicked. The React MouseEvent is passed in,
|
|
44
|
-
*
|
|
43
|
+
* Fired when the button is clicked. The React MouseEvent is passed in, in case
|
|
44
|
+
* the calling code wants to inspect it or stop propagation. Handlers that
|
|
45
|
+
* don't need the event can omit the parameter.
|
|
45
46
|
*/
|
|
46
|
-
onClick: (e
|
|
47
|
+
onClick: (e: React.MouseEvent) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Optional inline styles applied to the outer element, for one-off overrides
|
|
50
|
+
* of the default styling.
|
|
51
|
+
*/
|
|
52
|
+
style?: React.CSSProperties;
|
|
47
53
|
}
|
|
48
54
|
/**
|
|
49
55
|
* A prominent call-to-action button for primary actions.
|
|
@@ -40,21 +40,21 @@ var PrimaryButtonBase = function (props) {
|
|
|
40
40
|
// An IIconProps was provided. Use it as the props for the icon.
|
|
41
41
|
return React.createElement(Icon, __assign({ color: theme.colors.neutral[100] }, props.icon));
|
|
42
42
|
};
|
|
43
|
-
return (React.createElement("button", { "data-testid": props['data-testid'] || "PrimaryButton", className: props.className, type: "button", onClick: props.onClick, title: props.title, "aria-disabled": props.disabled, disabled: props.disabled },
|
|
43
|
+
return (React.createElement("button", { "data-testid": props['data-testid'] || "PrimaryButton", className: props.className, style: props.style, type: "button", onClick: props.onClick, title: props.title, "aria-disabled": props.disabled, disabled: props.disabled },
|
|
44
44
|
icon(),
|
|
45
45
|
props.children));
|
|
46
46
|
};
|
|
47
47
|
var PrimaryButtonStyled = styled(PrimaryButtonBase).attrs(function (p) {
|
|
48
48
|
return {
|
|
49
|
-
backgroundColor: p.disabled ? p.theme.colors.neutral[80]
|
|
49
|
+
$backgroundColor: p.disabled ? p.theme.colors.neutral[80]
|
|
50
50
|
: p.positive ? p.theme.colors.positive
|
|
51
51
|
: p.negative ? p.theme.colors.negative
|
|
52
52
|
: p.color ? p.color
|
|
53
53
|
: p.theme.colors.primary[1],
|
|
54
|
-
outlineColor: (p.positive || p.negative) ? p.theme.colors.primary[1]
|
|
54
|
+
$outlineColor: (p.positive || p.negative) ? p.theme.colors.primary[1]
|
|
55
55
|
: p.theme.colors.accent
|
|
56
56
|
};
|
|
57
|
-
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["
|
|
57
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Size:\n height: 46px; // was 56\n padding-left: 12px; // was 16\n padding-right: 12px; // was 16\n min-width: 90px;\n \n // Font:\n font: ", ";\n color: ", ";\n\n // Presentation:\n background-color: ", ";\n transition:\n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n\n // Content:\n display: flex;\n align-items: center;\n white-space: nowrap;\n flex-wrap: nowrap; \n justify-content: center; \n gap: 6px;\n\n box-shadow: ", ";\n &:hover {\n background-color: ", ";\n box-shadow: ", ";\n }\n &:active {\n background-color: ", ";\n box-shadow: none;\n }\n &:focus {\n outline: solid 2px ", ";\n }\n \n svg {\n width: 24px;\n height: 24px; \n }\n\n ", "\n"], ["\n // Size:\n height: 46px; // was 56\n padding-left: 12px; // was 16\n padding-right: 12px; // was 16\n min-width: 90px;\n \n // Font:\n font: ", ";\n color: ", ";\n\n // Presentation:\n background-color: ", ";\n transition:\n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n\n // Content:\n display: flex;\n align-items: center;\n white-space: nowrap;\n flex-wrap: nowrap; \n justify-content: center; \n gap: 6px;\n\n box-shadow: ", ";\n &:hover {\n background-color: ", ";\n box-shadow: ", ";\n }\n &:active {\n background-color: ", ";\n box-shadow: none;\n }\n &:focus {\n outline: solid 2px ", ";\n }\n \n svg {\n width: 24px;\n height: 24px; \n }\n\n ", "\n"
|
|
58
58
|
/**
|
|
59
59
|
* A prominent call-to-action button for primary actions.
|
|
60
60
|
*
|
|
@@ -94,7 +94,7 @@ var PrimaryButtonStyled = styled(PrimaryButtonBase).attrs(function (p) {
|
|
|
94
94
|
* | `disabled` | Prevents interaction |
|
|
95
95
|
* | `title` | Browser tooltip on hover |
|
|
96
96
|
*/
|
|
97
|
-
])), function (p) { return p.theme.font.labelLarge; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p
|
|
97
|
+
])), function (p) { return p.theme.font.labelLarge; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.$backgroundColor; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.radius.strong; }, function (p) { return p.theme.shadows.medium; }, function (p) { var _a; return darken(0.025, (_a = p.$backgroundColor) !== null && _a !== void 0 ? _a : p.theme.colors.primary[1]); }, function (p) { return p.theme.shadows.large; }, function (p) { return p.$backgroundColor; }, function (p) { return p.$outlineColor; }, function (p) { return p.disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: auto;\n pointer-events: none;\n color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "], ["\n cursor: auto;\n pointer-events: none;\n color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "])), p.theme.colors.primary[3], p.theme.colors.primary[3]); });
|
|
98
98
|
/**
|
|
99
99
|
* A prominent call-to-action button for primary actions.
|
|
100
100
|
*
|
|
@@ -35,6 +35,15 @@ interface IProgressProps extends ITestable {
|
|
|
35
35
|
* If set, applies a custom width (a CSS string), e.g. `300px` or `50%`.
|
|
36
36
|
*/
|
|
37
37
|
width?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Accessible name for the progress bar, announced by screen readers.
|
|
40
|
+
*/
|
|
41
|
+
ariaLabel?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Optional inline styles applied to the outer element, for one-off overrides
|
|
44
|
+
* of the default styling.
|
|
45
|
+
*/
|
|
46
|
+
style?: React.CSSProperties;
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
40
49
|
* A horizontal progress bar showing completion percentage.
|
|
@@ -27,17 +27,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
27
27
|
import * as React from 'react';
|
|
28
28
|
import styled, { css } from 'styled-components';
|
|
29
29
|
/**
|
|
30
|
-
* Input value may be less than 0 or more than 100.
|
|
31
|
-
* Clamp it.
|
|
30
|
+
* Input value may be less than 0 or more than 100 (or non-finite).
|
|
31
|
+
* Clamp it into 0..100, rounding, and treat non-finite input as 0.
|
|
32
32
|
*/
|
|
33
33
|
var getClampedValue = function (value) {
|
|
34
|
-
return Math.round(Math.min(100, Math.max(0, value)));
|
|
34
|
+
return Number.isFinite(value) ? Math.round(Math.min(100, Math.max(0, value))) : 0;
|
|
35
35
|
};
|
|
36
|
+
// Default prop values, referenced both by the ProgressStyled fallback and the
|
|
37
|
+
// Progress wrapper below.
|
|
38
|
+
var DEFAULT_THICKNESS = 5;
|
|
36
39
|
var ProgressBase = function (props) {
|
|
37
|
-
|
|
40
|
+
var value = getClampedValue(props.value);
|
|
41
|
+
return (React.createElement("div", { "data-testid": props['data-testid'] || "Progress", className: props.className, style: props.style, role: "progressbar", "aria-label": props.ariaLabel, "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": 100 },
|
|
38
42
|
React.createElement(FillOuter, null,
|
|
39
|
-
React.createElement(FillInner, { style: { transform: "scaleX(".concat(
|
|
40
|
-
props.numbered && React.createElement(Value, null, "".concat(
|
|
43
|
+
React.createElement(FillInner, { style: { transform: "scaleX(".concat(value / 100, ")") } })),
|
|
44
|
+
props.numbered && React.createElement(Value, null, "".concat(value, "%"))));
|
|
41
45
|
};
|
|
42
46
|
// We use inner DIVs to the display the inner fill and value. Previously these
|
|
43
47
|
// were done using :before/after pseudo-elements, which resulted in fewer
|
|
@@ -84,7 +88,7 @@ var ProgressStyled = styled(ProgressBase)(templateObject_6 || (templateObject_6
|
|
|
84
88
|
*
|
|
85
89
|
* Includes `role="progressbar"` with `aria-valuenow`, `aria-valuemin`, and `aria-valuemax`.
|
|
86
90
|
*/
|
|
87
|
-
])), function (p) { return p.thickness; }, function (p) { return p.width && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["width: ", ";"], ["width: ", ";"])), p.width); }, function (p) { return p.padded && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["margin: 10px;"], ["margin: 10px;"]))); }, function (p) { return p.theme.colors.neutral[50]; }, function (p) { return p.thickness / 2; }, FillInner, function (p) { var _a; return (_a = p.color) !== null && _a !== void 0 ? _a : p.theme.colors.primary[1]; });
|
|
91
|
+
])), function (p) { return p.thickness; }, function (p) { return p.width && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["width: ", ";"], ["width: ", ";"])), p.width); }, function (p) { return p.padded && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["margin: 10px;"], ["margin: 10px;"]))); }, function (p) { return p.theme.colors.neutral[50]; }, function (p) { var _a; return ((_a = p.thickness) !== null && _a !== void 0 ? _a : DEFAULT_THICKNESS) / 2; }, FillInner, function (p) { var _a; return (_a = p.color) !== null && _a !== void 0 ? _a : p.theme.colors.primary[1]; });
|
|
88
92
|
/**
|
|
89
93
|
* A horizontal progress bar showing completion percentage.
|
|
90
94
|
*
|
|
@@ -123,7 +127,7 @@ var ProgressStyled = styled(ProgressBase)(templateObject_6 || (templateObject_6
|
|
|
123
127
|
* Includes `role="progressbar"` with `aria-valuenow`, `aria-valuemin`, and `aria-valuemax`.
|
|
124
128
|
*/
|
|
125
129
|
var Progress = function (_a) {
|
|
126
|
-
var _b = _a.thickness, thickness = _b === void 0 ?
|
|
130
|
+
var _b = _a.thickness, thickness = _b === void 0 ? DEFAULT_THICKNESS : _b, _c = _a.numbered, numbered = _c === void 0 ? false : _c, _d = _a.padded, padded = _d === void 0 ? false : _d, props = __rest(_a, ["thickness", "numbered", "padded"]);
|
|
127
131
|
return React.createElement(ProgressStyled, __assign({ thickness: thickness, numbered: numbered, padded: padded }, props));
|
|
128
132
|
};
|
|
129
133
|
Progress.displayName = 'Progress';
|
|
@@ -39,10 +39,15 @@ interface ISecondaryButtonProps extends ITestable {
|
|
|
39
39
|
*/
|
|
40
40
|
title: string;
|
|
41
41
|
/**
|
|
42
|
-
* Fired when the button is clicked. The synthetic React click event
|
|
43
|
-
*
|
|
42
|
+
* Fired when the button is clicked. The synthetic React click event is passed
|
|
43
|
+
* along so callers may inspect it or stop propagation.
|
|
44
44
|
*/
|
|
45
|
-
onClick: (e
|
|
45
|
+
onClick: (e: React.MouseEvent) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Optional inline styles applied to the outer element, for one-off overrides
|
|
48
|
+
* of the default styling.
|
|
49
|
+
*/
|
|
50
|
+
style?: React.CSSProperties;
|
|
46
51
|
}
|
|
47
52
|
/**
|
|
48
53
|
* A compact icon-only button for secondary actions.
|
|
@@ -29,7 +29,7 @@ import styled, { css, useTheme } from 'styled-components';
|
|
|
29
29
|
import { Icon } from '../Icon';
|
|
30
30
|
var SecondaryButtonBase = function (props) {
|
|
31
31
|
var theme = useTheme();
|
|
32
|
-
return (React.createElement("button", { "data-testid": props['data-testid'] || "SecondaryButton", type: "button", className: props.className, disabled: props.disabled, onClick: props.onClick, title: props.title, "aria-label": props.title },
|
|
32
|
+
return (React.createElement("button", { "data-testid": props['data-testid'] || "SecondaryButton", type: "button", className: props.className, style: props.style, disabled: props.disabled, onClick: props.onClick, title: props.title, "aria-label": props.title },
|
|
33
33
|
React.createElement(Icon, __assign({ color: theme.colors.neutral[100] }, (typeof props.icon === 'string' ? { url: props.icon } : props.icon)))));
|
|
34
34
|
};
|
|
35
35
|
//
|
|
@@ -16,8 +16,7 @@ var EditorRegistry = /** @class */ (function () {
|
|
|
16
16
|
EditorRegistry.editors = EditorRegistry.editors.filter(function (e) { return e.div !== div; });
|
|
17
17
|
};
|
|
18
18
|
EditorRegistry.getEditor = function (div) {
|
|
19
|
-
|
|
20
|
-
return (_a = EditorRegistry.editors.find(function (e) { return e.div === div; })) === null || _a === void 0 ? void 0 : _a.editor;
|
|
19
|
+
return EditorRegistry.editors.find(function (e) { return e.div === div; }).editor;
|
|
21
20
|
};
|
|
22
21
|
return EditorRegistry;
|
|
23
22
|
}());
|