grommet 2.48.0 → 2.50.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.
Files changed (157) hide show
  1. package/components/AccordionPanel/AccordionPanel.js +3 -6
  2. package/components/Anchor/StyledAnchor.js +1 -1
  3. package/components/Box/StyledBox.js +1 -1
  4. package/components/Button/BusyAnimation.js +5 -1
  5. package/components/Button/Button.js +3 -1
  6. package/components/Calendar/Calendar.js +7 -10
  7. package/components/Cards/Cards.js +3 -4
  8. package/components/Chart/Chart.js +11 -9
  9. package/components/Chart/calcs.js +21 -13
  10. package/components/CheckBox/CheckBox.js +1 -1
  11. package/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
  12. package/components/Data/Data.js +5 -1
  13. package/components/Data/DataForm.js +6 -4
  14. package/components/Data/stories/Infinite.stories.js +10 -15
  15. package/components/Data/stories/OnSelect.stories.js +10 -15
  16. package/components/Data/stories/SpaceX.stories.js +10 -15
  17. package/components/Data/stories/StarWars.stories.js +6 -8
  18. package/components/DataChart/DataChart.js +14 -12
  19. package/components/DataChart/Detail.js +2 -2
  20. package/components/DataChart/Legend.js +8 -9
  21. package/components/DataChart/utils.js +15 -8
  22. package/components/DataFilter/DataFilter.js +10 -9
  23. package/components/DataFilters/DataFilters.js +9 -10
  24. package/components/DataSearch/DataSearch.js +5 -4
  25. package/components/DataSort/DataSort.js +4 -3
  26. package/components/DataSummary/DataSummary.js +6 -6
  27. package/components/DataTable/ExpanderCell.js +6 -3
  28. package/components/DataTable/Footer.js +6 -3
  29. package/components/DataTable/Header.js +6 -3
  30. package/components/DataTable/Resizer.js +22 -8
  31. package/components/DataTable/Searcher.js +5 -7
  32. package/components/DataTable/stories/ResizePinned.stories.js +321 -0
  33. package/components/DataTable/stories/SpaceX.stories.js +15 -16
  34. package/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
  35. package/components/DataTable/stories/rowDetails.stories.js +6 -8
  36. package/components/DataTableColumns/DataTableColumns.js +24 -22
  37. package/components/DateInput/DateInput.js +7 -6
  38. package/components/Distribution/Distribution.js +8 -5
  39. package/components/FileInput/FileInput.js +41 -36
  40. package/components/Footer/Footer.js +5 -1
  41. package/components/Header/Header.js +2 -2
  42. package/components/Layer/Layer.js +10 -5
  43. package/components/Layer/StyledLayer.js +2 -2
  44. package/components/List/List.js +5 -4
  45. package/components/MaskedInput/MaskedInput.js +6 -1
  46. package/components/Menu/Menu.js +13 -1
  47. package/components/Meter/Bar.js +38 -17
  48. package/components/Meter/Circle.js +31 -46
  49. package/components/Meter/stories/Circle.stories.js +6 -8
  50. package/components/Meter/utils.js +15 -1
  51. package/components/Nav/Nav.js +5 -1
  52. package/components/Notification/Notification.js +6 -8
  53. package/components/Pagination/Pagination.js +5 -10
  54. package/components/Pagination/PaginationStep.js +2 -1
  55. package/components/Paragraph/ParagraphSkeleton.js +2 -1
  56. package/components/RadioButton/RadioButton.js +1 -1
  57. package/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  58. package/components/RangeSelector/RangeSelector.js +2 -6
  59. package/components/Select/SelectContainer.js +2 -1
  60. package/components/SelectMultiple/SelectMultipleContainer.js +8 -4
  61. package/components/SelectMultiple/SelectMultipleValue.js +5 -7
  62. package/components/SelectMultiple/SelectionSummary.js +7 -8
  63. package/components/Sidebar/Sidebar.js +6 -3
  64. package/components/Spinner/Spinner.js +7 -4
  65. package/components/StarRating/StarRating.js +8 -5
  66. package/components/Tab/Tab.js +2 -1
  67. package/components/Table/StyledTable.js +2 -2
  68. package/components/Tabs/Tabs.js +8 -12
  69. package/components/Tag/StyledTag.js +9 -1
  70. package/components/TextInput/CopyButton.js +3 -2
  71. package/components/TextInput/TextInput.js +5 -0
  72. package/components/ThumbsRating/ThumbsRating.js +15 -10
  73. package/components/Toolbar/Toolbar.js +15 -11
  74. package/components/Video/Video.js +3 -5
  75. package/es6/components/AccordionPanel/AccordionPanel.js +3 -6
  76. package/es6/components/Anchor/StyledAnchor.js +2 -2
  77. package/es6/components/Box/StyledBox.js +1 -1
  78. package/es6/components/Button/BusyAnimation.js +5 -1
  79. package/es6/components/Button/Button.js +3 -1
  80. package/es6/components/Calendar/Calendar.js +7 -10
  81. package/es6/components/Cards/Cards.js +3 -4
  82. package/es6/components/Chart/Chart.js +11 -9
  83. package/es6/components/Chart/calcs.js +21 -13
  84. package/es6/components/CheckBox/CheckBox.js +1 -1
  85. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
  86. package/es6/components/Data/Data.js +5 -1
  87. package/es6/components/Data/DataForm.js +6 -4
  88. package/es6/components/Data/stories/Infinite.stories.js +10 -15
  89. package/es6/components/Data/stories/OnSelect.stories.js +10 -15
  90. package/es6/components/Data/stories/SpaceX.stories.js +10 -15
  91. package/es6/components/Data/stories/StarWars.stories.js +6 -8
  92. package/es6/components/DataChart/DataChart.js +14 -12
  93. package/es6/components/DataChart/Detail.js +2 -2
  94. package/es6/components/DataChart/Legend.js +8 -9
  95. package/es6/components/DataChart/utils.js +15 -8
  96. package/es6/components/DataFilter/DataFilter.js +10 -9
  97. package/es6/components/DataFilters/DataFilters.js +9 -10
  98. package/es6/components/DataSearch/DataSearch.js +5 -4
  99. package/es6/components/DataSort/DataSort.js +4 -3
  100. package/es6/components/DataSummary/DataSummary.js +6 -6
  101. package/es6/components/DataTable/ExpanderCell.js +4 -1
  102. package/es6/components/DataTable/Footer.js +4 -1
  103. package/es6/components/DataTable/Header.js +6 -3
  104. package/es6/components/DataTable/Resizer.js +22 -8
  105. package/es6/components/DataTable/Searcher.js +5 -7
  106. package/es6/components/DataTable/stories/ResizePinned.stories.js +316 -0
  107. package/es6/components/DataTable/stories/SpaceX.stories.js +15 -16
  108. package/es6/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
  109. package/es6/components/DataTable/stories/rowDetails.stories.js +6 -8
  110. package/es6/components/DataTableColumns/DataTableColumns.js +23 -21
  111. package/es6/components/DateInput/DateInput.js +6 -5
  112. package/es6/components/Distribution/Distribution.js +8 -5
  113. package/es6/components/FileInput/FileInput.js +42 -37
  114. package/es6/components/Footer/Footer.js +5 -1
  115. package/es6/components/Header/Header.js +2 -2
  116. package/es6/components/Layer/Layer.js +10 -5
  117. package/es6/components/Layer/StyledLayer.js +3 -3
  118. package/es6/components/List/List.js +5 -4
  119. package/es6/components/MaskedInput/MaskedInput.js +6 -1
  120. package/es6/components/Menu/Menu.js +13 -1
  121. package/es6/components/Meter/Bar.js +39 -18
  122. package/es6/components/Meter/Circle.js +33 -48
  123. package/es6/components/Meter/stories/Circle.stories.js +7 -9
  124. package/es6/components/Meter/utils.js +14 -0
  125. package/es6/components/Nav/Nav.js +5 -1
  126. package/es6/components/Notification/Notification.js +6 -8
  127. package/es6/components/Pagination/Pagination.js +5 -10
  128. package/es6/components/Pagination/PaginationStep.js +2 -1
  129. package/es6/components/Paragraph/ParagraphSkeleton.js +2 -1
  130. package/es6/components/RadioButton/RadioButton.js +1 -1
  131. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  132. package/es6/components/RangeSelector/RangeSelector.js +2 -6
  133. package/es6/components/Select/SelectContainer.js +2 -1
  134. package/es6/components/SelectMultiple/SelectMultipleContainer.js +8 -4
  135. package/es6/components/SelectMultiple/SelectMultipleValue.js +5 -7
  136. package/es6/components/SelectMultiple/SelectionSummary.js +7 -8
  137. package/es6/components/Sidebar/Sidebar.js +6 -3
  138. package/es6/components/Spinner/Spinner.js +6 -3
  139. package/es6/components/StarRating/StarRating.js +8 -5
  140. package/es6/components/Tab/Tab.js +2 -1
  141. package/es6/components/Table/StyledTable.js +2 -2
  142. package/es6/components/Tabs/Tabs.js +8 -12
  143. package/es6/components/Tag/StyledTag.js +10 -2
  144. package/es6/components/TextInput/CopyButton.js +3 -2
  145. package/es6/components/TextInput/TextInput.js +5 -0
  146. package/es6/components/ThumbsRating/ThumbsRating.js +15 -10
  147. package/es6/components/Toolbar/Toolbar.js +15 -11
  148. package/es6/components/Video/Video.js +3 -5
  149. package/es6/themes/base.d.ts +284 -4
  150. package/es6/themes/base.js +369 -21
  151. package/es6/utils/graphics.js +123 -0
  152. package/grommet.min.js +1 -1
  153. package/grommet.min.js.map +1 -1
  154. package/package.json +46 -46
  155. package/themes/base.d.ts +284 -4
  156. package/themes/base.js +369 -21
  157. package/utils/graphics.js +124 -1
@@ -33,7 +33,7 @@ var stackedChartType = {
33
33
  // normalize and automatically handle whatever the caller didn't specify.
34
34
 
35
35
  var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
36
- var _boundsProp$x, _boundsProp$y;
36
+ var _boundsProp$x, _boundsProp$y, _theme$dataChart2;
37
37
  var a11yTitle = _ref.a11yTitle,
38
38
  _ref$axis = _ref.axis,
39
39
  axisProp = _ref$axis === void 0 ? true : _ref$axis,
@@ -45,8 +45,7 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
45
  detail = _ref.detail,
46
46
  _ref$direction = _ref.direction,
47
47
  direction = _ref$direction === void 0 ? 'vertical' : _ref$direction,
48
- _ref$gap = _ref.gap,
49
- gap = _ref$gap === void 0 ? 'small' : _ref$gap,
48
+ gap = _ref.gap,
50
49
  guideProp = _ref.guide,
51
50
  legend = _ref.legend,
52
51
  offset = _ref.offset,
@@ -208,6 +207,7 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
208
207
 
209
208
  // map granularities to work well with the number of data points we have
210
209
  var granularities = useMemo(function () {
210
+ var _theme$dataChart, _theme$dataChart$size;
211
211
  var medium;
212
212
  // determine a good medium granularity that will align well with the
213
213
  // length of the data
@@ -219,7 +219,8 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
219
219
  fine: data.length,
220
220
  medium: medium
221
221
  };
222
- var granularity1 = _extends({}, heightYGranularity[size && size.height || 'small'] || {
222
+ var yGranularity = ((_theme$dataChart = theme.dataChart) == null || (_theme$dataChart = _theme$dataChart.granularity) == null ? void 0 : _theme$dataChart.y) || heightYGranularity;
223
+ var granularity1 = _extends({}, yGranularity[size && size.height || ((_theme$dataChart$size = theme.dataChart.size) == null ? void 0 : _theme$dataChart$size.height)] || {
223
224
  fine: 5,
224
225
  medium: 3
225
226
  }, {
@@ -232,8 +233,7 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
232
233
  x: granularity0,
233
234
  y: granularity1
234
235
  };
235
- }, [charts, data.length, horizontal, size]);
236
-
236
+ }, [charts, data.length, horizontal, size, theme]);
237
237
  // normalize axis to objects, convert granularity to a number
238
238
  var axis = useMemo(function () {
239
239
  if (!axisProp) return undefined;
@@ -352,10 +352,11 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
352
352
  bounds: chartBounds[index],
353
353
  direction: direction,
354
354
  steps: steps,
355
- thickness: thickness
355
+ thickness: thickness,
356
+ theme: theme
356
357
  });
357
358
  });
358
- }, [axis, boundsProp, charts, chartValues, data, direction, granularities, horizontal]);
359
+ }, [axis, boundsProp, charts, chartValues, data, direction, granularities, horizontal, theme]);
359
360
 
360
361
  // normalize how we style data properties for use by Legend and Detail
361
362
  var seriesStyles = useMemo(function () {
@@ -447,11 +448,12 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
447
448
  if (padProp !== undefined) return padProp;
448
449
  var pad0;
449
450
  var pad1;
451
+ var halfPadValues = halfPad(theme);
450
452
  charts.forEach(function (_ref7, index) {
451
453
  var type = _ref7.type;
452
454
  var thickness = chartProps[index].thickness;
453
- pad0 = largestSize(pad0, halfPad[thickness]);
454
- if (type && type !== 'bar') pad1 = largestSize(pad1, halfPad[thickness]);
455
+ pad0 = largestSize(theme, pad0, halfPadValues[thickness]);
456
+ if (type && type !== 'bar') pad1 = largestSize(theme, pad1, halfPadValues[thickness]);
455
457
  });
456
458
  return horizontal ? {
457
459
  horizontal: pad1,
@@ -460,7 +462,7 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
460
462
  horizontal: pad0,
461
463
  vertical: pad1
462
464
  };
463
- }, [chartProps, charts, horizontal, padProp]);
465
+ }, [chartProps, charts, horizontal, padProp, theme]);
464
466
 
465
467
  // calculate the thickness in pixels of each chart
466
468
  var thicknesses = useMemo(function () {
@@ -698,7 +700,7 @@ var DataChart = /*#__PURE__*/forwardRef(function (_ref, ref) {
698
700
  start: [1, 0],
699
701
  end: [1, 0]
700
702
  }],
701
- gap: gap
703
+ gap: gap || ((_theme$dataChart2 = theme.dataChart) == null ? void 0 : _theme$dataChart2.gap)
702
704
  }, rest), xAxisElement, yAxisElement, stackElement);
703
705
  if (legendElement) {
704
706
  content = /*#__PURE__*/React.createElement(Box, {
@@ -184,13 +184,13 @@ var Detail = function Detail(_ref) {
184
184
  onMouseLeave: onMouseLeave,
185
185
  trapFocus: false
186
186
  }, /*#__PURE__*/React.createElement(Box, {
187
- pad: "small",
187
+ pad: theme.dataChart.detail.pad,
188
188
  background: {
189
189
  color: 'background-back'
190
190
  }
191
191
  }, /*#__PURE__*/React.createElement(Grid, {
192
192
  columns: ['auto', 'auto', 'auto'],
193
- gap: "xsmall",
193
+ gap: theme.dataChart.detail.gap,
194
194
  align: "center"
195
195
  }, series.filter(function (_ref3) {
196
196
  var _data$detailIndex;
@@ -4,11 +4,14 @@ import { Box } from '../Box';
4
4
  import { Button } from '../Button';
5
5
  import { Text } from '../Text';
6
6
  import { Swatch } from './Swatch';
7
+ import { useThemeValue } from '../../utils/useThemeValue';
7
8
  var Legend = function Legend(_ref) {
8
9
  var activeProperty = _ref.activeProperty,
9
10
  seriesProp = _ref.series,
10
11
  seriesStyles = _ref.seriesStyles,
11
12
  setActiveProperty = _ref.setActiveProperty;
13
+ var _useThemeValue = useThemeValue(),
14
+ theme = _useThemeValue.theme;
12
15
  var series = useMemo(function () {
13
16
  return seriesProp.filter(function (s) {
14
17
  return seriesStyles[s.property];
@@ -23,13 +26,12 @@ var Legend = function Legend(_ref) {
23
26
  }).length > 1;
24
27
  }, [series, seriesStyles]);
25
28
  return /*#__PURE__*/React.createElement(Box, {
26
- margin: {
27
- top: 'small'
28
- },
29
+ margin: theme.dataChart.legend.margin,
29
30
  direction: "row",
30
31
  wrap: true,
31
- gap: "small"
32
+ gap: theme.dataChart.legend.gap
32
33
  }, series.map(function (_ref3) {
34
+ var _theme$dataChart, _theme$dataChart2;
33
35
  var property = _ref3.property,
34
36
  label = _ref3.label;
35
37
  var isActive = property === activeProperty;
@@ -47,11 +49,8 @@ var Legend = function Legend(_ref) {
47
49
  key: property,
48
50
  direction: "row",
49
51
  align: "center",
50
- pad: {
51
- horizontal: 'small',
52
- vertical: 'xsmall'
53
- },
54
- gap: "xsmall"
52
+ pad: (_theme$dataChart = theme.dataChart) == null || (_theme$dataChart = _theme$dataChart.legend) == null || (_theme$dataChart = _theme$dataChart.item) == null ? void 0 : _theme$dataChart.pad,
53
+ gap: (_theme$dataChart2 = theme.dataChart) == null || (_theme$dataChart2 = _theme$dataChart2.legend) == null || (_theme$dataChart2 = _theme$dataChart2.item) == null ? void 0 : _theme$dataChart2.gap
55
54
  }, /*#__PURE__*/React.createElement(Swatch, _extends({}, seriesStyles[property], swatchProps)), /*#__PURE__*/React.createElement(Text, textProps, label || property));
56
55
  if (interactive) {
57
56
  content = /*#__PURE__*/React.createElement(Button, {
@@ -26,12 +26,15 @@ export var heightYGranularity = {
26
26
  medium: 5
27
27
  }
28
28
  };
29
- export var halfPad = {
30
- xlarge: 'large',
31
- large: 'medium',
32
- medium: 'small',
33
- small: 'xsmall',
34
- xsmall: 'xxsmall'
29
+ export var halfPad = function halfPad(theme) {
30
+ var _theme$dataChart;
31
+ return (theme == null || (_theme$dataChart = theme.dataChart) == null ? void 0 : _theme$dataChart.halfPad) || {
32
+ xlarge: 'large',
33
+ large: 'medium',
34
+ medium: 'small',
35
+ small: 'xsmall',
36
+ xsmall: 'xxsmall'
37
+ };
35
38
  };
36
39
  export var doublePad = {
37
40
  large: 'xlarge',
@@ -40,7 +43,10 @@ export var doublePad = {
40
43
  xsmall: 'small',
41
44
  xxsmall: 'xsmall'
42
45
  };
43
- var orderedSizes = ['xlarge', 'large', 'medium', 'small', 'xsmall', 'xxsmall', 'hair'];
46
+ var getOrderedSizes = function getOrderedSizes(theme) {
47
+ var _theme$dataChart2;
48
+ return (theme == null || (_theme$dataChart2 = theme.dataChart) == null ? void 0 : _theme$dataChart2.orderedSizes) || ['xlarge', 'large', 'medium', 'small', 'xsmall', 'xxsmall', 'hair'];
49
+ };
44
50
  export var showInUnits = function showInUnits(content, maxValue) {
45
51
  var divideBy;
46
52
  var unit;
@@ -56,7 +62,8 @@ export var showInUnits = function showInUnits(content, maxValue) {
56
62
  if (unit) newContent = "" + newContent + unit;
57
63
  return newContent;
58
64
  };
59
- export var largestSize = function largestSize(size1, size2) {
65
+ export var largestSize = function largestSize(theme, size1, size2) {
66
+ var orderedSizes = getOrderedSizes(theme);
60
67
  if (size1 && !size2) return size1;
61
68
  if (size2 && !size1) return size2;
62
69
  if (orderedSizes.indexOf(size1) < orderedSizes.indexOf(size2)) return size1;
@@ -12,6 +12,7 @@ import { DataFilterPropTypes } from './propTypes';
12
12
  import { getDecimalCount } from '../RangeSelector/RangeSelector';
13
13
  import { DataFormContext } from '../../contexts/DataFormContext';
14
14
  import { selectInputId } from '../Select/utils';
15
+ import { useThemeValue } from '../../utils/useThemeValue';
15
16
 
16
17
  // empirical constants for when we change inputs
17
18
  var maxCheckBoxGroupOptions = 4;
@@ -82,6 +83,8 @@ export var DataFilter = function DataFilter(_ref) {
82
83
  var _useState = useState(''),
83
84
  searchText = _useState[0],
84
85
  setSearchText = _useState[1];
86
+ var _useThemeValue = useThemeValue(),
87
+ theme = _useThemeValue.theme;
85
88
  var _useMemo = useMemo(function () {
86
89
  var _properties$property, _properties$property2;
87
90
  if (children) return [undefined, undefined]; // caller driving
@@ -134,7 +137,7 @@ export var DataFilter = function DataFilter(_ref) {
134
137
  var content = children;
135
138
  if (!content) {
136
139
  if (range) {
137
- var _properties$property4;
140
+ var _properties$property4, _theme$dataFilter;
138
141
  var step =
139
142
  // from `range` on DataFilter
140
143
  (rangeProp == null ? void 0 : rangeProp.step) || (// from range in Data `properties`
@@ -156,7 +159,7 @@ export var DataFilter = function DataFilter(_ref) {
156
159
  step = multiplier * delta / (multiplier * defaultRangeSteps);
157
160
  } else step = delta / defaultRangeSteps;
158
161
  }
159
- content = /*#__PURE__*/React.createElement(RangeSelector, {
162
+ content = /*#__PURE__*/React.createElement(RangeSelector, _extends({
160
163
  "aria-label": ariaLabel,
161
164
  id: id,
162
165
  name: property + "._range",
@@ -164,10 +167,8 @@ export var DataFilter = function DataFilter(_ref) {
164
167
  label: true,
165
168
  min: range[0],
166
169
  max: range[1],
167
- step: step,
168
- size: "full",
169
- round: "small"
170
- });
170
+ step: step
171
+ }, (_theme$dataFilter = theme.dataFilter) == null ? void 0 : _theme$dataFilter.rangeSelector));
171
172
  } else if (options) {
172
173
  if (options.length === 2 && options[1] === true && options[0] === false) {
173
174
  // special case boolean properties
@@ -185,10 +186,10 @@ export var DataFilter = function DataFilter(_ref) {
185
186
  options: options
186
187
  });
187
188
  } else {
188
- content = /*#__PURE__*/React.createElement(SelectMultiple, {
189
+ var _theme$dataFilter2;
190
+ content = /*#__PURE__*/React.createElement(SelectMultiple, _extends({
189
191
  "aria-label": ariaLabel,
190
192
  id: id,
191
- dropHeight: "medium",
192
193
  name: property,
193
194
  showSelectedInline: true,
194
195
  options: searchedOptions,
@@ -201,7 +202,7 @@ export var DataFilter = function DataFilter(_ref) {
201
202
  key: 'value',
202
203
  reduce: true
203
204
  }
204
- });
205
+ }, (_theme$dataFilter2 = theme.dataFilter) == null ? void 0 : _theme$dataFilter2.selectMultiple));
205
206
  htmlFor = selectInputId(id);
206
207
  }
207
208
  }
@@ -29,6 +29,7 @@ var layerProps = {
29
29
  };
30
30
  var defaultTouched = {};
31
31
  export var DataFilters = function DataFilters(_ref) {
32
+ var _theme$dataFilters, _theme$dataFilters$ic, _theme$dataFilters2, _theme$dataFilters3, _theme$dataFilters4;
32
33
  var drop = _ref.drop,
33
34
  children = _ref.children,
34
35
  _ref$clearFilters = _ref.clearFilters,
@@ -57,6 +58,8 @@ export var DataFilters = function DataFilters(_ref) {
57
58
  var _useState2 = useState(defaultTouched),
58
59
  touched = _useState2[0],
59
60
  setTouched = _useState2[1];
61
+ var CloseIcon = ((_theme$dataFilters = theme.dataFilters) == null || (_theme$dataFilters = _theme$dataFilters.icons) == null ? void 0 : _theme$dataFilters.close) || Close;
62
+ var FilterIcon = ((_theme$dataFilters$ic = theme.dataFilters.icons) == null ? void 0 : _theme$dataFilters$ic.filter) || Filter;
60
63
 
61
64
  // if filters have been applied by this DataFilters, update
62
65
  // the DataContext that filters are not in a "cleared" state
@@ -100,9 +103,7 @@ export var DataFilters = function DataFilters(_ref) {
100
103
  }, [controlled, touched]);
101
104
  var clearControl = badge && clearFilters && /*#__PURE__*/React.createElement(Box, {
102
105
  flex: false,
103
- margin: {
104
- start: 'small'
105
- }
106
+ margin: (_theme$dataFilters2 = theme.dataFilters) == null || (_theme$dataFilters2 = _theme$dataFilters2.clearControl) == null ? void 0 : _theme$dataFilters2.margin
106
107
  }, /*#__PURE__*/React.createElement(DataClearFilters, null));
107
108
  var content = children;
108
109
  if (Children.count(children) === 0) {
@@ -125,7 +126,7 @@ export var DataFilters = function DataFilters(_ref) {
125
126
  });
126
127
  }
127
128
  content = /*#__PURE__*/React.createElement(DataForm, _extends({
128
- pad: controlled ? 'medium' : undefined,
129
+ pad: controlled ? (_theme$dataFilters3 = theme.dataFilters) == null ? void 0 : _theme$dataFilters3.pad : undefined,
129
130
  onDone: function onDone() {
130
131
  return setShowContent(false);
131
132
  },
@@ -139,7 +140,7 @@ export var DataFilters = function DataFilters(_ref) {
139
140
  id: 'dataFilters.heading',
140
141
  messages: messages == null ? void 0 : messages.dataFilters
141
142
  })), !controlled && clearControl, /*#__PURE__*/React.createElement(Button, {
142
- icon: /*#__PURE__*/React.createElement(Close, null),
143
+ icon: /*#__PURE__*/React.createElement(CloseIcon, null),
143
144
  onClick: function onClick() {
144
145
  return setShowContent(undefined);
145
146
  }
@@ -160,7 +161,7 @@ export var DataFilters = function DataFilters(_ref) {
160
161
  tip: tip,
161
162
  "aria-label": tip,
162
163
  kind: (_theme$data$button = theme.data.button) == null ? void 0 : _theme$data$button.kind,
163
- icon: /*#__PURE__*/React.createElement(Filter, null),
164
+ icon: /*#__PURE__*/React.createElement(FilterIcon, null),
164
165
  dropProps: dropProps,
165
166
  dropContent: content,
166
167
  badge: badge,
@@ -179,7 +180,7 @@ export var DataFilters = function DataFilters(_ref) {
179
180
  tip: tip,
180
181
  "aria-label": tip,
181
182
  kind: (_theme$data$button2 = theme.data.button) == null ? void 0 : _theme$data$button2.kind,
182
- icon: /*#__PURE__*/React.createElement(Filter, null),
183
+ icon: /*#__PURE__*/React.createElement(FilterIcon, null),
183
184
  badge: badge,
184
185
  onClick: function onClick() {
185
186
  return setShowContent(true);
@@ -199,9 +200,7 @@ export var DataFilters = function DataFilters(_ref) {
199
200
  return setShowContent(undefined);
200
201
  }
201
202
  }), /*#__PURE__*/React.createElement(Box, {
202
- width: {
203
- min: 'medium'
204
- }
203
+ width: (_theme$dataFilters4 = theme.dataFilters) == null ? void 0 : _theme$dataFilters4.width
205
204
  }, content)));
206
205
  };
207
206
  DataFilters.propTypes = DataFiltersPropTypes;
@@ -27,7 +27,7 @@ var dropProps = {
27
27
  // 300ms was chosen empirically as a reasonable default
28
28
  var DEBOUNCE_TIMEOUT = 300;
29
29
  export var DataSearch = function DataSearch(_ref) {
30
- var _theme$data$button;
30
+ var _theme$dataSearch$ico, _theme$data$button, _theme$data;
31
31
  var drop = _ref.drop,
32
32
  idProp = _ref.id,
33
33
  responsive = _ref.responsive,
@@ -56,6 +56,7 @@ export var DataSearch = function DataSearch(_ref) {
56
56
  value = _useState2[0],
57
57
  setValue = _useState2[1];
58
58
  var id = idProp || dataId + "--search";
59
+ var SearchIcon = ((_theme$dataSearch$ico = theme.dataSearch.icons) == null ? void 0 : _theme$dataSearch$ico.search) || Search;
59
60
  useEffect(function () {
60
61
  if (!inDataForm) addToolbarKey('_search');
61
62
  }, [addToolbarKey, inDataForm]);
@@ -101,7 +102,7 @@ export var DataSearch = function DataSearch(_ref) {
101
102
  }),
102
103
  id: id,
103
104
  name: "_search",
104
- icon: /*#__PURE__*/React.createElement(Search, null),
105
+ icon: /*#__PURE__*/React.createElement(SearchIcon, null),
105
106
  type: "search",
106
107
  value: value,
107
108
  onChange: onChange
@@ -127,10 +128,10 @@ export var DataSearch = function DataSearch(_ref) {
127
128
  messages: messages == null ? void 0 : messages.dataSort
128
129
  }),
129
130
  kind: (_theme$data$button = theme.data.button) == null ? void 0 : _theme$data$button.kind,
130
- icon: /*#__PURE__*/React.createElement(Search, null),
131
+ icon: /*#__PURE__*/React.createElement(SearchIcon, null),
131
132
  dropProps: dropProps,
132
133
  dropContent: /*#__PURE__*/React.createElement(Box, {
133
- pad: "small"
134
+ pad: (_theme$data = theme.data) == null || (_theme$data = _theme$data.drop) == null ? void 0 : _theme$data.pad
134
135
  }, content),
135
136
  open: showContent,
136
137
  onOpen: function onOpen() {
@@ -108,7 +108,7 @@ var Content = function Content(_ref) {
108
108
  }))];
109
109
  };
110
110
  export var DataSort = function DataSort(_ref4) {
111
- var _theme$data$button;
111
+ var _theme$dataSort, _theme$data$button, _theme$data;
112
112
  var drop = _ref4.drop,
113
113
  options = _ref4.options,
114
114
  rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
@@ -124,6 +124,7 @@ export var DataSort = function DataSort(_ref4) {
124
124
  var _useState = useState(),
125
125
  showContent = _useState[0],
126
126
  setShowContent = _useState[1];
127
+ var ControlIcon = ((_theme$dataSort = theme.dataSort) == null || (_theme$dataSort = _theme$dataSort.icons) == null ? void 0 : _theme$dataSort.control) || Descend;
127
128
  var content = /*#__PURE__*/React.createElement(Content, {
128
129
  options: options
129
130
  });
@@ -141,10 +142,10 @@ export var DataSort = function DataSort(_ref4) {
141
142
  "aria-label": tip,
142
143
  tip: tip,
143
144
  kind: (_theme$data$button = theme.data.button) == null ? void 0 : _theme$data$button.kind,
144
- icon: /*#__PURE__*/React.createElement(Descend, null),
145
+ icon: /*#__PURE__*/React.createElement(ControlIcon, null),
145
146
  dropProps: dropProps,
146
147
  dropContent: /*#__PURE__*/React.createElement(Box, {
147
- pad: "small"
148
+ pad: (_theme$data = theme.data) == null || (_theme$data = _theme$data.drop) == null ? void 0 : _theme$data.pad
148
149
  }, content),
149
150
  open: showContent,
150
151
  onOpen: function onOpen() {
@@ -5,8 +5,10 @@ import React, { useContext } from 'react';
5
5
  import { Text } from '../Text';
6
6
  import { DataContext } from '../../contexts/DataContext';
7
7
  import { MessageContext } from '../../contexts/MessageContext';
8
+ import { useThemeValue } from '../../utils/useThemeValue';
8
9
  import { DataSummaryPropTypes } from './propTypes';
9
10
  export var DataSummary = function DataSummary(_ref) {
11
+ var _theme$dataSummary, _theme$dataSummary2;
10
12
  var messages = _ref.messages,
11
13
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
12
14
  var _useContext = useContext(MessageContext),
@@ -16,6 +18,8 @@ export var DataSummary = function DataSummary(_ref) {
16
18
  dataMessages = _useContext2.messages,
17
19
  selected = _useContext2.selected,
18
20
  total = _useContext2.total;
21
+ var _useThemeValue = useThemeValue(),
22
+ theme = _useThemeValue.theme;
19
23
  var messageId;
20
24
  if (total !== filteredTotal) {
21
25
  if (filteredTotal === 1) messageId = 'dataSummary.filteredSingle';else messageId = 'dataSummary.filtered';
@@ -27,9 +31,7 @@ export var DataSummary = function DataSummary(_ref) {
27
31
  messages: messages || (dataMessages == null ? void 0 : dataMessages.dataSummary)
28
32
  });
29
33
  return /*#__PURE__*/React.createElement(Text, _extends({
30
- margin: {
31
- vertical: 'xsmall'
32
- }
34
+ margin: (_theme$dataSummary = theme.dataSummary) == null ? void 0 : _theme$dataSummary.margin
33
35
  }, rest), format({
34
36
  id: messageId,
35
37
  messages: messages || (dataMessages == null ? void 0 : dataMessages.dataSummary),
@@ -39,9 +41,7 @@ export var DataSummary = function DataSummary(_ref) {
39
41
  items: items
40
42
  }
41
43
  }), selected > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
42
- margin: {
43
- horizontal: 'small'
44
- }
44
+ margin: (_theme$dataSummary2 = theme.dataSummary) == null || (_theme$dataSummary2 = _theme$dataSummary2.separator) == null ? void 0 : _theme$dataSummary2.margin
45
45
  }, "|"), /*#__PURE__*/React.createElement(Text, null, format({
46
46
  id: 'dataSummary.selected',
47
47
  messages: messages || (dataMessages == null ? void 0 : dataMessages.dataSummary),
@@ -96,15 +96,18 @@ var ExpanderControl = function ExpanderControl(_ref) {
96
96
  return content;
97
97
  };
98
98
  var ExpanderCell = function ExpanderCell(_ref2) {
99
+ var _theme$dataTable$expa;
99
100
  var background = _ref2.background,
100
101
  border = _ref2.border,
101
102
  context = _ref2.context,
102
103
  expandLabel = _ref2.expandLabel,
103
104
  rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
105
+ var _useThemeValue2 = useThemeValue(),
106
+ theme = _useThemeValue2.theme;
104
107
  return /*#__PURE__*/React.createElement(TableCell, {
105
108
  background: background,
106
109
  border: border,
107
- size: "xxsmall",
110
+ size: (_theme$dataTable$expa = theme.dataTable.expand) == null ? void 0 : _theme$dataTable$expa.size,
108
111
  plain: "noPad",
109
112
  verticalAlign: context === 'groupEnd' ? 'bottom' : 'top'
110
113
  }, /*#__PURE__*/React.createElement(ExpanderControl, _extends({
@@ -8,6 +8,7 @@ import { Cell } from './Cell';
8
8
  import { StyledDataTableCell, StyledDataTableFooter } from './StyledDataTable';
9
9
  import { useThemeValue } from '../../utils/useThemeValue';
10
10
  var Footer = /*#__PURE__*/forwardRef(function (_ref, ref) {
11
+ var _theme$dataTable$expa;
11
12
  var cellProps = _ref.cellProps,
12
13
  columns = _ref.columns,
13
14
  fill = _ref.fill,
@@ -23,13 +24,15 @@ var Footer = /*#__PURE__*/forwardRef(function (_ref, ref) {
23
24
  var pin = pinProp ? ['bottom'] : [];
24
25
  var _useThemeValue = useThemeValue(),
25
26
  passThemeFlag = _useThemeValue.passThemeFlag;
27
+ var _useThemeValue2 = useThemeValue(),
28
+ theme = _useThemeValue2.theme;
26
29
  return /*#__PURE__*/React.createElement(StyledDataTableFooter, _extends({
27
30
  ref: ref,
28
31
  fillProp: fill,
29
32
  pin: pinProp
30
33
  }, rest), /*#__PURE__*/React.createElement(TableRow, null, groups && /*#__PURE__*/React.createElement(TableCell, {
31
34
  plain: true,
32
- size: "xxsmall",
35
+ size: (_theme$dataTable$expa = theme.dataTable.expand) == null ? void 0 : _theme$dataTable$expa.size,
33
36
  pad: "none",
34
37
  verticalAlign: "top",
35
38
  background: cellProps.background,
@@ -99,6 +99,7 @@ var StyledContentBox = styled(Box).withConfig({
99
99
  return props.extend;
100
100
  });
101
101
  var Header = /*#__PURE__*/forwardRef(function (_ref2, ref) {
102
+ var _theme$dataTable$expa;
102
103
  var allowSelectAll = _ref2.allowSelectAll,
103
104
  cellProps = _ref2.cellProps,
104
105
  columns = _ref2.columns,
@@ -240,7 +241,7 @@ var Header = /*#__PURE__*/forwardRef(function (_ref2, ref) {
240
241
  onChange: onChangeSelection,
241
242
  pad: cellProps.pad
242
243
  })), rowDetails && /*#__PURE__*/React.createElement(TableCell, {
243
- size: "xxsmall",
244
+ size: (_theme$dataTable$expa = theme.dataTable.expand) == null ? void 0 : _theme$dataTable$expa.size,
244
245
  plain: true,
245
246
  pad: "none"
246
247
  }), columns.map(function (_ref4) {
@@ -279,6 +280,7 @@ var Header = /*#__PURE__*/forwardRef(function (_ref2, ref) {
279
280
  }
280
281
  var ariaSort;
281
282
  if (onSort && sortable !== false) {
283
+ var _theme$dataTable$sort;
282
284
  var Icon;
283
285
  var iconAriaLabel;
284
286
  if (onSort && sortable !== false) {
@@ -314,7 +316,7 @@ var Header = /*#__PURE__*/forwardRef(function (_ref2, ref) {
314
316
  }, passThemeFlag), /*#__PURE__*/React.createElement(Box, {
315
317
  direction: "row",
316
318
  align: "center",
317
- gap: "xsmall",
319
+ gap: (_theme$dataTable$sort = theme.dataTable.sort) == null ? void 0 : _theme$dataTable$sort.gap,
318
320
  justify: align
319
321
  }, content, Icon && /*#__PURE__*/React.createElement(Icon, {
320
322
  "aria-label": iconAriaLabel
@@ -396,7 +398,8 @@ var Header = /*#__PURE__*/forwardRef(function (_ref2, ref) {
396
398
  style: {
397
399
  width: widths != null && widths[property] ? widths[property] + "px" : undefined,
398
400
  boxSizing: _onResize ? 'border-box' : undefined,
399
- position: _onResize ? 'relative' : undefined,
401
+ // Don't override positioning when DataTable has pin prop
402
+ position: _onResize && !columnPin && !pinProp ? 'relative' : undefined,
400
403
  overflow: _onResize ? 'visible' : undefined
401
404
  },
402
405
  onResize: _onResize,
@@ -8,22 +8,33 @@ import { DropButton } from '../DropButton';
8
8
  import { Keyboard } from '../Keyboard';
9
9
  import { useThemeValue } from '../../utils/useThemeValue';
10
10
  import { MessageContext } from '../../contexts/MessageContext';
11
+ import { edgeStyle } from '../../utils/styles';
11
12
 
12
13
  // We determined 12 empirically as being wide enough to hit but
13
14
  // not too wide to cause false hits.
14
15
  var STEP = 12; // Used to determine the width change on resize
16
+ var resizerWidth = 24; // minimum width required for WCAG compliance
15
17
 
16
18
  var StyledResizer = styled(DropButton).withConfig({
17
19
  displayName: "Resizer__StyledResizer",
18
20
  componentId: "sc-8l808w-0"
19
- })(["display:flex;justify-content:center;padding-top:", ";padding-bottom:", ";margin-right:-", ";position:absolute;right:0;width:24px;height:100%;top:0;cursor:col-resize;z-index:1;"], function (props) {
20
- return props.theme.global.edgeSize.xsmall;
21
+ })(["display:flex;justify-content:center;", ";", ";", " ", " ", " ", " position:absolute;width:", "px;height:100%;top:0;cursor:col-resize;z-index:1;"], function (props) {
22
+ var _props$theme$dataTabl;
23
+ return edgeStyle('padding-top', (_props$theme$dataTabl = props.theme.dataTable) == null || (_props$theme$dataTabl = _props$theme$dataTabl.resize) == null || (_props$theme$dataTabl = _props$theme$dataTabl.padding) == null ? void 0 : _props$theme$dataTabl.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
21
24
  }, function (props) {
22
- return props.theme.global.edgeSize.xsmall;
25
+ var _props$theme$dataTabl2;
26
+ return edgeStyle('padding-bottom', (_props$theme$dataTabl2 = props.theme.dataTable) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.resize) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.padding) == null ? void 0 : _props$theme$dataTabl2.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
23
27
  }, function (props) {
24
- return props.theme.global.edgeSize.small;
25
- });
28
+ return props.side === 'start' && "margin-left: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
29
+ }, function (props) {
30
+ return props.side === 'start' && "left: 0;";
31
+ }, function (props) {
32
+ return props.side === 'end' && "margin-right: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
33
+ }, function (props) {
34
+ return props.side === 'end' && "right: 0;";
35
+ }, resizerWidth);
26
36
  var Resizer = function Resizer(_ref) {
37
+ var _theme$dataTable$icon, _theme$dataTable$icon2, _border;
27
38
  var onResize = _ref.onResize,
28
39
  property = _ref.property,
29
40
  headerText = _ref.headerText,
@@ -44,6 +55,8 @@ var Resizer = function Resizer(_ref) {
44
55
  var thRef = useRef();
45
56
  var _useContext = useContext(MessageContext),
46
57
  format = _useContext.format;
58
+ var ResizeIncreaseIcon = ((_theme$dataTable$icon = theme.dataTable.icons) == null ? void 0 : _theme$dataTable$icon.resizeIncrease) || Add;
59
+ var ResizeDecreaseIcon = ((_theme$dataTable$icon2 = theme.dataTable.icons) == null ? void 0 : _theme$dataTable$icon2.resizeDecrease) || Subtract;
47
60
 
48
61
  // Set the initial width based on the TH element's width and
49
62
  // store th element ref
@@ -195,7 +208,7 @@ var Resizer = function Resizer(_ref) {
195
208
  },
196
209
  messages: messages
197
210
  }),
198
- icon: /*#__PURE__*/React.createElement(Subtract, null),
211
+ icon: /*#__PURE__*/React.createElement(ResizeDecreaseIcon, null),
199
212
  onClick: onDecrease,
200
213
  autoFocus: true
201
214
  }), /*#__PURE__*/React.createElement(Button, {
@@ -206,12 +219,13 @@ var Resizer = function Resizer(_ref) {
206
219
  },
207
220
  messages: messages
208
221
  }),
209
- icon: /*#__PURE__*/React.createElement(Add, null),
222
+ icon: /*#__PURE__*/React.createElement(ResizeIncreaseIcon, null),
210
223
  onClick: onIncrease
211
224
  })),
212
225
  dropAlign: {
213
226
  top: 'bottom'
214
- }
227
+ },
228
+ side: (_border = border) == null ? void 0 : _border.side
215
229
  }, /*#__PURE__*/React.createElement(Box, {
216
230
  border: hover || active ? hoverBorder : border,
217
231
  height: "100%",
@@ -9,6 +9,7 @@ import { MessageContext } from '../../contexts/MessageContext';
9
9
  import { normalizeColor } from '../../utils';
10
10
  import { useThemeValue } from '../../utils/useThemeValue';
11
11
  var Searcher = function Searcher(_ref) {
12
+ var _theme$dataTable, _theme$dataTable$sear, _theme$dataTable$sear2;
12
13
  var filtering = _ref.filtering,
13
14
  filters = _ref.filters,
14
15
  focusIndicator = _ref.focusIndicator,
@@ -26,6 +27,7 @@ var Searcher = function Searcher(_ref) {
26
27
  setButtonNeedsFocus = _useState[1];
27
28
  var _useContext = useContext(MessageContext),
28
29
  format = _useContext.format;
30
+ var SearchIcon = ((_theme$dataTable = theme.dataTable) == null || (_theme$dataTable = _theme$dataTable.icons) == null ? void 0 : _theme$dataTable.search) || FormSearch;
29
31
  useEffect(function () {
30
32
  if (inputRef && needsFocus) {
31
33
  inputRef.current.focus();
@@ -59,9 +61,7 @@ var Searcher = function Searcher(_ref) {
59
61
  // padding right is not needed any longer. There is margin
60
62
  // right set already on the container, see Header.js
61
63
  ,
62
- pad: {
63
- left: 'small'
64
- }
64
+ pad: (_theme$dataTable$sear = theme.dataTable.search) == null ? void 0 : _theme$dataTable$sear.pad
65
65
  }, /*#__PURE__*/React.createElement(TextInput, {
66
66
  name: "search-" + property,
67
67
  a11yTitle: a11yTitle,
@@ -75,15 +75,13 @@ var Searcher = function Searcher(_ref) {
75
75
  }
76
76
  }))) : /*#__PURE__*/React.createElement(React.Fragment, null, filters[property] ? /*#__PURE__*/React.createElement(Box, {
77
77
  flex: false,
78
- pad: {
79
- horizontal: 'small'
80
- },
78
+ pad: (_theme$dataTable$sear2 = theme.dataTable.search) == null || (_theme$dataTable$sear2 = _theme$dataTable$sear2.text) == null ? void 0 : _theme$dataTable$sear2.pad,
81
79
  direction: "row",
82
80
  align: "center"
83
81
  }, /*#__PURE__*/React.createElement(Text, null, filters[property])) : null, /*#__PURE__*/React.createElement(Button, {
84
82
  ref: buttonRef,
85
83
  a11yTitle: a11yTitle,
86
- icon: /*#__PURE__*/React.createElement(FormSearch, {
84
+ icon: /*#__PURE__*/React.createElement(SearchIcon, {
87
85
  color: normalizeColor(filtering === property ? 'brand' : 'border', theme)
88
86
  }),
89
87
  hoverIndicator: true,