baseui 10.9.0 → 10.9.1

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.
Files changed (39) hide show
  1. package/data-table/column-numerical.js +355 -307
  2. package/data-table/column-numerical.js.flow +287 -273
  3. package/data-table/constants.js +11 -17
  4. package/data-table/constants.js.flow +8 -11
  5. package/data-table/data-table.js +50 -53
  6. package/data-table/data-table.js.flow +13 -18
  7. package/data-table/filter-shell.js +4 -27
  8. package/data-table/filter-shell.js.flow +9 -33
  9. package/data-table/locale.js +2 -4
  10. package/data-table/locale.js.flow +2 -6
  11. package/data-table/measure-column-widths.js +121 -83
  12. package/data-table/measure-column-widths.js.flow +109 -87
  13. package/es/data-table/column-numerical.js +317 -245
  14. package/es/data-table/constants.js +8 -12
  15. package/es/data-table/data-table.js +16 -18
  16. package/es/data-table/filter-shell.js +4 -26
  17. package/es/data-table/locale.js +2 -4
  18. package/es/data-table/measure-column-widths.js +86 -75
  19. package/es/form-control/form-control.js +58 -7
  20. package/es/form-control/styled-components.js +27 -6
  21. package/es/popover/popover.js +1 -1
  22. package/esm/data-table/column-numerical.js +353 -304
  23. package/esm/data-table/constants.js +8 -12
  24. package/esm/data-table/data-table.js +50 -53
  25. package/esm/data-table/filter-shell.js +4 -26
  26. package/esm/data-table/locale.js +2 -4
  27. package/esm/data-table/measure-column-widths.js +121 -83
  28. package/esm/form-control/form-control.js +60 -9
  29. package/esm/form-control/styled-components.js +23 -3
  30. package/esm/popover/popover.js +1 -1
  31. package/form-control/form-control.js +61 -8
  32. package/form-control/form-control.js.flow +82 -10
  33. package/form-control/index.d.ts +1 -0
  34. package/form-control/styled-components.js +27 -5
  35. package/form-control/styled-components.js.flow +25 -3
  36. package/form-control/types.js.flow +20 -8
  37. package/package.json +1 -2
  38. package/popover/popover.js +1 -1
  39. package/popover/popover.js.flow +1 -1
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.MAX_BIN_COUNT = exports.HISTOGRAM_SIZE = exports.FILTER_SHELL_WIDTH = exports.SORT_DIRECTIONS = exports.DATETIME_OPERATIONS = exports.NUMERICAL_FORMATS = exports.COLUMNS = void 0;
6
+ exports.SORT_DIRECTIONS = exports.DATETIME_OPERATIONS = exports.NUMERICAL_OPERATIONS = exports.NUMERICAL_FORMATS = exports.COLUMNS = void 0;
7
7
 
8
8
  /*
9
9
  Copyright (c) Uber Technologies, Inc.
@@ -28,6 +28,14 @@ var NUMERICAL_FORMATS = Object.freeze({
28
28
  PERCENTAGE: 'PERCENTAGE'
29
29
  });
30
30
  exports.NUMERICAL_FORMATS = NUMERICAL_FORMATS;
31
+ var NUMERICAL_OPERATIONS = Object.freeze({
32
+ EQ: 'EQ',
33
+ GT: 'GT',
34
+ GTE: 'GTE',
35
+ LT: 'LT',
36
+ LTE: 'LTE'
37
+ });
38
+ exports.NUMERICAL_OPERATIONS = NUMERICAL_OPERATIONS;
31
39
  var DATETIME_OPERATIONS = Object.freeze({
32
40
  RANGE_DATETIME: 'RANGE_DATETIME',
33
41
  RANGE_DATE: 'RANGE_DATE',
@@ -42,19 +50,5 @@ exports.DATETIME_OPERATIONS = DATETIME_OPERATIONS;
42
50
  var SORT_DIRECTIONS = Object.freeze({
43
51
  ASC: 'ASC',
44
52
  DESC: 'DESC'
45
- }); // If modifying this, take a look at the histogram and adjust. see HISTOGRAM_SIZE
46
-
47
- exports.SORT_DIRECTIONS = SORT_DIRECTIONS;
48
- var FILTER_SHELL_WIDTH = '320px'; // Depends on FILTER_SHELL_WIDTH
49
-
50
- exports.FILTER_SHELL_WIDTH = FILTER_SHELL_WIDTH;
51
- var HISTOGRAM_SIZE = {
52
- width: 308,
53
- height: 120
54
- }; // Arguably visually appealing within the given width.
55
- // Smaller and we don't have enough detail per bar.
56
- // Larger and the bars are too granular and don't align well with the slider steps
57
-
58
- exports.HISTOGRAM_SIZE = HISTOGRAM_SIZE;
59
- var MAX_BIN_COUNT = 50;
60
- exports.MAX_BIN_COUNT = MAX_BIN_COUNT;
53
+ });
54
+ exports.SORT_DIRECTIONS = SORT_DIRECTIONS;
@@ -23,6 +23,14 @@ export const NUMERICAL_FORMATS = Object.freeze({
23
23
  PERCENTAGE: 'PERCENTAGE',
24
24
  });
25
25
 
26
+ export const NUMERICAL_OPERATIONS = Object.freeze({
27
+ EQ: 'EQ',
28
+ GT: 'GT',
29
+ GTE: 'GTE',
30
+ LT: 'LT',
31
+ LTE: 'LTE',
32
+ });
33
+
26
34
  export const DATETIME_OPERATIONS = Object.freeze({
27
35
  RANGE_DATETIME: 'RANGE_DATETIME',
28
36
  RANGE_DATE: 'RANGE_DATE',
@@ -39,17 +47,6 @@ export const SORT_DIRECTIONS = Object.freeze({
39
47
  DESC: 'DESC',
40
48
  });
41
49
 
42
- // If modifying this, take a look at the histogram and adjust. see HISTOGRAM_SIZE
43
- export const FILTER_SHELL_WIDTH = '320px';
44
-
45
- // Depends on FILTER_SHELL_WIDTH
46
- export const HISTOGRAM_SIZE = {width: 308, height: 120};
47
-
48
- // Arguably visually appealing within the given width.
49
- // Smaller and we don't have enough detail per bar.
50
- // Larger and the bars are too granular and don't align well with the slider steps
51
- export const MAX_BIN_COUNT = 50;
52
-
53
50
  declare var __DEV__: boolean;
54
51
  declare var __NODE__: boolean;
55
52
  declare var __BROWSER__: boolean;
@@ -62,12 +62,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
62
62
  // consider pulling this out to a prop if useful.
63
63
  var HEADER_ROW_HEIGHT = 48;
64
64
 
65
- var sum = function sum(ns) {
66
- return ns.reduce(function (s, n) {
67
- return s + n;
68
- }, 0);
69
- };
70
-
71
65
  function CellPlacement(_ref) {
72
66
  var columnIndex = _ref.columnIndex,
73
67
  rowIndex = _ref.rowIndex,
@@ -326,7 +320,7 @@ function Header(props) {
326
320
  }))));
327
321
  }
328
322
 
329
- function Headers() {
323
+ function Headers(props) {
330
324
  var _useStyletron5 = (0, _index2.useStyletron)(),
331
325
  _useStyletron6 = _slicedToArray(_useStyletron5, 2),
332
326
  css = _useStyletron6[0],
@@ -345,7 +339,9 @@ function Headers() {
345
339
  position: 'sticky',
346
340
  top: 0,
347
341
  left: 0,
348
- width: "".concat(sum(ctx.widths), "px"),
342
+ width: "".concat(ctx.widths.reduce(function (sum, w) {
343
+ return sum + w;
344
+ }, 0), "px"),
349
345
  height: "".concat(HEADER_ROW_HEIGHT, "px"),
350
346
  display: 'flex',
351
347
  // this feels bad.. the absolutely positioned children elements
@@ -568,27 +564,22 @@ function DataTable(_ref2) {
568
564
  }
569
565
 
570
566
  return rowHeight;
571
- }, [rowHeight]); // We use state for our ref, to allow hooks to update when the ref changes.
572
- // eslint-disable-next-line flowtype/no-weak-types
567
+ }, [rowHeight]);
568
+ var gridRef = React.useRef(null);
573
569
 
574
- var _React$useState7 = React.useState(null),
570
+ var _React$useState7 = React.useState(columns.map(function () {
571
+ return 0;
572
+ })),
575
573
  _React$useState8 = _slicedToArray(_React$useState7, 2),
576
- gridRef = _React$useState8[0],
577
- setGridRef = _React$useState8[1];
574
+ measuredWidths = _React$useState8[0],
575
+ setMeasuredWidths = _React$useState8[1];
578
576
 
579
577
  var _React$useState9 = React.useState(columns.map(function () {
580
578
  return 0;
581
579
  })),
582
580
  _React$useState10 = _slicedToArray(_React$useState9, 2),
583
- measuredWidths = _React$useState10[0],
584
- setMeasuredWidths = _React$useState10[1];
585
-
586
- var _React$useState11 = React.useState(columns.map(function () {
587
- return 0;
588
- })),
589
- _React$useState12 = _slicedToArray(_React$useState11, 2),
590
- resizeDeltas = _React$useState12[0],
591
- setResizeDeltas = _React$useState12[1];
581
+ resizeDeltas = _React$useState10[0],
582
+ setResizeDeltas = _React$useState10[1];
592
583
 
593
584
  React.useEffect(function () {
594
585
  setMeasuredWidths(function (prev) {
@@ -603,11 +594,11 @@ function DataTable(_ref2) {
603
594
  });
604
595
  }, [columns]);
605
596
  var resetAfterColumnIndex = React.useCallback(function (columnIndex) {
606
- if (gridRef) {
597
+ if (gridRef.current) {
607
598
  // $FlowFixMe trigger react-window to layout the elements again
608
- gridRef.resetAfterColumnIndex(columnIndex, true);
599
+ gridRef.current.resetAfterColumnIndex(columnIndex, true);
609
600
  }
610
- }, [gridRef]);
601
+ }, [gridRef.current]);
611
602
  var handleWidthsChange = React.useCallback(function (nextWidths) {
612
603
  setMeasuredWidths(nextWidths);
613
604
  resetAfterColumnIndex(0);
@@ -620,20 +611,20 @@ function DataTable(_ref2) {
620
611
  resetAfterColumnIndex(columnIndex);
621
612
  }, [setResizeDeltas, resetAfterColumnIndex]);
622
613
 
623
- var _React$useState13 = React.useState(0),
614
+ var _React$useState11 = React.useState(0),
615
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
616
+ scrollLeft = _React$useState12[0],
617
+ setScrollLeft = _React$useState12[1];
618
+
619
+ var _React$useState13 = React.useState(false),
624
620
  _React$useState14 = _slicedToArray(_React$useState13, 2),
625
- scrollLeft = _React$useState14[0],
626
- setScrollLeft = _React$useState14[1];
621
+ isScrollingX = _React$useState14[0],
622
+ setIsScrollingX = _React$useState14[1];
627
623
 
628
624
  var _React$useState15 = React.useState(false),
629
625
  _React$useState16 = _slicedToArray(_React$useState15, 2),
630
- isScrollingX = _React$useState16[0],
631
- setIsScrollingX = _React$useState16[1];
632
-
633
- var _React$useState17 = React.useState(false),
634
- _React$useState18 = _slicedToArray(_React$useState17, 2),
635
- recentlyScrolledX = _React$useState18[0],
636
- setRecentlyScrolledX = _React$useState18[1];
626
+ recentlyScrolledX = _React$useState16[0],
627
+ setRecentlyScrolledX = _React$useState16[1];
637
628
 
638
629
  React.useLayoutEffect(function () {
639
630
  if (recentlyScrolledX !== isScrollingX) {
@@ -755,18 +746,25 @@ function DataTable(_ref2) {
755
746
  return result;
756
747
  }, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
757
748
 
758
- var _React$useState19 = React.useState(0),
759
- _React$useState20 = _slicedToArray(_React$useState19, 2),
760
- browserScrollbarWidth = _React$useState20[0],
761
- setBrowserScrollbarWidth = _React$useState20[1];
749
+ var _React$useState17 = React.useState(0),
750
+ _React$useState18 = _slicedToArray(_React$useState17, 2),
751
+ browserScrollbarWidth = _React$useState18[0],
752
+ setBrowserScrollbarWidth = _React$useState18[1];
762
753
 
763
754
  var normalizedWidths = React.useMemo(function () {
755
+ var sum = function sum(ns) {
756
+ return ns.reduce(function (s, n) {
757
+ return s + n;
758
+ }, 0);
759
+ };
760
+
764
761
  var resizedWidths = measuredWidths.map(function (w, i) {
765
762
  return Math.floor(w) + Math.floor(resizeDeltas[i]);
766
763
  });
767
764
 
768
- if (gridRef) {
769
- var gridProps = gridRef.props;
765
+ if (gridRef.current) {
766
+ // $FlowFixMe
767
+ var gridProps = gridRef.current.props;
770
768
  var isContentTallerThanContainer = false;
771
769
  var visibleRowHeight = 0;
772
770
 
@@ -803,7 +801,7 @@ function DataTable(_ref2) {
803
801
  }
804
802
 
805
803
  return resizedWidths;
806
- }, [gridRef, measuredWidths, resizeDeltas, browserScrollbarWidth, rows.length, columns]);
804
+ }, [measuredWidths, resizeDeltas, browserScrollbarWidth, rows.length, columns]);
807
805
  var isSelectable = batchActions ? !!batchActions.length : false;
808
806
  var isSelectedAll = React.useMemo(function () {
809
807
  if (!selectedRowIds) {
@@ -847,23 +845,23 @@ function DataTable(_ref2) {
847
845
  }
848
846
  }, [onSort]);
849
847
 
848
+ var _React$useState19 = React.useState(-1),
849
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
850
+ columnHighlightIndex = _React$useState20[0],
851
+ setColumnHighlightIndex = _React$useState20[1];
852
+
850
853
  var _React$useState21 = React.useState(-1),
851
854
  _React$useState22 = _slicedToArray(_React$useState21, 2),
852
- columnHighlightIndex = _React$useState22[0],
853
- setColumnHighlightIndex = _React$useState22[1];
854
-
855
- var _React$useState23 = React.useState(-1),
856
- _React$useState24 = _slicedToArray(_React$useState23, 2),
857
- rowHighlightIndex = _React$useState24[0],
858
- setRowHighlightIndex = _React$useState24[1];
855
+ rowHighlightIndex = _React$useState22[0],
856
+ setRowHighlightIndex = _React$useState22[1];
859
857
 
860
858
  function handleRowHighlightIndexChange(nextIndex) {
861
859
  setRowHighlightIndex(nextIndex);
862
860
 
863
- if (gridRef) {
861
+ if (gridRef.current) {
864
862
  if (nextIndex >= 0) {
865
863
  // $FlowFixMe - unable to get react-window types
866
- gridRef.scrollToItem({
864
+ gridRef.current.scrollToItem({
867
865
  rowIndex: nextIndex
868
866
  });
869
867
  }
@@ -954,9 +952,8 @@ function DataTable(_ref2) {
954
952
  }
955
953
  }, /*#__PURE__*/React.createElement(_reactWindow.VariableSizeGrid // eslint-disable-next-line flowtype/no-weak-types
956
954
  , {
957
- ref: setGridRef,
955
+ ref: gridRef,
958
956
  overscanRowCount: 10,
959
- overscanColumnCount: 5,
960
957
  innerElementType: InnerTableElement,
961
958
  columnCount: columns.length,
962
959
  columnWidth: function columnWidth(columnIndex) {
@@ -87,8 +87,6 @@ type CellPlacementPropsT = {
87
87
  },
88
88
  };
89
89
 
90
- const sum = ns => ns.reduce((s, n) => s + n, 0);
91
-
92
90
  function CellPlacement({columnIndex, rowIndex, data, style}) {
93
91
  const [css, theme] = useStyletron();
94
92
 
@@ -413,7 +411,7 @@ function Header(props: HeaderProps) {
413
411
  );
414
412
  }
415
413
 
416
- function Headers() {
414
+ function Headers(props: {||}) {
417
415
  const [css, theme] = useStyletron();
418
416
  const locale = React.useContext(LocaleContext);
419
417
  const ctx = React.useContext(HeaderContext);
@@ -425,7 +423,7 @@ function Headers() {
425
423
  position: 'sticky',
426
424
  top: 0,
427
425
  left: 0,
428
- width: `${sum(ctx.widths)}px`,
426
+ width: `${ctx.widths.reduce((sum, w) => sum + w, 0)}px`,
429
427
  height: `${HEADER_ROW_HEIGHT}px`,
430
428
  display: 'flex',
431
429
  // this feels bad.. the absolutely positioned children elements
@@ -698,10 +696,7 @@ export function DataTable({
698
696
  },
699
697
  [rowHeight],
700
698
  );
701
-
702
- // We use state for our ref, to allow hooks to update when the ref changes.
703
- // eslint-disable-next-line flowtype/no-weak-types
704
- const [gridRef, setGridRef] = React.useState<?VariableSizeGrid<any>>(null);
699
+ const gridRef = React.useRef<typeof VariableSizeGrid | null>(null);
705
700
  const [measuredWidths, setMeasuredWidths] = React.useState(
706
701
  columns.map(() => 0),
707
702
  );
@@ -717,12 +712,12 @@ export function DataTable({
717
712
 
718
713
  const resetAfterColumnIndex = React.useCallback(
719
714
  columnIndex => {
720
- if (gridRef) {
715
+ if (gridRef.current) {
721
716
  // $FlowFixMe trigger react-window to layout the elements again
722
- gridRef.resetAfterColumnIndex(columnIndex, true);
717
+ gridRef.current.resetAfterColumnIndex(columnIndex, true);
723
718
  }
724
719
  },
725
- [gridRef],
720
+ [gridRef.current],
726
721
  );
727
722
  const handleWidthsChange = React.useCallback(
728
723
  nextWidths => {
@@ -848,11 +843,13 @@ export function DataTable({
848
843
 
849
844
  const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
850
845
  const normalizedWidths = React.useMemo(() => {
846
+ const sum = ns => ns.reduce((s, n) => s + n, 0);
851
847
  const resizedWidths = measuredWidths.map(
852
848
  (w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]),
853
849
  );
854
- if (gridRef) {
855
- const gridProps = gridRef.props;
850
+ if (gridRef.current) {
851
+ // $FlowFixMe
852
+ const gridProps = gridRef.current.props;
856
853
 
857
854
  let isContentTallerThanContainer = false;
858
855
  let visibleRowHeight = 0;
@@ -889,7 +886,6 @@ export function DataTable({
889
886
  }
890
887
  return resizedWidths;
891
888
  }, [
892
- gridRef,
893
889
  measuredWidths,
894
890
  resizeDeltas,
895
891
  browserScrollbarWidth,
@@ -952,10 +948,10 @@ export function DataTable({
952
948
 
953
949
  function handleRowHighlightIndexChange(nextIndex) {
954
950
  setRowHighlightIndex(nextIndex);
955
- if (gridRef) {
951
+ if (gridRef.current) {
956
952
  if (nextIndex >= 0) {
957
953
  // $FlowFixMe - unable to get react-window types
958
- gridRef.scrollToItem({rowIndex: nextIndex});
954
+ gridRef.current.scrollToItem({rowIndex: nextIndex});
959
955
  }
960
956
  if (onRowHighlightChange) {
961
957
  onRowHighlightChange(nextIndex, rows[nextIndex - 1]);
@@ -1055,9 +1051,8 @@ export function DataTable({
1055
1051
  >
1056
1052
  <VariableSizeGrid
1057
1053
  // eslint-disable-next-line flowtype/no-weak-types
1058
- ref={(setGridRef: any)}
1054
+ ref={(gridRef: any)}
1059
1055
  overscanRowCount={10}
1060
- overscanColumnCount={5}
1061
1056
  innerElementType={InnerTableElement}
1062
1057
  columnCount={columns.length}
1063
1058
  columnWidth={columnIndex => normalizedWidths[columnIndex]}
@@ -17,8 +17,6 @@ var _index3 = require("../styles/index.js");
17
17
 
18
18
  var _index4 = require("../locale/index.js");
19
19
 
20
- var _constants = require("./constants.js");
21
-
22
20
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
23
21
 
24
22
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -42,21 +40,6 @@ function FilterShell(props) {
42
40
  theme = _useStyletron2[1];
43
41
 
44
42
  var locale = React.useContext(_index4.LocaleContext);
45
- var excludeText;
46
-
47
- switch (props.excludeKind) {
48
- case 'value':
49
- excludeText = locale.datatable.filterExcludeValue;
50
- break;
51
-
52
- case 'range':
53
- excludeText = locale.datatable.filterExcludeRange;
54
- break;
55
-
56
- default:
57
- excludeText = locale.datatable.filterExclude;
58
- }
59
-
60
43
  return /*#__PURE__*/React.createElement("form", {
61
44
  className: css({
62
45
  backgroundColor: theme.colors.backgroundPrimary,
@@ -64,7 +47,7 @@ function FilterShell(props) {
64
47
  paddingRight: theme.sizing.scale600,
65
48
  paddingBottom: theme.sizing.scale600,
66
49
  paddingLeft: theme.sizing.scale600,
67
- width: _constants.FILTER_SHELL_WIDTH
50
+ width: '320px'
68
51
  }),
69
52
  onSubmit: function onSubmit(event) {
70
53
  event.preventDefault();
@@ -72,23 +55,17 @@ function FilterShell(props) {
72
55
  }
73
56
  }, props.children, /*#__PURE__*/React.createElement("div", {
74
57
  className: css({
58
+ alignItems: 'center',
75
59
  display: 'flex',
76
- flexDirection: 'column',
77
60
  justifyContent: 'space-between',
78
- alignItems: 'flex-end',
79
- marginTop: theme.sizing.scale600,
80
- gap: theme.sizing.scale200
81
- })
82
- }, /*#__PURE__*/React.createElement("div", {
83
- className: css({
84
- alignSelf: 'flex-start'
61
+ marginTop: theme.sizing.scale600
85
62
  })
86
63
  }, /*#__PURE__*/React.createElement(_index2.Checkbox, {
87
64
  checked: props.exclude,
88
65
  onChange: props.onExcludeChange,
89
66
  checkmarkType: _index2.STYLE_TYPE.toggle_round,
90
67
  labelPlacement: "right"
91
- }, excludeText)), /*#__PURE__*/React.createElement(_index.Button, {
68
+ }, locale.datatable.filterExclude), /*#__PURE__*/React.createElement(_index.Button, {
92
69
  size: _index.SIZE.compact,
93
70
  type: "submit"
94
71
  }, locale.datatable.filterApply)));
@@ -12,14 +12,10 @@ import {Button, SIZE as BUTTON_SIZE} from '../button/index.js';
12
12
  import {Checkbox, STYLE_TYPE} from '../checkbox/index.js';
13
13
  import {useStyletron} from '../styles/index.js';
14
14
  import {LocaleContext} from '../locale/index.js';
15
- import {FILTER_SHELL_WIDTH} from './constants.js';
16
-
17
- export type ExcludeKind = 'value' | 'range';
18
15
 
19
16
  type PropsT = {
20
17
  children: React.Node,
21
18
  exclude: boolean,
22
- excludeKind?: ExcludeKind,
23
19
  onExcludeChange: () => void,
24
20
  onApply: () => void,
25
21
  };
@@ -27,17 +23,6 @@ type PropsT = {
27
23
  function FilterShell(props: PropsT) {
28
24
  const [css, theme] = useStyletron();
29
25
  const locale = React.useContext(LocaleContext);
30
- let excludeText;
31
- switch (props.excludeKind) {
32
- case 'value':
33
- excludeText = locale.datatable.filterExcludeValue;
34
- break;
35
- case 'range':
36
- excludeText = locale.datatable.filterExcludeRange;
37
- break;
38
- default:
39
- excludeText = locale.datatable.filterExclude;
40
- }
41
26
  return (
42
27
  <form
43
28
  className={css({
@@ -46,7 +31,7 @@ function FilterShell(props: PropsT) {
46
31
  paddingRight: theme.sizing.scale600,
47
32
  paddingBottom: theme.sizing.scale600,
48
33
  paddingLeft: theme.sizing.scale600,
49
- width: FILTER_SHELL_WIDTH,
34
+ width: '320px',
50
35
  })}
51
36
  onSubmit={event => {
52
37
  event.preventDefault();
@@ -56,29 +41,20 @@ function FilterShell(props: PropsT) {
56
41
  {props.children}
57
42
  <div
58
43
  className={css({
44
+ alignItems: 'center',
59
45
  display: 'flex',
60
- flexDirection: 'column',
61
46
  justifyContent: 'space-between',
62
- alignItems: 'flex-end',
63
47
  marginTop: theme.sizing.scale600,
64
- gap: theme.sizing.scale200,
65
48
  })}
66
49
  >
67
- <div
68
- className={css({
69
- alignSelf: 'flex-start',
70
- })}
50
+ <Checkbox
51
+ checked={props.exclude}
52
+ onChange={props.onExcludeChange}
53
+ checkmarkType={STYLE_TYPE.toggle_round}
54
+ labelPlacement="right"
71
55
  >
72
- <Checkbox
73
- checked={props.exclude}
74
- onChange={props.onExcludeChange}
75
- checkmarkType={STYLE_TYPE.toggle_round}
76
- labelPlacement="right"
77
- >
78
- {excludeText}
79
- </Checkbox>
80
- </div>
81
-
56
+ {locale.datatable.filterExclude}
57
+ </Checkbox>
82
58
  <Button size={BUTTON_SIZE.compact} type="submit">
83
59
  {locale.datatable.filterApply}
84
60
  </Button>
@@ -13,20 +13,18 @@ LICENSE file in the root directory of this source tree.
13
13
  */
14
14
  var locale = {
15
15
  emptyState: 'No rows match the filter criteria defined. Please remove one or more filters to view more data.',
16
- loadingState: 'Loading rows.',
16
+ loadingState: 'Loading Rows.',
17
17
  searchAriaLabel: 'Search by text',
18
18
  filterAdd: 'Add Filter',
19
19
  filterExclude: 'Exclude',
20
20
  filterApply: 'Apply',
21
- filterExcludeRange: 'Exclude range',
22
- filterExcludeValue: 'Exclude value',
23
21
  filterAppliedTo: 'filter applied to',
24
22
  optionsLabel: 'Select column to filter by',
25
23
  optionsSearch: 'Search for a column to filter by...',
26
24
  optionsEmpty: 'No columns available.',
27
25
  categoricalFilterSelectAll: 'Select All',
28
26
  categoricalFilterSelectClear: 'Clear',
29
- categoricalFilterEmpty: 'No categories found',
27
+ categoricalFilterEmpty: 'No Categories Found',
30
28
  datetimeFilterRange: 'Range',
31
29
  datetimeFilterRangeDatetime: 'Date, Time',
32
30
  datetimeFilterRangeDate: 'Date',
@@ -12,8 +12,6 @@ export type DataTableLocaleT = {|
12
12
  searchAriaLabel: string,
13
13
  filterAdd: string,
14
14
  filterExclude: string,
15
- filterExcludeRange: string,
16
- filterExcludeValue: string,
17
15
  filterApply: string,
18
16
  filterAppliedTo: string,
19
17
  optionsLabel: string,
@@ -45,20 +43,18 @@ export type DataTableLocaleT = {|
45
43
  const locale = {
46
44
  emptyState:
47
45
  'No rows match the filter criteria defined. Please remove one or more filters to view more data.',
48
- loadingState: 'Loading rows.',
46
+ loadingState: 'Loading Rows.',
49
47
  searchAriaLabel: 'Search by text',
50
48
  filterAdd: 'Add Filter',
51
49
  filterExclude: 'Exclude',
52
50
  filterApply: 'Apply',
53
- filterExcludeRange: 'Exclude range',
54
- filterExcludeValue: 'Exclude value',
55
51
  filterAppliedTo: 'filter applied to',
56
52
  optionsLabel: 'Select column to filter by',
57
53
  optionsSearch: 'Search for a column to filter by...',
58
54
  optionsEmpty: 'No columns available.',
59
55
  categoricalFilterSelectAll: 'Select All',
60
56
  categoricalFilterSelectClear: 'Clear',
61
- categoricalFilterEmpty: 'No categories found',
57
+ categoricalFilterEmpty: 'No Categories Found',
62
58
  datetimeFilterRange: 'Range',
63
59
  datetimeFilterRangeDatetime: 'Date, Time',
64
60
  datetimeFilterRangeDate: 'Date',