baseui 10.8.0 → 10.9.0
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/a11y/a11y.js +2 -2
- package/a11y/a11y.js.flow +3 -3
- package/button/styled-components.js +47 -18
- package/button/styled-components.js.flow +25 -5
- package/combobox/combobox.js +6 -3
- package/combobox/combobox.js.flow +4 -2
- package/combobox/types.js.flow +2 -0
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +2 -2
- package/data-table/column-numerical.js +307 -355
- package/data-table/column-numerical.js.flow +273 -287
- package/data-table/constants.js +17 -11
- package/data-table/constants.js.flow +11 -8
- package/data-table/data-table.js +53 -50
- package/data-table/data-table.js.flow +18 -13
- package/data-table/filter-shell.js +27 -4
- package/data-table/filter-shell.js.flow +33 -9
- package/data-table/locale.js +4 -2
- package/data-table/locale.js.flow +6 -2
- package/data-table/measure-column-widths.js +83 -121
- package/data-table/measure-column-widths.js.flow +87 -109
- package/datepicker/styled-components.js +1 -1
- package/datepicker/styled-components.js.flow +4 -1
- package/drawer/drawer.js +3 -1
- package/drawer/drawer.js.flow +7 -1
- package/es/a11y/a11y.js +2 -2
- package/es/button/styled-components.js +32 -2
- package/es/combobox/combobox.js +6 -3
- package/es/data-table/column-categorical.js +2 -2
- package/es/data-table/column-numerical.js +245 -317
- package/es/data-table/constants.js +12 -8
- package/es/data-table/data-table.js +18 -16
- package/es/data-table/filter-shell.js +26 -4
- package/es/data-table/locale.js +4 -2
- package/es/data-table/measure-column-widths.js +75 -86
- package/es/datepicker/styled-components.js +1 -1
- package/es/drawer/drawer.js +3 -1
- package/es/index.js +1 -1
- package/es/map-marker/badge-enhancer.js +61 -0
- package/es/map-marker/constants.js +146 -2
- package/es/map-marker/drag-shadow.js +32 -0
- package/es/map-marker/fixed-marker.js +54 -48
- package/es/map-marker/floating-marker.js +21 -12
- package/es/map-marker/index.js +1 -1
- package/es/map-marker/label-enhancer.js +39 -0
- package/es/map-marker/needle.js +26 -0
- package/es/map-marker/pin-head.js +42 -40
- package/es/map-marker/styled-components.js +177 -32
- package/es/map-marker/types.js +1 -1
- package/es/menu/maybe-child-menu.js +0 -2
- package/es/menu/nested-menus.js +49 -3
- package/es/menu/stateful-container.js +13 -12
- package/es/modal/modal.js +3 -1
- package/es/popover/popover.js +3 -1
- package/es/progress-bar/index.js +1 -1
- package/es/progress-bar/progressbar.js +25 -10
- package/es/progress-bar/styled-components.js +9 -5
- package/es/select/select-component.js +2 -10
- package/es/spinner/styled-components.js +34 -16
- package/es/table/filter.js +3 -1
- package/es/themes/dark-theme/color-component-tokens.js +4 -0
- package/es/themes/light-theme/color-component-tokens.js +4 -0
- package/es/timezonepicker/timezone-picker.js +53 -36
- package/es/timezonepicker/tzdata.js +2 -0
- package/es/timezonepicker/update-tzdata.js +69 -0
- package/esm/a11y/a11y.js +3 -3
- package/esm/button/styled-components.js +47 -18
- package/esm/combobox/combobox.js +6 -3
- package/esm/data-table/column-categorical.js +2 -2
- package/esm/data-table/column-numerical.js +304 -353
- package/esm/data-table/constants.js +12 -8
- package/esm/data-table/data-table.js +53 -50
- package/esm/data-table/filter-shell.js +26 -4
- package/esm/data-table/locale.js +4 -2
- package/esm/data-table/measure-column-widths.js +83 -121
- package/esm/datepicker/styled-components.js +1 -1
- package/esm/drawer/drawer.js +3 -1
- package/esm/index.js +1 -1
- package/esm/map-marker/badge-enhancer.js +79 -0
- package/esm/map-marker/constants.js +94 -4
- package/esm/map-marker/drag-shadow.js +53 -0
- package/esm/map-marker/fixed-marker.js +84 -80
- package/esm/map-marker/floating-marker.js +22 -13
- package/esm/map-marker/index.js +1 -1
- package/esm/map-marker/label-enhancer.js +60 -0
- package/esm/map-marker/needle.js +43 -0
- package/esm/map-marker/pin-head.js +77 -66
- package/esm/map-marker/styled-components.js +182 -51
- package/esm/map-marker/types.js +1 -1
- package/esm/menu/maybe-child-menu.js +0 -2
- package/esm/menu/nested-menus.js +66 -5
- package/esm/menu/stateful-container.js +15 -13
- package/esm/modal/modal.js +3 -1
- package/esm/popover/popover.js +3 -1
- package/esm/progress-bar/index.js +1 -1
- package/esm/progress-bar/progressbar.js +32 -10
- package/esm/progress-bar/styled-components.js +9 -4
- package/esm/select/select-component.js +2 -11
- package/esm/spinner/styled-components.js +35 -16
- package/esm/table/filter.js +3 -1
- package/esm/themes/dark-theme/color-component-tokens.js +4 -0
- package/esm/themes/light-theme/color-component-tokens.js +4 -0
- package/esm/timezonepicker/timezone-picker.js +64 -36
- package/esm/timezonepicker/tzdata.js +2 -0
- package/esm/timezonepicker/update-tzdata.js +160 -0
- package/index.js +6 -0
- package/index.js.flow +1 -1
- package/map-marker/badge-enhancer.js +90 -0
- package/map-marker/badge-enhancer.js.flow +86 -0
- package/map-marker/constants.js +103 -5
- package/map-marker/constants.js.flow +152 -0
- package/map-marker/drag-shadow.js +64 -0
- package/map-marker/drag-shadow.js.flow +52 -0
- package/map-marker/fixed-marker.js +84 -78
- package/map-marker/fixed-marker.js.flow +78 -66
- package/map-marker/floating-marker.js +22 -13
- package/map-marker/floating-marker.js.flow +30 -17
- package/map-marker/index.d.ts +125 -24
- package/map-marker/index.js +18 -0
- package/map-marker/index.js.flow +3 -0
- package/map-marker/label-enhancer.js +71 -0
- package/map-marker/label-enhancer.js.flow +63 -0
- package/map-marker/needle.js +54 -0
- package/map-marker/needle.js.flow +29 -0
- package/map-marker/pin-head.js +80 -69
- package/map-marker/pin-head.js.flow +122 -84
- package/map-marker/styled-components.js +200 -62
- package/map-marker/styled-components.js.flow +172 -22
- package/map-marker/types.js.flow +69 -20
- package/menu/index.d.ts +9 -4
- package/menu/maybe-child-menu.js +0 -2
- package/menu/maybe-child-menu.js.flow +0 -2
- package/menu/nested-menus.js +66 -5
- package/menu/nested-menus.js.flow +50 -5
- package/menu/stateful-container.js +15 -13
- package/menu/stateful-container.js.flow +19 -13
- package/menu/types.js.flow +7 -1
- package/modal/modal.js +3 -1
- package/modal/modal.js.flow +2 -0
- package/package.json +5 -4
- package/popover/popover.js +3 -1
- package/popover/popover.js.flow +2 -0
- package/progress-bar/index.d.ts +2 -0
- package/progress-bar/index.js +6 -0
- package/progress-bar/index.js.flow +1 -0
- package/progress-bar/progressbar.js +32 -10
- package/progress-bar/progressbar.js.flow +35 -9
- package/progress-bar/styled-components.js +9 -4
- package/progress-bar/styled-components.js.flow +15 -4
- package/progress-bar/types.js.flow +12 -2
- package/select/select-component.js +2 -11
- package/select/select-component.js.flow +5 -7
- package/spinner/styled-components.js +35 -16
- package/spinner/styled-components.js.flow +37 -19
- package/spinner/types.js.flow +10 -0
- package/styles/index.js.flow +1 -1
- package/table/filter.js +3 -1
- package/table/filter.js.flow +5 -1
- package/themes/dark-theme/color-component-tokens.js +4 -0
- package/themes/dark-theme/color-component-tokens.js.flow +4 -0
- package/themes/light-theme/color-component-tokens.js +4 -0
- package/themes/light-theme/color-component-tokens.js.flow +4 -0
- package/themes/types.js.flow +4 -0
- package/timezonepicker/timezone-picker.js +69 -41
- package/timezonepicker/timezone-picker.js.flow +52 -46
- package/timezonepicker/types.js.flow +1 -1
- package/timezonepicker/tzdata.js +10 -0
- package/timezonepicker/tzdata.js.flow +347 -0
- package/timezonepicker/update-tzdata.js +164 -0
- package/timezonepicker/update-tzdata.js.flow +70 -0
|
@@ -19,13 +19,6 @@ export var NUMERICAL_FORMATS = Object.freeze({
|
|
|
19
19
|
ACCOUNTING: 'ACCOUNTING',
|
|
20
20
|
PERCENTAGE: 'PERCENTAGE'
|
|
21
21
|
});
|
|
22
|
-
export var NUMERICAL_OPERATIONS = Object.freeze({
|
|
23
|
-
EQ: 'EQ',
|
|
24
|
-
GT: 'GT',
|
|
25
|
-
GTE: 'GTE',
|
|
26
|
-
LT: 'LT',
|
|
27
|
-
LTE: 'LTE'
|
|
28
|
-
});
|
|
29
22
|
export var DATETIME_OPERATIONS = Object.freeze({
|
|
30
23
|
RANGE_DATETIME: 'RANGE_DATETIME',
|
|
31
24
|
RANGE_DATE: 'RANGE_DATE',
|
|
@@ -39,4 +32,15 @@ export var DATETIME_OPERATIONS = Object.freeze({
|
|
|
39
32
|
export var SORT_DIRECTIONS = Object.freeze({
|
|
40
33
|
ASC: 'ASC',
|
|
41
34
|
DESC: 'DESC'
|
|
42
|
-
});
|
|
35
|
+
}); // If modifying this, take a look at the histogram and adjust. see HISTOGRAM_SIZE
|
|
36
|
+
|
|
37
|
+
export var FILTER_SHELL_WIDTH = '320px'; // Depends on FILTER_SHELL_WIDTH
|
|
38
|
+
|
|
39
|
+
export var HISTOGRAM_SIZE = {
|
|
40
|
+
width: 308,
|
|
41
|
+
height: 120
|
|
42
|
+
}; // Arguably visually appealing within the given width.
|
|
43
|
+
// Smaller and we don't have enough detail per bar.
|
|
44
|
+
// Larger and the bars are too granular and don't align well with the slider steps
|
|
45
|
+
|
|
46
|
+
export var MAX_BIN_COUNT = 50;
|
|
@@ -43,6 +43,12 @@ import { LocaleContext } from '../locale/index.js'; // consider pulling this out
|
|
|
43
43
|
|
|
44
44
|
var HEADER_ROW_HEIGHT = 48;
|
|
45
45
|
|
|
46
|
+
var sum = function sum(ns) {
|
|
47
|
+
return ns.reduce(function (s, n) {
|
|
48
|
+
return s + n;
|
|
49
|
+
}, 0);
|
|
50
|
+
};
|
|
51
|
+
|
|
46
52
|
function CellPlacement(_ref) {
|
|
47
53
|
var columnIndex = _ref.columnIndex,
|
|
48
54
|
rowIndex = _ref.rowIndex,
|
|
@@ -301,7 +307,7 @@ function Header(props) {
|
|
|
301
307
|
}))));
|
|
302
308
|
}
|
|
303
309
|
|
|
304
|
-
function Headers(
|
|
310
|
+
function Headers() {
|
|
305
311
|
var _useStyletron5 = useStyletron(),
|
|
306
312
|
_useStyletron6 = _slicedToArray(_useStyletron5, 2),
|
|
307
313
|
css = _useStyletron6[0],
|
|
@@ -320,9 +326,7 @@ function Headers(props) {
|
|
|
320
326
|
position: 'sticky',
|
|
321
327
|
top: 0,
|
|
322
328
|
left: 0,
|
|
323
|
-
width: "".concat(ctx.widths
|
|
324
|
-
return sum + w;
|
|
325
|
-
}, 0), "px"),
|
|
329
|
+
width: "".concat(sum(ctx.widths), "px"),
|
|
326
330
|
height: "".concat(HEADER_ROW_HEIGHT, "px"),
|
|
327
331
|
display: 'flex',
|
|
328
332
|
// this feels bad.. the absolutely positioned children elements
|
|
@@ -545,22 +549,27 @@ export function DataTable(_ref2) {
|
|
|
545
549
|
}
|
|
546
550
|
|
|
547
551
|
return rowHeight;
|
|
548
|
-
}, [rowHeight]);
|
|
549
|
-
|
|
552
|
+
}, [rowHeight]); // We use state for our ref, to allow hooks to update when the ref changes.
|
|
553
|
+
// eslint-disable-next-line flowtype/no-weak-types
|
|
550
554
|
|
|
551
|
-
var _React$useState7 = React.useState(
|
|
552
|
-
return 0;
|
|
553
|
-
})),
|
|
555
|
+
var _React$useState7 = React.useState(null),
|
|
554
556
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
gridRef = _React$useState8[0],
|
|
558
|
+
setGridRef = _React$useState8[1];
|
|
557
559
|
|
|
558
560
|
var _React$useState9 = React.useState(columns.map(function () {
|
|
559
561
|
return 0;
|
|
560
562
|
})),
|
|
561
563
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
562
|
-
|
|
563
|
-
|
|
564
|
+
measuredWidths = _React$useState10[0],
|
|
565
|
+
setMeasuredWidths = _React$useState10[1];
|
|
566
|
+
|
|
567
|
+
var _React$useState11 = React.useState(columns.map(function () {
|
|
568
|
+
return 0;
|
|
569
|
+
})),
|
|
570
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
571
|
+
resizeDeltas = _React$useState12[0],
|
|
572
|
+
setResizeDeltas = _React$useState12[1];
|
|
564
573
|
|
|
565
574
|
React.useEffect(function () {
|
|
566
575
|
setMeasuredWidths(function (prev) {
|
|
@@ -575,11 +584,11 @@ export function DataTable(_ref2) {
|
|
|
575
584
|
});
|
|
576
585
|
}, [columns]);
|
|
577
586
|
var resetAfterColumnIndex = React.useCallback(function (columnIndex) {
|
|
578
|
-
if (gridRef
|
|
587
|
+
if (gridRef) {
|
|
579
588
|
// $FlowFixMe trigger react-window to layout the elements again
|
|
580
|
-
gridRef.
|
|
589
|
+
gridRef.resetAfterColumnIndex(columnIndex, true);
|
|
581
590
|
}
|
|
582
|
-
}, [gridRef
|
|
591
|
+
}, [gridRef]);
|
|
583
592
|
var handleWidthsChange = React.useCallback(function (nextWidths) {
|
|
584
593
|
setMeasuredWidths(nextWidths);
|
|
585
594
|
resetAfterColumnIndex(0);
|
|
@@ -592,20 +601,20 @@ export function DataTable(_ref2) {
|
|
|
592
601
|
resetAfterColumnIndex(columnIndex);
|
|
593
602
|
}, [setResizeDeltas, resetAfterColumnIndex]);
|
|
594
603
|
|
|
595
|
-
var _React$
|
|
596
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
597
|
-
scrollLeft = _React$useState12[0],
|
|
598
|
-
setScrollLeft = _React$useState12[1];
|
|
599
|
-
|
|
600
|
-
var _React$useState13 = React.useState(false),
|
|
604
|
+
var _React$useState13 = React.useState(0),
|
|
601
605
|
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
602
|
-
|
|
603
|
-
|
|
606
|
+
scrollLeft = _React$useState14[0],
|
|
607
|
+
setScrollLeft = _React$useState14[1];
|
|
604
608
|
|
|
605
609
|
var _React$useState15 = React.useState(false),
|
|
606
610
|
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
607
|
-
|
|
608
|
-
|
|
611
|
+
isScrollingX = _React$useState16[0],
|
|
612
|
+
setIsScrollingX = _React$useState16[1];
|
|
613
|
+
|
|
614
|
+
var _React$useState17 = React.useState(false),
|
|
615
|
+
_React$useState18 = _slicedToArray(_React$useState17, 2),
|
|
616
|
+
recentlyScrolledX = _React$useState18[0],
|
|
617
|
+
setRecentlyScrolledX = _React$useState18[1];
|
|
609
618
|
|
|
610
619
|
React.useLayoutEffect(function () {
|
|
611
620
|
if (recentlyScrolledX !== isScrollingX) {
|
|
@@ -727,25 +736,18 @@ export function DataTable(_ref2) {
|
|
|
727
736
|
return result;
|
|
728
737
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
729
738
|
|
|
730
|
-
var _React$
|
|
731
|
-
_React$
|
|
732
|
-
browserScrollbarWidth = _React$
|
|
733
|
-
setBrowserScrollbarWidth = _React$
|
|
739
|
+
var _React$useState19 = React.useState(0),
|
|
740
|
+
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
741
|
+
browserScrollbarWidth = _React$useState20[0],
|
|
742
|
+
setBrowserScrollbarWidth = _React$useState20[1];
|
|
734
743
|
|
|
735
744
|
var normalizedWidths = React.useMemo(function () {
|
|
736
|
-
var sum = function sum(ns) {
|
|
737
|
-
return ns.reduce(function (s, n) {
|
|
738
|
-
return s + n;
|
|
739
|
-
}, 0);
|
|
740
|
-
};
|
|
741
|
-
|
|
742
745
|
var resizedWidths = measuredWidths.map(function (w, i) {
|
|
743
746
|
return Math.floor(w) + Math.floor(resizeDeltas[i]);
|
|
744
747
|
});
|
|
745
748
|
|
|
746
|
-
if (gridRef
|
|
747
|
-
|
|
748
|
-
var gridProps = gridRef.current.props;
|
|
749
|
+
if (gridRef) {
|
|
750
|
+
var gridProps = gridRef.props;
|
|
749
751
|
var isContentTallerThanContainer = false;
|
|
750
752
|
var visibleRowHeight = 0;
|
|
751
753
|
|
|
@@ -782,7 +784,7 @@ export function DataTable(_ref2) {
|
|
|
782
784
|
}
|
|
783
785
|
|
|
784
786
|
return resizedWidths;
|
|
785
|
-
}, [measuredWidths, resizeDeltas, browserScrollbarWidth, rows.length, columns]);
|
|
787
|
+
}, [gridRef, measuredWidths, resizeDeltas, browserScrollbarWidth, rows.length, columns]);
|
|
786
788
|
var isSelectable = batchActions ? !!batchActions.length : false;
|
|
787
789
|
var isSelectedAll = React.useMemo(function () {
|
|
788
790
|
if (!selectedRowIds) {
|
|
@@ -826,23 +828,23 @@ export function DataTable(_ref2) {
|
|
|
826
828
|
}
|
|
827
829
|
}, [onSort]);
|
|
828
830
|
|
|
829
|
-
var _React$useState19 = React.useState(-1),
|
|
830
|
-
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
831
|
-
columnHighlightIndex = _React$useState20[0],
|
|
832
|
-
setColumnHighlightIndex = _React$useState20[1];
|
|
833
|
-
|
|
834
831
|
var _React$useState21 = React.useState(-1),
|
|
835
832
|
_React$useState22 = _slicedToArray(_React$useState21, 2),
|
|
836
|
-
|
|
837
|
-
|
|
833
|
+
columnHighlightIndex = _React$useState22[0],
|
|
834
|
+
setColumnHighlightIndex = _React$useState22[1];
|
|
835
|
+
|
|
836
|
+
var _React$useState23 = React.useState(-1),
|
|
837
|
+
_React$useState24 = _slicedToArray(_React$useState23, 2),
|
|
838
|
+
rowHighlightIndex = _React$useState24[0],
|
|
839
|
+
setRowHighlightIndex = _React$useState24[1];
|
|
838
840
|
|
|
839
841
|
function handleRowHighlightIndexChange(nextIndex) {
|
|
840
842
|
setRowHighlightIndex(nextIndex);
|
|
841
843
|
|
|
842
|
-
if (gridRef
|
|
844
|
+
if (gridRef) {
|
|
843
845
|
if (nextIndex >= 0) {
|
|
844
846
|
// $FlowFixMe - unable to get react-window types
|
|
845
|
-
gridRef.
|
|
847
|
+
gridRef.scrollToItem({
|
|
846
848
|
rowIndex: nextIndex
|
|
847
849
|
});
|
|
848
850
|
}
|
|
@@ -933,8 +935,9 @@ export function DataTable(_ref2) {
|
|
|
933
935
|
}
|
|
934
936
|
}, /*#__PURE__*/React.createElement(VariableSizeGrid // eslint-disable-next-line flowtype/no-weak-types
|
|
935
937
|
, {
|
|
936
|
-
ref:
|
|
938
|
+
ref: setGridRef,
|
|
937
939
|
overscanRowCount: 10,
|
|
940
|
+
overscanColumnCount: 5,
|
|
938
941
|
innerElementType: InnerTableElement,
|
|
939
942
|
columnCount: columns.length,
|
|
940
943
|
columnWidth: function columnWidth(columnIndex) {
|
|
@@ -21,6 +21,7 @@ import { Button, SIZE as BUTTON_SIZE } from '../button/index.js';
|
|
|
21
21
|
import { Checkbox, STYLE_TYPE } from '../checkbox/index.js';
|
|
22
22
|
import { useStyletron } from '../styles/index.js';
|
|
23
23
|
import { LocaleContext } from '../locale/index.js';
|
|
24
|
+
import { FILTER_SHELL_WIDTH } from './constants.js';
|
|
24
25
|
|
|
25
26
|
function FilterShell(props) {
|
|
26
27
|
var _useStyletron = useStyletron(),
|
|
@@ -29,6 +30,21 @@ function FilterShell(props) {
|
|
|
29
30
|
theme = _useStyletron2[1];
|
|
30
31
|
|
|
31
32
|
var locale = React.useContext(LocaleContext);
|
|
33
|
+
var excludeText;
|
|
34
|
+
|
|
35
|
+
switch (props.excludeKind) {
|
|
36
|
+
case 'value':
|
|
37
|
+
excludeText = locale.datatable.filterExcludeValue;
|
|
38
|
+
break;
|
|
39
|
+
|
|
40
|
+
case 'range':
|
|
41
|
+
excludeText = locale.datatable.filterExcludeRange;
|
|
42
|
+
break;
|
|
43
|
+
|
|
44
|
+
default:
|
|
45
|
+
excludeText = locale.datatable.filterExclude;
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
return /*#__PURE__*/React.createElement("form", {
|
|
33
49
|
className: css({
|
|
34
50
|
backgroundColor: theme.colors.backgroundPrimary,
|
|
@@ -36,7 +52,7 @@ function FilterShell(props) {
|
|
|
36
52
|
paddingRight: theme.sizing.scale600,
|
|
37
53
|
paddingBottom: theme.sizing.scale600,
|
|
38
54
|
paddingLeft: theme.sizing.scale600,
|
|
39
|
-
width:
|
|
55
|
+
width: FILTER_SHELL_WIDTH
|
|
40
56
|
}),
|
|
41
57
|
onSubmit: function onSubmit(event) {
|
|
42
58
|
event.preventDefault();
|
|
@@ -44,17 +60,23 @@ function FilterShell(props) {
|
|
|
44
60
|
}
|
|
45
61
|
}, props.children, /*#__PURE__*/React.createElement("div", {
|
|
46
62
|
className: css({
|
|
47
|
-
alignItems: 'center',
|
|
48
63
|
display: 'flex',
|
|
64
|
+
flexDirection: 'column',
|
|
49
65
|
justifyContent: 'space-between',
|
|
50
|
-
|
|
66
|
+
alignItems: 'flex-end',
|
|
67
|
+
marginTop: theme.sizing.scale600,
|
|
68
|
+
gap: theme.sizing.scale200
|
|
69
|
+
})
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: css({
|
|
72
|
+
alignSelf: 'flex-start'
|
|
51
73
|
})
|
|
52
74
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
53
75
|
checked: props.exclude,
|
|
54
76
|
onChange: props.onExcludeChange,
|
|
55
77
|
checkmarkType: STYLE_TYPE.toggle_round,
|
|
56
78
|
labelPlacement: "right"
|
|
57
|
-
},
|
|
79
|
+
}, excludeText)), /*#__PURE__*/React.createElement(Button, {
|
|
58
80
|
size: BUTTON_SIZE.compact,
|
|
59
81
|
type: "submit"
|
|
60
82
|
}, locale.datatable.filterApply)));
|
package/esm/data-table/locale.js
CHANGED
|
@@ -6,18 +6,20 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
var locale = {
|
|
8
8
|
emptyState: 'No rows match the filter criteria defined. Please remove one or more filters to view more data.',
|
|
9
|
-
loadingState: 'Loading
|
|
9
|
+
loadingState: 'Loading rows.',
|
|
10
10
|
searchAriaLabel: 'Search by text',
|
|
11
11
|
filterAdd: 'Add Filter',
|
|
12
12
|
filterExclude: 'Exclude',
|
|
13
13
|
filterApply: 'Apply',
|
|
14
|
+
filterExcludeRange: 'Exclude range',
|
|
15
|
+
filterExcludeValue: 'Exclude value',
|
|
14
16
|
filterAppliedTo: 'filter applied to',
|
|
15
17
|
optionsLabel: 'Select column to filter by',
|
|
16
18
|
optionsSearch: 'Search for a column to filter by...',
|
|
17
19
|
optionsEmpty: 'No columns available.',
|
|
18
20
|
categoricalFilterSelectAll: 'Select All',
|
|
19
21
|
categoricalFilterSelectClear: 'Clear',
|
|
20
|
-
categoricalFilterEmpty: 'No
|
|
22
|
+
categoricalFilterEmpty: 'No categories found',
|
|
21
23
|
datetimeFilterRange: 'Range',
|
|
22
24
|
datetimeFilterRangeDatetime: 'Date, Time',
|
|
23
25
|
datetimeFilterRangeDate: 'Date',
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
6
|
-
|
|
7
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
-
|
|
9
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
2
|
|
|
11
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -27,51 +19,62 @@ LICENSE file in the root directory of this source tree.
|
|
|
27
19
|
import * as React from 'react';
|
|
28
20
|
import { useStyletron } from '../styles/index.js';
|
|
29
21
|
import HeaderCell from './header-cell.js';
|
|
22
|
+
import { useRef } from 'react'; // Measures the column header + sampled data
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
function MeasureColumn(_ref) {
|
|
25
|
+
var sampleIndexes = _ref.sampleIndexes,
|
|
26
|
+
column = _ref.column,
|
|
27
|
+
columnIndex = _ref.columnIndex,
|
|
28
|
+
rows = _ref.rows,
|
|
29
|
+
isSelectable = _ref.isSelectable,
|
|
30
|
+
onLayout = _ref.onLayout;
|
|
37
31
|
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
setNode = _React$useState4[1];
|
|
32
|
+
var _useStyletron = useStyletron(),
|
|
33
|
+
_useStyletron2 = _slicedToArray(_useStyletron, 1),
|
|
34
|
+
css = _useStyletron2[0];
|
|
42
35
|
|
|
43
|
-
var ref =
|
|
44
|
-
setNode(node);
|
|
45
|
-
}, []);
|
|
36
|
+
var ref = useRef();
|
|
46
37
|
React.useEffect(function () {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
window.requestAnimationFrame(function () {
|
|
50
|
-
setDimensions(node.getBoundingClientRect());
|
|
51
|
-
});
|
|
52
|
-
}
|
|
38
|
+
if (ref.current) {
|
|
39
|
+
onLayout(columnIndex, ref.current.getBoundingClientRect());
|
|
53
40
|
}
|
|
54
|
-
}, [
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
41
|
+
}, []);
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
ref: ref,
|
|
44
|
+
className: css({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
width: 'fit-content'
|
|
48
|
+
})
|
|
49
|
+
}, /*#__PURE__*/React.createElement(HeaderCell, {
|
|
50
|
+
index: columnIndex,
|
|
51
|
+
isHovered: true,
|
|
52
|
+
isMeasured: true,
|
|
53
|
+
isSelectedAll: false,
|
|
54
|
+
isSelectedIndeterminate: false,
|
|
55
|
+
onMouseEnter: function onMouseEnter() {},
|
|
56
|
+
onMouseLeave: function onMouseLeave() {},
|
|
57
|
+
onSelectAll: function onSelectAll() {},
|
|
58
|
+
onSelectNone: function onSelectNone() {},
|
|
59
|
+
onSort: function onSort(i) {},
|
|
60
|
+
sortable: column.sortable,
|
|
61
|
+
sortDirection: null,
|
|
62
|
+
title: column.title,
|
|
63
|
+
isSelectable: isSelectable
|
|
64
|
+
}), sampleIndexes.map(function (rowIndex, i) {
|
|
65
|
+
var Cell = column.renderCell;
|
|
66
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
67
|
+
key: "measure-".concat(i),
|
|
68
|
+
value: column.mapDataToValue(rows[rowIndex].data),
|
|
69
|
+
isSelectable: isSelectable,
|
|
70
|
+
isMeasured: true,
|
|
71
|
+
sortable: column.sortable,
|
|
72
|
+
x: 0,
|
|
73
|
+
y: rowIndex
|
|
74
|
+
});
|
|
75
|
+
}));
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
// sample size could likely be generated based on row count, to have higher confidence
|
|
75
78
|
var MAX_SAMPLE_SIZE = 50;
|
|
76
79
|
|
|
77
80
|
function generateSampleIndices(inputMin, inputMax, maxSamples) {
|
|
@@ -103,57 +106,46 @@ function generateSampleIndices(inputMin, inputMax, maxSamples) {
|
|
|
103
106
|
return indices;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
export default function MeasureColumnWidths(
|
|
107
|
-
var columns =
|
|
108
|
-
rows =
|
|
109
|
-
widths =
|
|
110
|
-
isSelectable =
|
|
111
|
-
onWidthsChange =
|
|
109
|
+
export default function MeasureColumnWidths(_ref2) {
|
|
110
|
+
var columns = _ref2.columns,
|
|
111
|
+
rows = _ref2.rows,
|
|
112
|
+
widths = _ref2.widths,
|
|
113
|
+
isSelectable = _ref2.isSelectable,
|
|
114
|
+
onWidthsChange = _ref2.onWidthsChange;
|
|
112
115
|
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
css =
|
|
116
|
+
var _useStyletron3 = useStyletron(),
|
|
117
|
+
_useStyletron4 = _slicedToArray(_useStyletron3, 1),
|
|
118
|
+
css = _useStyletron4[0];
|
|
116
119
|
|
|
117
|
-
var
|
|
118
|
-
|
|
120
|
+
var widthMap = React.useMemo(function () {
|
|
121
|
+
return new Map();
|
|
122
|
+
}, []);
|
|
119
123
|
var sampleSize = rows.length < MAX_SAMPLE_SIZE ? rows.length : MAX_SAMPLE_SIZE;
|
|
120
124
|
var finishedMeasurementCount = (sampleSize + 1) * columns.length;
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
dimensionsCache.current = widths;
|
|
124
|
-
var indices = generateSampleIndices(0, rows.length - 1, sampleSize);
|
|
125
|
-
return columns.map(function () {
|
|
126
|
-
return indices;
|
|
127
|
-
});
|
|
125
|
+
var sampleIndexes = React.useMemo(function () {
|
|
126
|
+
return generateSampleIndices(0, rows.length - 1, sampleSize);
|
|
128
127
|
}, [columns, rows, widths, sampleSize]);
|
|
129
|
-
var handleDimensionsChange = React.useCallback(function (columnIndex,
|
|
130
|
-
|
|
128
|
+
var handleDimensionsChange = React.useCallback(function (columnIndex, dimensions) {
|
|
129
|
+
var nextWidth = Math.min(Math.max(columns[columnIndex].minWidth || 0, widthMap.get(columnIndex) || 0, dimensions.width + 1), columns[columnIndex].maxWidth || Infinity);
|
|
131
130
|
|
|
132
|
-
if (
|
|
133
|
-
|
|
131
|
+
if (nextWidth !== widthMap.get(columnIndex)) {
|
|
132
|
+
widthMap.set(columnIndex, nextWidth);
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
nextWidths[columnIndex] = nextWidth;
|
|
143
|
-
dimensionsCache.current = nextWidths;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (measurementCount.current >= finishedMeasurementCount) {
|
|
147
|
-
onWidthsChange(dimensionsCache.current);
|
|
135
|
+
if ( // Refresh at 100% of done
|
|
136
|
+
widthMap.size === columns.length || // ...50%
|
|
137
|
+
widthMap.size === Math.floor(columns.length / 2) || // ...25%
|
|
138
|
+
widthMap.size === Math.floor(columns.length / 4)) {
|
|
139
|
+
onWidthsChange(Array.from(widthMap.values()));
|
|
148
140
|
}
|
|
149
141
|
}, [columns, finishedMeasurementCount, onWidthsChange]);
|
|
150
142
|
var hiddenStyle = css({
|
|
151
143
|
position: 'absolute',
|
|
152
144
|
overflow: 'hidden',
|
|
153
145
|
height: 0
|
|
154
|
-
});
|
|
146
|
+
}); // Remove the measurement nodes after we are done updating our column width
|
|
155
147
|
|
|
156
|
-
if (
|
|
148
|
+
if (widthMap.size === columns.length) {
|
|
157
149
|
return null;
|
|
158
150
|
}
|
|
159
151
|
|
|
@@ -164,45 +156,15 @@ export default function MeasureColumnWidths(_ref) {
|
|
|
164
156
|
className: hiddenStyle,
|
|
165
157
|
"aria-hidden": true,
|
|
166
158
|
role: "none"
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
value: columns[columnIndex].mapDataToValue(rows[rowIndex].data),
|
|
177
|
-
isMeasured: true,
|
|
178
|
-
onSelect: isSelectable && columnIndex === 0 ? function () {} : undefined,
|
|
179
|
-
x: columnIndex,
|
|
180
|
-
y: rowIndex
|
|
181
|
-
})
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
}), columns.map(function (column, columnIndex) {
|
|
185
|
-
return /*#__PURE__*/React.createElement(ElementMeasurer, {
|
|
186
|
-
key: "measure-column-".concat(columnIndex),
|
|
187
|
-
onDimensionsChange: function onDimensionsChange(dimensions) {
|
|
188
|
-
return handleDimensionsChange(columnIndex, -1, dimensions);
|
|
189
|
-
},
|
|
190
|
-
item: /*#__PURE__*/React.createElement(HeaderCell, {
|
|
191
|
-
index: columnIndex,
|
|
192
|
-
isHovered: true,
|
|
193
|
-
isMeasured: true,
|
|
194
|
-
isSelectable: isSelectable && columnIndex === 0,
|
|
195
|
-
isSelectedAll: false,
|
|
196
|
-
isSelectedIndeterminate: false,
|
|
197
|
-
onMouseEnter: function onMouseEnter() {},
|
|
198
|
-
onMouseLeave: function onMouseLeave() {},
|
|
199
|
-
onSelectAll: function onSelectAll() {},
|
|
200
|
-
onSelectNone: function onSelectNone() {},
|
|
201
|
-
onSort: function onSort(i) {},
|
|
202
|
-
sortable: column.sortable,
|
|
203
|
-
sortDirection: null,
|
|
204
|
-
title: column.title
|
|
205
|
-
})
|
|
159
|
+
}, columns.map(function (column, i) {
|
|
160
|
+
return /*#__PURE__*/React.createElement(MeasureColumn, {
|
|
161
|
+
key: column.title + i,
|
|
162
|
+
column: column,
|
|
163
|
+
rows: rows,
|
|
164
|
+
isSelectable: isSelectable,
|
|
165
|
+
onLayout: handleDimensionsChange,
|
|
166
|
+
columnIndex: i,
|
|
167
|
+
sampleIndexes: sampleIndexes
|
|
206
168
|
});
|
|
207
169
|
}))
|
|
208
170
|
);
|
|
@@ -481,7 +481,7 @@ export var StyledDay = styled('div', function (props) {
|
|
|
481
481
|
content: '""',
|
|
482
482
|
boxSizing: 'border-box',
|
|
483
483
|
display: 'inline-block',
|
|
484
|
-
boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
484
|
+
boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
485
485
|
backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
|
|
486
486
|
height: $hasDateLabel ? '100%' : $density === DENSITY.high ? '42px' : '50px',
|
|
487
487
|
width: '100%',
|
package/esm/drawer/drawer.js
CHANGED
|
@@ -329,7 +329,9 @@ var Drawer = /*#__PURE__*/function (_React$Component) {
|
|
|
329
329
|
|
|
330
330
|
var sharedProps = this.getSharedProps();
|
|
331
331
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, function (locale) {
|
|
332
|
-
return /*#__PURE__*/React.createElement(FocusLock
|
|
332
|
+
return /*#__PURE__*/React.createElement(FocusLock // Allow focus to escape when UI is within an iframe
|
|
333
|
+
, {
|
|
334
|
+
crossFrame: false,
|
|
333
335
|
returnFocus: true,
|
|
334
336
|
autoFocus: autoFocus,
|
|
335
337
|
noFocusGuards: true
|
package/esm/index.js
CHANGED
|
@@ -8,4 +8,4 @@ export { styled, withStyle, withWrapper, useStyletron, createThemedStyled, creat
|
|
|
8
8
|
export { createTheme, createDarkTheme, createLightTheme, lightThemePrimitives, darkThemePrimitives, darkThemeOverrides, DarkTheme, DarkThemeMove, LightTheme, LightThemeMove } from './themes/index.js';
|
|
9
9
|
export { default as LocaleProvider } from './locale/index.js';
|
|
10
10
|
export { default as BaseProvider } from './helpers/base-provider.js';
|
|
11
|
-
export { mergeOverrides } from './helpers/overrides.js';
|
|
11
|
+
export { getOverrides, mergeOverrides } from './helpers/overrides.js';
|