baseui 0.0.0-alpha-fd35cbd → 0.0.0-alpha-2158d09

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 (194) hide show
  1. package/a11y/a11y.js +2 -2
  2. package/a11y/a11y.js.flow +3 -3
  3. package/button/styled-components.js +47 -18
  4. package/button/styled-components.js.flow +25 -5
  5. package/combobox/combobox.js +6 -3
  6. package/combobox/combobox.js.flow +4 -2
  7. package/combobox/types.js.flow +2 -0
  8. package/data-table/column-categorical.js +1 -1
  9. package/data-table/column-categorical.js.flow +2 -2
  10. package/data-table/column-datetime.js +1 -1
  11. package/data-table/column-datetime.js.flow +1 -1
  12. package/data-table/column-numerical.js +1 -1
  13. package/data-table/column-numerical.js.flow +3 -3
  14. package/data-table/data-table.js +53 -50
  15. package/data-table/data-table.js.flow +18 -13
  16. package/data-table/measure-column-widths.js +83 -121
  17. package/data-table/measure-column-widths.js.flow +87 -109
  18. package/datepicker/calendar.js +6 -12
  19. package/datepicker/calendar.js.flow +12 -23
  20. package/datepicker/datepicker.js +5 -16
  21. package/datepicker/datepicker.js.flow +10 -25
  22. package/datepicker/day.js +30 -58
  23. package/datepicker/day.js.flow +51 -103
  24. package/datepicker/stateful-container.js.flow +1 -2
  25. package/datepicker/styled-components.js +1 -1
  26. package/datepicker/styled-components.js.flow +4 -1
  27. package/datepicker/types.js.flow +9 -11
  28. package/drawer/drawer.js +3 -1
  29. package/drawer/drawer.js.flow +7 -1
  30. package/es/a11y/a11y.js +2 -2
  31. package/es/button/styled-components.js +32 -2
  32. package/es/combobox/combobox.js +6 -3
  33. package/es/data-table/column-categorical.js +2 -2
  34. package/es/data-table/column-datetime.js +1 -1
  35. package/es/data-table/column-numerical.js +2 -2
  36. package/es/data-table/data-table.js +18 -16
  37. package/es/data-table/measure-column-widths.js +75 -86
  38. package/es/datepicker/calendar.js +6 -12
  39. package/es/datepicker/datepicker.js +5 -15
  40. package/es/datepicker/day.js +30 -51
  41. package/es/datepicker/styled-components.js +1 -1
  42. package/es/drawer/drawer.js +3 -1
  43. package/es/form-control/form-control.js +58 -7
  44. package/es/form-control/styled-components.js +27 -6
  45. package/es/index.js +1 -1
  46. package/es/map-marker/badge-enhancer.js +61 -0
  47. package/es/map-marker/constants.js +146 -2
  48. package/es/map-marker/drag-shadow.js +32 -0
  49. package/es/map-marker/fixed-marker.js +54 -48
  50. package/es/map-marker/floating-marker.js +21 -12
  51. package/es/map-marker/index.js +1 -1
  52. package/es/map-marker/label-enhancer.js +39 -0
  53. package/es/map-marker/needle.js +26 -0
  54. package/es/map-marker/pin-head.js +42 -40
  55. package/es/map-marker/styled-components.js +177 -32
  56. package/es/map-marker/types.js +1 -1
  57. package/es/menu/maybe-child-menu.js +0 -2
  58. package/es/menu/nested-menus.js +49 -3
  59. package/es/menu/stateful-container.js +13 -12
  60. package/es/modal/modal.js +3 -1
  61. package/es/popover/popover.js +7 -3
  62. package/es/progress-bar/index.js +1 -1
  63. package/es/progress-bar/progressbar.js +25 -10
  64. package/es/progress-bar/styled-components.js +9 -5
  65. package/es/select/select-component.js +2 -10
  66. package/es/spinner/styled-components.js +34 -16
  67. package/es/table/filter.js +3 -1
  68. package/es/themes/dark-theme/color-component-tokens.js +19 -10
  69. package/es/themes/light-theme/color-component-tokens.js +19 -10
  70. package/es/timezonepicker/timezone-picker.js +53 -36
  71. package/es/timezonepicker/tzdata.js +2 -0
  72. package/es/timezonepicker/update-tzdata.js +69 -0
  73. package/es/toast/styled-components.js +18 -7
  74. package/es/utils/lcg.js +14 -0
  75. package/esm/a11y/a11y.js +3 -3
  76. package/esm/button/styled-components.js +47 -18
  77. package/esm/combobox/combobox.js +6 -3
  78. package/esm/data-table/column-categorical.js +2 -2
  79. package/esm/data-table/column-datetime.js +1 -1
  80. package/esm/data-table/column-numerical.js +2 -2
  81. package/esm/data-table/data-table.js +53 -50
  82. package/esm/data-table/measure-column-widths.js +83 -121
  83. package/esm/datepicker/calendar.js +6 -12
  84. package/esm/datepicker/datepicker.js +5 -16
  85. package/esm/datepicker/day.js +30 -58
  86. package/esm/datepicker/styled-components.js +1 -1
  87. package/esm/drawer/drawer.js +3 -1
  88. package/esm/form-control/form-control.js +60 -9
  89. package/esm/form-control/styled-components.js +23 -3
  90. package/esm/index.js +1 -1
  91. package/esm/map-marker/badge-enhancer.js +79 -0
  92. package/esm/map-marker/constants.js +94 -4
  93. package/esm/map-marker/drag-shadow.js +53 -0
  94. package/esm/map-marker/fixed-marker.js +84 -80
  95. package/esm/map-marker/floating-marker.js +22 -13
  96. package/esm/map-marker/index.js +1 -1
  97. package/esm/map-marker/label-enhancer.js +60 -0
  98. package/esm/map-marker/needle.js +43 -0
  99. package/esm/map-marker/pin-head.js +77 -66
  100. package/esm/map-marker/styled-components.js +182 -51
  101. package/esm/map-marker/types.js +1 -1
  102. package/esm/menu/maybe-child-menu.js +0 -2
  103. package/esm/menu/nested-menus.js +66 -5
  104. package/esm/menu/stateful-container.js +15 -13
  105. package/esm/modal/modal.js +3 -1
  106. package/esm/popover/popover.js +7 -3
  107. package/esm/progress-bar/index.js +1 -1
  108. package/esm/progress-bar/progressbar.js +32 -10
  109. package/esm/progress-bar/styled-components.js +9 -4
  110. package/esm/select/select-component.js +2 -11
  111. package/esm/spinner/styled-components.js +35 -16
  112. package/esm/table/filter.js +3 -1
  113. package/esm/themes/dark-theme/color-component-tokens.js +19 -10
  114. package/esm/themes/light-theme/color-component-tokens.js +19 -10
  115. package/esm/timezonepicker/timezone-picker.js +64 -36
  116. package/esm/timezonepicker/tzdata.js +2 -0
  117. package/esm/timezonepicker/update-tzdata.js +160 -0
  118. package/esm/toast/styled-components.js +13 -5
  119. package/esm/utils/lcg.js +16 -0
  120. package/form-control/form-control.js +61 -8
  121. package/form-control/form-control.js.flow +82 -10
  122. package/form-control/index.d.ts +1 -0
  123. package/form-control/styled-components.js +27 -5
  124. package/form-control/styled-components.js.flow +25 -3
  125. package/form-control/types.js.flow +20 -8
  126. package/index.js +6 -0
  127. package/index.js.flow +1 -1
  128. package/map-marker/badge-enhancer.js +90 -0
  129. package/map-marker/badge-enhancer.js.flow +86 -0
  130. package/map-marker/constants.js +103 -5
  131. package/map-marker/constants.js.flow +152 -0
  132. package/map-marker/drag-shadow.js +64 -0
  133. package/map-marker/drag-shadow.js.flow +52 -0
  134. package/map-marker/fixed-marker.js +84 -78
  135. package/map-marker/fixed-marker.js.flow +78 -66
  136. package/map-marker/floating-marker.js +22 -13
  137. package/map-marker/floating-marker.js.flow +30 -17
  138. package/map-marker/index.d.ts +125 -24
  139. package/map-marker/index.js +18 -0
  140. package/map-marker/index.js.flow +3 -0
  141. package/map-marker/label-enhancer.js +71 -0
  142. package/map-marker/label-enhancer.js.flow +63 -0
  143. package/map-marker/needle.js +54 -0
  144. package/map-marker/needle.js.flow +29 -0
  145. package/map-marker/pin-head.js +80 -69
  146. package/map-marker/pin-head.js.flow +122 -84
  147. package/map-marker/styled-components.js +200 -62
  148. package/map-marker/styled-components.js.flow +172 -22
  149. package/map-marker/types.js.flow +69 -20
  150. package/menu/index.d.ts +9 -4
  151. package/menu/maybe-child-menu.js +0 -2
  152. package/menu/maybe-child-menu.js.flow +0 -2
  153. package/menu/nested-menus.js +66 -5
  154. package/menu/nested-menus.js.flow +50 -5
  155. package/menu/stateful-container.js +15 -13
  156. package/menu/stateful-container.js.flow +19 -13
  157. package/menu/types.js.flow +7 -1
  158. package/modal/modal.js +3 -1
  159. package/modal/modal.js.flow +2 -0
  160. package/package.json +4 -4
  161. package/popover/popover.js +7 -3
  162. package/popover/popover.js.flow +23 -17
  163. package/progress-bar/index.d.ts +2 -0
  164. package/progress-bar/index.js +6 -0
  165. package/progress-bar/index.js.flow +1 -0
  166. package/progress-bar/progressbar.js +32 -10
  167. package/progress-bar/progressbar.js.flow +35 -9
  168. package/progress-bar/styled-components.js +9 -4
  169. package/progress-bar/styled-components.js.flow +15 -4
  170. package/progress-bar/types.js.flow +12 -2
  171. package/select/select-component.js +2 -11
  172. package/select/select-component.js.flow +5 -7
  173. package/spinner/styled-components.js +35 -16
  174. package/spinner/styled-components.js.flow +37 -19
  175. package/spinner/types.js.flow +10 -0
  176. package/styles/index.js.flow +1 -1
  177. package/table/filter.js +3 -1
  178. package/table/filter.js.flow +5 -1
  179. package/themes/dark-theme/color-component-tokens.js +19 -10
  180. package/themes/dark-theme/color-component-tokens.js.flow +19 -10
  181. package/themes/light-theme/color-component-tokens.js +19 -10
  182. package/themes/light-theme/color-component-tokens.js.flow +19 -10
  183. package/themes/types.js.flow +9 -0
  184. package/timezonepicker/timezone-picker.js +69 -41
  185. package/timezonepicker/timezone-picker.js.flow +52 -46
  186. package/timezonepicker/types.js.flow +1 -1
  187. package/timezonepicker/tzdata.js +10 -0
  188. package/timezonepicker/tzdata.js.flow +347 -0
  189. package/timezonepicker/update-tzdata.js +164 -0
  190. package/timezonepicker/update-tzdata.js.flow +70 -0
  191. package/toast/styled-components.js +13 -5
  192. package/toast/styled-components.js.flow +17 -7
  193. package/utils/lcg.js +24 -0
  194. package/utils/lcg.js.flow +21 -0
package/a11y/a11y.js CHANGED
@@ -140,8 +140,8 @@ function Violation(props) {
140
140
  ref: setPopper,
141
141
  $top: "".concat(offset.top, "px") || '0px',
142
142
  $left: "".concat(offset.left, "px") || '0px'
143
- }, /*#__PURE__*/React.createElement(_index2.Caption1, null, props.target), props.violations.map(function (violation, index) {
144
- return /*#__PURE__*/React.createElement(_index2.Paragraph3, {
143
+ }, /*#__PURE__*/React.createElement(_index2.ParagraphXSmall, null, props.target), props.violations.map(function (violation, index) {
144
+ return /*#__PURE__*/React.createElement(_index2.ParagraphSmall, {
145
145
  key: index
146
146
  }, violation.description);
147
147
  }))));
package/a11y/a11y.js.flow CHANGED
@@ -11,7 +11,7 @@ import * as React from 'react';
11
11
  import axe from 'axe-core';
12
12
 
13
13
  import {Layer, TetherBehavior, TETHER_PLACEMENT} from '../layer/index.js';
14
- import {Paragraph3, Caption1} from '../typography/index.js';
14
+ import {ParagraphSmall, ParagraphXSmall} from '../typography/index.js';
15
15
  import {styled} from '../styles/index.js';
16
16
  import {ThemeContext} from '../styles/theme-provider.js';
17
17
 
@@ -101,9 +101,9 @@ function Violation(props: ViolationPropsT) {
101
101
  $top={`${offset.top}px` || '0px'}
102
102
  $left={`${offset.left}px` || '0px'}
103
103
  >
104
- <Caption1>{props.target}</Caption1>
104
+ <ParagraphXSmall>{props.target}</ParagraphXSmall>
105
105
  {props.violations.map((violation, index) => (
106
- <Paragraph3 key={index}>{violation.description}</Paragraph3>
106
+ <ParagraphSmall key={index}>{violation.description}</ParagraphSmall>
107
107
  ))}
108
108
  </ViolationContainer>
109
109
  </TetherBehavior>
@@ -46,11 +46,14 @@ var BaseButton = (0, _index.styled)('button', function (_ref) {
46
46
  transitionDuration: $theme.animation.timing200,
47
47
  transitionTimingFunction: $theme.animation.linearCurve,
48
48
  cursor: 'pointer',
49
- ':disabled': {
50
- cursor: 'not-allowed',
51
- backgroundColor: $kind === _constants.KIND.minimal || $kind === _constants.KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
52
- color: $theme.colors.buttonDisabledText
53
- },
49
+ ':disabled': _objectSpread({
50
+ cursor: 'not-allowed'
51
+ }, getDisabledStyles({
52
+ $theme: $theme,
53
+ $kind: $kind,
54
+ $disabled: $disabled,
55
+ $isSelected: $isSelected
56
+ })),
54
57
  marginLeft: 0,
55
58
  marginTop: 0,
56
59
  marginRight: 0,
@@ -275,10 +278,36 @@ function getFontStyles(_ref10) {
275
278
  }
276
279
  }
277
280
 
278
- function getPaddingStyles(_ref11) {
281
+ function getDisabledStyles(_ref11) {
279
282
  var $theme = _ref11.$theme,
280
- $size = _ref11.$size,
281
- $shape = _ref11.$shape;
283
+ $kind = _ref11.$kind,
284
+ $isSelected = _ref11.$isSelected,
285
+ $disabled = _ref11.$disabled;
286
+
287
+ if ($disabled && $isSelected) {
288
+ if ($kind === _constants.KIND.primary || $kind === _constants.KIND.secondary) {
289
+ return {
290
+ color: $theme.colors.buttonDisabledActiveText,
291
+ backgroundColor: $theme.colors.buttonDisabledActiveFill
292
+ };
293
+ } else if ($kind === _constants.KIND.minimal || $kind === _constants.KIND.tertiary) {
294
+ return {
295
+ backgroundColor: $theme.colors.buttonTertiaryDisabledActiveFill,
296
+ color: $theme.colors.buttonTertiaryDisabledActiveText
297
+ };
298
+ }
299
+ }
300
+
301
+ return {
302
+ backgroundColor: $kind === _constants.KIND.minimal || $kind === _constants.KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
303
+ color: $theme.colors.buttonDisabledText
304
+ };
305
+ }
306
+
307
+ function getPaddingStyles(_ref12) {
308
+ var $theme = _ref12.$theme,
309
+ $size = _ref12.$size,
310
+ $shape = _ref12.$shape;
282
311
  var iconShape = $shape === _constants.SHAPE.square || $shape === _constants.SHAPE.circle || $shape === _constants.SHAPE.round;
283
312
 
284
313
  switch ($size) {
@@ -316,12 +345,12 @@ function getPaddingStyles(_ref11) {
316
345
  }
317
346
  }
318
347
 
319
- function getKindStyles(_ref12) {
320
- var $theme = _ref12.$theme,
321
- $isLoading = _ref12.$isLoading,
322
- $isSelected = _ref12.$isSelected,
323
- $kind = _ref12.$kind,
324
- $disabled = _ref12.$disabled;
348
+ function getKindStyles(_ref13) {
349
+ var $theme = _ref13.$theme,
350
+ $isLoading = _ref13.$isLoading,
351
+ $isSelected = _ref13.$isSelected,
352
+ $kind = _ref13.$kind,
353
+ $disabled = _ref13.$disabled;
325
354
 
326
355
  if ($disabled) {
327
356
  return Object.freeze({});
@@ -409,10 +438,10 @@ function getKindStyles(_ref12) {
409
438
  }
410
439
  }
411
440
 
412
- function getShapeStyles(_ref13) {
413
- var $theme = _ref13.$theme,
414
- $shape = _ref13.$shape,
415
- $size = _ref13.$size;
441
+ function getShapeStyles(_ref14) {
442
+ var $theme = _ref14.$theme,
443
+ $shape = _ref14.$shape,
444
+ $size = _ref14.$size;
416
445
 
417
446
  if ($shape === _constants.SHAPE.circle || $shape === _constants.SHAPE.square) {
418
447
  var height, width;
@@ -46,11 +46,7 @@ export const BaseButton = styled<SharedStylePropsT>(
46
46
  cursor: 'pointer',
47
47
  ':disabled': {
48
48
  cursor: 'not-allowed',
49
- backgroundColor:
50
- $kind === KIND.minimal || $kind === KIND.tertiary
51
- ? 'transparent'
52
- : $theme.colors.buttonDisabledFill,
53
- color: $theme.colors.buttonDisabledText,
49
+ ...getDisabledStyles({$theme, $kind, $disabled, $isSelected}),
54
50
  },
55
51
  marginLeft: 0,
56
52
  marginTop: 0,
@@ -229,6 +225,30 @@ function getFontStyles({$theme, $size}) {
229
225
  }
230
226
  }
231
227
 
228
+ function getDisabledStyles({$theme, $kind, $isSelected, $disabled}) {
229
+ if ($disabled && $isSelected) {
230
+ if ($kind === KIND.primary || $kind === KIND.secondary) {
231
+ return {
232
+ color: $theme.colors.buttonDisabledActiveText,
233
+ backgroundColor: $theme.colors.buttonDisabledActiveFill,
234
+ };
235
+ } else if ($kind === KIND.minimal || $kind === KIND.tertiary) {
236
+ return {
237
+ backgroundColor: $theme.colors.buttonTertiaryDisabledActiveFill,
238
+ color: $theme.colors.buttonTertiaryDisabledActiveText,
239
+ };
240
+ }
241
+ }
242
+
243
+ return {
244
+ backgroundColor:
245
+ $kind === KIND.minimal || $kind === KIND.tertiary
246
+ ? 'transparent'
247
+ : $theme.colors.buttonDisabledFill,
248
+ color: $theme.colors.buttonDisabledText,
249
+ };
250
+ }
251
+
232
252
  function getPaddingStyles({$theme, $size, $shape}) {
233
253
  const iconShape =
234
254
  $shape === SHAPE.square ||
@@ -60,6 +60,7 @@ function Combobox(props) {
60
60
  onChange = props.onChange,
61
61
  onFocus = props.onFocus,
62
62
  onSubmit = props.onSubmit,
63
+ listBoxLabel = props.listBoxLabel,
63
64
  mapOptionToNode = props.mapOptionToNode,
64
65
  mapOptionToString = props.mapOptionToString,
65
66
  id = props.id,
@@ -322,6 +323,7 @@ function Combobox(props) {
322
323
  ,
323
324
  ref: listboxRef,
324
325
  role: "listbox",
326
+ "aria-label": listBoxLabel,
325
327
  $width: listboxWidth
326
328
  }, listBoxProps), options.map(function (option, index) {
327
329
  var isSelected = selectionIndex === index;
@@ -360,9 +362,8 @@ function Combobox(props) {
360
362
  role: "combobox"
361
363
  }, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
362
364
  inputRef: handleInputRef,
363
- "aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
365
+ "aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
364
366
  "aria-autocomplete": "list",
365
- "aria-controls": listboxId,
366
367
  disabled: disabled,
367
368
  error: error,
368
369
  name: name,
@@ -375,7 +376,9 @@ function Combobox(props) {
375
376
  positive: positive,
376
377
  size: size,
377
378
  value: tempValue ? tempValue : value
378
- }, restInputProps)))));
379
+ }, isOpen ? {
380
+ 'aria-controls': listboxId
381
+ } : {}, restInputProps)))));
379
382
  }
380
383
 
381
384
  var _default = Combobox;
@@ -38,6 +38,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
38
38
  onChange,
39
39
  onFocus,
40
40
  onSubmit,
41
+ listBoxLabel,
41
42
  mapOptionToNode,
42
43
  mapOptionToString,
43
44
  id,
@@ -274,6 +275,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
274
275
  // eslint-disable-next-line flowtype/no-weak-types
275
276
  ref={(listboxRef: any)}
276
277
  role="listbox"
278
+ aria-label={listBoxLabel}
277
279
  $width={listboxWidth}
278
280
  {...listBoxProps}
279
281
  >
@@ -322,10 +324,9 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
322
324
  <OverriddenInput
323
325
  inputRef={handleInputRef}
324
326
  aria-activedescendant={
325
- selectionIndex >= 0 ? activeDescendantId : undefined
327
+ isOpen && selectionIndex >= 0 ? activeDescendantId : undefined
326
328
  }
327
329
  aria-autocomplete="list"
328
- aria-controls={listboxId}
329
330
  disabled={disabled}
330
331
  error={error}
331
332
  name={name}
@@ -338,6 +339,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
338
339
  positive={positive}
339
340
  size={size}
340
341
  value={tempValue ? tempValue : value}
342
+ {...(isOpen ? {'aria-controls': listboxId} : {})}
341
343
  {...restInputProps}
342
344
  />
343
345
  </InputContainer>
@@ -18,6 +18,8 @@ export type PropsT<OptionT = mixed> = {|
18
18
  disabled?: boolean,
19
19
  // Proxies value through to Input component.
20
20
  error?: boolean,
21
+ // Label used for the listbox/popup with options
22
+ listBoxLabel?: string,
21
23
  // Used to render a custom node besides the default.
22
24
  mapOptionToNode?: React.AbstractComponent<{|
23
25
  isSelected: boolean,
@@ -208,7 +208,7 @@ function CategoricalFilter(props) {
208
208
  overflowY: 'auto',
209
209
  marginTop: theme.sizing.scale600
210
210
  })
211
- }, !filteredCategories.length && /*#__PURE__*/React.createElement(_index6.Label3, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map(function (category, i) {
211
+ }, !filteredCategories.length && /*#__PURE__*/React.createElement(_index6.LabelSmall, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map(function (category, i) {
212
212
  return /*#__PURE__*/React.createElement("div", {
213
213
  className: checkboxStyles,
214
214
  key: i
@@ -14,7 +14,7 @@ import {Checkbox, StyledLabel} from '../checkbox/index.js';
14
14
  import Search from '../icon/search.js';
15
15
  import {Input, SIZE as INPUT_SIZE} from '../input/index.js';
16
16
  import {useStyletron, withStyle} from '../styles/index.js';
17
- import {Label3} from '../typography/index.js';
17
+ import {LabelSmall} from '../typography/index.js';
18
18
 
19
19
  import Column from './column.js';
20
20
  import {COLUMNS} from './constants.js';
@@ -184,7 +184,7 @@ export function CategoricalFilter(props: CategoricalFilterProps) {
184
184
  })}
185
185
  >
186
186
  {!filteredCategories.length && (
187
- <Label3>{locale.datatable.categoricalFilterEmpty}</Label3>
187
+ <LabelSmall>{locale.datatable.categoricalFilterEmpty}</LabelSmall>
188
188
  )}
189
189
 
190
190
  {Boolean(filteredCategories.length) &&
@@ -456,7 +456,7 @@ function DatetimeFilter(props) {
456
456
  if (Array.isArray(date)) {
457
457
  if (!date.length) return;
458
458
  var nextDates = date.map(function (d, i) {
459
- return d ? (0, _index13.applyDateToTime)(rangeDates[i], d) : null;
459
+ return (0, _index13.applyDateToTime)(rangeDates[i], d);
460
460
  });
461
461
  setRangeDates(nextDates);
462
462
  }
@@ -410,7 +410,7 @@ function DatetimeFilter(props) {
410
410
  if (Array.isArray(date)) {
411
411
  if (!date.length) return;
412
412
  const nextDates = date.map((d, i) =>
413
- d ? applyDateToTime(rangeDates[i], d) : null,
413
+ applyDateToTime(rangeDates[i], d),
414
414
  );
415
415
  setRangeDates(nextDates);
416
416
  }
@@ -493,7 +493,7 @@ function NumericalFilter(props) {
493
493
  marginLeft: theme.sizing.scale300,
494
494
  marginRight: theme.sizing.scale300
495
495
  })
496
- }, /*#__PURE__*/React.createElement(_index5.Paragraph4, null, format(min, props.options)), ' ', /*#__PURE__*/React.createElement(_index5.Paragraph4, null, format(max, props.options))), /*#__PURE__*/React.createElement("div", {
496
+ }, /*#__PURE__*/React.createElement(_index5.ParagraphXSmall, null, format(min, props.options)), ' ', /*#__PURE__*/React.createElement(_index5.ParagraphXSmall, null, format(max, props.options))), /*#__PURE__*/React.createElement("div", {
497
497
  className: css({
498
498
  display: 'flex',
499
499
  justifyContent: 'space-between'
@@ -12,7 +12,7 @@ import {Button, SIZE} from '../button/index.js';
12
12
  import {ButtonGroup, MODE} from '../button-group/index.js';
13
13
  import {Input, SIZE as INPUT_SIZE} from '../input/index.js';
14
14
  import {useStyletron} from '../styles/index.js';
15
- import {Paragraph4} from '../typography/index.js';
15
+ import {ParagraphXSmall} from '../typography/index.js';
16
16
 
17
17
  import Column from './column.js';
18
18
  import {COLUMNS, NUMERICAL_FORMATS, NUMERICAL_OPERATIONS} from './constants.js';
@@ -388,8 +388,8 @@ function NumericalFilter(props) {
388
388
  marginRight: theme.sizing.scale300,
389
389
  })}
390
390
  >
391
- <Paragraph4>{format(min, props.options)}</Paragraph4>{' '}
392
- <Paragraph4>{format(max, props.options)}</Paragraph4>
391
+ <ParagraphXSmall>{format(min, props.options)}</ParagraphXSmall>{' '}
392
+ <ParagraphXSmall>{format(max, props.options)}</ParagraphXSmall>
393
393
  </div>
394
394
 
395
395
  <div className={css({display: 'flex', justifyContent: 'space-between'})}>
@@ -62,6 +62,12 @@ 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
+
65
71
  function CellPlacement(_ref) {
66
72
  var columnIndex = _ref.columnIndex,
67
73
  rowIndex = _ref.rowIndex,
@@ -320,7 +326,7 @@ function Header(props) {
320
326
  }))));
321
327
  }
322
328
 
323
- function Headers(props) {
329
+ function Headers() {
324
330
  var _useStyletron5 = (0, _index2.useStyletron)(),
325
331
  _useStyletron6 = _slicedToArray(_useStyletron5, 2),
326
332
  css = _useStyletron6[0],
@@ -339,9 +345,7 @@ function Headers(props) {
339
345
  position: 'sticky',
340
346
  top: 0,
341
347
  left: 0,
342
- width: "".concat(ctx.widths.reduce(function (sum, w) {
343
- return sum + w;
344
- }, 0), "px"),
348
+ width: "".concat(sum(ctx.widths), "px"),
345
349
  height: "".concat(HEADER_ROW_HEIGHT, "px"),
346
350
  display: 'flex',
347
351
  // this feels bad.. the absolutely positioned children elements
@@ -564,22 +568,27 @@ function DataTable(_ref2) {
564
568
  }
565
569
 
566
570
  return rowHeight;
567
- }, [rowHeight]);
568
- var gridRef = React.useRef(null);
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
569
573
 
570
- var _React$useState7 = React.useState(columns.map(function () {
571
- return 0;
572
- })),
574
+ var _React$useState7 = React.useState(null),
573
575
  _React$useState8 = _slicedToArray(_React$useState7, 2),
574
- measuredWidths = _React$useState8[0],
575
- setMeasuredWidths = _React$useState8[1];
576
+ gridRef = _React$useState8[0],
577
+ setGridRef = _React$useState8[1];
576
578
 
577
579
  var _React$useState9 = React.useState(columns.map(function () {
578
580
  return 0;
579
581
  })),
580
582
  _React$useState10 = _slicedToArray(_React$useState9, 2),
581
- resizeDeltas = _React$useState10[0],
582
- setResizeDeltas = _React$useState10[1];
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];
583
592
 
584
593
  React.useEffect(function () {
585
594
  setMeasuredWidths(function (prev) {
@@ -594,11 +603,11 @@ function DataTable(_ref2) {
594
603
  });
595
604
  }, [columns]);
596
605
  var resetAfterColumnIndex = React.useCallback(function (columnIndex) {
597
- if (gridRef.current) {
606
+ if (gridRef) {
598
607
  // $FlowFixMe trigger react-window to layout the elements again
599
- gridRef.current.resetAfterColumnIndex(columnIndex, true);
608
+ gridRef.resetAfterColumnIndex(columnIndex, true);
600
609
  }
601
- }, [gridRef.current]);
610
+ }, [gridRef]);
602
611
  var handleWidthsChange = React.useCallback(function (nextWidths) {
603
612
  setMeasuredWidths(nextWidths);
604
613
  resetAfterColumnIndex(0);
@@ -611,20 +620,20 @@ function DataTable(_ref2) {
611
620
  resetAfterColumnIndex(columnIndex);
612
621
  }, [setResizeDeltas, resetAfterColumnIndex]);
613
622
 
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),
623
+ var _React$useState13 = React.useState(0),
620
624
  _React$useState14 = _slicedToArray(_React$useState13, 2),
621
- isScrollingX = _React$useState14[0],
622
- setIsScrollingX = _React$useState14[1];
625
+ scrollLeft = _React$useState14[0],
626
+ setScrollLeft = _React$useState14[1];
623
627
 
624
628
  var _React$useState15 = React.useState(false),
625
629
  _React$useState16 = _slicedToArray(_React$useState15, 2),
626
- recentlyScrolledX = _React$useState16[0],
627
- setRecentlyScrolledX = _React$useState16[1];
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];
628
637
 
629
638
  React.useLayoutEffect(function () {
630
639
  if (recentlyScrolledX !== isScrollingX) {
@@ -746,25 +755,18 @@ function DataTable(_ref2) {
746
755
  return result;
747
756
  }, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
748
757
 
749
- var _React$useState17 = React.useState(0),
750
- _React$useState18 = _slicedToArray(_React$useState17, 2),
751
- browserScrollbarWidth = _React$useState18[0],
752
- setBrowserScrollbarWidth = _React$useState18[1];
758
+ var _React$useState19 = React.useState(0),
759
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
760
+ browserScrollbarWidth = _React$useState20[0],
761
+ setBrowserScrollbarWidth = _React$useState20[1];
753
762
 
754
763
  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
-
761
764
  var resizedWidths = measuredWidths.map(function (w, i) {
762
765
  return Math.floor(w) + Math.floor(resizeDeltas[i]);
763
766
  });
764
767
 
765
- if (gridRef.current) {
766
- // $FlowFixMe
767
- var gridProps = gridRef.current.props;
768
+ if (gridRef) {
769
+ var gridProps = gridRef.props;
768
770
  var isContentTallerThanContainer = false;
769
771
  var visibleRowHeight = 0;
770
772
 
@@ -801,7 +803,7 @@ function DataTable(_ref2) {
801
803
  }
802
804
 
803
805
  return resizedWidths;
804
- }, [measuredWidths, resizeDeltas, browserScrollbarWidth, rows.length, columns]);
806
+ }, [gridRef, measuredWidths, resizeDeltas, browserScrollbarWidth, rows.length, columns]);
805
807
  var isSelectable = batchActions ? !!batchActions.length : false;
806
808
  var isSelectedAll = React.useMemo(function () {
807
809
  if (!selectedRowIds) {
@@ -845,23 +847,23 @@ function DataTable(_ref2) {
845
847
  }
846
848
  }, [onSort]);
847
849
 
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
-
853
850
  var _React$useState21 = React.useState(-1),
854
851
  _React$useState22 = _slicedToArray(_React$useState21, 2),
855
- rowHighlightIndex = _React$useState22[0],
856
- setRowHighlightIndex = _React$useState22[1];
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];
857
859
 
858
860
  function handleRowHighlightIndexChange(nextIndex) {
859
861
  setRowHighlightIndex(nextIndex);
860
862
 
861
- if (gridRef.current) {
863
+ if (gridRef) {
862
864
  if (nextIndex >= 0) {
863
865
  // $FlowFixMe - unable to get react-window types
864
- gridRef.current.scrollToItem({
866
+ gridRef.scrollToItem({
865
867
  rowIndex: nextIndex
866
868
  });
867
869
  }
@@ -952,8 +954,9 @@ function DataTable(_ref2) {
952
954
  }
953
955
  }, /*#__PURE__*/React.createElement(_reactWindow.VariableSizeGrid // eslint-disable-next-line flowtype/no-weak-types
954
956
  , {
955
- ref: gridRef,
957
+ ref: setGridRef,
956
958
  overscanRowCount: 10,
959
+ overscanColumnCount: 5,
957
960
  innerElementType: InnerTableElement,
958
961
  columnCount: columns.length,
959
962
  columnWidth: function columnWidth(columnIndex) {
@@ -87,6 +87,8 @@ type CellPlacementPropsT = {
87
87
  },
88
88
  };
89
89
 
90
+ const sum = ns => ns.reduce((s, n) => s + n, 0);
91
+
90
92
  function CellPlacement({columnIndex, rowIndex, data, style}) {
91
93
  const [css, theme] = useStyletron();
92
94
 
@@ -411,7 +413,7 @@ function Header(props: HeaderProps) {
411
413
  );
412
414
  }
413
415
 
414
- function Headers(props: {||}) {
416
+ function Headers() {
415
417
  const [css, theme] = useStyletron();
416
418
  const locale = React.useContext(LocaleContext);
417
419
  const ctx = React.useContext(HeaderContext);
@@ -423,7 +425,7 @@ function Headers(props: {||}) {
423
425
  position: 'sticky',
424
426
  top: 0,
425
427
  left: 0,
426
- width: `${ctx.widths.reduce((sum, w) => sum + w, 0)}px`,
428
+ width: `${sum(ctx.widths)}px`,
427
429
  height: `${HEADER_ROW_HEIGHT}px`,
428
430
  display: 'flex',
429
431
  // this feels bad.. the absolutely positioned children elements
@@ -696,7 +698,10 @@ export function DataTable({
696
698
  },
697
699
  [rowHeight],
698
700
  );
699
- const gridRef = React.useRef<typeof VariableSizeGrid | null>(null);
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);
700
705
  const [measuredWidths, setMeasuredWidths] = React.useState(
701
706
  columns.map(() => 0),
702
707
  );
@@ -712,12 +717,12 @@ export function DataTable({
712
717
 
713
718
  const resetAfterColumnIndex = React.useCallback(
714
719
  columnIndex => {
715
- if (gridRef.current) {
720
+ if (gridRef) {
716
721
  // $FlowFixMe trigger react-window to layout the elements again
717
- gridRef.current.resetAfterColumnIndex(columnIndex, true);
722
+ gridRef.resetAfterColumnIndex(columnIndex, true);
718
723
  }
719
724
  },
720
- [gridRef.current],
725
+ [gridRef],
721
726
  );
722
727
  const handleWidthsChange = React.useCallback(
723
728
  nextWidths => {
@@ -843,13 +848,11 @@ export function DataTable({
843
848
 
844
849
  const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
845
850
  const normalizedWidths = React.useMemo(() => {
846
- const sum = ns => ns.reduce((s, n) => s + n, 0);
847
851
  const resizedWidths = measuredWidths.map(
848
852
  (w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]),
849
853
  );
850
- if (gridRef.current) {
851
- // $FlowFixMe
852
- const gridProps = gridRef.current.props;
854
+ if (gridRef) {
855
+ const gridProps = gridRef.props;
853
856
 
854
857
  let isContentTallerThanContainer = false;
855
858
  let visibleRowHeight = 0;
@@ -886,6 +889,7 @@ export function DataTable({
886
889
  }
887
890
  return resizedWidths;
888
891
  }, [
892
+ gridRef,
889
893
  measuredWidths,
890
894
  resizeDeltas,
891
895
  browserScrollbarWidth,
@@ -948,10 +952,10 @@ export function DataTable({
948
952
 
949
953
  function handleRowHighlightIndexChange(nextIndex) {
950
954
  setRowHighlightIndex(nextIndex);
951
- if (gridRef.current) {
955
+ if (gridRef) {
952
956
  if (nextIndex >= 0) {
953
957
  // $FlowFixMe - unable to get react-window types
954
- gridRef.current.scrollToItem({rowIndex: nextIndex});
958
+ gridRef.scrollToItem({rowIndex: nextIndex});
955
959
  }
956
960
  if (onRowHighlightChange) {
957
961
  onRowHighlightChange(nextIndex, rows[nextIndex - 1]);
@@ -1051,8 +1055,9 @@ export function DataTable({
1051
1055
  >
1052
1056
  <VariableSizeGrid
1053
1057
  // eslint-disable-next-line flowtype/no-weak-types
1054
- ref={(gridRef: any)}
1058
+ ref={(setGridRef: any)}
1055
1059
  overscanRowCount={10}
1060
+ overscanColumnCount={5}
1056
1061
  innerElementType={InnerTableElement}
1057
1062
  columnCount={columns.length}
1058
1063
  columnWidth={columnIndex => normalizedWidths[columnIndex]}